var mHe=Object.defineProperty;var g2e=t=>{throw TypeError(t)};var gHe=(t,e,n)=>e in t?mHe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var qn=(t,e,n)=>gHe(t,typeof e!="symbol"?e+"":e,n),Ioe=(t,e,n)=>e.has(t)||g2e("Cannot "+n);var Zt=(t,e,n)=>(Ioe(t,e,"read from private field"),n?n.call(t):e.get(t)),ri=(t,e,n)=>e.has(t)?g2e("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),is=(t,e,n,s)=>(Ioe(t,e,"write to private field"),s?s.call(t,n):e.set(t,n),n),sa=(t,e,n)=>(Ioe(t,e,"access private method"),n);var v6=(t,e,n,s)=>({set _(i){is(t,e,i,n)},get _(){return Zt(t,e,s)}});function yHe(t,e){for(var n=0;ns[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&s(c)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();var _y=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Oa(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function vMe(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function s(){return this instanceof s?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(s){var i=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(n,s,i.get?i:{enumerable:!0,get:function(){return t[s]}})}),n}var _Me={exports:{}},ine={},bMe={exports:{}},_a={};/** * @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 DE=Symbol.for("react.element"),xHe=Symbol.for("react.portal"),vHe=Symbol.for("react.fragment"),_He=Symbol.for("react.strict_mode"),bHe=Symbol.for("react.profiler"),wHe=Symbol.for("react.provider"),jHe=Symbol.for("react.context"),kHe=Symbol.for("react.forward_ref"),NHe=Symbol.for("react.suspense"),SHe=Symbol.for("react.memo"),CHe=Symbol.for("react.lazy"),y2e=Symbol.iterator;function MHe(t){return t===null||typeof t!="object"?null:(t=y2e&&t[y2e]||t["@@iterator"],typeof t=="function"?t:null)}var wMe={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},jMe=Object.assign,kMe={};function kC(t,e,n){this.props=t,this.context=e,this.refs=kMe,this.updater=n||wMe}kC.prototype.isReactComponent={};kC.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=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,t,e,"setState")};kC.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function NMe(){}NMe.prototype=kC.prototype;function Ape(t,e,n){this.props=t,this.context=e,this.refs=kMe,this.updater=n||wMe}var Epe=Ape.prototype=new NMe;Epe.constructor=Ape;jMe(Epe,kC.prototype);Epe.isPureReactComponent=!0;var x2e=Array.isArray,SMe=Object.prototype.hasOwnProperty,Ipe={current:null},CMe={key:!0,ref:!0,__self:!0,__source:!0};function MMe(t,e,n){var s,i={},o=null,c=null;if(e!=null)for(s in e.ref!==void 0&&(c=e.ref),e.key!==void 0&&(o=""+e.key),e)SMe.call(e,s)&&!CMe.hasOwnProperty(s)&&(i[s]=e[s]);var a=arguments.length-2;if(a===1)i.children=n;else if(1>>1,oe=fe[Se];if(0>>1;Sei(Me,Ie))Uei(Re,Me)?(fe[Se]=Re,fe[Ue]=Ie,Se=Ue):(fe[Se]=Me,fe[je]=Ie,Se=je);else if(Uei(Re,Ie))fe[Se]=Re,fe[Ue]=Ie,Se=Ue;else break e}}return ve}function i(fe,ve){var Ie=fe.sortIndex-ve.sortIndex;return Ie!==0?Ie:fe.id-ve.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;t.unstable_now=function(){return o.now()}}else{var c=Date,a=c.now();t.unstable_now=function(){return c.now()-a}}var f=[],m=[],y=1,v=null,w=3,k=!1,C=!1,S=!1,T=typeof setTimeout=="function"?setTimeout:null,I=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function D(fe){for(var ve=n(m);ve!==null;){if(ve.callback===null)s(m);else if(ve.startTime<=fe)s(m),ve.sortIndex=ve.expirationTime,e(f,ve);else break;ve=n(m)}}function $(fe){if(S=!1,D(fe),!C)if(n(f)!==null)C=!0,ie(F);else{var ve=n(m);ve!==null&&me($,ve.startTime-fe)}}function F(fe,ve){C=!1,S&&(S=!1,I(K),K=-1),k=!0;var Ie=w;try{for(D(ve),v=n(f);v!==null&&(!(v.expirationTime>ve)||fe&&!he());){var Se=v.callback;if(typeof Se=="function"){v.callback=null,w=v.priorityLevel;var oe=Se(v.expirationTime<=ve);ve=t.unstable_now(),typeof oe=="function"?v.callback=oe:v===n(f)&&s(f),D(ve)}else s(f);v=n(f)}if(v!==null)var ae=!0;else{var je=n(m);je!==null&&me($,je.startTime-ve),ae=!1}return ae}finally{v=null,w=Ie,k=!1}}var q=!1,W=null,K=-1,Z=5,re=-1;function he(){return!(t.unstable_now()-refe||125Se?(fe.sortIndex=Ie,e(m,fe),n(f)===null&&fe===n(m)&&(S?(I(K),K=-1):S=!0,me($,Ie-Se))):(fe.sortIndex=oe,e(f,fe),C||k||(C=!0,ie(F))),fe},t.unstable_shouldYield=he,t.unstable_wrapCallback=function(fe){var ve=w;return function(){var Ie=w;w=ve;try{return fe.apply(this,arguments)}finally{w=Ie}}}})(PMe);IMe.exports=PMe;var zHe=IMe.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 BHe=P,Hh=zHe;function kn(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ide=Object.prototype.hasOwnProperty,$He=/^[: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]*$/,_2e={},b2e={};function UHe(t){return ide.call(b2e,t)?!0:ide.call(_2e,t)?!1:$He.test(t)?b2e[t]=!0:(_2e[t]=!0,!1)}function qHe(t,e,n,s){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return s?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function VHe(t,e,n,s){if(e===null||typeof e>"u"||qHe(t,e,n,s))return!0;if(s)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Pu(t,e,n,s,i,o,c){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=s,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=o,this.removeEmptyString=c}var Td={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Td[t]=new Pu(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Td[e]=new Pu(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Td[t]=new Pu(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Td[t]=new Pu(t,2,!1,t,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(t){Td[t]=new Pu(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Td[t]=new Pu(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Td[t]=new Pu(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Td[t]=new Pu(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Td[t]=new Pu(t,5,!1,t.toLowerCase(),null,!1,!1)});var Ope=/[\-:]([a-z])/g;function Dpe(t){return t[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(t){var e=t.replace(Ope,Dpe);Td[e]=new Pu(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(Ope,Dpe);Td[e]=new Pu(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(Ope,Dpe);Td[e]=new Pu(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Td[t]=new Pu(t,1,!1,t.toLowerCase(),null,!1,!1)});Td.xlinkHref=new Pu("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Td[t]=new Pu(t,1,!1,t.toLowerCase(),null,!0,!0)});function Rpe(t,e,n,s){var i=Td.hasOwnProperty(e)?Td[e]:null;(i!==null?i.type!==0:s||!(2a||i[c]!==o[a]){var f=` `+i[c].replace(" at new "," at ");return t.displayName&&f.includes("")&&(f=f.replace("",t.displayName)),f}while(1<=c&&0<=a);break}}}finally{Ooe=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?P5(t):""}function HHe(t){switch(t.tag){case 5:return P5(t.type);case 16:return P5("Lazy");case 13:return P5("Suspense");case 19:return P5("SuspenseList");case 0:case 2:case 15:return t=Doe(t.type,!1),t;case 11:return t=Doe(t.type.render,!1),t;case 1:return t=Doe(t.type,!0),t;default:return""}}function cde(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case sS:return"Fragment";case nS:return"Portal";case ade:return"Profiler";case Fpe:return"StrictMode";case ode:return"Suspense";case lde:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case DMe:return(t.displayName||"Context")+".Consumer";case OMe:return(t._context.displayName||"Context")+".Provider";case zpe:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Bpe:return e=t.displayName||null,e!==null?e:cde(t.type)||"Memo";case Kx:e=t._payload,t=t._init;try{return cde(t(e))}catch{}}return null}function WHe(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return cde(e);case 8:return e===Fpe?"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 e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function h1(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function FMe(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function GHe(t){var e=FMe(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),s=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(c){s=""+c,o.call(this,c)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return s},setValue:function(c){s=""+c},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function w6(t){t._valueTracker||(t._valueTracker=GHe(t))}function zMe(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),s="";return t&&(s=FMe(t)?t.checked?"true":"false":t.value),t=s,t!==n?(e.setValue(t),!0):!1}function uee(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function dde(t,e){var n=e.checked;return Al({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function j2e(t,e){var n=e.defaultValue==null?"":e.defaultValue,s=e.checked!=null?e.checked:e.defaultChecked;n=h1(e.value!=null?e.value:n),t._wrapperState={initialChecked:s,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function BMe(t,e){e=e.checked,e!=null&&Rpe(t,"checked",e,!1)}function ude(t,e){BMe(t,e);var n=h1(e.value),s=e.type;if(n!=null)s==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(s==="submit"||s==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?hde(t,e.type,n):e.hasOwnProperty("defaultValue")&&hde(t,e.type,h1(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function k2e(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var s=e.type;if(!(s!=="submit"&&s!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function hde(t,e,n){(e!=="number"||uee(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var L5=Array.isArray;function wS(t,e,n,s){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=j6.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function oA(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var K5={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},KHe=["Webkit","ms","Moz","O"];Object.keys(K5).forEach(function(t){KHe.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),K5[e]=K5[t]})});function VMe(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||K5.hasOwnProperty(t)&&K5[t]?(""+e).trim():e+"px"}function HMe(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var s=n.indexOf("--")===0,i=VMe(n,e[n],s);n==="float"&&(n="cssFloat"),s?t.setProperty(n,i):t[n]=i}}var ZHe=Al({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 mde(t,e){if(e){if(ZHe[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(kn(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(kn(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(kn(61))}if(e.style!=null&&typeof e.style!="object")throw Error(kn(62))}}function gde(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var yde=null;function $pe(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var xde=null,jS=null,kS=null;function C2e(t){if(t=zE(t)){if(typeof xde!="function")throw Error(kn(280));var e=t.stateNode;e&&(e=dne(e),xde(t.stateNode,t.type,e))}}function WMe(t){jS?kS?kS.push(t):kS=[t]:jS=t}function GMe(){if(jS){var t=jS,e=kS;if(kS=jS=null,C2e(t),e)for(t=0;t>>=0,t===0?32:31-(aWe(t)/oWe|0)|0}var k6=64,N6=4194304;function O5(t){switch(t&-t){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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function mee(t,e){var n=t.pendingLanes;if(n===0)return 0;var s=0,i=t.suspendedLanes,o=t.pingedLanes,c=n&268435455;if(c!==0){var a=c&~i;a!==0?s=O5(a):(o&=c,o!==0&&(s=O5(o)))}else c=n&~i,c!==0?s=O5(c):o!==0&&(s=O5(o));if(s===0)return 0;if(e!==0&&e!==s&&!(e&i)&&(i=s&-s,o=e&-e,i>=o||i===16&&(o&4194240)!==0))return e;if(s&4&&(s|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=s;0n;n++)e.push(t);return e}function RE(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Xp(e),t[e]=n}function uWe(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var s=t.eventTimes;for(t=t.expirationTimes;0=Y5),D2e=" ",R2e=!1;function f5e(t,e){switch(t){case"keyup":return zWe.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function p5e(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var iS=!1;function $We(t,e){switch(t){case"compositionend":return p5e(e);case"keypress":return e.which!==32?null:(R2e=!0,D2e);case"textInput":return t=e.data,t===D2e&&R2e?null:t;default:return null}}function UWe(t,e){if(iS)return t==="compositionend"||!Zpe&&f5e(t,e)?(t=u5e(),zL=Wpe=j0=null,iS=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:n,offset:e-t};t=s}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=$2e(n)}}function x5e(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?x5e(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function v5e(){for(var t=window,e=uee();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=uee(t.document)}return e}function Ype(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function XWe(t){var e=v5e(),n=t.focusedElem,s=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&x5e(n.ownerDocument.documentElement,n)){if(s!==null&&Ype(n)){if(e=s.start,t=s.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=n.textContent.length,o=Math.min(s.start,i);s=s.end===void 0?o:Math.min(s.end,i),!t.extend&&o>s&&(i=s,s=o,o=i),i=U2e(n,o);var c=U2e(n,s);i&&c&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==c.node||t.focusOffset!==c.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),o>s?(t.addRange(e),t.extend(c.node,c.offset)):(e.setEnd(c.node,c.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,aS=null,kde=null,Q5=null,Nde=!1;function q2e(t,e,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Nde||aS==null||aS!==uee(s)||(s=aS,"selectionStart"in s&&Ype(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),Q5&&fA(Q5,s)||(Q5=s,s=xee(kde,"onSelect"),0cS||(t.current=Ede[cS],Ede[cS]=null,cS--)}function Go(t,e){cS++,Ede[cS]=t.current,t.current=e}var f1={},Xd=j1(f1),oh=j1(!1),nj=f1;function M4(t,e){var n=t.type.contextTypes;if(!n)return f1;var s=t.stateNode;if(s&&s.__reactInternalMemoizedUnmaskedChildContext===e)return s.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=e[o];return s&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function lh(t){return t=t.childContextTypes,t!=null}function _ee(){ol(oh),ol(Xd)}function Y2e(t,e,n){if(Xd.current!==f1)throw Error(kn(168));Go(Xd,e),Go(oh,n)}function M5e(t,e,n){var s=t.stateNode;if(e=e.childContextTypes,typeof s.getChildContext!="function")return n;s=s.getChildContext();for(var i in s)if(!(i in e))throw Error(kn(108,WHe(t)||"Unknown",i));return Al({},n,s)}function bee(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||f1,nj=Xd.current,Go(Xd,t),Go(oh,oh.current),!0}function X2e(t,e,n){var s=t.stateNode;if(!s)throw Error(kn(169));n?(t=M5e(t,e,nj),s.__reactInternalMemoizedMergedChildContext=t,ol(oh),ol(Xd),Go(Xd,t)):ol(oh),Go(oh,n)}var py=null,une=!1,Yoe=!1;function T5e(t){py===null?py=[t]:py.push(t)}function cGe(t){une=!0,T5e(t)}function k1(){if(!Yoe&&py!==null){Yoe=!0;var t=0,e=_o;try{var n=py;for(_o=1;t>=c,i-=c,by=1<<32-Xp(e)+i|n<K?(Z=W,W=null):Z=W.sibling;var re=w(I,W,D[K],$);if(re===null){W===null&&(W=Z);break}t&&W&&re.alternate===null&&e(I,W),A=o(re,A,K),q===null?F=re:q.sibling=re,q=re,W=Z}if(K===D.length)return n(I,W),ml&&Fv(I,K),F;if(W===null){for(;KK?(Z=W,W=null):Z=W.sibling;var he=w(I,W,re.value,$);if(he===null){W===null&&(W=Z);break}t&&W&&he.alternate===null&&e(I,W),A=o(he,A,K),q===null?F=he:q.sibling=he,q=he,W=Z}if(re.done)return n(I,W),ml&&Fv(I,K),F;if(W===null){for(;!re.done;K++,re=D.next())re=v(I,re.value,$),re!==null&&(A=o(re,A,K),q===null?F=re:q.sibling=re,q=re);return ml&&Fv(I,K),F}for(W=s(I,W);!re.done;K++,re=D.next())re=k(W,I,K,re.value,$),re!==null&&(t&&re.alternate!==null&&W.delete(re.key===null?K:re.key),A=o(re,A,K),q===null?F=re:q.sibling=re,q=re);return t&&W.forEach(function(ue){return e(I,ue)}),ml&&Fv(I,K),F}function T(I,A,D,$){if(typeof D=="object"&&D!==null&&D.type===sS&&D.key===null&&(D=D.props.children),typeof D=="object"&&D!==null){switch(D.$$typeof){case b6:e:{for(var F=D.key,q=A;q!==null;){if(q.key===F){if(F=D.type,F===sS){if(q.tag===7){n(I,q.sibling),A=i(q,D.props.children),A.return=I,I=A;break e}}else if(q.elementType===F||typeof F=="object"&&F!==null&&F.$$typeof===Kx&&ebe(F)===q.type){n(I,q.sibling),A=i(q,D.props),A.ref=i5(I,q,D),A.return=I,I=A;break e}n(I,q);break}else e(I,q);q=q.sibling}D.type===sS?(A=Lw(D.props.children,I.mode,$,D.key),A.return=I,I=A):($=GL(D.type,D.key,D.props,null,I.mode,$),$.ref=i5(I,A,D),$.return=I,I=$)}return c(I);case nS:e:{for(q=D.key;A!==null;){if(A.key===q)if(A.tag===4&&A.stateNode.containerInfo===D.containerInfo&&A.stateNode.implementation===D.implementation){n(I,A.sibling),A=i(A,D.children||[]),A.return=I,I=A;break e}else{n(I,A);break}else e(I,A);A=A.sibling}A=sle(D,I.mode,$),A.return=I,I=A}return c(I);case Kx:return q=D._init,T(I,A,q(D._payload),$)}if(L5(D))return C(I,A,D,$);if(e5(D))return S(I,A,D,$);I6(I,D)}return typeof D=="string"&&D!==""||typeof D=="number"?(D=""+D,A!==null&&A.tag===6?(n(I,A.sibling),A=i(A,D),A.return=I,I=A):(n(I,A),A=nle(D,I.mode,$),A.return=I,I=A),c(I)):n(I,A)}return T}var A4=P5e(!0),L5e=P5e(!1),kee=j1(null),Nee=null,hS=null,eme=null;function tme(){eme=hS=Nee=null}function rme(t){var e=kee.current;ol(kee),t._currentValue=e}function Lde(t,e,n){for(;t!==null;){var s=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,s!==null&&(s.childLanes|=e)):s!==null&&(s.childLanes&e)!==e&&(s.childLanes|=e),t===n)break;t=t.return}}function SS(t,e){Nee=t,eme=hS=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(nh=!0),t.firstContext=null)}function Hf(t){var e=t._currentValue;if(eme!==t)if(t={context:t,memoizedValue:e,next:null},hS===null){if(Nee===null)throw Error(kn(308));hS=t,Nee.dependencies={lanes:0,firstContext:t}}else hS=hS.next=t;return e}var dw=null;function nme(t){dw===null?dw=[t]:dw.push(t)}function O5e(t,e,n,s){var i=e.interleaved;return i===null?(n.next=n,nme(e)):(n.next=i.next,i.next=n),e.interleaved=n,By(t,s)}function By(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var Zx=!1;function sme(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function D5e(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Cy(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function D0(t,e,n){var s=t.updateQueue;if(s===null)return null;if(s=s.shared,Ua&2){var i=s.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),s.pending=e,By(t,n)}return i=s.interleaved,i===null?(e.next=e,nme(s)):(e.next=i.next,i.next=e),s.interleaved=e,By(t,n)}function $L(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var s=e.lanes;s&=t.pendingLanes,n|=s,e.lanes=n,qpe(t,n)}}function tbe(t,e){var n=t.updateQueue,s=t.alternate;if(s!==null&&(s=s.updateQueue,n===s)){var i=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var c={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?i=o=c:o=o.next=c,n=n.next}while(n!==null);o===null?i=o=e:o=o.next=e}else i=o=e;n={baseState:s.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:s.shared,effects:s.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function See(t,e,n,s){var i=t.updateQueue;Zx=!1;var o=i.firstBaseUpdate,c=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var f=a,m=f.next;f.next=null,c===null?o=m:c.next=m,c=f;var y=t.alternate;y!==null&&(y=y.updateQueue,a=y.lastBaseUpdate,a!==c&&(a===null?y.firstBaseUpdate=m:a.next=m,y.lastBaseUpdate=f))}if(o!==null){var v=i.baseState;c=0,y=m=f=null,a=o;do{var w=a.lane,k=a.eventTime;if((s&w)===w){y!==null&&(y=y.next={eventTime:k,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var C=t,S=a;switch(w=e,k=n,S.tag){case 1:if(C=S.payload,typeof C=="function"){v=C.call(k,v,w);break e}v=C;break e;case 3:C.flags=C.flags&-65537|128;case 0:if(C=S.payload,w=typeof C=="function"?C.call(k,v,w):C,w==null)break e;v=Al({},v,w);break e;case 2:Zx=!0}}a.callback!==null&&a.lane!==0&&(t.flags|=64,w=i.effects,w===null?i.effects=[a]:w.push(a))}else k={eventTime:k,lane:w,tag:a.tag,payload:a.payload,callback:a.callback,next:null},y===null?(m=y=k,f=v):y=y.next=k,c|=w;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;w=a,a=w.next,w.next=null,i.lastBaseUpdate=w,i.shared.pending=null}}while(!0);if(y===null&&(f=v),i.baseState=f,i.firstBaseUpdate=m,i.lastBaseUpdate=y,e=i.shared.interleaved,e!==null){i=e;do c|=i.lane,i=i.next;while(i!==e)}else o===null&&(i.shared.lanes=0);aj|=c,t.lanes=c,t.memoizedState=v}}function rbe(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;en?n:4,t(!0);var s=Qoe.transition;Qoe.transition={};try{t(!1),e()}finally{_o=n,Qoe.transition=s}}function J5e(){return Wf().memoizedState}function fGe(t,e,n){var s=F0(t);if(n={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null},eTe(t))tTe(e,n);else if(n=O5e(t,e,n,s),n!==null){var i=Su();Qp(n,t,s,i),rTe(n,e,s)}}function pGe(t,e,n){var s=F0(t),i={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null};if(eTe(t))tTe(e,i);else{var o=t.alternate;if(t.lanes===0&&(o===null||o.lanes===0)&&(o=e.lastRenderedReducer,o!==null))try{var c=e.lastRenderedState,a=o(c,n);if(i.hasEagerState=!0,i.eagerState=a,lm(a,c)){var f=e.interleaved;f===null?(i.next=i,nme(e)):(i.next=f.next,f.next=i),e.interleaved=i;return}}catch{}finally{}n=O5e(t,e,i,s),n!==null&&(i=Su(),Qp(n,t,s,i),rTe(n,e,s))}}function eTe(t){var e=t.alternate;return t===Cl||e!==null&&e===Cl}function tTe(t,e){J5=Mee=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function rTe(t,e,n){if(n&4194240){var s=e.lanes;s&=t.pendingLanes,n|=s,e.lanes=n,qpe(t,n)}}var Tee={readContext:Hf,useCallback:Dd,useContext:Dd,useEffect:Dd,useImperativeHandle:Dd,useInsertionEffect:Dd,useLayoutEffect:Dd,useMemo:Dd,useReducer:Dd,useRef:Dd,useState:Dd,useDebugValue:Dd,useDeferredValue:Dd,useTransition:Dd,useMutableSource:Dd,useSyncExternalStore:Dd,useId:Dd,unstable_isNewReconciler:!1},mGe={readContext:Hf,useCallback:function(t,e){return $m().memoizedState=[t,e===void 0?null:e],t},useContext:Hf,useEffect:sbe,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,qL(4194308,4,K5e.bind(null,e,t),n)},useLayoutEffect:function(t,e){return qL(4194308,4,t,e)},useInsertionEffect:function(t,e){return qL(4,2,t,e)},useMemo:function(t,e){var n=$m();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var s=$m();return e=n!==void 0?n(e):e,s.memoizedState=s.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},s.queue=t,t=t.dispatch=fGe.bind(null,Cl,t),[s.memoizedState,t]},useRef:function(t){var e=$m();return t={current:t},e.memoizedState=t},useState:nbe,useDebugValue:hme,useDeferredValue:function(t){return $m().memoizedState=t},useTransition:function(){var t=nbe(!1),e=t[0];return t=hGe.bind(null,t[1]),$m().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var s=Cl,i=$m();if(ml){if(n===void 0)throw Error(kn(407));n=n()}else{if(n=e(),nd===null)throw Error(kn(349));ij&30||B5e(s,e,n)}i.memoizedState=n;var o={value:n,getSnapshot:e};return i.queue=o,sbe(U5e.bind(null,s,o,t),[t]),s.flags|=2048,bA(9,$5e.bind(null,s,o,n,e),void 0,null),n},useId:function(){var t=$m(),e=nd.identifierPrefix;if(ml){var n=wy,s=by;n=(s&~(1<<32-Xp(s)-1)).toString(32)+n,e=":"+e+"R"+n,n=vA++,0<\/script>",t=t.removeChild(t.firstChild)):typeof s.is=="string"?t=c.createElement(n,{is:s.is}):(t=c.createElement(n),n==="select"&&(c=t,s.multiple?c.multiple=!0:s.size&&(c.size=s.size))):t=c.createElementNS(t,n),t[Ym]=e,t[gA]=s,hTe(t,e,!1,!1),e.stateNode=t;e:{switch(c=gde(n,s),n){case"dialog":nl("cancel",t),nl("close",t),i=s;break;case"iframe":case"object":case"embed":nl("load",t),i=s;break;case"video":case"audio":for(i=0;iP4&&(e.flags|=128,s=!0,a5(o,!1),e.lanes=4194304)}else{if(!s)if(t=Cee(c),t!==null){if(e.flags|=128,s=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),a5(o,!0),o.tail===null&&o.tailMode==="hidden"&&!c.alternate&&!ml)return Rd(e),null}else 2*rc()-o.renderingStartTime>P4&&n!==1073741824&&(e.flags|=128,s=!0,a5(o,!1),e.lanes=4194304);o.isBackwards?(c.sibling=e.child,e.child=c):(n=o.last,n!==null?n.sibling=c:e.child=c,o.last=c)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=rc(),e.sibling=null,n=Nl.current,Go(Nl,s?n&1|2:n&1),e):(Rd(e),null);case 22:case 23:return xme(),s=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==s&&(e.flags|=8192),s&&e.mode&1?Ah&1073741824&&(Rd(e),e.subtreeFlags&6&&(e.flags|=8192)):Rd(e),null;case 24:return null;case 25:return null}throw Error(kn(156,e.tag))}function jGe(t,e){switch(Qpe(e),e.tag){case 1:return lh(e.type)&&_ee(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return E4(),ol(oh),ol(Xd),ome(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return ame(e),null;case 13:if(ol(Nl),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(kn(340));T4()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return ol(Nl),null;case 4:return E4(),null;case 10:return rme(e.type._context),null;case 22:case 23:return xme(),null;case 24:return null;default:return null}}var L6=!1,$d=!1,kGe=typeof WeakSet=="function"?WeakSet:Set,ms=null;function fS(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(s){Ol(t,e,s)}else n.current=null}function qde(t,e,n){try{n()}catch(s){Ol(t,e,s)}}var mbe=!1;function NGe(t,e){if(Sde=gee,t=v5e(),Ype(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var s=n.getSelection&&n.getSelection();if(s&&s.rangeCount!==0){n=s.anchorNode;var i=s.anchorOffset,o=s.focusNode;s=s.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var c=0,a=-1,f=-1,m=0,y=0,v=t,w=null;t:for(;;){for(var k;v!==n||i!==0&&v.nodeType!==3||(a=c+i),v!==o||s!==0&&v.nodeType!==3||(f=c+s),v.nodeType===3&&(c+=v.nodeValue.length),(k=v.firstChild)!==null;)w=v,v=k;for(;;){if(v===t)break t;if(w===n&&++m===i&&(a=c),w===o&&++y===s&&(f=c),(k=v.nextSibling)!==null)break;v=w,w=v.parentNode}v=k}n=a===-1||f===-1?null:{start:a,end:f}}else n=null}n=n||{start:0,end:0}}else n=null;for(Cde={focusedElem:t,selectionRange:n},gee=!1,ms=e;ms!==null;)if(e=ms,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,ms=t;else for(;ms!==null;){e=ms;try{var C=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(C!==null){var S=C.memoizedProps,T=C.memoizedState,I=e.stateNode,A=I.getSnapshotBeforeUpdate(e.elementType===e.type?S:Dp(e.type,S),T);I.__reactInternalSnapshotBeforeUpdate=A}break;case 3:var D=e.stateNode.containerInfo;D.nodeType===1?D.textContent="":D.nodeType===9&&D.documentElement&&D.removeChild(D.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(kn(163))}}catch($){Ol(e,e.return,$)}if(t=e.sibling,t!==null){t.return=e.return,ms=t;break}ms=e.return}return C=mbe,mbe=!1,C}function eT(t,e,n){var s=e.updateQueue;if(s=s!==null?s.lastEffect:null,s!==null){var i=s=s.next;do{if((i.tag&t)===t){var o=i.destroy;i.destroy=void 0,o!==void 0&&qde(e,n,o)}i=i.next}while(i!==s)}}function pne(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var s=n.create;n.destroy=s()}n=n.next}while(n!==e)}}function Vde(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function mTe(t){var e=t.alternate;e!==null&&(t.alternate=null,mTe(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Ym],delete e[gA],delete e[Ade],delete e[oGe],delete e[lGe])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function gTe(t){return t.tag===5||t.tag===3||t.tag===4}function gbe(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||gTe(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Hde(t,e,n){var s=t.tag;if(s===5||s===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=vee));else if(s!==4&&(t=t.child,t!==null))for(Hde(t,e,n),t=t.sibling;t!==null;)Hde(t,e,n),t=t.sibling}function Wde(t,e,n){var s=t.tag;if(s===5||s===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(s!==4&&(t=t.child,t!==null))for(Wde(t,e,n),t=t.sibling;t!==null;)Wde(t,e,n),t=t.sibling}var _d=null,Bp=!1;function Fx(t,e,n){for(n=n.child;n!==null;)yTe(t,e,n),n=n.sibling}function yTe(t,e,n){if(ng&&typeof ng.onCommitFiberUnmount=="function")try{ng.onCommitFiberUnmount(ane,n)}catch{}switch(n.tag){case 5:$d||fS(n,e);case 6:var s=_d,i=Bp;_d=null,Fx(t,e,n),_d=s,Bp=i,_d!==null&&(Bp?(t=_d,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):_d.removeChild(n.stateNode));break;case 18:_d!==null&&(Bp?(t=_d,n=n.stateNode,t.nodeType===8?Zoe(t.parentNode,n):t.nodeType===1&&Zoe(t,n),uA(t)):Zoe(_d,n.stateNode));break;case 4:s=_d,i=Bp,_d=n.stateNode.containerInfo,Bp=!0,Fx(t,e,n),_d=s,Bp=i;break;case 0:case 11:case 14:case 15:if(!$d&&(s=n.updateQueue,s!==null&&(s=s.lastEffect,s!==null))){i=s=s.next;do{var o=i,c=o.destroy;o=o.tag,c!==void 0&&(o&2||o&4)&&qde(n,e,c),i=i.next}while(i!==s)}Fx(t,e,n);break;case 1:if(!$d&&(fS(n,e),s=n.stateNode,typeof s.componentWillUnmount=="function"))try{s.props=n.memoizedProps,s.state=n.memoizedState,s.componentWillUnmount()}catch(a){Ol(n,e,a)}Fx(t,e,n);break;case 21:Fx(t,e,n);break;case 22:n.mode&1?($d=(s=$d)||n.memoizedState!==null,Fx(t,e,n),$d=s):Fx(t,e,n);break;default:Fx(t,e,n)}}function ybe(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new kGe),e.forEach(function(s){var i=LGe.bind(null,t,s);n.has(s)||(n.add(s),s.then(i,i))})}}function Tp(t,e){var n=e.deletions;if(n!==null)for(var s=0;si&&(i=c),s&=~o}if(s=i,s=rc()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*CGe(s/1960))-s,10t?16:t,k0===null)var s=!1;else{if(t=k0,k0=null,Iee=0,Ua&6)throw Error(kn(331));var i=Ua;for(Ua|=4,ms=t.current;ms!==null;){var o=ms,c=o.child;if(ms.flags&16){var a=o.deletions;if(a!==null){for(var f=0;frc()-gme?Pw(t,0):mme|=n),ch(t,e)}function NTe(t,e){e===0&&(t.mode&1?(e=N6,N6<<=1,!(N6&130023424)&&(N6=4194304)):e=1);var n=Su();t=By(t,e),t!==null&&(RE(t,e,n),ch(t,n))}function PGe(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),NTe(t,n)}function LGe(t,e){var n=0;switch(t.tag){case 13:var s=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:s=t.stateNode;break;default:throw Error(kn(314))}s!==null&&s.delete(e),NTe(t,n)}var STe;STe=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||oh.current)nh=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return nh=!1,bGe(t,e,n);nh=!!(t.flags&131072)}else nh=!1,ml&&e.flags&1048576&&A5e(e,jee,e.index);switch(e.lanes=0,e.tag){case 2:var s=e.type;VL(t,e),t=e.pendingProps;var i=M4(e,Xd.current);SS(e,n),i=cme(null,e,s,t,i,n);var o=dme();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,lh(s)?(o=!0,bee(e)):o=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,sme(e),i.updater=fne,e.stateNode=i,i._reactInternals=e,Dde(e,s,t,n),e=zde(null,e,s,!0,o,n)):(e.tag=0,ml&&o&&Xpe(e),fu(null,e,i,n),e=e.child),e;case 16:s=e.elementType;e:{switch(VL(t,e),t=e.pendingProps,i=s._init,s=i(s._payload),e.type=s,i=e.tag=DGe(s),t=Dp(s,t),i){case 0:e=Fde(null,e,s,t,n);break e;case 1:e=hbe(null,e,s,t,n);break e;case 11:e=dbe(null,e,s,t,n);break e;case 14:e=ube(null,e,s,Dp(s.type,t),n);break e}throw Error(kn(306,s,""))}return e;case 0:return s=e.type,i=e.pendingProps,i=e.elementType===s?i:Dp(s,i),Fde(t,e,s,i,n);case 1:return s=e.type,i=e.pendingProps,i=e.elementType===s?i:Dp(s,i),hbe(t,e,s,i,n);case 3:e:{if(cTe(e),t===null)throw Error(kn(387));s=e.pendingProps,o=e.memoizedState,i=o.element,D5e(t,e),See(e,s,null,n);var c=e.memoizedState;if(s=c.element,o.isDehydrated)if(o={element:s,isDehydrated:!1,cache:c.cache,pendingSuspenseBoundaries:c.pendingSuspenseBoundaries,transitions:c.transitions},e.updateQueue.baseState=o,e.memoizedState=o,e.flags&256){i=I4(Error(kn(423)),e),e=fbe(t,e,s,n,i);break e}else if(s!==i){i=I4(Error(kn(424)),e),e=fbe(t,e,s,n,i);break e}else for(zh=O0(e.stateNode.containerInfo.firstChild),Bh=e,ml=!0,Vp=null,n=L5e(e,null,s,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(T4(),s===i){e=$y(t,e,n);break e}fu(t,e,s,n)}e=e.child}return e;case 5:return R5e(e),t===null&&Pde(e),s=e.type,i=e.pendingProps,o=t!==null?t.memoizedProps:null,c=i.children,Mde(s,i)?c=null:o!==null&&Mde(s,o)&&(e.flags|=32),lTe(t,e),fu(t,e,c,n),e.child;case 6:return t===null&&Pde(e),null;case 13:return dTe(t,e,n);case 4:return ime(e,e.stateNode.containerInfo),s=e.pendingProps,t===null?e.child=A4(e,null,s,n):fu(t,e,s,n),e.child;case 11:return s=e.type,i=e.pendingProps,i=e.elementType===s?i:Dp(s,i),dbe(t,e,s,i,n);case 7:return fu(t,e,e.pendingProps,n),e.child;case 8:return fu(t,e,e.pendingProps.children,n),e.child;case 12:return fu(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(s=e.type._context,i=e.pendingProps,o=e.memoizedProps,c=i.value,Go(kee,s._currentValue),s._currentValue=c,o!==null)if(lm(o.value,c)){if(o.children===i.children&&!oh.current){e=$y(t,e,n);break e}}else for(o=e.child,o!==null&&(o.return=e);o!==null;){var a=o.dependencies;if(a!==null){c=o.child;for(var f=a.firstContext;f!==null;){if(f.context===s){if(o.tag===1){f=Cy(-1,n&-n),f.tag=2;var m=o.updateQueue;if(m!==null){m=m.shared;var y=m.pending;y===null?f.next=f:(f.next=y.next,y.next=f),m.pending=f}}o.lanes|=n,f=o.alternate,f!==null&&(f.lanes|=n),Lde(o.return,n,e),a.lanes|=n;break}f=f.next}}else if(o.tag===10)c=o.type===e.type?null:o.child;else if(o.tag===18){if(c=o.return,c===null)throw Error(kn(341));c.lanes|=n,a=c.alternate,a!==null&&(a.lanes|=n),Lde(c,n,e),c=o.sibling}else c=o.child;if(c!==null)c.return=o;else for(c=o;c!==null;){if(c===e){c=null;break}if(o=c.sibling,o!==null){o.return=c.return,c=o;break}c=c.return}o=c}fu(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,s=e.pendingProps.children,SS(e,n),i=Hf(i),s=s(i),e.flags|=1,fu(t,e,s,n),e.child;case 14:return s=e.type,i=Dp(s,e.pendingProps),i=Dp(s.type,i),ube(t,e,s,i,n);case 15:return aTe(t,e,e.type,e.pendingProps,n);case 17:return s=e.type,i=e.pendingProps,i=e.elementType===s?i:Dp(s,i),VL(t,e),e.tag=1,lh(s)?(t=!0,bee(e)):t=!1,SS(e,n),nTe(e,s,i),Dde(e,s,i,n),zde(null,e,s,!0,t,n);case 19:return uTe(t,e,n);case 22:return oTe(t,e,n)}throw Error(kn(156,e.tag))};function CTe(t,e){return e5e(t,e)}function OGe(t,e,n,s){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Af(t,e,n,s){return new OGe(t,e,n,s)}function _me(t){return t=t.prototype,!(!t||!t.isReactComponent)}function DGe(t){if(typeof t=="function")return _me(t)?1:0;if(t!=null){if(t=t.$$typeof,t===zpe)return 11;if(t===Bpe)return 14}return 2}function z0(t,e){var n=t.alternate;return n===null?(n=Af(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function GL(t,e,n,s,i,o){var c=2;if(s=t,typeof t=="function")_me(t)&&(c=1);else if(typeof t=="string")c=5;else e:switch(t){case sS:return Lw(n.children,i,o,e);case Fpe:c=8,i|=8;break;case ade:return t=Af(12,n,e,i|2),t.elementType=ade,t.lanes=o,t;case ode:return t=Af(13,n,e,i),t.elementType=ode,t.lanes=o,t;case lde:return t=Af(19,n,e,i),t.elementType=lde,t.lanes=o,t;case RMe:return gne(n,i,o,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case OMe:c=10;break e;case DMe:c=9;break e;case zpe:c=11;break e;case Bpe:c=14;break e;case Kx:c=16,s=null;break e}throw Error(kn(130,t==null?t:typeof t,""))}return e=Af(c,n,e,i),e.elementType=t,e.type=s,e.lanes=o,e}function Lw(t,e,n,s){return t=Af(7,t,s,e),t.lanes=n,t}function gne(t,e,n,s){return t=Af(22,t,s,e),t.elementType=RMe,t.lanes=n,t.stateNode={isHidden:!1},t}function nle(t,e,n){return t=Af(6,t,null,e),t.lanes=n,t}function sle(t,e,n){return e=Af(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function RGe(t,e,n,s,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Foe(0),this.expirationTimes=Foe(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Foe(0),this.identifierPrefix=s,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function bme(t,e,n,s,i,o,c,a,f){return t=new RGe(t,e,n,a,f),e===1?(e=1,o===!0&&(e|=8)):e=0,o=Af(3,null,null,e),t.current=o,o.stateNode=t,o.memoizedState={element:s,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},sme(o),t}function FGe(t,e,n){var s=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ETe)}catch(t){console.error(t)}}ETe(),EMe.exports=Xh;var N1=EMe.exports;const Nme=Oa(N1);var ITe,Nbe=N1;ITe=Nbe.createRoot,Nbe.hydrateRoot;const qGe=1,VGe=1e6;let ile=0;function HGe(){return ile=(ile+1)%Number.MAX_SAFE_INTEGER,ile.toString()}const ale=new Map,Sbe=t=>{if(ale.has(t))return;const e=setTimeout(()=>{ale.delete(t),nT({type:"REMOVE_TOAST",toastId:t})},VGe);ale.set(t,e)},WGe=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,qGe)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(n=>n.id===e.toast.id?{...n,...e.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=e;return n?Sbe(n):t.toasts.forEach(s=>{Sbe(s.id)}),{...t,toasts:t.toasts.map(s=>s.id===n||n===void 0?{...s,open:!1}:s)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(n=>n.id!==e.toastId)}}},KL=[];let ZL={toasts:[]};function nT(t){ZL=WGe(ZL,t),KL.forEach(e=>{e(ZL)})}function Wi({...t}){const e=HGe(),n=i=>nT({type:"UPDATE_TOAST",toast:{...i,id:e}}),s=()=>nT({type:"DISMISS_TOAST",toastId:e});return nT({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:i=>{i||s()}}}),{id:e,dismiss:s,update:n}}function la(){const[t,e]=P.useState(ZL);return P.useEffect(()=>(KL.push(e),()=>{const n=KL.indexOf(e);n>-1&&KL.splice(n,1)}),[t]),{...t,toast:Wi,dismiss:n=>nT({type:"DISMISS_TOAST",toastId:n})}}function an(t,e,{checkForDefaultPrevented:n=!0}={}){return function(i){if(t==null||t(i),n===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function Cbe(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Uy(...t){return e=>{let n=!1;const s=t.map(i=>{const o=Cbe(i,e);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i{const{children:c,...a}=o,f=P.useMemo(()=>a,Object.values(a));return r.jsx(n.Provider,{value:f,children:c})};s.displayName=t+"Provider";function i(o){const c=P.useContext(n);if(c)return c;if(e!==void 0)return e;throw new Error(`\`${o}\` must be used within \`${t}\``)}return[s,i]}function Zl(t,e=[]){let n=[];function s(o,c){const a=P.createContext(c),f=n.length;n=[...n,c];const m=v=>{var I;const{scope:w,children:k,...C}=v,S=((I=w==null?void 0:w[t])==null?void 0:I[f])||a,T=P.useMemo(()=>C,Object.values(C));return r.jsx(S.Provider,{value:T,children:k})};m.displayName=o+"Provider";function y(v,w){var S;const k=((S=w==null?void 0:w[t])==null?void 0:S[f])||a,C=P.useContext(k);if(C)return C;if(c!==void 0)return c;throw new Error(`\`${v}\` must be used within \`${o}\``)}return[m,y]}const i=()=>{const o=n.map(c=>P.createContext(c));return function(a){const f=(a==null?void 0:a[t])||o;return P.useMemo(()=>({[`__scope${t}`]:{...a,[t]:f}}),[a,f])}};return i.scopeName=t,[s,KGe(i,...e)]}function KGe(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const s=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const c=s.reduce((a,{useScope:f,scopeName:m})=>{const v=f(o)[`__scope${m}`];return{...a,...v}},{});return P.useMemo(()=>({[`__scope${e.scopeName}`]:c}),[c])}};return n.scopeName=e.scopeName,n}function p1(t){const e=ZGe(t),n=P.forwardRef((s,i)=>{const{children:o,...c}=s,a=P.Children.toArray(o),f=a.find(YGe);if(f){const m=f.props.children,y=a.map(v=>v===f?P.Children.count(m)>1?P.Children.only(null):P.isValidElement(m)?m.props.children:null:v);return r.jsx(e,{...c,ref:i,children:P.isValidElement(m)?P.cloneElement(m,void 0,y):null})}return r.jsx(e,{...c,ref:i,children:o})});return n.displayName=`${t}.Slot`,n}var Sme=p1("Slot");function ZGe(t){const e=P.forwardRef((n,s)=>{const{children:i,...o}=n;if(P.isValidElement(i)){const c=QGe(i),a=XGe(o,i.props);return i.type!==P.Fragment&&(a.ref=s?Uy(s,c):c),P.cloneElement(i,a)}return P.Children.count(i)>1?P.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var PTe=Symbol("radix.slottable");function LTe(t){const e=({children:n})=>r.jsx(r.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=PTe,e}function YGe(t){return P.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===PTe}function XGe(t,e){const n={...e};for(const s in e){const i=t[s],o=e[s];/^on[A-Z]/.test(s)?i&&o?n[s]=(...a)=>{const f=o(...a);return i(...a),f}:i&&(n[s]=i):s==="style"?n[s]={...i,...o}:s==="className"&&(n[s]=[i,o].filter(Boolean).join(" "))}return{...t,...n}}function QGe(t){var s,i;let e=(s=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:s.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function $E(t){const e=t+"CollectionProvider",[n,s]=Zl(e),[i,o]=n(e,{collectionRef:{current:null},itemMap:new Map}),c=S=>{const{scope:T,children:I}=S,A=lt.useRef(null),D=lt.useRef(new Map).current;return r.jsx(i,{scope:T,itemMap:D,collectionRef:A,children:I})};c.displayName=e;const a=t+"CollectionSlot",f=p1(a),m=lt.forwardRef((S,T)=>{const{scope:I,children:A}=S,D=o(a,I),$=Gs(T,D.collectionRef);return r.jsx(f,{ref:$,children:A})});m.displayName=a;const y=t+"CollectionItemSlot",v="data-radix-collection-item",w=p1(y),k=lt.forwardRef((S,T)=>{const{scope:I,children:A,...D}=S,$=lt.useRef(null),F=Gs(T,$),q=o(y,I);return lt.useEffect(()=>(q.itemMap.set($,{ref:$,...D}),()=>void q.itemMap.delete($))),r.jsx(w,{[v]:"",ref:F,children:A})});k.displayName=y;function C(S){const T=o(t+"CollectionConsumer",S);return lt.useCallback(()=>{const A=T.collectionRef.current;if(!A)return[];const D=Array.from(A.querySelectorAll(`[${v}]`));return Array.from(T.itemMap.values()).sort((q,W)=>D.indexOf(q.ref.current)-D.indexOf(W.ref.current))},[T.collectionRef,T.itemMap])}return[{Provider:c,Slot:m,ItemSlot:k},C,s]}var JGe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],On=JGe.reduce((t,e)=>{const n=p1(`Primitive.${e}`),s=P.forwardRef((i,o)=>{const{asChild:c,...a}=i,f=c?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(f,{...a,ref:o})});return s.displayName=`Primitive.${e}`,{...t,[e]:s}},{});function Cme(t,e){t&&N1.flushSync(()=>t.dispatchEvent(e))}function $l(t){const e=P.useRef(t);return P.useEffect(()=>{e.current=t}),P.useMemo(()=>(...n)=>{var s;return(s=e.current)==null?void 0:s.call(e,...n)},[])}function eKe(t,e=globalThis==null?void 0:globalThis.document){const n=$l(t);P.useEffect(()=>{const s=i=>{i.key==="Escape"&&n(i)};return e.addEventListener("keydown",s,{capture:!0}),()=>e.removeEventListener("keydown",s,{capture:!0})},[n,e])}var tKe="DismissableLayer",Xde="dismissableLayer.update",rKe="dismissableLayer.pointerDownOutside",nKe="dismissableLayer.focusOutside",Mbe,OTe=P.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),S1=P.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:c,onDismiss:a,...f}=t,m=P.useContext(OTe),[y,v]=P.useState(null),w=(y==null?void 0:y.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,k]=P.useState({}),C=Gs(e,W=>v(W)),S=Array.from(m.layers),[T]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),I=S.indexOf(T),A=y?S.indexOf(y):-1,D=m.layersWithOutsidePointerEventsDisabled.size>0,$=A>=I,F=iKe(W=>{const K=W.target,Z=[...m.branches].some(re=>re.contains(K));!$||Z||(i==null||i(W),c==null||c(W),W.defaultPrevented||a==null||a())},w),q=aKe(W=>{const K=W.target;[...m.branches].some(re=>re.contains(K))||(o==null||o(W),c==null||c(W),W.defaultPrevented||a==null||a())},w);return eKe(W=>{A===m.layers.size-1&&(s==null||s(W),!W.defaultPrevented&&a&&(W.preventDefault(),a()))},w),P.useEffect(()=>{if(y)return n&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(Mbe=w.body.style.pointerEvents,w.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(y)),m.layers.add(y),Tbe(),()=>{n&&m.layersWithOutsidePointerEventsDisabled.size===1&&(w.body.style.pointerEvents=Mbe)}},[y,w,n,m]),P.useEffect(()=>()=>{y&&(m.layers.delete(y),m.layersWithOutsidePointerEventsDisabled.delete(y),Tbe())},[y,m]),P.useEffect(()=>{const W=()=>k({});return document.addEventListener(Xde,W),()=>document.removeEventListener(Xde,W)},[]),r.jsx(On.div,{...f,ref:C,style:{pointerEvents:D?$?"auto":"none":void 0,...t.style},onFocusCapture:an(t.onFocusCapture,q.onFocusCapture),onBlurCapture:an(t.onBlurCapture,q.onBlurCapture),onPointerDownCapture:an(t.onPointerDownCapture,F.onPointerDownCapture)})});S1.displayName=tKe;var sKe="DismissableLayerBranch",DTe=P.forwardRef((t,e)=>{const n=P.useContext(OTe),s=P.useRef(null),i=Gs(e,s);return P.useEffect(()=>{const o=s.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),r.jsx(On.div,{...t,ref:i})});DTe.displayName=sKe;function iKe(t,e=globalThis==null?void 0:globalThis.document){const n=$l(t),s=P.useRef(!1),i=P.useRef(()=>{});return P.useEffect(()=>{const o=a=>{if(a.target&&!s.current){let f=function(){RTe(rKe,n,m,{discrete:!0})};const m={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=f,e.addEventListener("click",i.current,{once:!0})):f()}else e.removeEventListener("click",i.current);s.current=!1},c=window.setTimeout(()=>{e.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(c),e.removeEventListener("pointerdown",o),e.removeEventListener("click",i.current)}},[e,n]),{onPointerDownCapture:()=>s.current=!0}}function aKe(t,e=globalThis==null?void 0:globalThis.document){const n=$l(t),s=P.useRef(!1);return P.useEffect(()=>{const i=o=>{o.target&&!s.current&&RTe(nKe,n,{originalEvent:o},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function Tbe(){const t=new CustomEvent(Xde);document.dispatchEvent(t)}function RTe(t,e,n,{discrete:s}){const i=n.originalEvent.target,o=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),s?Cme(i,o):i.dispatchEvent(o)}var oKe=S1,lKe=DTe,Gl=globalThis!=null&&globalThis.document?P.useLayoutEffect:()=>{},cKe="Portal",CC=P.forwardRef((t,e)=>{var a;const{container:n,...s}=t,[i,o]=P.useState(!1);Gl(()=>o(!0),[]);const c=n||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return c?Nme.createPortal(r.jsx(On.div,{...s,ref:e}),c):null});CC.displayName=cKe;function dKe(t,e){return P.useReducer((n,s)=>e[n][s]??n,t)}var oc=t=>{const{present:e,children:n}=t,s=uKe(e),i=typeof n=="function"?n({present:s.isPresent}):P.Children.only(n),o=Gs(s.ref,hKe(i));return typeof n=="function"||s.isPresent?P.cloneElement(i,{ref:o}):null};oc.displayName="Presence";function uKe(t){const[e,n]=P.useState(),s=P.useRef(null),i=P.useRef(t),o=P.useRef("none"),c=t?"mounted":"unmounted",[a,f]=dKe(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return P.useEffect(()=>{const m=R6(s.current);o.current=a==="mounted"?m:"none"},[a]),Gl(()=>{const m=s.current,y=i.current;if(y!==t){const w=o.current,k=R6(m);t?f("MOUNT"):k==="none"||(m==null?void 0:m.display)==="none"?f("UNMOUNT"):f(y&&w!==k?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,f]),Gl(()=>{if(e){let m;const y=e.ownerDocument.defaultView??window,v=k=>{const S=R6(s.current).includes(k.animationName);if(k.target===e&&S&&(f("ANIMATION_END"),!i.current)){const T=e.style.animationFillMode;e.style.animationFillMode="forwards",m=y.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=T)})}},w=k=>{k.target===e&&(o.current=R6(s.current))};return e.addEventListener("animationstart",w),e.addEventListener("animationcancel",v),e.addEventListener("animationend",v),()=>{y.clearTimeout(m),e.removeEventListener("animationstart",w),e.removeEventListener("animationcancel",v),e.removeEventListener("animationend",v)}}else f("ANIMATION_END")},[e,f]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:P.useCallback(m=>{s.current=m?getComputedStyle(m):null,n(m)},[])}}function R6(t){return(t==null?void 0:t.animationName)||"none"}function hKe(t){var s,i;let e=(s=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:s.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var fKe=Lpe[" useInsertionEffect ".trim().toString()]||Gl;function Tu({prop:t,defaultProp:e,onChange:n=()=>{},caller:s}){const[i,o,c]=pKe({defaultProp:e,onChange:n}),a=t!==void 0,f=a?t:i;{const y=P.useRef(t!==void 0);P.useEffect(()=>{const v=y.current;v!==a&&console.warn(`${s} is changing from ${v?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),y.current=a},[a,s])}const m=P.useCallback(y=>{var v;if(a){const w=mKe(y)?y(t):y;w!==t&&((v=c.current)==null||v.call(c,w))}else o(y)},[a,t,o,c]);return[f,m]}function pKe({defaultProp:t,onChange:e}){const[n,s]=P.useState(t),i=P.useRef(n),o=P.useRef(e);return fKe(()=>{o.current=e},[e]),P.useEffect(()=>{var c;i.current!==n&&((c=o.current)==null||c.call(o,n),i.current=n)},[n,i]),[n,s,o]}function mKe(t){return typeof t=="function"}var FTe=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),gKe="VisuallyHidden",bne=P.forwardRef((t,e)=>r.jsx(On.span,{...t,ref:e,style:{...FTe,...t.style}}));bne.displayName=gKe;var yKe=bne,Mme="ToastProvider",[Tme,xKe,vKe]=$E("Toast"),[zTe]=Zl("Toast",[vKe]),[_Ke,wne]=zTe(Mme),BTe=t=>{const{__scopeToast:e,label:n="Notification",duration:s=5e3,swipeDirection:i="right",swipeThreshold:o=50,children:c}=t,[a,f]=P.useState(null),[m,y]=P.useState(0),v=P.useRef(!1),w=P.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Mme}\`. Expected non-empty \`string\`.`),r.jsx(Tme.Provider,{scope:e,children:r.jsx(_Ke,{scope:e,label:n,duration:s,swipeDirection:i,swipeThreshold:o,toastCount:m,viewport:a,onViewportChange:f,onToastAdd:P.useCallback(()=>y(k=>k+1),[]),onToastRemove:P.useCallback(()=>y(k=>k-1),[]),isFocusedToastEscapeKeyDownRef:v,isClosePausedRef:w,children:c})})};BTe.displayName=Mme;var $Te="ToastViewport",bKe=["F8"],Qde="toast.viewportPause",Jde="toast.viewportResume",UTe=P.forwardRef((t,e)=>{const{__scopeToast:n,hotkey:s=bKe,label:i="Notifications ({hotkey})",...o}=t,c=wne($Te,n),a=xKe(n),f=P.useRef(null),m=P.useRef(null),y=P.useRef(null),v=P.useRef(null),w=Gs(e,v,c.onViewportChange),k=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),C=c.toastCount>0;P.useEffect(()=>{const T=I=>{var D;s.length!==0&&s.every($=>I[$]||I.code===$)&&((D=v.current)==null||D.focus())};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[s]),P.useEffect(()=>{const T=f.current,I=v.current;if(C&&T&&I){const A=()=>{if(!c.isClosePausedRef.current){const q=new CustomEvent(Qde);I.dispatchEvent(q),c.isClosePausedRef.current=!0}},D=()=>{if(c.isClosePausedRef.current){const q=new CustomEvent(Jde);I.dispatchEvent(q),c.isClosePausedRef.current=!1}},$=q=>{!T.contains(q.relatedTarget)&&D()},F=()=>{T.contains(document.activeElement)||D()};return T.addEventListener("focusin",A),T.addEventListener("focusout",$),T.addEventListener("pointermove",A),T.addEventListener("pointerleave",F),window.addEventListener("blur",A),window.addEventListener("focus",D),()=>{T.removeEventListener("focusin",A),T.removeEventListener("focusout",$),T.removeEventListener("pointermove",A),T.removeEventListener("pointerleave",F),window.removeEventListener("blur",A),window.removeEventListener("focus",D)}}},[C,c.isClosePausedRef]);const S=P.useCallback(({tabbingDirection:T})=>{const A=a().map(D=>{const $=D.ref.current,F=[$,...LKe($)];return T==="forwards"?F:F.reverse()});return(T==="forwards"?A.reverse():A).flat()},[a]);return P.useEffect(()=>{const T=v.current;if(T){const I=A=>{var F,q,W;const D=A.altKey||A.ctrlKey||A.metaKey;if(A.key==="Tab"&&!D){const K=document.activeElement,Z=A.shiftKey;if(A.target===T&&Z){(F=m.current)==null||F.focus();return}const ue=S({tabbingDirection:Z?"backwards":"forwards"}),Ne=ue.findIndex(se=>se===K);ole(ue.slice(Ne+1))?A.preventDefault():Z?(q=m.current)==null||q.focus():(W=y.current)==null||W.focus()}};return T.addEventListener("keydown",I),()=>T.removeEventListener("keydown",I)}},[a,S]),r.jsxs(lKe,{ref:f,role:"region","aria-label":i.replace("{hotkey}",k),tabIndex:-1,style:{pointerEvents:C?void 0:"none"},children:[C&&r.jsx(eue,{ref:m,onFocusFromOutsideViewport:()=>{const T=S({tabbingDirection:"forwards"});ole(T)}}),r.jsx(Tme.Slot,{scope:n,children:r.jsx(On.ol,{tabIndex:-1,...o,ref:w})}),C&&r.jsx(eue,{ref:y,onFocusFromOutsideViewport:()=>{const T=S({tabbingDirection:"backwards"});ole(T)}})]})});UTe.displayName=$Te;var qTe="ToastFocusProxy",eue=P.forwardRef((t,e)=>{const{__scopeToast:n,onFocusFromOutsideViewport:s,...i}=t,o=wne(qTe,n);return r.jsx(bne,{"aria-hidden":!0,tabIndex:0,...i,ref:e,style:{position:"fixed"},onFocus:c=>{var m;const a=c.relatedTarget;!((m=o.viewport)!=null&&m.contains(a))&&s()}})});eue.displayName=qTe;var UE="Toast",wKe="toast.swipeStart",jKe="toast.swipeMove",kKe="toast.swipeCancel",NKe="toast.swipeEnd",VTe=P.forwardRef((t,e)=>{const{forceMount:n,open:s,defaultOpen:i,onOpenChange:o,...c}=t,[a,f]=Tu({prop:s,defaultProp:i??!0,onChange:o,caller:UE});return r.jsx(oc,{present:n||a,children:r.jsx(MKe,{open:a,...c,ref:e,onClose:()=>f(!1),onPause:$l(t.onPause),onResume:$l(t.onResume),onSwipeStart:an(t.onSwipeStart,m=>{m.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:an(t.onSwipeMove,m=>{const{x:y,y:v}=m.detail.delta;m.currentTarget.setAttribute("data-swipe","move"),m.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${y}px`),m.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${v}px`)}),onSwipeCancel:an(t.onSwipeCancel,m=>{m.currentTarget.setAttribute("data-swipe","cancel"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),m.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),m.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:an(t.onSwipeEnd,m=>{const{x:y,y:v}=m.detail.delta;m.currentTarget.setAttribute("data-swipe","end"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),m.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${y}px`),m.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${v}px`),f(!1)})})})});VTe.displayName=UE;var[SKe,CKe]=zTe(UE,{onClose(){}}),MKe=P.forwardRef((t,e)=>{const{__scopeToast:n,type:s="foreground",duration:i,open:o,onClose:c,onEscapeKeyDown:a,onPause:f,onResume:m,onSwipeStart:y,onSwipeMove:v,onSwipeCancel:w,onSwipeEnd:k,...C}=t,S=wne(UE,n),[T,I]=P.useState(null),A=Gs(e,se=>I(se)),D=P.useRef(null),$=P.useRef(null),F=i||S.duration,q=P.useRef(0),W=P.useRef(F),K=P.useRef(0),{onToastAdd:Z,onToastRemove:re}=S,he=$l(()=>{var xe;(T==null?void 0:T.contains(document.activeElement))&&((xe=S.viewport)==null||xe.focus()),c()}),ue=P.useCallback(se=>{!se||se===1/0||(window.clearTimeout(K.current),q.current=new Date().getTime(),K.current=window.setTimeout(he,se))},[he]);P.useEffect(()=>{const se=S.viewport;if(se){const xe=()=>{ue(W.current),m==null||m()},ie=()=>{const me=new Date().getTime()-q.current;W.current=W.current-me,window.clearTimeout(K.current),f==null||f()};return se.addEventListener(Qde,ie),se.addEventListener(Jde,xe),()=>{se.removeEventListener(Qde,ie),se.removeEventListener(Jde,xe)}}},[S.viewport,F,f,m,ue]),P.useEffect(()=>{o&&!S.isClosePausedRef.current&&ue(F)},[o,F,S.isClosePausedRef,ue]),P.useEffect(()=>(Z(),()=>re()),[Z,re]);const Ne=P.useMemo(()=>T?XTe(T):null,[T]);return S.viewport?r.jsxs(r.Fragment,{children:[Ne&&r.jsx(TKe,{__scopeToast:n,role:"status","aria-live":s==="foreground"?"assertive":"polite","aria-atomic":!0,children:Ne}),r.jsx(SKe,{scope:n,onClose:he,children:N1.createPortal(r.jsx(Tme.ItemSlot,{scope:n,children:r.jsx(oKe,{asChild:!0,onEscapeKeyDown:an(a,()=>{S.isFocusedToastEscapeKeyDownRef.current||he(),S.isFocusedToastEscapeKeyDownRef.current=!1}),children:r.jsx(On.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":o?"open":"closed","data-swipe-direction":S.swipeDirection,...C,ref:A,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:an(t.onKeyDown,se=>{se.key==="Escape"&&(a==null||a(se.nativeEvent),se.nativeEvent.defaultPrevented||(S.isFocusedToastEscapeKeyDownRef.current=!0,he()))}),onPointerDown:an(t.onPointerDown,se=>{se.button===0&&(D.current={x:se.clientX,y:se.clientY})}),onPointerMove:an(t.onPointerMove,se=>{if(!D.current)return;const xe=se.clientX-D.current.x,ie=se.clientY-D.current.y,me=!!$.current,fe=["left","right"].includes(S.swipeDirection),ve=["left","up"].includes(S.swipeDirection)?Math.min:Math.max,Ie=fe?ve(0,xe):0,Se=fe?0:ve(0,ie),oe=se.pointerType==="touch"?10:2,ae={x:Ie,y:Se},je={originalEvent:se,delta:ae};me?($.current=ae,F6(jKe,v,je,{discrete:!1})):Abe(ae,S.swipeDirection,oe)?($.current=ae,F6(wKe,y,je,{discrete:!1}),se.target.setPointerCapture(se.pointerId)):(Math.abs(xe)>oe||Math.abs(ie)>oe)&&(D.current=null)}),onPointerUp:an(t.onPointerUp,se=>{const xe=$.current,ie=se.target;if(ie.hasPointerCapture(se.pointerId)&&ie.releasePointerCapture(se.pointerId),$.current=null,D.current=null,xe){const me=se.currentTarget,fe={originalEvent:se,delta:xe};Abe(xe,S.swipeDirection,S.swipeThreshold)?F6(NKe,k,fe,{discrete:!0}):F6(kKe,w,fe,{discrete:!0}),me.addEventListener("click",ve=>ve.preventDefault(),{once:!0})}})})})}),S.viewport)})]}):null}),TKe=t=>{const{__scopeToast:e,children:n,...s}=t,i=wne(UE,e),[o,c]=P.useState(!1),[a,f]=P.useState(!1);return IKe(()=>c(!0)),P.useEffect(()=>{const m=window.setTimeout(()=>f(!0),1e3);return()=>window.clearTimeout(m)},[]),a?null:r.jsx(CC,{asChild:!0,children:r.jsx(bne,{...s,children:o&&r.jsxs(r.Fragment,{children:[i.label," ",n]})})})},AKe="ToastTitle",HTe=P.forwardRef((t,e)=>{const{__scopeToast:n,...s}=t;return r.jsx(On.div,{...s,ref:e})});HTe.displayName=AKe;var EKe="ToastDescription",WTe=P.forwardRef((t,e)=>{const{__scopeToast:n,...s}=t;return r.jsx(On.div,{...s,ref:e})});WTe.displayName=EKe;var GTe="ToastAction",KTe=P.forwardRef((t,e)=>{const{altText:n,...s}=t;return n.trim()?r.jsx(YTe,{altText:n,asChild:!0,children:r.jsx(Ame,{...s,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${GTe}\`. Expected non-empty \`string\`.`),null)});KTe.displayName=GTe;var ZTe="ToastClose",Ame=P.forwardRef((t,e)=>{const{__scopeToast:n,...s}=t,i=CKe(ZTe,n);return r.jsx(YTe,{asChild:!0,children:r.jsx(On.button,{type:"button",...s,ref:e,onClick:an(t.onClick,i.onClose)})})});Ame.displayName=ZTe;var YTe=P.forwardRef((t,e)=>{const{__scopeToast:n,altText:s,...i}=t;return r.jsx(On.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":s||void 0,...i,ref:e})});function XTe(t){const e=[];return Array.from(t.childNodes).forEach(s=>{if(s.nodeType===s.TEXT_NODE&&s.textContent&&e.push(s.textContent),PKe(s)){const i=s.ariaHidden||s.hidden||s.style.display==="none",o=s.dataset.radixToastAnnounceExclude==="";if(!i)if(o){const c=s.dataset.radixToastAnnounceAlt;c&&e.push(c)}else e.push(...XTe(s))}}),e}function F6(t,e,n,{discrete:s}){const i=n.originalEvent.currentTarget,o=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),s?Cme(i,o):i.dispatchEvent(o)}var Abe=(t,e,n=0)=>{const s=Math.abs(t.x),i=Math.abs(t.y),o=s>i;return e==="left"||e==="right"?o&&s>n:!o&&i>n};function IKe(t=()=>{}){const e=$l(t);Gl(()=>{let n=0,s=0;return n=window.requestAnimationFrame(()=>s=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(s)}},[e])}function PKe(t){return t.nodeType===t.ELEMENT_NODE}function LKe(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const i=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||i?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function ole(t){const e=document.activeElement;return t.some(n=>n===e?!0:(n.focus(),document.activeElement!==e))}var OKe=BTe,QTe=UTe,JTe=VTe,eAe=HTe,tAe=WTe,rAe=KTe,nAe=Ame;function sAe(t){var e,n,s="";if(typeof t=="string"||typeof t=="number")s+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;etypeof t=="boolean"?`${t}`:t===0?"0":t,Ibe=ta,MC=(t,e)=>n=>{var s;if((e==null?void 0:e.variants)==null)return Ibe(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:o}=e,c=Object.keys(i).map(m=>{const y=n==null?void 0:n[m],v=o==null?void 0:o[m];if(y===null)return null;const w=Ebe(y)||Ebe(v);return i[m][w]}),a=n&&Object.entries(n).reduce((m,y)=>{let[v,w]=y;return w===void 0||(m[v]=w),m},{}),f=e==null||(s=e.compoundVariants)===null||s===void 0?void 0:s.reduce((m,y)=>{let{class:v,className:w,...k}=y;return Object.entries(k).every(C=>{let[S,T]=C;return Array.isArray(T)?T.includes({...o,...a}[S]):{...o,...a}[S]===T})?[...m,v,w]:m},[]);return Ibe(t,c,f,n==null?void 0:n.class,n==null?void 0:n.className)};/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DKe=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),iAe=(...t)=>t.filter((e,n,s)=>!!e&&e.trim()!==""&&s.indexOf(e)===n).join(" ").trim();/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var RKe={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aAe=P.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:i="",children:o,iconNode:c,...a},f)=>P.createElement("svg",{ref:f,...RKe,width:e,height:e,stroke:t,strokeWidth:s?Number(n)*24/Number(e):n,className:iAe("lucide",i),...a},[...c.map(([m,y])=>P.createElement(m,y)),...Array.isArray(o)?o:[o]]));/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U=(t,e)=>{const n=P.forwardRef(({className:s,...i},o)=>P.createElement(aAe,{ref:o,iconNode:e,className:iAe(`lucide-${DKe(t)}`,s),...i}));return n.displayName=`${t}`,n};/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YL=U("AArrowDown",[["path",{d:"M3.5 13h6",key:"p1my2r"}],["path",{d:"m2 16 4.5-9 4.5 9",key:"ndf0b3"}],["path",{d:"M18 7v9",key:"pknjwm"}],["path",{d:"m14 12 4 4 4-4",key:"buelq4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XL=U("AArrowUp",[["path",{d:"M3.5 13h6",key:"p1my2r"}],["path",{d:"m2 16 4.5-9 4.5 9",key:"ndf0b3"}],["path",{d:"M18 16V7",key:"ty0viw"}],["path",{d:"m14 11 4-4 4 4",key:"1pu57t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QL=U("ALargeSmall",[["path",{d:"M21 14h-5",key:"1vh23k"}],["path",{d:"M16 16v-3.5a2.5 2.5 0 0 1 5 0V16",key:"1wh10o"}],["path",{d:"M4.5 13h6",key:"dfilno"}],["path",{d:"m3 16 4.5-9 4.5 9",key:"2dxa0e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JL=U("Accessibility",[["circle",{cx:"16",cy:"4",r:"1",key:"1grugj"}],["path",{d:"m18 19 1-7-6 1",key:"r0i19z"}],["path",{d:"m5 8 3-3 5.5 3-2.36 3.5",key:"9ptxx2"}],["path",{d:"M4.24 14.5a5 5 0 0 0 6.88 6",key:"10kmtu"}],["path",{d:"M13.76 17.5a5 5 0 0 0-6.88-6",key:"2qq6rc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ig=U("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eO=U("AirVent",[["path",{d:"M6 12H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"larmp2"}],["path",{d:"M6 8h12",key:"6g4wlu"}],["path",{d:"M18.3 17.7a2.5 2.5 0 0 1-3.16 3.83 2.53 2.53 0 0 1-1.14-2V12",key:"1bo8pg"}],["path",{d:"M6.6 15.6A2 2 0 1 0 10 17v-5",key:"t9h90c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tO=U("Airplay",[["path",{d:"M5 17H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-1",key:"ns4c3b"}],["path",{d:"m12 15 5 6H7Z",key:"14qnn2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bv=U("AlarmClockCheck",[["circle",{cx:"12",cy:"13",r:"8",key:"3y4lt7"}],["path",{d:"M5 3 2 6",key:"18tl5t"}],["path",{d:"m22 6-3-3",key:"1opdir"}],["path",{d:"M6.38 18.7 4 21",key:"17xu3x"}],["path",{d:"M17.64 18.67 20 21",key:"kv2oe2"}],["path",{d:"m9 13 2 2 4-4",key:"6343dt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $v=U("AlarmClockMinus",[["circle",{cx:"12",cy:"13",r:"8",key:"3y4lt7"}],["path",{d:"M5 3 2 6",key:"18tl5t"}],["path",{d:"m22 6-3-3",key:"1opdir"}],["path",{d:"M6.38 18.7 4 21",key:"17xu3x"}],["path",{d:"M17.64 18.67 20 21",key:"kv2oe2"}],["path",{d:"M9 13h6",key:"1uhe8q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rO=U("AlarmClockOff",[["path",{d:"M6.87 6.87a8 8 0 1 0 11.26 11.26",key:"3on8tj"}],["path",{d:"M19.9 14.25a8 8 0 0 0-9.15-9.15",key:"15ghsc"}],["path",{d:"m22 6-3-3",key:"1opdir"}],["path",{d:"M6.26 18.67 4 21",key:"yzmioq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M4 4 2 6",key:"1ycko6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Uv=U("AlarmClockPlus",[["circle",{cx:"12",cy:"13",r:"8",key:"3y4lt7"}],["path",{d:"M5 3 2 6",key:"18tl5t"}],["path",{d:"m22 6-3-3",key:"1opdir"}],["path",{d:"M6.38 18.7 4 21",key:"17xu3x"}],["path",{d:"M17.64 18.67 20 21",key:"kv2oe2"}],["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nO=U("AlarmClock",[["circle",{cx:"12",cy:"13",r:"8",key:"3y4lt7"}],["path",{d:"M12 9v4l2 2",key:"1c63tq"}],["path",{d:"M5 3 2 6",key:"18tl5t"}],["path",{d:"m22 6-3-3",key:"1opdir"}],["path",{d:"M6.38 18.7 4 21",key:"17xu3x"}],["path",{d:"M17.64 18.67 20 21",key:"kv2oe2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sO=U("AlarmSmoke",[["path",{d:"M11 21c0-2.5 2-2.5 2-5",key:"1sicvv"}],["path",{d:"M16 21c0-2.5 2-2.5 2-5",key:"1o3eny"}],["path",{d:"m19 8-.8 3a1.25 1.25 0 0 1-1.2 1H7a1.25 1.25 0 0 1-1.2-1L5 8",key:"1bvca4"}],["path",{d:"M21 3a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4a1 1 0 0 1 1-1z",key:"x3qr1j"}],["path",{d:"M6 21c0-2.5 2-2.5 2-5",key:"i3w1gp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iO=U("Album",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["polyline",{points:"11 3 11 11 14 8 17 11 17 3",key:"1wcwz3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aO=U("AlignCenterHorizontal",[["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"M10 16v4a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-4",key:"11f1s0"}],["path",{d:"M10 8V4a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v4",key:"t14dx9"}],["path",{d:"M20 16v1a2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2v-1",key:"1w07xs"}],["path",{d:"M14 8V7c0-1.1.9-2 2-2h2a2 2 0 0 1 2 2v1",key:"1apec2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oO=U("AlignCenterVertical",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"M8 10H4a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h4",key:"14d6g8"}],["path",{d:"M16 10h4a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-4",key:"1e2lrw"}],["path",{d:"M8 20H7a2 2 0 0 1-2-2v-2c0-1.1.9-2 2-2h1",key:"1fkdwx"}],["path",{d:"M16 14h1a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2h-1",key:"1euafb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MS=U("AlignCenter",[["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 18H5",key:"18s9l3"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lO=U("AlignEndHorizontal",[["rect",{width:"6",height:"16",x:"4",y:"2",rx:"2",key:"z5wdxg"}],["rect",{width:"6",height:"9",x:"14",y:"9",rx:"2",key:"um7a8w"}],["path",{d:"M22 22H2",key:"19qnx5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cO=U("AlignEndVertical",[["rect",{width:"16",height:"6",x:"2",y:"4",rx:"2",key:"10wcwx"}],["rect",{width:"9",height:"6",x:"9",y:"14",rx:"2",key:"4p5bwg"}],["path",{d:"M22 22V2",key:"12ipfv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dO=U("AlignHorizontalDistributeCenter",[["rect",{width:"6",height:"14",x:"4",y:"5",rx:"2",key:"1wwnby"}],["rect",{width:"6",height:"10",x:"14",y:"7",rx:"2",key:"1fe6j6"}],["path",{d:"M17 22v-5",key:"4b6g73"}],["path",{d:"M17 7V2",key:"hnrr36"}],["path",{d:"M7 22v-3",key:"1r4jpn"}],["path",{d:"M7 5V2",key:"liy1u9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uO=U("AlignHorizontalDistributeEnd",[["rect",{width:"6",height:"14",x:"4",y:"5",rx:"2",key:"1wwnby"}],["rect",{width:"6",height:"10",x:"14",y:"7",rx:"2",key:"1fe6j6"}],["path",{d:"M10 2v20",key:"uyc634"}],["path",{d:"M20 2v20",key:"1tx262"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hO=U("AlignHorizontalDistributeStart",[["rect",{width:"6",height:"14",x:"4",y:"5",rx:"2",key:"1wwnby"}],["rect",{width:"6",height:"10",x:"14",y:"7",rx:"2",key:"1fe6j6"}],["path",{d:"M4 2v20",key:"gtpd5x"}],["path",{d:"M14 2v20",key:"tg6bpw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fO=U("AlignHorizontalJustifyCenter",[["rect",{width:"6",height:"14",x:"2",y:"5",rx:"2",key:"dy24zr"}],["rect",{width:"6",height:"10",x:"16",y:"7",rx:"2",key:"13zkjt"}],["path",{d:"M12 2v20",key:"t6zp3m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pO=U("AlignHorizontalJustifyEnd",[["rect",{width:"6",height:"14",x:"2",y:"5",rx:"2",key:"dy24zr"}],["rect",{width:"6",height:"10",x:"12",y:"7",rx:"2",key:"1ht384"}],["path",{d:"M22 2v20",key:"40qfg1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mO=U("AlignHorizontalJustifyStart",[["rect",{width:"6",height:"14",x:"6",y:"5",rx:"2",key:"hsirpf"}],["rect",{width:"6",height:"10",x:"16",y:"7",rx:"2",key:"13zkjt"}],["path",{d:"M2 2v20",key:"1ivd8o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gO=U("AlignHorizontalSpaceAround",[["rect",{width:"6",height:"10",x:"9",y:"7",rx:"2",key:"yn7j0q"}],["path",{d:"M4 22V2",key:"tsjzd3"}],["path",{d:"M20 22V2",key:"1bnhr8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yO=U("AlignHorizontalSpaceBetween",[["rect",{width:"6",height:"14",x:"3",y:"5",rx:"2",key:"j77dae"}],["rect",{width:"6",height:"10",x:"15",y:"7",rx:"2",key:"bq30hj"}],["path",{d:"M3 2v20",key:"1d2pfg"}],["path",{d:"M21 2v20",key:"p059bm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xO=U("AlignJustify",[["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 18h18",key:"1h113x"}],["path",{d:"M3 6h18",key:"d0wm0j"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TS=U("AlignLeft",[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AS=U("AlignRight",[["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 18H7",key:"1ygte8"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vO=U("AlignStartHorizontal",[["rect",{width:"6",height:"16",x:"4",y:"6",rx:"2",key:"1n4dg1"}],["rect",{width:"6",height:"9",x:"14",y:"6",rx:"2",key:"17khns"}],["path",{d:"M22 2H2",key:"fhrpnj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _O=U("AlignStartVertical",[["rect",{width:"9",height:"6",x:"6",y:"14",rx:"2",key:"lpm2y7"}],["rect",{width:"16",height:"6",x:"6",y:"4",rx:"2",key:"rdj6ps"}],["path",{d:"M2 2v20",key:"1ivd8o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bO=U("AlignVerticalDistributeCenter",[["path",{d:"M22 17h-3",key:"1lwga1"}],["path",{d:"M22 7h-5",key:"o2endc"}],["path",{d:"M5 17H2",key:"1gx9xc"}],["path",{d:"M7 7H2",key:"6bq26l"}],["rect",{x:"5",y:"14",width:"14",height:"6",rx:"2",key:"1qrzuf"}],["rect",{x:"7",y:"4",width:"10",height:"6",rx:"2",key:"we8e9z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wO=U("AlignVerticalDistributeEnd",[["rect",{width:"14",height:"6",x:"5",y:"14",rx:"2",key:"jmoj9s"}],["rect",{width:"10",height:"6",x:"7",y:"4",rx:"2",key:"aza5on"}],["path",{d:"M2 20h20",key:"owomy5"}],["path",{d:"M2 10h20",key:"1ir3d8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jO=U("AlignVerticalDistributeStart",[["rect",{width:"14",height:"6",x:"5",y:"14",rx:"2",key:"jmoj9s"}],["rect",{width:"10",height:"6",x:"7",y:"4",rx:"2",key:"aza5on"}],["path",{d:"M2 14h20",key:"myj16y"}],["path",{d:"M2 4h20",key:"mda7wb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kO=U("AlignVerticalJustifyCenter",[["rect",{width:"14",height:"6",x:"5",y:"16",rx:"2",key:"1i8z2d"}],["rect",{width:"10",height:"6",x:"7",y:"2",rx:"2",key:"ypihtt"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NO=U("AlignVerticalJustifyEnd",[["rect",{width:"14",height:"6",x:"5",y:"12",rx:"2",key:"4l4tp2"}],["rect",{width:"10",height:"6",x:"7",y:"2",rx:"2",key:"ypihtt"}],["path",{d:"M2 22h20",key:"272qi7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SO=U("AlignVerticalJustifyStart",[["rect",{width:"14",height:"6",x:"5",y:"16",rx:"2",key:"1i8z2d"}],["rect",{width:"10",height:"6",x:"7",y:"6",rx:"2",key:"13squh"}],["path",{d:"M2 2h20",key:"1ennik"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CO=U("AlignVerticalSpaceAround",[["rect",{width:"10",height:"6",x:"7",y:"9",rx:"2",key:"b1zbii"}],["path",{d:"M22 20H2",key:"1p1f7z"}],["path",{d:"M22 4H2",key:"1b7qnq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MO=U("AlignVerticalSpaceBetween",[["rect",{width:"14",height:"6",x:"5",y:"15",rx:"2",key:"1w91an"}],["rect",{width:"10",height:"6",x:"7",y:"3",rx:"2",key:"17wqzy"}],["path",{d:"M2 21h20",key:"1nyx9w"}],["path",{d:"M2 3h20",key:"91anmk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TO=U("Ambulance",[["path",{d:"M10 10H6",key:"1bsnug"}],["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.28a1 1 0 0 0-.684-.948l-1.923-.641a1 1 0 0 1-.578-.502l-1.539-3.076A1 1 0 0 0 16.382 8H14",key:"lrkjwd"}],["path",{d:"M8 8v4",key:"1fwk8c"}],["path",{d:"M9 18h6",key:"x1upvd"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AO=U("Ampersand",[["path",{d:"M17.5 12c0 4.4-3.6 8-8 8A4.5 4.5 0 0 1 5 15.5c0-6 8-4 8-8.5a3 3 0 1 0-6 0c0 3 2.5 8.5 12 13",key:"1o9ehi"}],["path",{d:"M16 12h3",key:"4uvgyw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EO=U("Ampersands",[["path",{d:"M10 17c-5-3-7-7-7-9a2 2 0 0 1 4 0c0 2.5-5 2.5-5 6 0 1.7 1.3 3 3 3 2.8 0 5-2.2 5-5",key:"12lh1k"}],["path",{d:"M22 17c-5-3-7-7-7-9a2 2 0 0 1 4 0c0 2.5-5 2.5-5 6 0 1.7 1.3 3 3 3 2.8 0 5-2.2 5-5",key:"173c68"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IO=U("Amphora",[["path",{d:"M10 2v5.632c0 .424-.272.795-.653.982A6 6 0 0 0 6 14c.006 4 3 7 5 8",key:"1h8rid"}],["path",{d:"M10 5H8a2 2 0 0 0 0 4h.68",key:"3ezsi6"}],["path",{d:"M14 2v5.632c0 .424.272.795.652.982A6 6 0 0 1 18 14c0 4-3 7-5 8",key:"yt6q09"}],["path",{d:"M14 5h2a2 2 0 0 1 0 4h-.68",key:"8f95yk"}],["path",{d:"M18 22H6",key:"mg6kv4"}],["path",{d:"M9 2h6",key:"1jrp98"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PO=U("Anchor",[["path",{d:"M12 22V8",key:"qkxhtm"}],["path",{d:"M5 12H2a10 10 0 0 0 20 0h-3",key:"1hv3nh"}],["circle",{cx:"12",cy:"5",r:"3",key:"rqqgnr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LO=U("Angry",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M16 16s-1.5-2-4-2-4 2-4 2",key:"epbg0q"}],["path",{d:"M7.5 8 10 9",key:"olxxln"}],["path",{d:"m14 9 2.5-1",key:"1j6cij"}],["path",{d:"M9 10h.01",key:"qbtxuw"}],["path",{d:"M15 10h.01",key:"1qmjsl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OO=U("Annoyed",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 15h8",key:"45n4r"}],["path",{d:"M8 9h2",key:"1g203m"}],["path",{d:"M14 9h2",key:"116p9w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DO=U("Antenna",[["path",{d:"M2 12 7 2",key:"117k30"}],["path",{d:"m7 12 5-10",key:"1tvx22"}],["path",{d:"m12 12 5-10",key:"ev1o1a"}],["path",{d:"m17 12 5-10",key:"1e4ti3"}],["path",{d:"M4.5 7h15",key:"vlsxkz"}],["path",{d:"M12 16v6",key:"c8a4gj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RO=U("Anvil",[["path",{d:"M7 10H6a4 4 0 0 1-4-4 1 1 0 0 1 1-1h4",key:"1hjpb6"}],["path",{d:"M7 5a1 1 0 0 1 1-1h13a1 1 0 0 1 1 1 7 7 0 0 1-7 7H8a1 1 0 0 1-1-1z",key:"1qn45f"}],["path",{d:"M9 12v5",key:"3anwtq"}],["path",{d:"M15 12v5",key:"5xh3zn"}],["path",{d:"M5 20a3 3 0 0 1 3-3h8a3 3 0 0 1 3 3 1 1 0 0 1-1 1H6a1 1 0 0 1-1-1",key:"1fi4x8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FO=U("Aperture",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m14.31 8 5.74 9.94",key:"1y6ab4"}],["path",{d:"M9.69 8h11.48",key:"1wxppr"}],["path",{d:"m7.38 12 5.74-9.94",key:"1grp0k"}],["path",{d:"M9.69 16 3.95 6.06",key:"libnyf"}],["path",{d:"M14.31 16H2.83",key:"x5fava"}],["path",{d:"m16.62 12-5.74 9.94",key:"1vwawt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zO=U("AppWindowMac",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M14 8h.01",key:"1primd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sT=U("AppWindow",[["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}],["path",{d:"M10 4v4",key:"pp8u80"}],["path",{d:"M2 8h20",key:"d11cs7"}],["path",{d:"M6 4v4",key:"1svtjw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BO=U("Apple",[["path",{d:"M12 20.94c1.5 0 2.75 1.06 4 1.06 3 0 6-8 6-12.22A4.91 4.91 0 0 0 17 5c-2.22 0-4 1.44-5 2-1-.56-2.78-2-5-2a4.9 4.9 0 0 0-5 4.78C2 14 5 22 8 22c1.25 0 2.5-1.06 4-1.06Z",key:"3s7exb"}],["path",{d:"M10 2c1 .5 2 2 2 5",key:"fcco2y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $O=U("ArchiveRestore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UO=U("ArchiveX",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"m9.5 17 5-5",key:"nakeu6"}],["path",{d:"m9.5 12 5 5",key:"1hccrj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qO=U("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VO=U("Armchair",[["path",{d:"M19 9V6a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2v3",key:"irtipd"}],["path",{d:"M3 16a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-5a2 2 0 0 0-4 0v1.5a.5.5 0 0 1-.5.5h-9a.5.5 0 0 1-.5-.5V11a2 2 0 0 0-4 0z",key:"1qyhux"}],["path",{d:"M5 18v2",key:"ppbyun"}],["path",{d:"M19 18v2",key:"gy7782"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HO=U("ArrowBigDownDash",[["path",{d:"M15 5H9",key:"1tp3ed"}],["path",{d:"M15 9v3h4l-7 7-7-7h4V9z",key:"ncdc4b"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WO=U("ArrowBigDown",[["path",{d:"M15 6v6h4l-7 7-7-7h4V6h6z",key:"1thax2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GO=U("ArrowBigLeftDash",[["path",{d:"M19 15V9",key:"1hci5f"}],["path",{d:"M15 15h-3v4l-7-7 7-7v4h3v6z",key:"16tjna"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KO=U("ArrowBigLeft",[["path",{d:"M18 15h-6v4l-7-7 7-7v4h6v6z",key:"lbrdak"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZO=U("ArrowBigRightDash",[["path",{d:"M5 9v6",key:"158jrl"}],["path",{d:"M9 9h3V5l7 7-7 7v-4H9V9z",key:"1sg2xn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YO=U("ArrowBigRight",[["path",{d:"M6 9h6V5l7 7-7 7v-4H6V9z",key:"7fvt9c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XO=U("ArrowBigUpDash",[["path",{d:"M9 19h6",key:"456am0"}],["path",{d:"M9 15v-3H5l7-7 7 7h-4v3H9z",key:"1r2uve"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QO=U("ArrowBigUp",[["path",{d:"M9 18v-6H5l7-7 7 7h-4v6H9z",key:"1x06kx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JO=U("ArrowDown01",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["rect",{x:"15",y:"4",width:"4",height:"6",ry:"2",key:"1bwicg"}],["path",{d:"M17 20v-6h-2",key:"1qp1so"}],["path",{d:"M15 20h4",key:"1j968p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eD=U("ArrowDown10",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M17 10V4h-2",key:"zcsr5x"}],["path",{d:"M15 10h4",key:"id2lce"}],["rect",{x:"15",y:"14",width:"4",height:"6",ry:"2",key:"33xykx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qv=U("ArrowDownAZ",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M20 8h-5",key:"1vsyxs"}],["path",{d:"M15 10V6.5a2.5 2.5 0 0 1 5 0V10",key:"ag13bf"}],["path",{d:"M15 14h5l-5 6h5",key:"ur5jdg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tD=U("ArrowDownFromLine",[["path",{d:"M19 3H5",key:"1236rx"}],["path",{d:"M12 21V7",key:"gj6g52"}],["path",{d:"m6 15 6 6 6-6",key:"h15q88"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rD=U("ArrowDownLeft",[["path",{d:"M17 7 7 17",key:"15tmo1"}],["path",{d:"M17 17H7V7",key:"1org7z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nD=U("ArrowDownNarrowWide",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M11 4h4",key:"6d7r33"}],["path",{d:"M11 8h7",key:"djye34"}],["path",{d:"M11 12h10",key:"1438ji"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sD=U("ArrowDownRight",[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iD=U("ArrowDownToDot",[["path",{d:"M12 2v14",key:"jyx4ut"}],["path",{d:"m19 9-7 7-7-7",key:"1oe3oy"}],["circle",{cx:"12",cy:"21",r:"1",key:"o0uj5v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aD=U("ArrowDownToLine",[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oD=U("ArrowDownUp",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"m21 8-4-4-4 4",key:"1c9v7m"}],["path",{d:"M17 4v16",key:"7dpous"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vv=U("ArrowDownWideNarrow",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M11 4h10",key:"1w87gc"}],["path",{d:"M11 8h7",key:"djye34"}],["path",{d:"M11 12h4",key:"q8tih4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Hv=U("ArrowDownZA",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M15 4h5l-5 6h5",key:"8asdl1"}],["path",{d:"M15 20v-3.5a2.5 2.5 0 0 1 5 0V20",key:"r6l5cz"}],["path",{d:"M20 18h-5",key:"18j1r2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ES=U("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lD=U("ArrowLeftFromLine",[["path",{d:"m9 6-6 6 6 6",key:"7v63n9"}],["path",{d:"M3 12h14",key:"13k4hi"}],["path",{d:"M21 19V5",key:"b4bplr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cD=U("ArrowLeftRight",[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dD=U("ArrowLeftToLine",[["path",{d:"M3 19V5",key:"rwsyhb"}],["path",{d:"m13 6-6 6 6 6",key:"1yhaz7"}],["path",{d:"M7 12h14",key:"uoisry"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Va=U("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uD=U("ArrowRightFromLine",[["path",{d:"M3 5v14",key:"1nt18q"}],["path",{d:"M21 12H7",key:"13ipq5"}],["path",{d:"m15 18 6-6-6-6",key:"6tx3qv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hD=U("ArrowRightLeft",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fD=U("ArrowRightToLine",[["path",{d:"M17 12H3",key:"8awo09"}],["path",{d:"m11 18 6-6-6-6",key:"8c2y43"}],["path",{d:"M21 5v14",key:"nzette"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ho=U("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pD=U("ArrowUp01",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["rect",{x:"15",y:"4",width:"4",height:"6",ry:"2",key:"1bwicg"}],["path",{d:"M17 20v-6h-2",key:"1qp1so"}],["path",{d:"M15 20h4",key:"1j968p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mD=U("ArrowUp10",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M17 10V4h-2",key:"zcsr5x"}],["path",{d:"M15 10h4",key:"id2lce"}],["rect",{x:"15",y:"14",width:"4",height:"6",ry:"2",key:"33xykx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wv=U("ArrowUpAZ",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M20 8h-5",key:"1vsyxs"}],["path",{d:"M15 10V6.5a2.5 2.5 0 0 1 5 0V10",key:"ag13bf"}],["path",{d:"M15 14h5l-5 6h5",key:"ur5jdg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B0=U("ArrowUpDown",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gD=U("ArrowUpFromDot",[["path",{d:"m5 9 7-7 7 7",key:"1hw5ic"}],["path",{d:"M12 16V2",key:"ywoabb"}],["circle",{cx:"12",cy:"21",r:"1",key:"o0uj5v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yD=U("ArrowUpFromLine",[["path",{d:"m18 9-6-6-6 6",key:"kcunyi"}],["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xD=U("ArrowUpLeft",[["path",{d:"M7 17V7h10",key:"11bw93"}],["path",{d:"M17 17 7 7",key:"2786uv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gv=U("ArrowUpNarrowWide",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M11 12h4",key:"q8tih4"}],["path",{d:"M11 16h7",key:"uosisv"}],["path",{d:"M11 20h10",key:"jvxblo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vD=U("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _D=U("ArrowUpToLine",[["path",{d:"M5 3h14",key:"7usisc"}],["path",{d:"m18 13-6-6-6 6",key:"1kf1n9"}],["path",{d:"M12 7v14",key:"1akyts"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bD=U("ArrowUpWideNarrow",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 16h7",key:"uosisv"}],["path",{d:"M11 20h4",key:"1krc32"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kv=U("ArrowUpZA",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M15 4h5l-5 6h5",key:"8asdl1"}],["path",{d:"M15 20v-3.5a2.5 2.5 0 0 1 5 0V20",key:"r6l5cz"}],["path",{d:"M20 18h-5",key:"18j1r2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $0=U("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wD=U("ArrowsUpFromLine",[["path",{d:"m4 6 3-3 3 3",key:"9aidw8"}],["path",{d:"M7 17V3",key:"19qxw1"}],["path",{d:"m14 6 3-3 3 3",key:"6iy689"}],["path",{d:"M17 17V3",key:"o0fmgi"}],["path",{d:"M4 21h16",key:"1h09gz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jD=U("Asterisk",[["path",{d:"M12 6v12",key:"1vza4d"}],["path",{d:"M17.196 9 6.804 15",key:"1ah31z"}],["path",{d:"m6.804 9 10.392 6",key:"1b6pxd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kD=U("AtSign",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ND=U("Atom",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M20.2 20.2c2.04-2.03.02-7.36-4.5-11.9-4.54-4.52-9.87-6.54-11.9-4.5-2.04 2.03-.02 7.36 4.5 11.9 4.54 4.52 9.87 6.54 11.9 4.5Z",key:"1l2ple"}],["path",{d:"M15.7 15.7c4.52-4.54 6.54-9.87 4.5-11.9-2.03-2.04-7.36-.02-11.9 4.5-4.52 4.54-6.54 9.87-4.5 11.9 2.03 2.04 7.36.02 11.9-4.5Z",key:"1wam0m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SD=U("AudioLines",[["path",{d:"M2 10v3",key:"1fnikh"}],["path",{d:"M6 6v11",key:"11sgs0"}],["path",{d:"M10 3v18",key:"yhl04a"}],["path",{d:"M14 8v7",key:"3a1oy3"}],["path",{d:"M18 5v13",key:"123xd1"}],["path",{d:"M22 10v3",key:"154ddg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CD=U("AudioWaveform",[["path",{d:"M2 13a2 2 0 0 0 2-2V7a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0V4a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0v-4a2 2 0 0 1 2-2",key:"57tc96"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Cu=U("Award",[["path",{d:"m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526",key:"1yiouv"}],["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MD=U("Axe",[["path",{d:"m14 12-8.5 8.5a2.12 2.12 0 1 1-3-3L11 9",key:"csbz4o"}],["path",{d:"M15 13 9 7l4-4 6 6h3a8 8 0 0 1-7 7z",key:"113wfo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zv=U("Axis3d",[["path",{d:"M4 4v16h16",key:"1s015l"}],["path",{d:"m4 20 7-7",key:"17qe9y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TD=U("Baby",[["path",{d:"M9 12h.01",key:"157uk2"}],["path",{d:"M15 12h.01",key:"1k8ypt"}],["path",{d:"M10 16c.5.3 1.2.5 2 .5s1.5-.2 2-.5",key:"1u7htd"}],["path",{d:"M19 6.3a9 9 0 0 1 1.8 3.9 2 2 0 0 1 0 3.6 9 9 0 0 1-17.6 0 2 2 0 0 1 0-3.6A9 9 0 0 1 12 3c2 0 3.5 1.1 3.5 2.5s-.9 2.5-2 2.5c-.8 0-1.5-.4-1.5-1",key:"5yv0yz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AD=U("Backpack",[["path",{d:"M4 10a4 4 0 0 1 4-4h8a4 4 0 0 1 4 4v10a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2z",key:"1ol0lm"}],["path",{d:"M8 10h8",key:"c7uz4u"}],["path",{d:"M8 18h8",key:"1no2b1"}],["path",{d:"M8 22v-6a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v6",key:"1fr6do"}],["path",{d:"M9 6V4a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2",key:"donm21"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ED=U("BadgeAlert",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ID=U("BadgeCent",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M12 7v10",key:"jspqdw"}],["path",{d:"M15.4 10a4 4 0 1 0 0 4",key:"2eqtx8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yv=U("BadgeCheck",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PD=U("BadgeDollarSign",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 18V6",key:"zqpxq5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LD=U("BadgeEuro",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M7 12h5",key:"gblrwe"}],["path",{d:"M15 9.4a4 4 0 1 0 0 5.2",key:"1makmb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OD=U("BadgeHelp",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["line",{x1:"12",x2:"12.01",y1:"17",y2:"17",key:"io3f8k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DD=U("BadgeIndianRupee",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M8 8h8",key:"1bis0t"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"m13 17-5-1h1a4 4 0 0 0 0-8",key:"nu2bwa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RD=U("BadgeInfo",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["line",{x1:"12",x2:"12",y1:"16",y2:"12",key:"1y1yb1"}],["line",{x1:"12",x2:"12.01",y1:"8",y2:"8",key:"110wyk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FD=U("BadgeJapaneseYen",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 8 3 3v7",key:"17yadx"}],["path",{d:"m12 11 3-3",key:"p4cfq1"}],["path",{d:"M9 12h6",key:"1c52cq"}],["path",{d:"M9 16h6",key:"8wimt3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zD=U("BadgeMinus",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BD=U("BadgePercent",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"M15 15h.01",key:"lqbp3k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $D=U("BadgePlus",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["line",{x1:"12",x2:"12",y1:"8",y2:"16",key:"10p56q"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UD=U("BadgePoundSterling",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M8 12h4",key:"qz6y1c"}],["path",{d:"M10 16V9.5a2.5 2.5 0 0 1 5 0",key:"3mlbjk"}],["path",{d:"M8 16h7",key:"sbedsn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qD=U("BadgeRussianRuble",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M9 16h5",key:"1syiyw"}],["path",{d:"M9 12h5a2 2 0 1 0 0-4h-3v9",key:"1ge9c1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VD=U("BadgeSwissFranc",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M11 17V8h4",key:"1bfq6y"}],["path",{d:"M11 12h3",key:"2eqnfz"}],["path",{d:"M9 16h4",key:"1skf3a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HD=U("BadgeX",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["line",{x1:"15",x2:"9",y1:"9",y2:"15",key:"f7djnv"}],["line",{x1:"9",x2:"15",y1:"9",y2:"15",key:"1shsy8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WD=U("Badge",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GD=U("BaggageClaim",[["path",{d:"M22 18H6a2 2 0 0 1-2-2V7a2 2 0 0 0-2-2",key:"4irg2o"}],["path",{d:"M17 14V4a2 2 0 0 0-2-2h-1a2 2 0 0 0-2 2v10",key:"14fcyx"}],["rect",{width:"13",height:"8",x:"8",y:"6",rx:"1",key:"o6oiis"}],["circle",{cx:"18",cy:"20",r:"2",key:"t9985n"}],["circle",{cx:"9",cy:"20",r:"2",key:"e5v82j"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KD=U("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZD=U("Banana",[["path",{d:"M4 13c3.5-2 8-2 10 2a5.5 5.5 0 0 1 8 5",key:"1cscit"}],["path",{d:"M5.15 17.89c5.52-1.52 8.65-6.89 7-12C11.55 4 11.5 2 13 2c3.22 0 5 5.5 5 8 0 6.5-4.2 12-10.49 12C5.11 22 2 22 2 20c0-1.5 1.14-1.55 3.15-2.11Z",key:"1y1nbv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YD=U("Bandage",[["path",{d:"M10 10.01h.01",key:"1e9xi7"}],["path",{d:"M10 14.01h.01",key:"ac23bv"}],["path",{d:"M14 10.01h.01",key:"2wfrvf"}],["path",{d:"M14 14.01h.01",key:"8tw8yn"}],["path",{d:"M18 6v11.5",key:"dkbidh"}],["path",{d:"M6 6v12",key:"vkc79e"}],["rect",{x:"2",y:"6",width:"20",height:"12",rx:"2",key:"1wpnh2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XD=U("Banknote",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M6 12h.01M18 12h.01",key:"113zkx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QD=U("Barcode",[["path",{d:"M3 5v14",key:"1nt18q"}],["path",{d:"M8 5v14",key:"1ybrkv"}],["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"M17 5v14",key:"ycjyhj"}],["path",{d:"M21 5v14",key:"nzette"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JD=U("Baseline",[["path",{d:"M4 20h16",key:"14thso"}],["path",{d:"m6 16 6-12 6 12",key:"1b4byz"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lf=U("Bath",[["path",{d:"M10 4 8 6",key:"1rru8s"}],["path",{d:"M17 19v2",key:"ts1sot"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"M7 19v2",key:"12npes"}],["path",{d:"M9 5 7.621 3.621A2.121 2.121 0 0 0 4 5v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5",key:"14ym8i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e8=U("BatteryCharging",[["path",{d:"M15 7h1a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2h-2",key:"1sdynx"}],["path",{d:"M6 7H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h1",key:"1gkd3k"}],["path",{d:"m11 7-3 5h4l-3 5",key:"b4a64w"}],["line",{x1:"22",x2:"22",y1:"11",y2:"13",key:"4dh1rd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const t8=U("BatteryFull",[["rect",{width:"16",height:"10",x:"2",y:"7",rx:"2",ry:"2",key:"1w10f2"}],["line",{x1:"22",x2:"22",y1:"11",y2:"13",key:"4dh1rd"}],["line",{x1:"6",x2:"6",y1:"11",y2:"13",key:"1wd6dw"}],["line",{x1:"10",x2:"10",y1:"11",y2:"13",key:"haxvl5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"13",key:"c6fn6x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const r8=U("BatteryLow",[["rect",{width:"16",height:"10",x:"2",y:"7",rx:"2",ry:"2",key:"1w10f2"}],["line",{x1:"22",x2:"22",y1:"11",y2:"13",key:"4dh1rd"}],["line",{x1:"6",x2:"6",y1:"11",y2:"13",key:"1wd6dw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n8=U("BatteryMedium",[["rect",{width:"16",height:"10",x:"2",y:"7",rx:"2",ry:"2",key:"1w10f2"}],["line",{x1:"22",x2:"22",y1:"11",y2:"13",key:"4dh1rd"}],["line",{x1:"6",x2:"6",y1:"11",y2:"13",key:"1wd6dw"}],["line",{x1:"10",x2:"10",y1:"11",y2:"13",key:"haxvl5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s8=U("BatteryWarning",[["path",{d:"M10 17h.01",key:"nbq80n"}],["path",{d:"M10 7v6",key:"nne03l"}],["path",{d:"M14 7h2a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2h-2",key:"1x5o8m"}],["path",{d:"M22 11v2",key:"1wo06k"}],["path",{d:"M6 7H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"1mdjgh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i8=U("Battery",[["rect",{width:"16",height:"10",x:"2",y:"7",rx:"2",ry:"2",key:"1w10f2"}],["line",{x1:"22",x2:"22",y1:"11",y2:"13",key:"4dh1rd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a8=U("Beaker",[["path",{d:"M4.5 3h15",key:"c7n0jr"}],["path",{d:"M6 3v16a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V3",key:"m1uhx7"}],["path",{d:"M6 14h12",key:"4cwo0f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o8=U("BeanOff",[["path",{d:"M9 9c-.64.64-1.521.954-2.402 1.165A6 6 0 0 0 8 22a13.96 13.96 0 0 0 9.9-4.1",key:"bq3udt"}],["path",{d:"M10.75 5.093A6 6 0 0 1 22 8c0 2.411-.61 4.68-1.683 6.66",key:"17ccse"}],["path",{d:"M5.341 10.62a4 4 0 0 0 6.487 1.208M10.62 5.341a4.015 4.015 0 0 1 2.039 2.04",key:"18zqgq"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l8=U("Bean",[["path",{d:"M10.165 6.598C9.954 7.478 9.64 8.36 9 9c-.64.64-1.521.954-2.402 1.165A6 6 0 0 0 8 22c7.732 0 14-6.268 14-14a6 6 0 0 0-11.835-1.402Z",key:"1tvzk7"}],["path",{d:"M5.341 10.62a4 4 0 1 0 5.279-5.28",key:"2cyri2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c8=U("BedDouble",[["path",{d:"M2 20v-8a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v8",key:"1k78r4"}],["path",{d:"M4 10V6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v4",key:"fb3tl2"}],["path",{d:"M12 4v6",key:"1dcgq2"}],["path",{d:"M2 18h20",key:"ajqnye"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d8=U("BedSingle",[["path",{d:"M3 20v-8a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v8",key:"1wm6mi"}],["path",{d:"M5 10V6a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v4",key:"4k93s5"}],["path",{d:"M3 18h18",key:"1h113x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Of=U("Bed",[["path",{d:"M2 4v16",key:"vw9hq8"}],["path",{d:"M2 8h18a2 2 0 0 1 2 2v10",key:"1dgv2r"}],["path",{d:"M2 17h20",key:"18nfp3"}],["path",{d:"M6 8v9",key:"1yriud"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u8=U("Beef",[["circle",{cx:"12.5",cy:"8.5",r:"2.5",key:"9738u8"}],["path",{d:"M12.5 2a6.5 6.5 0 0 0-6.22 4.6c-1.1 3.13-.78 3.9-3.18 6.08A3 3 0 0 0 5 18c4 0 8.4-1.8 11.4-4.3A6.5 6.5 0 0 0 12.5 2Z",key:"o0f6za"}],["path",{d:"m18.5 6 2.19 4.5a6.48 6.48 0 0 1 .31 2 6.49 6.49 0 0 1-2.6 5.2C15.4 20.2 11 22 7 22a3 3 0 0 1-2.68-1.66L2.4 16.5",key:"k7p6i0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h8=U("BeerOff",[["path",{d:"M13 13v5",key:"igwfh0"}],["path",{d:"M17 11.47V8",key:"16yw0g"}],["path",{d:"M17 11h1a3 3 0 0 1 2.745 4.211",key:"1xbt65"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 8v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2v-3",key:"c55o3e"}],["path",{d:"M7.536 7.535C6.766 7.649 6.154 8 5.5 8a2.5 2.5 0 0 1-1.768-4.268",key:"1ydug7"}],["path",{d:"M8.727 3.204C9.306 2.767 9.885 2 11 2c1.56 0 2 1.5 3 1.5s1.72-.5 2.5-.5a1 1 0 1 1 0 5c-.78 0-1.5-.5-2.5-.5a3.149 3.149 0 0 0-.842.12",key:"q81o7q"}],["path",{d:"M9 14.6V18",key:"20ek98"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f8=U("Beer",[["path",{d:"M17 11h1a3 3 0 0 1 0 6h-1",key:"1yp76v"}],["path",{d:"M9 12v6",key:"1u1cab"}],["path",{d:"M13 12v6",key:"1sugkk"}],["path",{d:"M14 7.5c-1 0-1.44.5-3 .5s-2-.5-3-.5-1.72.5-2.5.5a2.5 2.5 0 0 1 0-5c.78 0 1.57.5 2.5.5S9.44 2 11 2s2 1.5 3 1.5 1.72-.5 2.5-.5a2.5 2.5 0 0 1 0 5c-.78 0-1.5-.5-2.5-.5Z",key:"1510fo"}],["path",{d:"M5 8v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"19jb7n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p8=U("BellDot",[["path",{d:"M19.4 14.9C20.2 16.4 21 17 21 17H3s3-2 3-9c0-3.3 2.7-6 6-6 .7 0 1.3.1 1.9.3",key:"xcehk"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["circle",{cx:"18",cy:"8",r:"3",key:"1g0gzu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m8=U("BellElectric",[["path",{d:"M18.8 4A6.3 8.7 0 0 1 20 9",key:"xve1fh"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["circle",{cx:"9",cy:"9",r:"7",key:"p2h5vp"}],["rect",{width:"10",height:"6",x:"4",y:"16",rx:"2",key:"17f3te"}],["path",{d:"M14 19c3 0 4.6-1.6 4.6-1.6",key:"n7odp6"}],["circle",{cx:"20",cy:"16",r:"2",key:"1v9bxh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g8=U("BellMinus",[["path",{d:"M18.4 12c.8 3.8 2.6 5 2.6 5H3s3-2 3-9c0-3.3 2.7-6 6-6 1.8 0 3.4.8 4.5 2",key:"eck70s"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"M15 8h6",key:"8ybuxh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ow=U("BellOff",[["path",{d:"M8.7 3A6 6 0 0 1 18 8a21.3 21.3 0 0 0 .6 5",key:"o7mx20"}],["path",{d:"M17 17H3s3-2 3-9a4.67 4.67 0 0 1 .3-1.7",key:"16f1lm"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y8=U("BellPlus",[["path",{d:"M19.3 14.8C20.1 16.4 21 17 21 17H3s3-2 3-9c0-3.3 2.7-6 6-6 1 0 1.9.2 2.8.7",key:"guizqy"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"M15 8h6",key:"8ybuxh"}],["path",{d:"M18 5v6",key:"g5ayrv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x8=U("BellRing",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ag=U("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xv=U("BetweenHorizontalEnd",[["rect",{width:"13",height:"7",x:"3",y:"3",rx:"1",key:"11xb64"}],["path",{d:"m22 15-3-3 3-3",key:"26chmm"}],["rect",{width:"13",height:"7",x:"3",y:"14",rx:"1",key:"k6ky7n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qv=U("BetweenHorizontalStart",[["rect",{width:"13",height:"7",x:"8",y:"3",rx:"1",key:"pkso9a"}],["path",{d:"m2 9 3 3-3 3",key:"1agib5"}],["rect",{width:"13",height:"7",x:"8",y:"14",rx:"1",key:"1q5fc1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v8=U("BetweenVerticalEnd",[["rect",{width:"7",height:"13",x:"3",y:"3",rx:"1",key:"1fdu0f"}],["path",{d:"m9 22 3-3 3 3",key:"17z65a"}],["rect",{width:"7",height:"13",x:"14",y:"3",rx:"1",key:"1squn4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _8=U("BetweenVerticalStart",[["rect",{width:"7",height:"13",x:"3",y:"8",rx:"1",key:"1fjrkv"}],["path",{d:"m15 2-3 3-3-3",key:"1uh6eb"}],["rect",{width:"7",height:"13",x:"14",y:"8",rx:"1",key:"w3fjg8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b8=U("BicepsFlexed",[["path",{d:"M12.409 13.017A5 5 0 0 1 22 15c0 3.866-4 7-9 7-4.077 0-8.153-.82-10.371-2.462-.426-.316-.631-.832-.62-1.362C2.118 12.723 2.627 2 10 2a3 3 0 0 1 3 3 2 2 0 0 1-2 2c-1.105 0-1.64-.444-2-1",key:"1pmlyh"}],["path",{d:"M15 14a5 5 0 0 0-7.584 2",key:"5rb254"}],["path",{d:"M9.964 6.825C8.019 7.977 9.5 13 8 15",key:"kbvsx9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w8=U("Bike",[["circle",{cx:"18.5",cy:"17.5",r:"3.5",key:"15x4ox"}],["circle",{cx:"5.5",cy:"17.5",r:"3.5",key:"1noe27"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["path",{d:"M12 17.5V14l-3-3 4-3 2 3h2",key:"1npguv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j8=U("Binary",[["rect",{x:"14",y:"14",width:"4",height:"6",rx:"2",key:"p02svl"}],["rect",{x:"6",y:"4",width:"4",height:"6",rx:"2",key:"xm4xkj"}],["path",{d:"M6 20h4",key:"1i6q5t"}],["path",{d:"M14 10h4",key:"ru81e7"}],["path",{d:"M6 14h2v6",key:"16z9wg"}],["path",{d:"M14 4h2v6",key:"1idq9u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k8=U("Binoculars",[["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M19 7V4a1 1 0 0 0-1-1h-2a1 1 0 0 0-1 1v3",key:"3apit1"}],["path",{d:"M20 21a2 2 0 0 0 2-2v-3.851c0-1.39-2-2.962-2-4.829V8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v11a2 2 0 0 0 2 2z",key:"rhpgnw"}],["path",{d:"M 22 16 L 2 16",key:"14lkq7"}],["path",{d:"M4 21a2 2 0 0 1-2-2v-3.851c0-1.39 2-2.962 2-4.829V8a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v11a2 2 0 0 1-2 2z",key:"104b3k"}],["path",{d:"M9 7V4a1 1 0 0 0-1-1H6a1 1 0 0 0-1 1v3",key:"14fczp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N8=U("Biohazard",[["circle",{cx:"12",cy:"11.9",r:"2",key:"e8h31w"}],["path",{d:"M6.7 3.4c-.9 2.5 0 5.2 2.2 6.7C6.5 9 3.7 9.6 2 11.6",key:"17bolr"}],["path",{d:"m8.9 10.1 1.4.8",key:"15ezny"}],["path",{d:"M17.3 3.4c.9 2.5 0 5.2-2.2 6.7 2.4-1.2 5.2-.6 6.9 1.5",key:"wtwa5u"}],["path",{d:"m15.1 10.1-1.4.8",key:"1r0b28"}],["path",{d:"M16.7 20.8c-2.6-.4-4.6-2.6-4.7-5.3-.2 2.6-2.1 4.8-4.7 5.2",key:"m7qszh"}],["path",{d:"M12 13.9v1.6",key:"zfyyim"}],["path",{d:"M13.5 5.4c-1-.2-2-.2-3 0",key:"1bi9q0"}],["path",{d:"M17 16.4c.7-.7 1.2-1.6 1.5-2.5",key:"1rhjqw"}],["path",{d:"M5.5 13.9c.3.9.8 1.8 1.5 2.5",key:"8gsud3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S8=U("Bird",[["path",{d:"M16 7h.01",key:"1kdx03"}],["path",{d:"M3.4 18H12a8 8 0 0 0 8-8V7a4 4 0 0 0-7.28-2.3L2 20",key:"oj1oa8"}],["path",{d:"m20 7 2 .5-2 .5",key:"12nv4d"}],["path",{d:"M10 18v3",key:"1yea0a"}],["path",{d:"M14 17.75V21",key:"1pymcb"}],["path",{d:"M7 18a6 6 0 0 0 3.84-10.61",key:"1npnn0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C8=U("Bitcoin",[["path",{d:"M11.767 19.089c4.924.868 6.14-6.025 1.216-6.894m-1.216 6.894L5.86 18.047m5.908 1.042-.347 1.97m1.563-8.864c4.924.869 6.14-6.025 1.215-6.893m-1.215 6.893-3.94-.694m5.155-6.2L8.29 4.26m5.908 1.042.348-1.97M7.48 20.364l3.126-17.727",key:"yr8idg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M8=U("Blend",[["circle",{cx:"9",cy:"9",r:"7",key:"p2h5vp"}],["circle",{cx:"15",cy:"15",r:"7",key:"19ennj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const T8=U("Blinds",[["path",{d:"M3 3h18",key:"o7r712"}],["path",{d:"M20 7H8",key:"gd2fo2"}],["path",{d:"M20 11H8",key:"1ynp89"}],["path",{d:"M10 19h10",key:"19hjk5"}],["path",{d:"M8 15h12",key:"1yqzne"}],["path",{d:"M4 3v14",key:"fggqzn"}],["circle",{cx:"4",cy:"19",r:"2",key:"p3m9r0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A8=U("Blocks",[["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["path",{d:"M10 21V8a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1H3",key:"1fpvtg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E8=U("BluetoothConnected",[["path",{d:"m7 7 10 10-5 5V2l5 5L7 17",key:"1q5490"}],["line",{x1:"18",x2:"21",y1:"12",y2:"12",key:"1rsjjs"}],["line",{x1:"3",x2:"6",y1:"12",y2:"12",key:"11yl8c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I8=U("BluetoothOff",[["path",{d:"m17 17-5 5V12l-5 5",key:"v5aci6"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M14.5 9.5 17 7l-5-5v4.5",key:"1kddfz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P8=U("BluetoothSearching",[["path",{d:"m7 7 10 10-5 5V2l5 5L7 17",key:"1q5490"}],["path",{d:"M20.83 14.83a4 4 0 0 0 0-5.66",key:"k8tn1j"}],["path",{d:"M18 12h.01",key:"yjnet6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L8=U("Bluetooth",[["path",{d:"m7 7 10 10-5 5V2l5 5L7 17",key:"1q5490"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IS=U("Bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O8=U("Bolt",[["path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D8=U("Bomb",[["circle",{cx:"11",cy:"13",r:"9",key:"hd149"}],["path",{d:"M14.35 4.65 16.3 2.7a2.41 2.41 0 0 1 3.4 0l1.6 1.6a2.4 2.4 0 0 1 0 3.4l-1.95 1.95",key:"jp4j1b"}],["path",{d:"m22 2-1.5 1.5",key:"ay92ug"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R8=U("Bone",[["path",{d:"M17 10c.7-.7 1.69 0 2.5 0a2.5 2.5 0 1 0 0-5 .5.5 0 0 1-.5-.5 2.5 2.5 0 1 0-5 0c0 .81.7 1.8 0 2.5l-7 7c-.7.7-1.69 0-2.5 0a2.5 2.5 0 0 0 0 5c.28 0 .5.22.5.5a2.5 2.5 0 1 0 5 0c0-.81-.7-1.8 0-2.5Z",key:"w610uw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F8=U("BookA",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"m8 13 4-7 4 7",key:"4rari8"}],["path",{d:"M9.1 11h5.7",key:"1gkovt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z8=U("BookAudio",[["path",{d:"M12 6v7",key:"1f6ttz"}],["path",{d:"M16 8v3",key:"gejaml"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M8 8v3",key:"1qzp49"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B8=U("BookCheck",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"m9 9.5 2 2 4-4",key:"1dth82"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $8=U("BookCopy",[["path",{d:"M2 16V4a2 2 0 0 1 2-2h11",key:"spzkk5"}],["path",{d:"M22 18H11a2 2 0 1 0 0 4h10.5a.5.5 0 0 0 .5-.5v-15a.5.5 0 0 0-.5-.5H11a2 2 0 0 0-2 2v12",key:"1wz07i"}],["path",{d:"M5 14H4a2 2 0 1 0 0 4h1",key:"16gqf9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jv=U("BookDashed",[["path",{d:"M12 17h2",key:"13u4lk"}],["path",{d:"M12 22h2",key:"kn7ki6"}],["path",{d:"M12 2h2",key:"cvn524"}],["path",{d:"M18 22h1a1 1 0 0 0 1-1",key:"w6gbqz"}],["path",{d:"M18 2h1a1 1 0 0 1 1 1v1",key:"1vpra5"}],["path",{d:"M20 15v2h-2",key:"fph276"}],["path",{d:"M20 8v3",key:"deu0bs"}],["path",{d:"M4 11V9",key:"v3xsx8"}],["path",{d:"M4 19.5V15",key:"6gr39e"}],["path",{d:"M4 5v-.5A2.5 2.5 0 0 1 6.5 2H8",key:"wywhs9"}],["path",{d:"M8 22H6.5a1 1 0 0 1 0-5H8",key:"1cu73q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U8=U("BookDown",[["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"m9 10 3 3 3-3",key:"zt5b4y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q8=U("BookHeadphones",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M8 12v-2a4 4 0 0 1 8 0v2",key:"1vsqkj"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V8=U("BookHeart",[["path",{d:"M16 8.2A2.22 2.22 0 0 0 13.8 6c-.8 0-1.4.3-1.8.9-.4-.6-1-.9-1.8-.9A2.22 2.22 0 0 0 8 8.2c0 .6.3 1.2.7 1.6A226.652 226.652 0 0 0 12 13a404 404 0 0 0 3.3-3.1 2.413 2.413 0 0 0 .7-1.7",key:"1t75a8"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H8=U("BookImage",[["path",{d:"m20 13.7-2.1-2.1a2 2 0 0 0-2.8 0L9.7 17",key:"q6ojf0"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["circle",{cx:"10",cy:"8",r:"2",key:"2qkj4p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W8=U("BookKey",[["path",{d:"m19 3 1 1",key:"ze14oc"}],["path",{d:"m20 2-4.5 4.5",key:"1sppr8"}],["path",{d:"M20 8v13a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"1ocbpn"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H14",key:"1gfsgw"}],["circle",{cx:"14",cy:"8",r:"2",key:"u49eql"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G8=U("BookLock",[["path",{d:"M18 6V4a2 2 0 1 0-4 0v2",key:"1aquzs"}],["path",{d:"M20 15v6a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"1rkj32"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H10",key:"18wgow"}],["rect",{x:"12",y:"6",width:"8",height:"5",rx:"1",key:"73l30o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K8=U("BookMarked",[["path",{d:"M10 2v8l3-3 3 3V2",key:"sqw3rj"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z8=U("BookMinus",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y8=U("BookOpenCheck",[["path",{d:"M12 21V7",key:"gj6g52"}],["path",{d:"m16 12 2 2 4-4",key:"mdajum"}],["path",{d:"M22 6V4a1 1 0 0 0-1-1h-5a4 4 0 0 0-4 4 4 4 0 0 0-4-4H3a1 1 0 0 0-1 1v13a1 1 0 0 0 1 1h6a3 3 0 0 1 3 3 3 3 0 0 1 3-3h6a1 1 0 0 0 1-1v-1.3",key:"8arnkb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X8=U("BookOpenText",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M16 12h2",key:"7q9ll5"}],["path",{d:"M16 8h2",key:"msurwy"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}],["path",{d:"M6 12h2",key:"32wvfc"}],["path",{d:"M6 8h2",key:"30oboj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iT=U("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q8=U("BookPlus",[["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J8=U("BookText",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M8 11h8",key:"vwpz6n"}],["path",{d:"M8 7h6",key:"1f0q6e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eR=U("BookType",[["path",{d:"M10 13h4",key:"ytezjc"}],["path",{d:"M12 6v7",key:"1f6ttz"}],["path",{d:"M16 8V6H8v2",key:"x8j6u4"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tR=U("BookUp2",[["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M18 2h1a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"161d7n"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2",key:"1lorq7"}],["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rR=U("BookUp",[["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nR=U("BookUser",[["path",{d:"M15 13a3 3 0 1 0-6 0",key:"10j68g"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sR=U("BookX",[["path",{d:"m14.5 7-5 5",key:"dy991v"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"m9.5 7 5 5",key:"s45iea"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iR=U("Book",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aR=U("BookmarkCheck",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2Z",key:"169p4p"}],["path",{d:"m9 10 2 2 4-4",key:"1gnqz4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oR=U("BookmarkMinus",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}],["line",{x1:"15",x2:"9",y1:"10",y2:"10",key:"1gty7f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lR=U("BookmarkPlus",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}],["line",{x1:"12",x2:"12",y1:"7",y2:"13",key:"1cppfj"}],["line",{x1:"15",x2:"9",y1:"10",y2:"10",key:"1gty7f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cR=U("BookmarkX",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2Z",key:"169p4p"}],["path",{d:"m14.5 7.5-5 5",key:"3lb6iw"}],["path",{d:"m9.5 7.5 5 5",key:"ko136h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jp=U("Bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dR=U("BoomBox",[["path",{d:"M4 9V5a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v4",key:"vvzvr1"}],["path",{d:"M8 8v1",key:"xcqmfk"}],["path",{d:"M12 8v1",key:"1rj8u4"}],["path",{d:"M16 8v1",key:"1q12zr"}],["rect",{width:"20",height:"12",x:"2",y:"9",rx:"2",key:"igpb89"}],["circle",{cx:"8",cy:"15",r:"2",key:"fa4a8s"}],["circle",{cx:"16",cy:"15",r:"2",key:"14c3ya"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uR=U("BotMessageSquare",[["path",{d:"M12 6V2H8",key:"1155em"}],["path",{d:"m8 18-4 4V8a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2Z",key:"w2lp3e"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M9 11v2",key:"1ueba0"}],["path",{d:"M15 11v2",key:"i11awn"}],["path",{d:"M20 12h2",key:"1q8mjw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hR=U("BotOff",[["path",{d:"M13.67 8H18a2 2 0 0 1 2 2v4.33",key:"7az073"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M22 22 2 2",key:"1r8tn9"}],["path",{d:"M8 8H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h12a2 2 0 0 0 1.414-.586",key:"s09a7a"}],["path",{d:"M9 13v2",key:"rq6x2g"}],["path",{d:"M9.67 4H12v2.33",key:"110xot"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PS=U("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fR=U("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pR=U("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e_=U("Braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mR=U("Brackets",[["path",{d:"M16 3h3v18h-3",key:"1yor1f"}],["path",{d:"M8 21H5V3h3",key:"1qrfwo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gR=U("BrainCircuit",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M9 13a4.5 4.5 0 0 0 3-4",key:"10igwf"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M12 13h4",key:"1ku699"}],["path",{d:"M12 18h6a2 2 0 0 1 2 2v1",key:"105ag5"}],["path",{d:"M12 8h8",key:"1lhi5i"}],["path",{d:"M16 8V5a2 2 0 0 1 2-2",key:"u6izg6"}],["circle",{cx:"16",cy:"13",r:".5",key:"ry7gng"}],["circle",{cx:"18",cy:"3",r:".5",key:"1aiba7"}],["circle",{cx:"20",cy:"21",r:".5",key:"yhc1fs"}],["circle",{cx:"20",cy:"8",r:".5",key:"1e43v0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yR=U("BrainCog",[["path",{d:"M12 5a3 3 0 1 0-5.997.142 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588 4 4 0 0 0 7.636 2.106 3.2 3.2 0 0 0 .164-.546c.028-.13.306-.13.335 0a3.2 3.2 0 0 0 .163.546 4 4 0 0 0 7.636-2.106 4 4 0 0 0 .556-6.588 4 4 0 0 0-2.526-5.77A3 3 0 1 0 12 5",key:"1kgmhc"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"m15.7 10.4-.9.4",key:"ayzo6p"}],["path",{d:"m9.2 13.2-.9.4",key:"1uzb3g"}],["path",{d:"m13.6 15.7-.4-.9",key:"11ifqf"}],["path",{d:"m10.8 9.2-.4-.9",key:"1pmk2v"}],["path",{d:"m15.7 13.5-.9-.4",key:"7ng02m"}],["path",{d:"m9.2 10.9-.9-.4",key:"1x66zd"}],["path",{d:"m10.5 15.7.4-.9",key:"3js94g"}],["path",{d:"m13.1 9.2.4-.9",key:"18n7mc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xR=U("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vR=U("BrickWall",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 9v6",key:"199k2o"}],["path",{d:"M16 15v6",key:"8rj2es"}],["path",{d:"M16 3v6",key:"1j6rpj"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M8 15v6",key:"1stoo3"}],["path",{d:"M8 3v6",key:"vlvjmk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _R=U("BriefcaseBusiness",[["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2",key:"1ksdt3"}],["path",{d:"M22 13a18.15 18.15 0 0 1-20 0",key:"12hx5q"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bR=U("BriefcaseConveyorBelt",[["path",{d:"M10 20v2",key:"1n8e1g"}],["path",{d:"M14 20v2",key:"1lq872"}],["path",{d:"M18 20v2",key:"10uadw"}],["path",{d:"M21 20H3",key:"kdqkdp"}],["path",{d:"M6 20v2",key:"a9bc87"}],["path",{d:"M8 16V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v12",key:"17n9tx"}],["rect",{x:"4",y:"6",width:"16",height:"10",rx:"2",key:"1097i5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wR=U("BriefcaseMedical",[["path",{d:"M12 11v4",key:"a6ujw6"}],["path",{d:"M14 13h-4",key:"1pl8zg"}],["path",{d:"M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2",key:"1ksdt3"}],["path",{d:"M18 6v14",key:"1mu4gy"}],["path",{d:"M6 6v14",key:"1s15cj"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dh=U("Briefcase",[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jR=U("BringToFront",[["rect",{x:"8",y:"8",width:"8",height:"8",rx:"2",key:"yj20xf"}],["path",{d:"M4 10a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2",key:"1ltk23"}],["path",{d:"M14 20a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2",key:"1q24h9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kR=U("Brush",[["path",{d:"m9.06 11.9 8.07-8.06a2.85 2.85 0 1 1 4.03 4.03l-8.06 8.08",key:"1styjt"}],["path",{d:"M7.07 14.94c-1.66 0-3 1.35-3 3.02 0 1.33-2.5 1.52-2 2.02 1.08 1.1 2.49 2.02 4 2.02 2.2 0 4-1.8 4-4.04a3.01 3.01 0 0 0-3-3.02z",key:"z0l1mu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NR=U("BugOff",[["path",{d:"M15 7.13V6a3 3 0 0 0-5.14-2.1L8 2",key:"vl8zik"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M22 13h-4v-2a4 4 0 0 0-4-4h-1.3",key:"1ou0bd"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M7.7 7.7A4 4 0 0 0 6 11v3a6 6 0 0 0 11.13 3.13",key:"1njkjs"}],["path",{d:"M12 20v-8",key:"i3yub9"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SR=U("BugPlay",[["path",{d:"M12.765 21.522a.5.5 0 0 1-.765-.424v-8.196a.5.5 0 0 1 .765-.424l5.878 3.674a1 1 0 0 1 0 1.696z",key:"17shqo"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M18 11a4 4 0 0 0-4-4h-4a4 4 0 0 0-4 4v3a6.1 6.1 0 0 0 2 4.5",key:"1tjixy"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CR=U("Bug",[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ra=U("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LS=U("Building",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["path",{d:"M9 22v-4h6v4",key:"r93iot"}],["path",{d:"M8 6h.01",key:"1dz90k"}],["path",{d:"M16 6h.01",key:"1x0f13"}],["path",{d:"M12 6h.01",key:"1vi96p"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M8 14h.01",key:"6423bh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MR=U("BusFront",[["path",{d:"M4 6 2 7",key:"1mqr15"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"m22 7-2-1",key:"1umjhc"}],["rect",{width:"16",height:"16",x:"4",y:"3",rx:"2",key:"1wxw4b"}],["path",{d:"M4 11h16",key:"mpoxn0"}],["path",{d:"M8 15h.01",key:"a7atzg"}],["path",{d:"M16 15h.01",key:"rnfrdf"}],["path",{d:"M6 19v2",key:"1loha6"}],["path",{d:"M18 21v-2",key:"sqyl04"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TR=U("Bus",[["path",{d:"M8 6v6",key:"18i7km"}],["path",{d:"M15 6v6",key:"1sg6z9"}],["path",{d:"M2 12h19.6",key:"de5uta"}],["path",{d:"M18 18h3s.5-1.7.8-2.8c.1-.4.2-.8.2-1.2 0-.4-.1-.8-.2-1.2l-1.4-5C20.1 6.8 19.1 6 18 6H4a2 2 0 0 0-2 2v10h3",key:"1wwztk"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}],["path",{d:"M9 18h5",key:"lrx6i"}],["circle",{cx:"16",cy:"18",r:"2",key:"1v4tcr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AR=U("CableCar",[["path",{d:"M10 3h.01",key:"lbucoy"}],["path",{d:"M14 2h.01",key:"1k8aa1"}],["path",{d:"m2 9 20-5",key:"1kz0j5"}],["path",{d:"M12 12V6.5",key:"1vbrij"}],["rect",{width:"16",height:"10",x:"4",y:"12",rx:"3",key:"if91er"}],["path",{d:"M9 12v5",key:"3anwtq"}],["path",{d:"M15 12v5",key:"5xh3zn"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ER=U("Cable",[["path",{d:"M17 21v-2a1 1 0 0 1-1-1v-1a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1",key:"10bnsj"}],["path",{d:"M19 15V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V9",key:"1eqmu1"}],["path",{d:"M21 21v-2h-4",key:"14zm7j"}],["path",{d:"M3 5h4V3",key:"z442eg"}],["path",{d:"M7 5a1 1 0 0 1 1 1v1a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1V3",key:"ebdjd7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IR=U("CakeSlice",[["circle",{cx:"9",cy:"7",r:"2",key:"1305pl"}],["path",{d:"M7.2 7.9 3 11v9c0 .6.4 1 1 1h16c.6 0 1-.4 1-1v-9c0-2-3-6-7-8l-3.6 2.6",key:"xle13f"}],["path",{d:"M16 13H3",key:"1wpj08"}],["path",{d:"M16 17H3",key:"3lvfcd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const og=U("Cake",[["path",{d:"M20 21v-8a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8",key:"1w3rig"}],["path",{d:"M4 16s.5-1 2-1 2.5 2 4 2 2.5-2 4-2 2.5 2 4 2 2-1 2-1",key:"n2jgmb"}],["path",{d:"M2 21h20",key:"1nyx9w"}],["path",{d:"M7 8v3",key:"1qtyvj"}],["path",{d:"M12 8v3",key:"hwp4zt"}],["path",{d:"M17 8v3",key:"1i6e5u"}],["path",{d:"M7 4h.01",key:"1bh4kh"}],["path",{d:"M12 4h.01",key:"1ujb9j"}],["path",{d:"M17 4h.01",key:"1upcoc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PR=U("Calculator",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["line",{x1:"8",x2:"16",y1:"6",y2:"6",key:"x4nwl0"}],["line",{x1:"16",x2:"16",y1:"14",y2:"18",key:"wjye3r"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M8 18h.01",key:"lrp35t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LR=U("Calendar1",[["path",{d:"M11 14h1v4",key:"fy54vd"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",key:"12vinp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OR=U("CalendarArrowDown",[["path",{d:"m14 18 4 4 4-4",key:"1waygx"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M18 14v8",key:"irew45"}],["path",{d:"M21 11.354V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h7.343",key:"bse4f3"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DR=U("CalendarArrowUp",[["path",{d:"m14 18 4-4 4 4",key:"ftkppy"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M18 22v-8",key:"su0gjh"}],["path",{d:"M21 11.343V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h9",key:"1exg90"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RR=U("CalendarCheck2",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 14V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8",key:"bce9hv"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m16 20 2 2 4-4",key:"13tcca"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FR=U("CalendarCheck",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m9 16 2 2 4-4",key:"19s6y9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zR=U("CalendarClock",[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BR=U("CalendarCog",[["path",{d:"m15.2 16.9-.9-.4",key:"1r0w5f"}],["path",{d:"m15.2 19.1-.9.4",key:"j188fs"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"m16.9 15.2-.4-.9",key:"699xu"}],["path",{d:"m16.9 20.8-.4.9",key:"dfjc4z"}],["path",{d:"m19.5 14.3-.4.9",key:"1eb35c"}],["path",{d:"m19.5 21.7-.4-.9",key:"1tonu5"}],["path",{d:"M21 10.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6",key:"11kmuh"}],["path",{d:"m21.7 16.5-.9.4",key:"1knoei"}],["path",{d:"m21.7 19.5-.9-.4",key:"q4dx6b"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const em=U("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $R=U("CalendarFold",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 17V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11Z",key:"kg77oy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M15 22v-4a2 2 0 0 1 2-2h4",key:"1gnbqr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UR=U("CalendarHeart",[["path",{d:"M3 10h18V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h7",key:"136lmk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21.29 14.7a2.43 2.43 0 0 0-2.65-.52c-.3.12-.57.3-.8.53l-.34.34-.35-.34a2.43 2.43 0 0 0-2.65-.53c-.3.12-.56.3-.79.53-.95.94-1 2.53.2 3.74L17.5 22l3.6-3.55c1.2-1.21 1.14-2.8.19-3.74Z",key:"1t7hil"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qR=U("CalendarMinus2",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M10 16h4",key:"17e571"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VR=U("CalendarMinus",[["path",{d:"M16 19h6",key:"xwg31i"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 15V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8.5",key:"1scpom"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HR=U("CalendarOff",[["path",{d:"M4.2 4.2A2 2 0 0 0 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 1.82-1.18",key:"16swn3"}],["path",{d:"M21 15.5V6a2 2 0 0 0-2-2H9.5",key:"yhw86o"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h7",key:"1wap6i"}],["path",{d:"M21 10h-5.5",key:"quycpq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WR=U("CalendarPlus2",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M10 16h4",key:"17e571"}],["path",{d:"M12 14v4",key:"1thi36"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Dw=U("CalendarPlus",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 13V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8",key:"3spt84"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M16 19h6",key:"xwg31i"}],["path",{d:"M19 16v6",key:"tddt3s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GR=U("CalendarRange",[["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M17 14h-6",key:"bkmgh3"}],["path",{d:"M13 18H7",key:"bb0bb7"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 18h.01",key:"1bdyru"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KR=U("CalendarSearch",[["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 11.75V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h7.25",key:"1jrsq6"}],["path",{d:"m22 22-1.875-1.875",key:"13zax7"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZR=U("CalendarSync",[["path",{d:"M11 10v4h4",key:"172dkj"}],["path",{d:"m11 14 1.535-1.605a5 5 0 0 1 8 1.5",key:"vu0qm5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"m21 18-1.535 1.605a5 5 0 0 1-8-1.5",key:"1qgeyt"}],["path",{d:"M21 22v-4h-4",key:"hrummi"}],["path",{d:"M21 8.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h4.3",key:"mctw84"}],["path",{d:"M3 10h4",key:"1el30a"}],["path",{d:"M8 2v4",key:"1cmpym"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YR=U("CalendarX2",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 13V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8",key:"3spt84"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m17 22 5-5",key:"1k6ppv"}],["path",{d:"m17 17 5 5",key:"p7ous7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XR=U("CalendarX",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m14 14-4 4",key:"rymu2i"}],["path",{d:"m10 14 4 4",key:"3sz06r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const li=U("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QR=U("CameraOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16",key:"qmtpty"}],["path",{d:"M9.5 4h5L17 7h3a2 2 0 0 1 2 2v7.5",key:"1ufyfc"}],["path",{d:"M14.121 15.121A3 3 0 1 1 9.88 10.88",key:"11zox6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rw=U("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JR=U("CandyCane",[["path",{d:"M5.7 21a2 2 0 0 1-3.5-2l8.6-14a6 6 0 0 1 10.4 6 2 2 0 1 1-3.464-2 2 2 0 1 0-3.464-2Z",key:"isaq8g"}],["path",{d:"M17.75 7 15 2.1",key:"12x7e8"}],["path",{d:"M10.9 4.8 13 9",key:"100a87"}],["path",{d:"m7.9 9.7 2 4.4",key:"ntfhaj"}],["path",{d:"M4.9 14.7 7 18.9",key:"1x43jy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eF=U("CandyOff",[["path",{d:"m8.5 8.5-1 1a4.95 4.95 0 0 0 7 7l1-1",key:"1ff4ui"}],["path",{d:"M11.843 6.187A4.947 4.947 0 0 1 16.5 7.5a4.947 4.947 0 0 1 1.313 4.657",key:"1sbrv4"}],["path",{d:"M14 16.5V14",key:"1maf8j"}],["path",{d:"M14 6.5v1.843",key:"1a6u6t"}],["path",{d:"M10 10v7.5",key:"80pj65"}],["path",{d:"m16 7 1-5 1.367.683A3 3 0 0 0 19.708 3H21v1.292a3 3 0 0 0 .317 1.341L22 7l-5 1",key:"11a9mt"}],["path",{d:"m8 17-1 5-1.367-.683A3 3 0 0 0 4.292 21H3v-1.292a3 3 0 0 0-.317-1.341L2 17l5-1",key:"3mjmon"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tF=U("Candy",[["path",{d:"m9.5 7.5-2 2a4.95 4.95 0 1 0 7 7l2-2a4.95 4.95 0 1 0-7-7Z",key:"ue6khb"}],["path",{d:"M14 6.5v10",key:"5xnk7c"}],["path",{d:"M10 7.5v10",key:"1uew51"}],["path",{d:"m16 7 1-5 1.37.68A3 3 0 0 0 19.7 3H21v1.3c0 .46.1.92.32 1.33L22 7l-5 1",key:"b9cp6k"}],["path",{d:"m8 17-1 5-1.37-.68A3 3 0 0 0 4.3 21H3v-1.3a3 3 0 0 0-.32-1.33L2 17l5-1",key:"5lney8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rF=U("Cannabis",[["path",{d:"M12 22v-4",key:"1utk9m"}],["path",{d:"M7 12c-1.5 0-4.5 1.5-5 3 3.5 1.5 6 1 6 1-1.5 1.5-2 3.5-2 5 2.5 0 4.5-1.5 6-3 1.5 1.5 3.5 3 6 3 0-1.5-.5-3.5-2-5 0 0 2.5.5 6-1-.5-1.5-3.5-3-5-3 1.5-1 4-4 4-6-2.5 0-5.5 1.5-7 3 0-2.5-.5-5-2-7-1.5 2-2 4.5-2 7-1.5-1.5-4.5-3-7-3 0 2 2.5 5 4 6",key:"1mezod"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nF=U("CaptionsOff",[["path",{d:"M10.5 5H19a2 2 0 0 1 2 2v8.5",key:"jqtk4d"}],["path",{d:"M17 11h-.5",key:"1961ue"}],["path",{d:"M19 19H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2",key:"1keqsi"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M7 11h4",key:"1o1z6v"}],["path",{d:"M7 15h2.5",key:"1ina1g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const t_=U("Captions",[["rect",{width:"18",height:"14",x:"3",y:"5",rx:"2",ry:"2",key:"12ruh7"}],["path",{d:"M7 15h4M15 15h2M7 11h2M13 11h4",key:"1ueiar"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sF=U("CarFront",[["path",{d:"m21 8-2 2-1.5-3.7A2 2 0 0 0 15.646 5H8.4a2 2 0 0 0-1.903 1.257L5 10 3 8",key:"1imjwt"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 14h.01",key:"7oqj8z"}],["rect",{width:"18",height:"8",x:"3",y:"10",rx:"2",key:"a7itu8"}],["path",{d:"M5 18v2",key:"ppbyun"}],["path",{d:"M19 18v2",key:"gy7782"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iF=U("CarTaxiFront",[["path",{d:"M10 2h4",key:"n1abiw"}],["path",{d:"m21 8-2 2-1.5-3.7A2 2 0 0 0 15.646 5H8.4a2 2 0 0 0-1.903 1.257L5 10 3 8",key:"1imjwt"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 14h.01",key:"7oqj8z"}],["rect",{width:"18",height:"8",x:"3",y:"10",rx:"2",key:"a7itu8"}],["path",{d:"M5 18v2",key:"ppbyun"}],["path",{d:"M19 18v2",key:"gy7782"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aF=U("Car",[["path",{d:"M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2",key:"5owen"}],["circle",{cx:"7",cy:"17",r:"2",key:"u2ysq9"}],["path",{d:"M9 17h6",key:"r8uit2"}],["circle",{cx:"17",cy:"17",r:"2",key:"axvx0g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oF=U("Caravan",[["path",{d:"M18 19V9a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v8a2 2 0 0 0 2 2h2",key:"19jm3t"}],["path",{d:"M2 9h3a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H2",key:"13hakp"}],["path",{d:"M22 17v1a1 1 0 0 1-1 1H10v-9a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v9",key:"1crci8"}],["circle",{cx:"8",cy:"19",r:"2",key:"t8fc5s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lF=U("Carrot",[["path",{d:"M2.27 21.7s9.87-3.5 12.73-6.36a4.5 4.5 0 0 0-6.36-6.37C5.77 11.84 2.27 21.7 2.27 21.7zM8.64 14l-2.05-2.04M15.34 15l-2.46-2.46",key:"rfqxbe"}],["path",{d:"M22 9s-1.33-2-3.5-2C16.86 7 15 9 15 9s1.33 2 3.5 2S22 9 22 9z",key:"6b25w4"}],["path",{d:"M15 2s-2 1.33-2 3.5S15 9 15 9s2-1.84 2-3.5C17 3.33 15 2 15 2z",key:"fn65lo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cF=U("CaseLower",[["circle",{cx:"7",cy:"12",r:"3",key:"12clwm"}],["path",{d:"M10 9v6",key:"17i7lo"}],["circle",{cx:"17",cy:"12",r:"3",key:"gl7c2s"}],["path",{d:"M14 7v8",key:"dl84cr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dF=U("CaseSensitive",[["path",{d:"m3 15 4-8 4 8",key:"1vwr6u"}],["path",{d:"M4 13h6",key:"1r9ots"}],["circle",{cx:"18",cy:"12",r:"3",key:"1kchzo"}],["path",{d:"M21 9v6",key:"anns31"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uF=U("CaseUpper",[["path",{d:"m3 15 4-8 4 8",key:"1vwr6u"}],["path",{d:"M4 13h6",key:"1r9ots"}],["path",{d:"M15 11h4.5a2 2 0 0 1 0 4H15V7h4a2 2 0 0 1 0 4",key:"1sqfas"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hF=U("CassetteTape",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["circle",{cx:"8",cy:"10",r:"2",key:"1xl4ub"}],["path",{d:"M8 12h8",key:"1wcyev"}],["circle",{cx:"16",cy:"10",r:"2",key:"r14t7q"}],["path",{d:"m6 20 .7-2.9A1.4 1.4 0 0 1 8.1 16h7.8a1.4 1.4 0 0 1 1.4 1l.7 3",key:"l01ucn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fF=U("Cast",[["path",{d:"M2 8V6a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-6",key:"3zrzxg"}],["path",{d:"M2 12a9 9 0 0 1 8 8",key:"g6cvee"}],["path",{d:"M2 16a5 5 0 0 1 4 4",key:"1y1dii"}],["line",{x1:"2",x2:"2.01",y1:"20",y2:"20",key:"xu2jvo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pF=U("Castle",[["path",{d:"M22 20v-9H2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2Z",key:"109fe4"}],["path",{d:"M18 11V4H6v7",key:"mon5oj"}],["path",{d:"M15 22v-4a3 3 0 0 0-3-3a3 3 0 0 0-3 3v4",key:"1k4jtn"}],["path",{d:"M22 11V9",key:"3zbp94"}],["path",{d:"M2 11V9",key:"1x5rnq"}],["path",{d:"M6 4V2",key:"1rsq15"}],["path",{d:"M18 4V2",key:"1jsdo1"}],["path",{d:"M10 4V2",key:"75d9ly"}],["path",{d:"M14 4V2",key:"8nj3z6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mF=U("Cat",[["path",{d:"M12 5c.67 0 1.35.09 2 .26 1.78-2 5.03-2.84 6.42-2.26 1.4.58-.42 7-.42 7 .57 1.07 1 2.24 1 3.44C21 17.9 16.97 21 12 21s-9-3-9-7.56c0-1.25.5-2.4 1-3.44 0 0-1.89-6.42-.5-7 1.39-.58 4.72.23 6.5 2.23A9.04 9.04 0 0 1 12 5Z",key:"x6xyqk"}],["path",{d:"M8 14v.5",key:"1nzgdb"}],["path",{d:"M16 14v.5",key:"1lajdz"}],["path",{d:"M11.25 16.25h1.5L12 17l-.75-.75Z",key:"12kq1m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gF=U("Cctv",[["path",{d:"M16.75 12h3.632a1 1 0 0 1 .894 1.447l-2.034 4.069a1 1 0 0 1-1.708.134l-2.124-2.97",key:"ir91b5"}],["path",{d:"M17.106 9.053a1 1 0 0 1 .447 1.341l-3.106 6.211a1 1 0 0 1-1.342.447L3.61 12.3a2.92 2.92 0 0 1-1.3-3.91L3.69 5.6a2.92 2.92 0 0 1 3.92-1.3z",key:"jlp8i1"}],["path",{d:"M2 19h3.76a2 2 0 0 0 1.8-1.1L9 15",key:"19bib8"}],["path",{d:"M2 21v-4",key:"l40lih"}],["path",{d:"M7 9h.01",key:"19b3jx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const r_=U("ChartArea",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 11.207a.5.5 0 0 1 .146-.353l2-2a.5.5 0 0 1 .708 0l3.292 3.292a.5.5 0 0 0 .708 0l4.292-4.292a.5.5 0 0 1 .854.353V16a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z",key:"q0gr47"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n_=U("ChartBarBig",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["rect",{x:"7",y:"13",width:"9",height:"4",rx:"1",key:"1iip1u"}],["rect",{x:"7",y:"5",width:"12",height:"4",rx:"1",key:"1anskk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yF=U("ChartBarDecreasing",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 11h8",key:"1feolt"}],["path",{d:"M7 16h3",key:"ur6vzw"}],["path",{d:"M7 6h12",key:"sz5b0d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xF=U("ChartBarIncreasing",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 11h8",key:"1feolt"}],["path",{d:"M7 16h12",key:"wsnu98"}],["path",{d:"M7 6h3",key:"w9rmul"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vF=U("ChartBarStacked",[["path",{d:"M11 13v4",key:"vyy2rb"}],["path",{d:"M15 5v4",key:"1gx88a"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["rect",{x:"7",y:"13",width:"9",height:"4",rx:"1",key:"1iip1u"}],["rect",{x:"7",y:"5",width:"12",height:"4",rx:"1",key:"1anskk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s_=U("ChartBar",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 16h8",key:"srdodz"}],["path",{d:"M7 11h12",key:"127s9w"}],["path",{d:"M7 6h3",key:"w9rmul"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i_=U("ChartCandlestick",[["path",{d:"M9 5v4",key:"14uxtq"}],["rect",{width:"4",height:"6",x:"7",y:"9",rx:"1",key:"f4fvz0"}],["path",{d:"M9 15v2",key:"r5rk32"}],["path",{d:"M17 3v2",key:"1l2re6"}],["rect",{width:"4",height:"8",x:"15",y:"5",rx:"1",key:"z38je5"}],["path",{d:"M17 13v3",key:"5l0wba"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a_=U("ChartColumnBig",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["rect",{x:"15",y:"5",width:"4",height:"12",rx:"1",key:"q8uenq"}],["rect",{x:"7",y:"8",width:"4",height:"9",rx:"1",key:"sr5ea"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _F=U("ChartColumnDecreasing",[["path",{d:"M13 17V9",key:"1fwyjl"}],["path",{d:"M18 17v-3",key:"1sqioe"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M8 17V5",key:"1wzmnc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o_=U("ChartColumnIncreasing",[["path",{d:"M13 17V9",key:"1fwyjl"}],["path",{d:"M18 17V5",key:"sfb6ij"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bF=U("ChartColumnStacked",[["path",{d:"M11 13H7",key:"t0o9gq"}],["path",{d:"M19 9h-4",key:"rera1j"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["rect",{x:"15",y:"5",width:"4",height:"12",rx:"1",key:"q8uenq"}],["rect",{x:"7",y:"8",width:"4",height:"9",rx:"1",key:"sr5ea"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xc=U("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wF=U("ChartGantt",[["path",{d:"M10 6h8",key:"zvc2xc"}],["path",{d:"M12 16h6",key:"yi5mkt"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M8 11h7",key:"wz2hg0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l_=U("ChartLine",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jF=U("ChartNetwork",[["path",{d:"m13.11 7.664 1.78 2.672",key:"go2gg9"}],["path",{d:"m14.162 12.788-3.324 1.424",key:"11x848"}],["path",{d:"m20 4-6.06 1.515",key:"1wxxh7"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["circle",{cx:"12",cy:"6",r:"2",key:"1jj5th"}],["circle",{cx:"16",cy:"12",r:"2",key:"4ma0v8"}],["circle",{cx:"9",cy:"15",r:"2",key:"lf2ghp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kF=U("ChartNoAxesColumnDecreasing",[["path",{d:"M12 20V10",key:"g8npz5"}],["path",{d:"M18 20v-4",key:"8uic4z"}],["path",{d:"M6 20V4",key:"1w1bmo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c_=U("ChartNoAxesColumnIncreasing",[["line",{x1:"12",x2:"12",y1:"20",y2:"10",key:"1vz5eb"}],["line",{x1:"18",x2:"18",y1:"20",y2:"4",key:"cun8e5"}],["line",{x1:"6",x2:"6",y1:"20",y2:"16",key:"hq0ia6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d_=U("ChartNoAxesColumn",[["line",{x1:"18",x2:"18",y1:"20",y2:"10",key:"1xfpm4"}],["line",{x1:"12",x2:"12",y1:"20",y2:"4",key:"be30l9"}],["line",{x1:"6",x2:"6",y1:"20",y2:"14",key:"1r4le6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NF=U("ChartNoAxesCombined",[["path",{d:"M12 16v5",key:"zza2cw"}],["path",{d:"M16 14v7",key:"1g90b9"}],["path",{d:"M20 10v11",key:"1iqoj0"}],["path",{d:"m22 3-8.646 8.646a.5.5 0 0 1-.708 0L9.354 8.354a.5.5 0 0 0-.707 0L2 15",key:"1fw8x9"}],["path",{d:"M4 18v3",key:"1yp0dc"}],["path",{d:"M8 14v7",key:"n3cwzv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u_=U("ChartNoAxesGantt",[["path",{d:"M8 6h10",key:"9lnwnk"}],["path",{d:"M6 12h9",key:"1g9pqf"}],["path",{d:"M11 18h7",key:"c8dzvl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h_=U("ChartPie",[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f_=U("ChartScatter",[["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}],["circle",{cx:"18.5",cy:"5.5",r:".5",fill:"currentColor",key:"lysivs"}],["circle",{cx:"11.5",cy:"11.5",r:".5",fill:"currentColor",key:"byv1b8"}],["circle",{cx:"7.5",cy:"16.5",r:".5",fill:"currentColor",key:"nkw3mc"}],["circle",{cx:"17.5",cy:"14.5",r:".5",fill:"currentColor",key:"1gjh6j"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SF=U("ChartSpline",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 16c.5-2 1.5-7 4-7 2 0 2 3 4 3 2.5 0 4.5-5 5-7",key:"lw07rv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CF=U("CheckCheck",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ba=U("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MF=U("ChefHat",[["path",{d:"M17 21a1 1 0 0 0 1-1v-5.35c0-.457.316-.844.727-1.041a4 4 0 0 0-2.134-7.589 5 5 0 0 0-9.186 0 4 4 0 0 0-2.134 7.588c.411.198.727.585.727 1.041V20a1 1 0 0 0 1 1Z",key:"1qvrer"}],["path",{d:"M6 17h12",key:"1jwigz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TF=U("Cherry",[["path",{d:"M2 17a5 5 0 0 0 10 0c0-2.76-2.5-5-5-3-2.5-2-5 .24-5 3Z",key:"cvxqlc"}],["path",{d:"M12 17a5 5 0 0 0 10 0c0-2.76-2.5-5-5-3-2.5-2-5 .24-5 3Z",key:"1ostrc"}],["path",{d:"M7 14c3.22-2.91 4.29-8.75 5-12 1.66 2.38 4.94 9 5 12",key:"hqx58h"}],["path",{d:"M22 9c-4.29 0-7.14-2.33-10-7 5.71 0 10 4.67 10 7Z",key:"eykp1o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uh=U("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AF=U("ChevronFirst",[["path",{d:"m17 18-6-6 6-6",key:"1yerx2"}],["path",{d:"M7 6v12",key:"1p53r6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EF=U("ChevronLast",[["path",{d:"m7 18 6-6-6-6",key:"lwmzdw"}],["path",{d:"M17 6v12",key:"1o0aio"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sd=U("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ha=U("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U0=U("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IF=U("ChevronsDownUp",[["path",{d:"m7 20 5-5 5 5",key:"13a0gw"}],["path",{d:"m7 4 5 5 5-5",key:"1kwcof"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PF=U("ChevronsDown",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LF=U("ChevronsLeftRightEllipsis",[["path",{d:"m18 8 4 4-4 4",key:"1ak13k"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"M8 12h.01",key:"czm47f"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 12h.01",key:"1l6xoz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OF=U("ChevronsLeftRight",[["path",{d:"m9 7-5 5 5 5",key:"j5w590"}],["path",{d:"m15 7 5 5-5 5",key:"1bl6da"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DF=U("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RF=U("ChevronsRightLeft",[["path",{d:"m20 17-5-5 5-5",key:"30x0n2"}],["path",{d:"m4 17 5-5-5-5",key:"16spf4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FF=U("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fw=U("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zF=U("ChevronsUp",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BF=U("Chrome",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["line",{x1:"21.17",x2:"12",y1:"8",y2:"8",key:"a0cw5f"}],["line",{x1:"3.95",x2:"8.54",y1:"6.06",y2:"14",key:"1kftof"}],["line",{x1:"10.88",x2:"15.46",y1:"21.94",y2:"14",key:"1ymyh8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $F=U("Church",[["path",{d:"M10 9h4",key:"u4k05v"}],["path",{d:"M12 7v5",key:"ma6bk"}],["path",{d:"M14 22v-4a2 2 0 0 0-4 0v4",key:"1pdhuj"}],["path",{d:"M18 22V5.618a1 1 0 0 0-.553-.894l-4.553-2.277a2 2 0 0 0-1.788 0L6.553 4.724A1 1 0 0 0 6 5.618V22",key:"1rkokr"}],["path",{d:"m18 7 3.447 1.724a1 1 0 0 1 .553.894V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9.618a1 1 0 0 1 .553-.894L6 7",key:"1w6esw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UF=U("CigaretteOff",[["path",{d:"M12 12H3a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h13",key:"1gdiyg"}],["path",{d:"M18 8c0-2.5-2-2.5-2-5",key:"1il607"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M21 12a1 1 0 0 1 1 1v2a1 1 0 0 1-.5.866",key:"166zjj"}],["path",{d:"M22 8c0-2.5-2-2.5-2-5",key:"1gah44"}],["path",{d:"M7 12v4",key:"jqww69"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qF=U("Cigarette",[["path",{d:"M17 12H3a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h14",key:"1mb5g1"}],["path",{d:"M18 8c0-2.5-2-2.5-2-5",key:"1il607"}],["path",{d:"M21 16a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"1yl5r7"}],["path",{d:"M22 8c0-2.5-2-2.5-2-5",key:"1gah44"}],["path",{d:"M7 12v4",key:"jqww69"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bl=U("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p_=U("CircleArrowDown",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"m8 12 4 4 4-4",key:"k98ssh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m_=U("CircleArrowLeft",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M16 12H8",key:"1fr5h0"}],["path",{d:"m12 8-4 4 4 4",key:"15vm53"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g_=U("CircleArrowOutDownLeft",[["path",{d:"M2 12a10 10 0 1 1 10 10",key:"1yn6ov"}],["path",{d:"m2 22 10-10",key:"28ilpk"}],["path",{d:"M8 22H2v-6",key:"sulq54"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y_=U("CircleArrowOutDownRight",[["path",{d:"M12 22a10 10 0 1 1 10-10",key:"130bv5"}],["path",{d:"M22 22 12 12",key:"131aw7"}],["path",{d:"M22 16v6h-6",key:"1gvm70"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x_=U("CircleArrowOutUpLeft",[["path",{d:"M2 8V2h6",key:"hiwtdz"}],["path",{d:"m2 2 10 10",key:"1oh8rs"}],["path",{d:"M12 2A10 10 0 1 1 2 12",key:"rrk4fa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v_=U("CircleArrowOutUpRight",[["path",{d:"M22 12A10 10 0 1 1 12 2",key:"1fm58d"}],["path",{d:"M22 2 12 12",key:"yg2myt"}],["path",{d:"M16 2h6v6",key:"zan5cs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const __=U("CircleArrowRight",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"m12 16 4-4-4-4",key:"1i9zcv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b_=U("CircleArrowUp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const za=U("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const io=U("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w_=U("CircleChevronDown",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j_=U("CircleChevronLeft",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m14 16-4-4 4-4",key:"ojs7w8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k_=U("CircleChevronRight",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N_=U("CircleChevronUp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m8 14 4-4 4 4",key:"fy2ptz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VF=U("CircleDashed",[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S_=U("CircleDivide",[["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}],["line",{x1:"12",x2:"12",y1:"16",y2:"16",key:"aqc6ln"}],["line",{x1:"12",x2:"12",y1:"8",y2:"8",key:"1mkcni"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HF=U("CircleDollarSign",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 18V6",key:"zqpxq5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WF=U("CircleDotDashed",[["path",{d:"M10.1 2.18a9.93 9.93 0 0 1 3.8 0",key:"1qdqn0"}],["path",{d:"M17.6 3.71a9.95 9.95 0 0 1 2.69 2.7",key:"1bq7p6"}],["path",{d:"M21.82 10.1a9.93 9.93 0 0 1 0 3.8",key:"1rlaqf"}],["path",{d:"M20.29 17.6a9.95 9.95 0 0 1-2.7 2.69",key:"1xk03u"}],["path",{d:"M13.9 21.82a9.94 9.94 0 0 1-3.8 0",key:"l7re25"}],["path",{d:"M6.4 20.29a9.95 9.95 0 0 1-2.69-2.7",key:"1v18p6"}],["path",{d:"M2.18 13.9a9.93 9.93 0 0 1 0-3.8",key:"xdo6bj"}],["path",{d:"M3.71 6.4a9.95 9.95 0 0 1 2.7-2.69",key:"1jjmaz"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GF=U("CircleDot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KF=U("CircleEllipsis",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M17 12h.01",key:"1m0b6t"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M7 12h.01",key:"eqddd0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZF=U("CircleEqual",[["path",{d:"M7 10h10",key:"1101jm"}],["path",{d:"M7 14h10",key:"1mhdw3"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YF=U("CircleFadingArrowUp",[["path",{d:"M12 2a10 10 0 0 1 7.38 16.75",key:"175t95"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}],["path",{d:"M2.5 8.875a10 10 0 0 0-.5 3",key:"1vce0s"}],["path",{d:"M2.83 16a10 10 0 0 0 2.43 3.4",key:"o3fkw4"}],["path",{d:"M4.636 5.235a10 10 0 0 1 .891-.857",key:"1szpfk"}],["path",{d:"M8.644 21.42a10 10 0 0 0 7.631-.38",key:"9yhvd4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XF=U("CircleFadingPlus",[["path",{d:"M12 2a10 10 0 0 1 7.38 16.75",key:"175t95"}],["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M16 12H8",key:"1fr5h0"}],["path",{d:"M2.5 8.875a10 10 0 0 0-.5 3",key:"1vce0s"}],["path",{d:"M2.83 16a10 10 0 0 0 2.43 3.4",key:"o3fkw4"}],["path",{d:"M4.636 5.235a10 10 0 0 1 .891-.857",key:"1szpfk"}],["path",{d:"M8.644 21.42a10 10 0 0 0 7.631-.38",key:"9yhvd4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C_=U("CircleGauge",[["path",{d:"M15.6 2.7a10 10 0 1 0 5.7 5.7",key:"1e0p6d"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M13.4 10.6 19 5",key:"1kr7tw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const my=U("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M_=U("CircleMinus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QF=U("CircleOff",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.35 2.69A10 10 0 0 1 21.3 15.65",key:"1pfsoa"}],["path",{d:"M19.08 19.08A10 10 0 1 1 4.92 4.92",key:"1ablyi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const T_=U("CircleParkingOff",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m5 5 14 14",key:"11anup"}],["path",{d:"M13 13a3 3 0 1 0 0-6H9v2",key:"uoagbd"}],["path",{d:"M9 17v-2.34",key:"a9qo08"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A_=U("CircleParking",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9 17V7h4a3 3 0 0 1 0 6H9",key:"1dfk2c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E_=U("CirclePause",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I_=U("CirclePercent",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"M15 15h.01",key:"lqbp3k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sf=U("CirclePlay",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P_=U("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L_=U("CirclePower",[["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M7.998 9.003a5 5 0 1 0 8-.005",key:"1pek45"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O_=U("CircleSlash2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M22 2 2 22",key:"y4kqgn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JF=U("CircleSlash",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D_=U("CircleStop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R_=U("CircleUserRound",[["path",{d:"M18 20a6 6 0 0 0-12 0",key:"1qehca"}],["circle",{cx:"12",cy:"10",r:"4",key:"1h16sb"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F_=U("CircleUser",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lc=U("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mu=U("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ez=U("CircuitBoard",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M11 9h4a2 2 0 0 0 2-2V3",key:"1ve2rv"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"M7 21v-4a2 2 0 0 1 2-2h4",key:"1fwkro"}],["circle",{cx:"15",cy:"15",r:"2",key:"3i40o0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tz=U("Citrus",[["path",{d:"M21.66 17.67a1.08 1.08 0 0 1-.04 1.6A12 12 0 0 1 4.73 2.38a1.1 1.1 0 0 1 1.61-.04z",key:"4ite01"}],["path",{d:"M19.65 15.66A8 8 0 0 1 8.35 4.34",key:"1gxipu"}],["path",{d:"m14 10-5.5 5.5",key:"92pfem"}],["path",{d:"M14 17.85V10H6.15",key:"xqmtsk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rz=U("Clapperboard",[["path",{d:"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3Z",key:"1tn4o7"}],["path",{d:"m6.2 5.3 3.1 3.9",key:"iuk76l"}],["path",{d:"m12.4 3.4 3.1 4",key:"6hsd6n"}],["path",{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z",key:"ltgou9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aT=U("ClipboardCheck",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nz=U("ClipboardCopy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sz=U("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iz=U("ClipboardMinus",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M9 14h6",key:"159ibu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const az=U("ClipboardPaste",[["path",{d:"M15 2H9a1 1 0 0 0-1 1v2c0 .6.4 1 1 1h6c.6 0 1-.4 1-1V3c0-.6-.4-1-1-1Z",key:"1pp7kr"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2M16 4h2a2 2 0 0 1 2 2v2M11 14h10",key:"2ik1ml"}],["path",{d:"m17 10 4 4-4 4",key:"vp2hj1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z_=U("ClipboardPenLine",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",key:"1oijnt"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-.5",key:"1but9f"}],["path",{d:"M16 4h2a2 2 0 0 1 1.73 1",key:"1p8n7l"}],["path",{d:"M8 18h1",key:"13wk12"}],["path",{d:"M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"2t3380"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B_=U("ClipboardPen",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",key:"1oijnt"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-5.5",key:"cereej"}],["path",{d:"M4 13.5V6a2 2 0 0 1 2-2h2",key:"5ua5vh"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oz=U("ClipboardPlus",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M9 14h6",key:"159ibu"}],["path",{d:"M12 17v-6",key:"1y8rbf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lz=U("ClipboardType",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M9 12v-1h6v1",key:"iehl6m"}],["path",{d:"M11 17h2",key:"12w5me"}],["path",{d:"M12 11v6",key:"1bwqyc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cz=U("ClipboardX",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m15 11-6 6",key:"1toa9n"}],["path",{d:"m9 11 6 6",key:"wlibny"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dz=U("Clipboard",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uz=U("Clock1",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 14.5 8",key:"12zbmj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hz=U("Clock10",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 8 10",key:"atfzqc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fz=U("Clock11",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 9.5 8",key:"l5bg6f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pz=U("Clock12",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12",key:"1fub01"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mz=U("Clock2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 10",key:"1g230d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gz=U("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yz=U("Clock4",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xz=U("Clock5",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 14.5 16",key:"1pcbox"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vz=U("Clock6",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 12 16.5",key:"hb2qv6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _z=U("Clock7",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 9.5 16",key:"ka3394"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bz=U("Clock8",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 8 14",key:"tmc9b4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wz=U("Clock9",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 7.5 12",key:"1k60p0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jz=U("ClockAlert",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["path",{d:"M16 21.16a10 10 0 1 1 5-13.516",key:"cxo92l"}],["path",{d:"M20 11.5v6",key:"2ei3xq"}],["path",{d:"M20 21.5h.01",key:"1r2dzp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kz=U("ClockArrowDown",[["path",{d:"M12.338 21.994A10 10 0 1 1 21.925 13.227",key:"1i7shu"}],["path",{d:"M12 6v6l2 1",key:"19cm8n"}],["path",{d:"m14 18 4 4 4-4",key:"1waygx"}],["path",{d:"M18 14v8",key:"irew45"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Nz=U("ClockArrowUp",[["path",{d:"M13.228 21.925A10 10 0 1 1 21.994 12.338",key:"1fzlyi"}],["path",{d:"M12 6v6l1.562.781",key:"1ujuk9"}],["path",{d:"m14 18 4-4 4 4",key:"ftkppy"}],["path",{d:"M18 22v-8",key:"su0gjh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xi=U("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sz=U("CloudAlert",[["path",{d:"M12 12v4",key:"tww15h"}],["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M17 18h.5a1 1 0 0 0 0-9h-1.79A7 7 0 1 0 7 17.708",key:"xsb5ju"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Cz=U("CloudCog",[["circle",{cx:"12",cy:"17",r:"3",key:"1spfwm"}],["path",{d:"M4.2 15.1A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.2",key:"zaobp"}],["path",{d:"m15.7 18.4-.9-.3",key:"4qxpbn"}],["path",{d:"m9.2 15.9-.9-.3",key:"17q7o2"}],["path",{d:"m10.6 20.7.3-.9",key:"1pf4s2"}],["path",{d:"m13.1 14.2.3-.9",key:"1mnuqm"}],["path",{d:"m13.6 20.7-.4-1",key:"1jpd1m"}],["path",{d:"m10.8 14.3-.4-1",key:"17ugyy"}],["path",{d:"m8.3 18.6 1-.4",key:"s42vdx"}],["path",{d:"m14.7 15.8 1-.4",key:"2wizun"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $_=U("CloudDownload",[["path",{d:"M12 13v8l-4-4",key:"1f5nwf"}],["path",{d:"m12 21 4-4",key:"1lfcce"}],["path",{d:"M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284",key:"ui1hmy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mz=U("CloudDrizzle",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M8 19v1",key:"1dk2by"}],["path",{d:"M8 14v1",key:"84yxot"}],["path",{d:"M16 19v1",key:"v220m7"}],["path",{d:"M16 14v1",key:"g12gj6"}],["path",{d:"M12 21v1",key:"q8vafk"}],["path",{d:"M12 16v1",key:"1mx6rx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Tz=U("CloudFog",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M16 17H7",key:"pygtm1"}],["path",{d:"M17 21H9",key:"1u2q02"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Az=U("CloudHail",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M16 14v2",key:"a1is7l"}],["path",{d:"M8 14v2",key:"1e9m6t"}],["path",{d:"M16 20h.01",key:"xwek51"}],["path",{d:"M8 20h.01",key:"1vjney"}],["path",{d:"M12 16v2",key:"z66u1j"}],["path",{d:"M12 22h.01",key:"1urd7a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ez=U("CloudLightning",[["path",{d:"M6 16.326A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 .5 8.973",key:"1cez44"}],["path",{d:"m13 12-3 5h4l-3 5",key:"1t22er"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Iz=U("CloudMoonRain",[["path",{d:"M10.188 8.5A6 6 0 0 1 16 4a1 1 0 0 0 6 6 6 6 0 0 1-3 5.197",key:"erj67n"}],["path",{d:"M11 20v2",key:"174qtz"}],["path",{d:"M3 20a5 5 0 1 1 8.9-4H13a3 3 0 0 1 2 5.24",key:"1qmrp3"}],["path",{d:"M7 19v2",key:"12npes"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pz=U("CloudMoon",[["path",{d:"M10.188 8.5A6 6 0 0 1 16 4a1 1 0 0 0 6 6 6 6 0 0 1-3 5.197",key:"erj67n"}],["path",{d:"M13 16a3 3 0 1 1 0 6H7a5 5 0 1 1 4.9-6Z",key:"p44pc9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lz=U("CloudOff",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5.782 5.782A7 7 0 0 0 9 19h8.5a4.5 4.5 0 0 0 1.307-.193",key:"yfwify"}],["path",{d:"M21.532 16.5A4.5 4.5 0 0 0 17.5 10h-1.79A7.008 7.008 0 0 0 10 5.07",key:"jlfiyv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Oz=U("CloudRainWind",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m9.2 22 3-7",key:"sb5f6j"}],["path",{d:"m9 13-3 7",key:"500co5"}],["path",{d:"m17 13-3 7",key:"8t2fiy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Dz=U("CloudRain",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M16 14v6",key:"1j4efv"}],["path",{d:"M8 14v6",key:"17c4r9"}],["path",{d:"M12 16v6",key:"c8a4gj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rz=U("CloudSnow",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M8 15h.01",key:"a7atzg"}],["path",{d:"M8 19h.01",key:"puxtts"}],["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M12 21h.01",key:"h35vbk"}],["path",{d:"M16 15h.01",key:"rnfrdf"}],["path",{d:"M16 19h.01",key:"1vcnzz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fz=U("CloudSunRain",[["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}],["path",{d:"M15.947 12.65a4 4 0 0 0-5.925-4.128",key:"dpwdj0"}],["path",{d:"M3 20a5 5 0 1 1 8.9-4H13a3 3 0 0 1 2 5.24",key:"1qmrp3"}],["path",{d:"M11 20v2",key:"174qtz"}],["path",{d:"M7 19v2",key:"12npes"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zz=U("CloudSun",[["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}],["path",{d:"M15.947 12.65a4 4 0 0 0-5.925-4.128",key:"dpwdj0"}],["path",{d:"M13 22H7a5 5 0 1 1 4.9-6H13a3 3 0 0 1 0 6Z",key:"s09mg5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U_=U("CloudUpload",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bz=U("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $z=U("Cloudy",[["path",{d:"M17.5 21H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"gqqjvc"}],["path",{d:"M22 10a3 3 0 0 0-3-3h-2.207a5.502 5.502 0 0 0-10.702.5",key:"1p2s76"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Uz=U("Clover",[["path",{d:"M16.17 7.83 2 22",key:"t58vo8"}],["path",{d:"M4.02 12a2.827 2.827 0 1 1 3.81-4.17A2.827 2.827 0 1 1 12 4.02a2.827 2.827 0 1 1 4.17 3.81A2.827 2.827 0 1 1 19.98 12a2.827 2.827 0 1 1-3.81 4.17A2.827 2.827 0 1 1 12 19.98a2.827 2.827 0 1 1-4.17-3.81A1 1 0 1 1 4 12",key:"17k36q"}],["path",{d:"m7.83 7.83 8.34 8.34",key:"1d7sxk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qz=U("Club",[["path",{d:"M17.28 9.05a5.5 5.5 0 1 0-10.56 0A5.5 5.5 0 1 0 12 17.66a5.5 5.5 0 1 0 5.28-8.6Z",key:"27yuqz"}],["path",{d:"M12 17.66L12 22",key:"ogfahf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q_=U("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zw=U("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vz=U("Codepen",[["polygon",{points:"12 2 22 8.5 22 15.5 12 22 2 15.5 2 8.5 12 2",key:"srzb37"}],["line",{x1:"12",x2:"12",y1:"22",y2:"15.5",key:"1t73f2"}],["polyline",{points:"22 8.5 12 15.5 2 8.5",key:"ajlxae"}],["polyline",{points:"2 15.5 12 8.5 22 15.5",key:"susrui"}],["line",{x1:"12",x2:"12",y1:"2",y2:"8.5",key:"2cldga"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Hz=U("Codesandbox",[["path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}],["polyline",{points:"7.5 4.21 12 6.81 16.5 4.21",key:"fabo96"}],["polyline",{points:"7.5 19.79 7.5 14.6 3 12",key:"z377f1"}],["polyline",{points:"21 12 16.5 14.6 16.5 19.79",key:"9nrev1"}],["polyline",{points:"3.27 6.96 12 12.01 20.73 6.96",key:"1180pa"}],["line",{x1:"12",x2:"12",y1:"22.08",y2:"12",key:"3z3uq6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wz=U("Coffee",[["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M14 2v2",key:"6buw04"}],["path",{d:"M16 8a1 1 0 0 1 1 1v8a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1h14a4 4 0 1 1 0 8h-1",key:"pwadti"}],["path",{d:"M6 2v2",key:"colzsn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gz=U("Cog",[["path",{d:"M12 20a8 8 0 1 0 0-16 8 8 0 0 0 0 16Z",key:"sobvz5"}],["path",{d:"M12 14a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z",key:"11i496"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 22v-2",key:"1osdcq"}],["path",{d:"m17 20.66-1-1.73",key:"eq3orb"}],["path",{d:"M11 10.27 7 3.34",key:"16pf9h"}],["path",{d:"m20.66 17-1.73-1",key:"sg0v6f"}],["path",{d:"m3.34 7 1.73 1",key:"1ulond"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"m20.66 7-1.73 1",key:"1ow05n"}],["path",{d:"m3.34 17 1.73-1",key:"nuk764"}],["path",{d:"m17 3.34-1 1.73",key:"2wel8s"}],["path",{d:"m11 13.73-4 6.93",key:"794ttg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kz=U("Coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V_=U("Columns2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H_=U("Columns3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zz=U("Columns4",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7.5 3v18",key:"w0wo6v"}],["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M16.5 3v18",key:"10tjh1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yz=U("Combine",[["path",{d:"M10 18H5a3 3 0 0 1-3-3v-1",key:"ru65g8"}],["path",{d:"M14 2a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2",key:"e30een"}],["path",{d:"M20 2a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2",key:"2ahx8o"}],["path",{d:"m7 21 3-3-3-3",key:"127cv2"}],["rect",{x:"14",y:"14",width:"8",height:"8",rx:"2",key:"1b0bso"}],["rect",{x:"2",y:"2",width:"8",height:"8",rx:"2",key:"1x09vl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xz=U("Command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qz=U("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jz=U("Component",[["path",{d:"M15.536 11.293a1 1 0 0 0 0 1.414l2.376 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z",key:"1uwlt4"}],["path",{d:"M2.297 11.293a1 1 0 0 0 0 1.414l2.377 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414L6.088 8.916a1 1 0 0 0-1.414 0z",key:"10291m"}],["path",{d:"M8.916 17.912a1 1 0 0 0 0 1.415l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.415l-2.377-2.376a1 1 0 0 0-1.414 0z",key:"1tqoq1"}],["path",{d:"M8.916 4.674a1 1 0 0 0 0 1.414l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z",key:"1x6lto"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e7=U("Computer",[["rect",{width:"14",height:"8",x:"5",y:"2",rx:"2",key:"wc9tft"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6 18h2",key:"rwmk9e"}],["path",{d:"M12 18h6",key:"aqd8w3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const t7=U("ConciergeBell",[["path",{d:"M3 20a1 1 0 0 1-1-1v-1a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1Z",key:"1pvr1r"}],["path",{d:"M20 16a8 8 0 1 0-16 0",key:"1pa543"}],["path",{d:"M12 4v4",key:"1bq03y"}],["path",{d:"M10 4h4",key:"1xpv9s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const r7=U("Cone",[["path",{d:"m20.9 18.55-8-15.98a1 1 0 0 0-1.8 0l-8 15.98",key:"53pte7"}],["ellipse",{cx:"12",cy:"19",rx:"9",ry:"3",key:"1ji25f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n7=U("Construction",[["rect",{x:"2",y:"6",width:"20",height:"8",rx:"1",key:"1estib"}],["path",{d:"M17 14v7",key:"7m2elx"}],["path",{d:"M7 14v7",key:"1cm7wv"}],["path",{d:"M17 3v3",key:"1v4jwn"}],["path",{d:"M7 3v3",key:"7o6guu"}],["path",{d:"M10 14 2.3 6.3",key:"1023jk"}],["path",{d:"m14 6 7.7 7.7",key:"1s8pl2"}],["path",{d:"m8 6 8 8",key:"hl96qh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W_=U("ContactRound",[["path",{d:"M16 2v2",key:"scm5qe"}],["path",{d:"M17.915 22a6 6 0 0 0-12 0",key:"suqz9p"}],["path",{d:"M8 2v2",key:"pbkmx"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",key:"12vinp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s7=U("Contact",[["path",{d:"M16 2v2",key:"scm5qe"}],["path",{d:"M7 22v-2a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2",key:"1waht3"}],["path",{d:"M8 2v2",key:"pbkmx"}],["circle",{cx:"12",cy:"11",r:"3",key:"itu57m"}],["rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",key:"12vinp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i7=U("Container",[["path",{d:"M22 7.7c0-.6-.4-1.2-.8-1.5l-6.3-3.9a1.72 1.72 0 0 0-1.7 0l-10.3 6c-.5.2-.9.8-.9 1.4v6.6c0 .5.4 1.2.8 1.5l6.3 3.9a1.72 1.72 0 0 0 1.7 0l10.3-6c.5-.3.9-1 .9-1.5Z",key:"1t2lqe"}],["path",{d:"M10 21.9V14L2.1 9.1",key:"o7czzq"}],["path",{d:"m10 14 11.9-6.9",key:"zm5e20"}],["path",{d:"M14 19.8v-8.1",key:"159ecu"}],["path",{d:"M18 17.5V9.4",key:"11uown"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a7=U("Contrast",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 18a6 6 0 0 0 0-12v12z",key:"j4l70d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o7=U("Cookie",[["path",{d:"M12 2a10 10 0 1 0 10 10 4 4 0 0 1-5-5 4 4 0 0 1-5-5",key:"laymnq"}],["path",{d:"M8.5 8.5v.01",key:"ue8clq"}],["path",{d:"M16 15.5v.01",key:"14dtrp"}],["path",{d:"M12 12v.01",key:"u5ubse"}],["path",{d:"M11 17v.01",key:"1hyl5a"}],["path",{d:"M7 14v.01",key:"uct60s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l7=U("CookingPot",[["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"M20 12v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-8",key:"u0tga0"}],["path",{d:"m4 8 16-4",key:"16g0ng"}],["path",{d:"m8.86 6.78-.45-1.81a2 2 0 0 1 1.45-2.43l1.94-.48a2 2 0 0 1 2.43 1.46l.45 1.8",key:"12cejc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c7=U("CopyCheck",[["path",{d:"m12 15 2 2 4-4",key:"2c609p"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d7=U("CopyMinus",[["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u7=U("CopyPlus",[["line",{x1:"15",x2:"15",y1:"12",y2:"18",key:"1p7wdc"}],["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h7=U("CopySlash",[["line",{x1:"12",x2:"18",y1:"18",y2:"12",key:"ebkxgr"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f7=U("CopyX",[["line",{x1:"12",x2:"18",y1:"12",y2:"18",key:"1rg63v"}],["line",{x1:"12",x2:"18",y1:"18",y2:"12",key:"ebkxgr"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ul=U("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p7=U("Copyleft",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.17 14.83a4 4 0 1 0 0-5.66",key:"1sveal"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m7=U("Copyright",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M14.83 14.83a4 4 0 1 1 0-5.66",key:"1i56pz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g7=U("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y7=U("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x7=U("CornerLeftDown",[["polyline",{points:"14 15 9 20 4 15",key:"nkc4i"}],["path",{d:"M20 4h-7a4 4 0 0 0-4 4v12",key:"nbpdq2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v7=U("CornerLeftUp",[["polyline",{points:"14 9 9 4 4 9",key:"m9oyvo"}],["path",{d:"M20 20h-7a4 4 0 0 1-4-4V4",key:"1blwi3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _7=U("CornerRightDown",[["polyline",{points:"10 15 15 20 20 15",key:"axus6l"}],["path",{d:"M4 4h7a4 4 0 0 1 4 4v12",key:"wcbgct"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b7=U("CornerRightUp",[["polyline",{points:"10 9 15 4 20 9",key:"1lr6px"}],["path",{d:"M4 20h7a4 4 0 0 0 4-4V4",key:"1plgdj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w7=U("CornerUpLeft",[["polyline",{points:"9 14 4 9 9 4",key:"881910"}],["path",{d:"M20 20v-7a4 4 0 0 0-4-4H4",key:"1nkjon"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j7=U("CornerUpRight",[["polyline",{points:"15 14 20 9 15 4",key:"1tbx3s"}],["path",{d:"M4 20v-7a4 4 0 0 1 4-4h12",key:"1lu4f8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k7=U("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N7=U("CreativeCommons",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M10 9.3a2.8 2.8 0 0 0-3.5 1 3.1 3.1 0 0 0 0 3.4 2.7 2.7 0 0 0 3.5 1",key:"1ss3eq"}],["path",{d:"M17 9.3a2.8 2.8 0 0 0-3.5 1 3.1 3.1 0 0 0 0 3.4 2.7 2.7 0 0 0 3.5 1",key:"1od56t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q0=U("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S7=U("Croissant",[["path",{d:"m4.6 13.11 5.79-3.21c1.89-1.05 4.79 1.78 3.71 3.71l-3.22 5.81C8.8 23.16.79 15.23 4.6 13.11Z",key:"1ozxlb"}],["path",{d:"m10.5 9.5-1-2.29C9.2 6.48 8.8 6 8 6H4.5C2.79 6 2 6.5 2 8.5a7.71 7.71 0 0 0 2 4.83",key:"ffuyb5"}],["path",{d:"M8 6c0-1.55.24-4-2-4-2 0-2.5 2.17-2.5 4",key:"osnpzi"}],["path",{d:"m14.5 13.5 2.29 1c.73.3 1.21.7 1.21 1.5v3.5c0 1.71-.5 2.5-2.5 2.5a7.71 7.71 0 0 1-4.83-2",key:"1vubaw"}],["path",{d:"M18 16c1.55 0 4-.24 4 2 0 2-2.17 2.5-4 2.5",key:"wxr772"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C7=U("Crop",[["path",{d:"M6 2v14a2 2 0 0 0 2 2h14",key:"ron5a4"}],["path",{d:"M18 22V8a2 2 0 0 0-2-2H2",key:"7s9ehn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M7=U("Cross",[["path",{d:"M4 9a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h4a1 1 0 0 1 1 1v4a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-4a1 1 0 0 1 1-1h4a2 2 0 0 0 2-2v-2a2 2 0 0 0-2-2h-4a1 1 0 0 1-1-1V4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4a1 1 0 0 1-1 1z",key:"1xbrqy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const T7=U("Crosshair",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bw=U("Crown",[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A7=U("Cuboid",[["path",{d:"m21.12 6.4-6.05-4.06a2 2 0 0 0-2.17-.05L2.95 8.41a2 2 0 0 0-.95 1.7v5.82a2 2 0 0 0 .88 1.66l6.05 4.07a2 2 0 0 0 2.17.05l9.95-6.12a2 2 0 0 0 .95-1.7V8.06a2 2 0 0 0-.88-1.66Z",key:"1u2ovd"}],["path",{d:"M10 22v-8L2.25 9.15",key:"11pn4q"}],["path",{d:"m10 14 11.77-6.87",key:"1kt1wh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E7=U("CupSoda",[["path",{d:"m6 8 1.75 12.28a2 2 0 0 0 2 1.72h4.54a2 2 0 0 0 2-1.72L18 8",key:"8166m8"}],["path",{d:"M5 8h14",key:"pcz4l3"}],["path",{d:"M7 15a6.47 6.47 0 0 1 5 0 6.47 6.47 0 0 0 5 0",key:"yjz344"}],["path",{d:"m12 8 1-6h2",key:"3ybfa4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I7=U("Currency",[["circle",{cx:"12",cy:"12",r:"8",key:"46899m"}],["line",{x1:"3",x2:"6",y1:"3",y2:"6",key:"1jkytn"}],["line",{x1:"21",x2:"18",y1:"3",y2:"6",key:"14zfjt"}],["line",{x1:"3",x2:"6",y1:"21",y2:"18",key:"iusuec"}],["line",{x1:"21",x2:"18",y1:"21",y2:"18",key:"yj2dd7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P7=U("Cylinder",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5v14a9 3 0 0 0 18 0V5",key:"aqi0yr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L7=U("Dam",[["path",{d:"M11 11.31c1.17.56 1.54 1.69 3.5 1.69 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"157kva"}],["path",{d:"M11.75 18c.35.5 1.45 1 2.75 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"d7q6m6"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M7 3a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h4a1 1 0 0 0 1-1L10 4a1 1 0 0 0-1-1z",key:"pr6s65"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O7=U("DatabaseBackup",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 12a9 3 0 0 0 5 2.69",key:"1ui2ym"}],["path",{d:"M21 9.3V5",key:"6k6cib"}],["path",{d:"M3 5v14a9 3 0 0 0 6.47 2.88",key:"i62tjy"}],["path",{d:"M12 12v4h4",key:"1bxaet"}],["path",{d:"M13 20a5 5 0 0 0 9-3 4.5 4.5 0 0 0-4.5-4.5c-1.33 0-2.54.54-3.41 1.41L12 16",key:"1f4ei9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D7=U("DatabaseZap",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 15 21.84",key:"14ibmq"}],["path",{d:"M21 5V8",key:"1marbg"}],["path",{d:"M21 12L18 17H22L19 22",key:"zafso"}],["path",{d:"M3 12A9 3 0 0 0 14.59 14.87",key:"1y4wr8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R7=U("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F7=U("Delete",[["path",{d:"M10 5a2 2 0 0 0-1.344.519l-6.328 5.74a1 1 0 0 0 0 1.481l6.328 5.741A2 2 0 0 0 10 19h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2z",key:"1yo7s0"}],["path",{d:"m12 9 6 6",key:"anjzzh"}],["path",{d:"m18 9-6 6",key:"1fp51s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z7=U("Dessert",[["circle",{cx:"12",cy:"4",r:"2",key:"muu5ef"}],["path",{d:"M10.2 3.2C5.5 4 2 8.1 2 13a2 2 0 0 0 4 0v-1a2 2 0 0 1 4 0v4a2 2 0 0 0 4 0v-4a2 2 0 0 1 4 0v1a2 2 0 0 0 4 0c0-4.9-3.5-9-8.2-9.8",key:"lfo06j"}],["path",{d:"M3.2 14.8a9 9 0 0 0 17.6 0",key:"12xarc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B7=U("Diameter",[["circle",{cx:"19",cy:"19",r:"2",key:"17f5cg"}],["circle",{cx:"5",cy:"5",r:"2",key:"1gwv83"}],["path",{d:"M6.48 3.66a10 10 0 0 1 13.86 13.86",key:"xr8kdq"}],["path",{d:"m6.41 6.41 11.18 11.18",key:"uhpjw7"}],["path",{d:"M3.66 6.48a10 10 0 0 0 13.86 13.86",key:"cldpwv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $7=U("DiamondMinus",[["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G_=U("DiamondPercent",[["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0Z",key:"1tpxz2"}],["path",{d:"M9.2 9.2h.01",key:"1b7bvt"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"M14.7 14.8h.01",key:"17nsh4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U7=U("DiamondPlus",[["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q7=U("Diamond",[["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z",key:"1f1r0c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V7=U("Dice1",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M12 12h.01",key:"1mp3jc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H7=U("Dice2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M15 9h.01",key:"x1ddxp"}],["path",{d:"M9 15h.01",key:"fzyn71"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W7=U("Dice3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M16 8h.01",key:"cr5u4v"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G7=U("Dice4",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M16 8h.01",key:"cr5u4v"}],["path",{d:"M8 8h.01",key:"1e4136"}],["path",{d:"M8 16h.01",key:"18s6g9"}],["path",{d:"M16 16h.01",key:"1f9h7w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K7=U("Dice5",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M16 8h.01",key:"cr5u4v"}],["path",{d:"M8 8h.01",key:"1e4136"}],["path",{d:"M8 16h.01",key:"18s6g9"}],["path",{d:"M16 16h.01",key:"1f9h7w"}],["path",{d:"M12 12h.01",key:"1mp3jc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z7=U("Dice6",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M16 8h.01",key:"cr5u4v"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M16 16h.01",key:"1f9h7w"}],["path",{d:"M8 8h.01",key:"1e4136"}],["path",{d:"M8 12h.01",key:"czm47f"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y7=U("Dices",[["rect",{width:"12",height:"12",x:"2",y:"10",rx:"2",ry:"2",key:"6agr2n"}],["path",{d:"m17.92 14 3.5-3.5a2.24 2.24 0 0 0 0-3l-5-4.92a2.24 2.24 0 0 0-3 0L10 6",key:"1o487t"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 14h.01",key:"ssrbsk"}],["path",{d:"M15 6h.01",key:"cblpky"}],["path",{d:"M18 9h.01",key:"2061c0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X7=U("Diff",[["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 10h14",key:"elsbfy"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q7=U("Disc2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 12h.01",key:"1mp3jc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J7=U("Disc3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M6 12c0-1.7.7-3.2 1.8-4.2",key:"oqkarx"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M18 12c0 1.7-.7 3.2-1.8 4.2",key:"1eah9h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eB=U("DiscAlbum",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["circle",{cx:"12",cy:"12",r:"5",key:"nd82uf"}],["path",{d:"M12 12h.01",key:"1mp3jc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tB=U("Disc",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rB=U("Divide",[["circle",{cx:"12",cy:"6",r:"1",key:"1bh7o1"}],["line",{x1:"5",x2:"19",y1:"12",y2:"12",key:"13b5wn"}],["circle",{cx:"12",cy:"18",r:"1",key:"lqb9t5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nB=U("DnaOff",[["path",{d:"M15 2c-1.35 1.5-2.092 3-2.5 4.5L14 8",key:"1bivrr"}],["path",{d:"m17 6-2.891-2.891",key:"xu6p2f"}],["path",{d:"M2 15c3.333-3 6.667-3 10-3",key:"nxix30"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"m20 9 .891.891",key:"3xwk7g"}],["path",{d:"M22 9c-1.5 1.35-3 2.092-4.5 2.5l-1-1",key:"18cutr"}],["path",{d:"M3.109 14.109 4 15",key:"q76aoh"}],["path",{d:"m6.5 12.5 1 1",key:"cs35ky"}],["path",{d:"m7 18 2.891 2.891",key:"1sisit"}],["path",{d:"M9 22c1.35-1.5 2.092-3 2.5-4.5L10 16",key:"rlvei3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sB=U("Dna",[["path",{d:"m10 16 1.5 1.5",key:"11lckj"}],["path",{d:"m14 8-1.5-1.5",key:"1ohn8i"}],["path",{d:"M15 2c-1.798 1.998-2.518 3.995-2.807 5.993",key:"80uv8i"}],["path",{d:"m16.5 10.5 1 1",key:"696xn5"}],["path",{d:"m17 6-2.891-2.891",key:"xu6p2f"}],["path",{d:"M2 15c6.667-6 13.333 0 20-6",key:"1pyr53"}],["path",{d:"m20 9 .891.891",key:"3xwk7g"}],["path",{d:"M3.109 14.109 4 15",key:"q76aoh"}],["path",{d:"m6.5 12.5 1 1",key:"cs35ky"}],["path",{d:"m7 18 2.891 2.891",key:"1sisit"}],["path",{d:"M9 22c1.798-1.998 2.518-3.995 2.807-5.993",key:"q3hbxp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iB=U("Dock",[["path",{d:"M2 8h20",key:"d11cs7"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M6 16h12",key:"u522kt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aB=U("Dog",[["path",{d:"M11.25 16.25h1.5L12 17z",key:"w7jh35"}],["path",{d:"M16 14v.5",key:"1lajdz"}],["path",{d:"M4.42 11.247A13.152 13.152 0 0 0 4 14.556C4 18.728 7.582 21 12 21s8-2.272 8-6.444a11.702 11.702 0 0 0-.493-3.309",key:"u7s9ue"}],["path",{d:"M8 14v.5",key:"1nzgdb"}],["path",{d:"M8.5 8.5c-.384 1.05-1.083 2.028-2.344 2.5-1.931.722-3.576-.297-3.656-1-.113-.994 1.177-6.53 4-7 1.923-.321 3.651.845 3.651 2.235A7.497 7.497 0 0 1 14 5.277c0-1.39 1.844-2.598 3.767-2.277 2.823.47 4.113 6.006 4 7-.08.703-1.725 1.722-3.656 1-1.261-.472-1.855-1.45-2.239-2.5",key:"v8hric"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Cd=U("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oB=U("Donut",[["path",{d:"M20.5 10a2.5 2.5 0 0 1-2.4-3H18a2.95 2.95 0 0 1-2.6-4.4 10 10 0 1 0 6.3 7.1c-.3.2-.8.3-1.2.3",key:"19sr3x"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lB=U("DoorClosed",[["path",{d:"M18 20V6a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v14",key:"36qu9e"}],["path",{d:"M2 20h20",key:"owomy5"}],["path",{d:"M14 12v.01",key:"xfcn54"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oT=U("DoorOpen",[["path",{d:"M13 4h3a2 2 0 0 1 2 2v14",key:"hrm0s9"}],["path",{d:"M2 20h3",key:"1gaodv"}],["path",{d:"M13 20h9",key:"s90cdi"}],["path",{d:"M10 12v.01",key:"vx6srw"}],["path",{d:"M13 4.562v16.157a1 1 0 0 1-1.242.97L5 20V5.562a2 2 0 0 1 1.515-1.94l4-1A2 2 0 0 1 13 4.561Z",key:"199qr4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cB=U("Dot",[["circle",{cx:"12.1",cy:"12.1",r:"1",key:"18d7e5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mo=U("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dB=U("DraftingCompass",[["path",{d:"m12.99 6.74 1.93 3.44",key:"iwagvd"}],["path",{d:"M19.136 12a10 10 0 0 1-14.271 0",key:"ppmlo4"}],["path",{d:"m21 21-2.16-3.84",key:"vylbct"}],["path",{d:"m3 21 8.02-14.26",key:"1ssaw4"}],["circle",{cx:"12",cy:"5",r:"2",key:"f1ur92"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uB=U("Drama",[["path",{d:"M10 11h.01",key:"d2at3l"}],["path",{d:"M14 6h.01",key:"k028ub"}],["path",{d:"M18 6h.01",key:"1v4wsw"}],["path",{d:"M6.5 13.1h.01",key:"1748ia"}],["path",{d:"M22 5c0 9-4 12-6 12s-6-3-6-12c0-2 2-3 6-3s6 1 6 3",key:"172yzv"}],["path",{d:"M17.4 9.9c-.8.8-2 .8-2.8 0",key:"1obv0w"}],["path",{d:"M10.1 7.1C9 7.2 7.7 7.7 6 8.6c-3.5 2-4.7 3.9-3.7 5.6 4.5 7.8 9.5 8.4 11.2 7.4.9-.5 1.9-2.1 1.9-4.7",key:"rqjl8i"}],["path",{d:"M9.1 16.5c.3-1.1 1.4-1.7 2.4-1.4",key:"1mr6wy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hB=U("Dribbble",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M19.13 5.09C15.22 9.14 10 10.44 2.25 10.94",key:"hpej1"}],["path",{d:"M21.75 12.84c-6.62-1.41-12.14 1-16.38 6.32",key:"1tr44o"}],["path",{d:"M8.56 2.75c4.37 6 6 9.42 8 17.72",key:"kbh691"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fB=U("Drill",[["path",{d:"M10 18a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H5a3 3 0 0 1-3-3 1 1 0 0 1 1-1z",key:"ioqxb1"}],["path",{d:"M13 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1l-.81 3.242a1 1 0 0 1-.97.758H8",key:"1rs59n"}],["path",{d:"M14 4h3a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-3",key:"105ega"}],["path",{d:"M18 6h4",key:"66u95g"}],["path",{d:"m5 10-2 8",key:"xt2lic"}],["path",{d:"m7 18 2-8",key:"1bzku2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pB=U("Droplet",[["path",{d:"M12 22a7 7 0 0 0 7-7c0-2-1-3.9-3-5.5s-3.5-4-4-6.5c-.5 2.5-2 4.9-4 6.5C6 11.1 5 13 5 15a7 7 0 0 0 7 7z",key:"c7niix"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mB=U("Droplets",[["path",{d:"M7 16.3c2.2 0 4-1.83 4-4.05 0-1.16-.57-2.26-1.71-3.19S7.29 6.75 7 5.3c-.29 1.45-1.14 2.84-2.29 3.76S3 11.1 3 12.25c0 2.22 1.8 4.05 4 4.05z",key:"1ptgy4"}],["path",{d:"M12.56 6.6A10.97 10.97 0 0 0 14 3.02c.5 2.5 2 4.9 4 6.5s3 3.5 3 5.5a6.98 6.98 0 0 1-11.91 4.97",key:"1sl1rz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gB=U("Drum",[["path",{d:"m2 2 8 8",key:"1v6059"}],["path",{d:"m22 2-8 8",key:"173r8a"}],["ellipse",{cx:"12",cy:"9",rx:"10",ry:"5",key:"liohsx"}],["path",{d:"M7 13.4v7.9",key:"1yi6u9"}],["path",{d:"M12 14v8",key:"1tn2tj"}],["path",{d:"M17 13.4v7.9",key:"eqz2v3"}],["path",{d:"M2 9v8a10 5 0 0 0 20 0V9",key:"1750ul"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yB=U("Drumstick",[["path",{d:"M15.4 15.63a7.875 6 135 1 1 6.23-6.23 4.5 3.43 135 0 0-6.23 6.23",key:"1dtqwm"}],["path",{d:"m8.29 12.71-2.6 2.6a2.5 2.5 0 1 0-1.65 4.65A2.5 2.5 0 1 0 8.7 18.3l2.59-2.59",key:"1oq1fw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xB=U("Dumbbell",[["path",{d:"M14.4 14.4 9.6 9.6",key:"ic80wn"}],["path",{d:"M18.657 21.485a2 2 0 1 1-2.829-2.828l-1.767 1.768a2 2 0 1 1-2.829-2.829l6.364-6.364a2 2 0 1 1 2.829 2.829l-1.768 1.767a2 2 0 1 1 2.828 2.829z",key:"nnl7wr"}],["path",{d:"m21.5 21.5-1.4-1.4",key:"1f1ice"}],["path",{d:"M3.9 3.9 2.5 2.5",key:"1evmna"}],["path",{d:"M6.404 12.768a2 2 0 1 1-2.829-2.829l1.768-1.767a2 2 0 1 1-2.828-2.829l2.828-2.828a2 2 0 1 1 2.829 2.828l1.767-1.768a2 2 0 1 1 2.829 2.829z",key:"yhosts"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vB=U("EarOff",[["path",{d:"M6 18.5a3.5 3.5 0 1 0 7 0c0-1.57.92-2.52 2.04-3.46",key:"1qngmn"}],["path",{d:"M6 8.5c0-.75.13-1.47.36-2.14",key:"b06bma"}],["path",{d:"M8.8 3.15A6.5 6.5 0 0 1 19 8.5c0 1.63-.44 2.81-1.09 3.76",key:"g10hsz"}],["path",{d:"M12.5 6A2.5 2.5 0 0 1 15 8.5M10 13a2 2 0 0 0 1.82-1.18",key:"ygzou7"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _B=U("Ear",[["path",{d:"M6 8.5a6.5 6.5 0 1 1 13 0c0 6-6 6-6 10a3.5 3.5 0 1 1-7 0",key:"1dfaln"}],["path",{d:"M15 8.5a2.5 2.5 0 0 0-5 0v1a2 2 0 1 1 0 4",key:"1qnva7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bB=U("EarthLock",[["path",{d:"M7 3.34V5a3 3 0 0 0 3 3",key:"w732o8"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2 2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"f02343"}],["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M12 2a10 10 0 1 0 9.54 13",key:"zjsr6q"}],["path",{d:"M20 6V4a2 2 0 1 0-4 0v2",key:"1of5e8"}],["rect",{width:"8",height:"5",x:"14",y:"6",rx:"1",key:"1fmf51"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K_=U("Earth",[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wB=U("Eclipse",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a7 7 0 1 0 10 10",key:"1yuj32"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jB=U("EggFried",[["circle",{cx:"11.5",cy:"12.5",r:"3.5",key:"1cl1mi"}],["path",{d:"M3 8c0-3.5 2.5-6 6.5-6 5 0 4.83 3 7.5 5s5 2 5 6c0 4.5-2.5 6.5-7 6.5-2.5 0-2.5 2.5-6 2.5s-7-2-7-5.5c0-3 1.5-3 1.5-5C3.5 10 3 9 3 8Z",key:"165ef9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kB=U("EggOff",[["path",{d:"M6.399 6.399C5.362 8.157 4.65 10.189 4.5 12c-.37 4.43 1.27 9.95 7.5 10 3.256-.026 5.259-1.547 6.375-3.625",key:"6et380"}],["path",{d:"M19.532 13.875A14.07 14.07 0 0 0 19.5 12c-.36-4.34-3.95-9.96-7.5-10-1.04.012-2.082.502-3.046 1.297",key:"gcdc3f"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NB=U("Egg",[["path",{d:"M12 22c6.23-.05 7.87-5.57 7.5-10-.36-4.34-3.95-9.96-7.5-10-3.55.04-7.14 5.66-7.5 10-.37 4.43 1.27 9.95 7.5 10z",key:"1c39pg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gy=U("EllipsisVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zm=U("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SB=U("EqualApproximately",[["path",{d:"M5 15a6.5 6.5 0 0 1 7 0 6.5 6.5 0 0 0 7 0",key:"yrdkhy"}],["path",{d:"M5 9a6.5 6.5 0 0 1 7 0 6.5 6.5 0 0 0 7 0",key:"gzkvyz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CB=U("EqualNot",[["line",{x1:"5",x2:"19",y1:"9",y2:"9",key:"1nwqeh"}],["line",{x1:"5",x2:"19",y1:"15",y2:"15",key:"g8yjpy"}],["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MB=U("Equal",[["line",{x1:"5",x2:"19",y1:"9",y2:"9",key:"1nwqeh"}],["line",{x1:"5",x2:"19",y1:"15",y2:"15",key:"g8yjpy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TB=U("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AB=U("EthernetPort",[["path",{d:"m15 20 3-3h2a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h2l3 3z",key:"rbahqx"}],["path",{d:"M6 8v1",key:"1636ez"}],["path",{d:"M10 8v1",key:"1talb4"}],["path",{d:"M14 8v1",key:"1rsfgr"}],["path",{d:"M18 8v1",key:"gnkwox"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EB=U("Euro",[["path",{d:"M4 10h12",key:"1y6xl8"}],["path",{d:"M4 14h9",key:"1loblj"}],["path",{d:"M19 6a7.7 7.7 0 0 0-5.2-2A7.9 7.9 0 0 0 6 12c0 4.4 3.5 8 7.8 8 2 0 3.8-.8 5.2-2",key:"1j6lzo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IB=U("Expand",[["path",{d:"m21 21-6-6m6 6v-4.8m0 4.8h-4.8",key:"1c15vz"}],["path",{d:"M3 16.2V21m0 0h4.8M3 21l6-6",key:"1fsnz2"}],["path",{d:"M21 7.8V3m0 0h-4.8M21 3l-6 6",key:"hawz9i"}],["path",{d:"M3 7.8V3m0 0h4.8M3 3l6 6",key:"u9ee12"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fs=U("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PB=U("EyeClosed",[["path",{d:"m15 18-.722-3.25",key:"1j64jw"}],["path",{d:"M2 8a10.645 10.645 0 0 0 20 0",key:"1e7gxb"}],["path",{d:"m20 15-1.726-2.05",key:"1cnuld"}],["path",{d:"m4 15 1.726-2.05",key:"1dsqqd"}],["path",{d:"m9 18 .722-3.25",key:"ypw2yx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $w=U("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ml=U("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Md=U("Facebook",[["path",{d:"M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z",key:"1jg4f8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LB=U("Factory",[["path",{d:"M2 20a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8l-7 5V8l-7 5V4a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"159hny"}],["path",{d:"M17 18h1",key:"uldtlt"}],["path",{d:"M12 18h1",key:"s9uhes"}],["path",{d:"M7 18h1",key:"1neino"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OB=U("Fan",[["path",{d:"M10.827 16.379a6.082 6.082 0 0 1-8.618-7.002l5.412 1.45a6.082 6.082 0 0 1 7.002-8.618l-1.45 5.412a6.082 6.082 0 0 1 8.618 7.002l-5.412-1.45a6.082 6.082 0 0 1-7.002 8.618l1.45-5.412Z",key:"484a7f"}],["path",{d:"M12 12v.01",key:"u5ubse"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DB=U("FastForward",[["polygon",{points:"13 19 22 12 13 5 13 19",key:"587y9g"}],["polygon",{points:"2 19 11 12 2 5 2 19",key:"3pweh0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RB=U("Feather",[["path",{d:"M12.67 19a2 2 0 0 0 1.416-.588l6.154-6.172a6 6 0 0 0-8.49-8.49L5.586 9.914A2 2 0 0 0 5 11.328V18a1 1 0 0 0 1 1z",key:"18jl4k"}],["path",{d:"M16 8 2 22",key:"vp34q"}],["path",{d:"M17.5 15H9",key:"1oz8nu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FB=U("Fence",[["path",{d:"M4 3 2 5v15c0 .6.4 1 1 1h2c.6 0 1-.4 1-1V5Z",key:"1n2rgs"}],["path",{d:"M6 8h4",key:"utf9t1"}],["path",{d:"M6 18h4",key:"12yh4b"}],["path",{d:"m12 3-2 2v15c0 .6.4 1 1 1h2c.6 0 1-.4 1-1V5Z",key:"3ha7mj"}],["path",{d:"M14 8h4",key:"1r8wg2"}],["path",{d:"M14 18h4",key:"1t3kbu"}],["path",{d:"m20 3-2 2v15c0 .6.4 1 1 1h2c.6 0 1-.4 1-1V5Z",key:"dfd4e2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zB=U("FerrisWheel",[["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m6.8 15-3.5 2",key:"hjy98k"}],["path",{d:"m20.7 7-3.5 2",key:"f08gto"}],["path",{d:"M6.8 9 3.3 7",key:"1aevh4"}],["path",{d:"m20.7 17-3.5-2",key:"1liqo3"}],["path",{d:"m9 22 3-8 3 8",key:"wees03"}],["path",{d:"M8 22h8",key:"rmew8v"}],["path",{d:"M18 18.7a9 9 0 1 0-12 0",key:"dhzg4g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BB=U("Figma",[["path",{d:"M5 5.5A3.5 3.5 0 0 1 8.5 2H12v7H8.5A3.5 3.5 0 0 1 5 5.5z",key:"1340ok"}],["path",{d:"M12 2h3.5a3.5 3.5 0 1 1 0 7H12V2z",key:"1hz3m3"}],["path",{d:"M12 12.5a3.5 3.5 0 1 1 7 0 3.5 3.5 0 1 1-7 0z",key:"1oz8n2"}],["path",{d:"M5 19.5A3.5 3.5 0 0 1 8.5 16H12v3.5a3.5 3.5 0 1 1-7 0z",key:"1ff65i"}],["path",{d:"M5 12.5A3.5 3.5 0 0 1 8.5 9H12v7H8.5A3.5 3.5 0 0 1 5 12.5z",key:"pdip6e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $B=U("FileArchive",[["path",{d:"M10 12v-1",key:"v7bkov"}],["path",{d:"M10 18v-2",key:"1cjy8d"}],["path",{d:"M10 7V6",key:"dljcrl"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 .274 1.01",key:"gkbcor"}],["circle",{cx:"10",cy:"20",r:"2",key:"1xzdoj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UB=U("FileAudio2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v2",key:"17k7jt"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"3",cy:"17",r:"1",key:"vo6nti"}],["path",{d:"M2 17v-3a4 4 0 0 1 8 0v3",key:"1ggdre"}],["circle",{cx:"9",cy:"17",r:"1",key:"bc1fq4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qB=U("FileAudio",[["path",{d:"M17.5 22h.5a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"rslqgf"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 19a2 2 0 1 1 4 0v1a2 2 0 1 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 1 1-4 0v-1a2 2 0 1 1 4 0",key:"9f7x3i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z_=U("FileAxis3d",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m8 18 4-4",key:"12zab0"}],["path",{d:"M8 10v8h8",key:"tlaukw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VB=U("FileBadge2",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m14 12.5 1 5.5-3-1-3 1 1-5.5",key:"14xlky"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HB=U("FileBadge",[["path",{d:"M12 22h6a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"12ixgl"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M5 17a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z",key:"u0c8gj"}],["path",{d:"M7 16.5 8 22l-3-1-3 1 1-5.5",key:"5gm2nr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WB=U("FileBox",[["path",{d:"M14.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"16lz6z"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 13.1a2 2 0 0 0-1 1.76v3.24a2 2 0 0 0 .97 1.78L6 21.7a2 2 0 0 0 2.03.01L11 19.9a2 2 0 0 0 1-1.76V14.9a2 2 0 0 0-.97-1.78L8 11.3a2 2 0 0 0-2.03-.01Z",key:"99pj1s"}],["path",{d:"M7 17v5",key:"1yj1jh"}],["path",{d:"M11.7 14.2 7 17l-4.7-2.8",key:"1yk8tc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y_=U("FileChartColumnIncreasing",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 18v-2",key:"qcmpov"}],["path",{d:"M12 18v-4",key:"q1q25u"}],["path",{d:"M16 18v-6",key:"15y0np"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X_=U("FileChartColumn",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 18v-1",key:"zg0ygc"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"M16 18v-3",key:"j5jt4h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q_=U("FileChartLine",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m16 13-3.5 3.5-2-2L8 17",key:"zz7yod"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J_=U("FileChartPie",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M16 22h2a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3.5",key:"13ddob"}],["path",{d:"M4.017 11.512a6 6 0 1 0 8.466 8.475",key:"s6vs5t"}],["path",{d:"M9 16a1 1 0 0 1-1-1v-4c0-.552.45-1.008.995-.917a6 6 0 0 1 4.922 4.922c.091.544-.365.995-.917.995z",key:"1dl6s6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GB=U("FileCheck2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m3 15 2 2 4-4",key:"1lhrkk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KB=U("FileCheck",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m9 15 2 2 4-4",key:"1grp1n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZB=U("FileClock",[["path",{d:"M16 22h2a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"37hlfg"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"8",cy:"16",r:"6",key:"10v15b"}],["path",{d:"M9.5 17.5 8 16.25V14",key:"1o80t2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YB=U("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XB=U("FileCode",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e2=U("FileCog",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m3.2 12.9-.9-.4",key:"1i3dj5"}],["path",{d:"m3.2 15.1-.9.4",key:"1fvgj0"}],["path",{d:"M4.677 21.5a2 2 0 0 0 1.313.5H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v2.5",key:"1yo3oz"}],["path",{d:"m4.9 11.2-.4-.9",key:"otmhb9"}],["path",{d:"m4.9 16.8-.4.9",key:"1b8z07"}],["path",{d:"m7.5 10.3-.4.9",key:"11k65u"}],["path",{d:"m7.5 17.7-.4-.9",key:"431x55"}],["path",{d:"m9.7 12.5-.9.4",key:"87sjan"}],["path",{d:"m9.7 15.5-.9-.4",key:"khqm91"}],["circle",{cx:"6",cy:"14",r:"3",key:"a1xfv6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QB=U("FileDiff",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JB=U("FileDigit",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["rect",{width:"4",height:"6",x:"2",y:"12",rx:"2",key:"jm304g"}],["path",{d:"M10 12h2v6",key:"12zw74"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e9=U("FileDown",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const t9=U("FileHeart",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v2",key:"17k7jt"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10.29 10.7a2.43 2.43 0 0 0-2.66-.52c-.29.12-.56.3-.78.53l-.35.34-.35-.34a2.43 2.43 0 0 0-2.65-.53c-.3.12-.56.3-.79.53-.95.94-1 2.53.2 3.74L6.5 18l3.6-3.55c1.2-1.21 1.14-2.8.19-3.74Z",key:"1c1fso"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V0=U("FileImage",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const r9=U("FileInput",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 15h10",key:"jfw4w8"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n9=U("FileJson2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"fq0c9t"}],["path",{d:"M8 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"4gibmv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s9=U("FileJson",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i9=U("FileKey2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v6",key:"rc0qvx"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"4",cy:"16",r:"2",key:"1ehqvc"}],["path",{d:"m10 10-4.5 4.5",key:"7fwrp6"}],["path",{d:"m9 11 1 1",key:"wa6s5q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a9=U("FileKey",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["circle",{cx:"10",cy:"16",r:"2",key:"4ckbqe"}],["path",{d:"m16 10-4.5 4.5",key:"7p3ebg"}],["path",{d:"m15 11 1 1",key:"1bsyx3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o9=U("FileLock2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v1",key:"jmtmu2"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["rect",{width:"8",height:"5",x:"2",y:"13",rx:"1",key:"10y5wo"}],["path",{d:"M8 13v-2a2 2 0 1 0-4 0v2",key:"1pdxzg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l9=U("FileLock",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["rect",{width:"8",height:"6",x:"8",y:"12",rx:"1",key:"3yr8at"}],["path",{d:"M10 12v-2a2 2 0 1 1 4 0v2",key:"j4i8d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c9=U("FileMinus2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d9=U("FileMinus",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 15h6",key:"cctwl0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u9=U("FileMusic",[["path",{d:"M10.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v8.4",key:"1d3kfm"}],["path",{d:"M8 18v-7.7L16 9v7",key:"1oie6o"}],["circle",{cx:"14",cy:"16",r:"2",key:"1bzzi3"}],["circle",{cx:"6",cy:"18",r:"2",key:"1fncim"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h9=U("FileOutput",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4 7V4a2 2 0 0 1 2-2 2 2 0 0 0-2 2",key:"1vk7w2"}],["path",{d:"M4.063 20.999a2 2 0 0 0 2 1L18 22a2 2 0 0 0 2-2V7l-5-5H6",key:"1jink5"}],["path",{d:"m5 11-3 3",key:"1dgrs4"}],["path",{d:"m5 17-3-3h10",key:"1mvvaf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const t2=U("FilePenLine",[["path",{d:"m18 5-2.414-2.414A2 2 0 0 0 14.172 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2",key:"142zxg"}],["path",{d:"M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"2t3380"}],["path",{d:"M8 18h1",key:"13wk12"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const r2=U("FilePen",[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f9=U("FilePlus2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}],["path",{d:"M6 12v6",key:"1u72j0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p9=U("FilePlus",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m9=U("FileQuestion",[["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g9=U("FileScan",[["path",{d:"M20 10V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h4",key:"1rdf37"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M16 14a2 2 0 0 0-2 2",key:"ceaadl"}],["path",{d:"M20 14a2 2 0 0 1 2 2",key:"1ny6zw"}],["path",{d:"M20 22a2 2 0 0 0 2-2",key:"1l9q4k"}],["path",{d:"M16 22a2 2 0 0 1-2-2",key:"1wqh5n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y9=U("FileSearch2",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x9=U("FileSearch",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4.268 21a2 2 0 0 0 1.727 1H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"ms7g94"}],["path",{d:"m9 18-1.5-1.5",key:"1j6qii"}],["circle",{cx:"5",cy:"14",r:"3",key:"ufru5t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v9=U("FileSliders",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M10 11v2",key:"1s651w"}],["path",{d:"M8 17h8",key:"wh5c61"}],["path",{d:"M14 16v2",key:"12fp5e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H0=U("FileSpreadsheet",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _9=U("FileStack",[["path",{d:"M21 7h-3a2 2 0 0 1-2-2V2",key:"9rb54x"}],["path",{d:"M21 6v6.5c0 .8-.7 1.5-1.5 1.5h-7c-.8 0-1.5-.7-1.5-1.5v-9c0-.8.7-1.5 1.5-1.5H17Z",key:"1059l0"}],["path",{d:"M7 8v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H15",key:"16874u"}],["path",{d:"M3 12v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H11",key:"k2ox98"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b9=U("FileSymlink",[["path",{d:"m10 18 3-3-3-3",key:"18f6ys"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4 11V4a2 2 0 0 1 2-2h9l5 5v13a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h7",key:"50q2rw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w9=U("FileTerminal",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m8 16 2-2-2-2",key:"10vzyd"}],["path",{d:"M12 18h4",key:"1wd2n7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ai=U("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j9=U("FileType2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 13v-1h6v1",key:"1dh9dg"}],["path",{d:"M5 12v6",key:"150t9c"}],["path",{d:"M4 18h2",key:"1xrofg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k9=U("FileType",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 13v-1h6v1",key:"1bb014"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M11 18h2",key:"12mj7e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N9=U("FileUp",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S9=U("FileUser",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 18a3 3 0 1 0-6 0",key:"16awa0"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}],["circle",{cx:"12",cy:"13",r:"2",key:"1c1ljs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C9=U("FileVideo2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["rect",{width:"8",height:"6",x:"2",y:"12",rx:"1",key:"1a6c1e"}],["path",{d:"m10 15.5 4 2.5v-6l-4 2.5",key:"t7cp39"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M9=U("FileVideo",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m10 11 5 3-5 3v-6Z",key:"7ntvm4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const T9=U("FileVolume2",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 15h.01",key:"a7atzg"}],["path",{d:"M11.5 13.5a2.5 2.5 0 0 1 0 3",key:"1fccat"}],["path",{d:"M15 12a5 5 0 0 1 0 6",key:"ps46cm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A9=U("FileVolume",[["path",{d:"M11 11a5 5 0 0 1 0 6",key:"193qb2"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4 6.765V4a2 2 0 0 1 2-2h9l5 5v13a2 2 0 0 1-2 2H6a2 2 0 0 1-.93-.23",key:"ifyjnl"}],["path",{d:"M7 10.51a.5.5 0 0 0-.826-.38l-1.893 1.628A1 1 0 0 1 3.63 12H2.5a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h1.129a1 1 0 0 1 .652.242l1.893 1.63a.5.5 0 0 0 .826-.38z",key:"mk8rxu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E9=U("FileWarning",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I9=U("FileX2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m8 12.5-5 5",key:"b853mi"}],["path",{d:"m3 12.5 5 5",key:"1qls4r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P9=U("FileX",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m14.5 12.5-5 5",key:"b62r18"}],["path",{d:"m9.5 12.5 5 5",key:"1rk7el"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L9=U("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O9=U("Files",[["path",{d:"M20 7h-3a2 2 0 0 1-2-2V2",key:"x099mo"}],["path",{d:"M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z",key:"18t6ie"}],["path",{d:"M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8",key:"1nja0z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wd=U("Film",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M3 7.5h4",key:"zfgn84"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 16.5h4",key:"1230mu"}],["path",{d:"M17 3v18",key:"in4fa5"}],["path",{d:"M17 7.5h4",key:"myr1c1"}],["path",{d:"M17 16.5h4",key:"go4c1d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D9=U("FilterX",[["path",{d:"M13.013 3H2l8 9.46V19l4 2v-8.54l.9-1.055",key:"1fi1da"}],["path",{d:"m22 3-5 5",key:"12jva0"}],["path",{d:"m17 3 5 5",key:"k36vhe"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Uw=U("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R9=U("Fingerprint",[["path",{d:"M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4",key:"1nerag"}],["path",{d:"M14 13.12c0 2.38 0 6.38-1 8.88",key:"o46ks0"}],["path",{d:"M17.29 21.02c.12-.6.43-2.3.5-3.02",key:"ptglia"}],["path",{d:"M2 12a10 10 0 0 1 18-6",key:"ydlgp0"}],["path",{d:"M2 16h.01",key:"1gqxmh"}],["path",{d:"M21.8 16c.2-2 .131-5.354 0-6",key:"drycrb"}],["path",{d:"M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2",key:"1tidbn"}],["path",{d:"M8.65 22c.21-.66.45-1.32.57-2",key:"13wd9y"}],["path",{d:"M9 6.8a6 6 0 0 1 9 5.2v2",key:"1fr1j5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F9=U("FireExtinguisher",[["path",{d:"M15 6.5V3a1 1 0 0 0-1-1h-2a1 1 0 0 0-1 1v3.5",key:"sqyvz"}],["path",{d:"M9 18h8",key:"i7pszb"}],["path",{d:"M18 3h-3",key:"7idoqj"}],["path",{d:"M11 3a6 6 0 0 0-6 6v11",key:"1v5je3"}],["path",{d:"M5 13h4",key:"svpcxo"}],["path",{d:"M17 10a4 4 0 0 0-8 0v10a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2Z",key:"vsjego"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z9=U("FishOff",[["path",{d:"M18 12.47v.03m0-.5v.47m-.475 5.056A6.744 6.744 0 0 1 15 18c-3.56 0-7.56-2.53-8.5-6 .348-1.28 1.114-2.433 2.121-3.38m3.444-2.088A8.802 8.802 0 0 1 15 6c3.56 0 6.06 2.54 7 6-.309 1.14-.786 2.177-1.413 3.058",key:"1j1hse"}],["path",{d:"M7 10.67C7 8 5.58 5.97 2.73 5.5c-1 1.5-1 5 .23 6.5-1.24 1.5-1.24 5-.23 6.5C5.58 18.03 7 16 7 13.33m7.48-4.372A9.77 9.77 0 0 1 16 6.07m0 11.86a9.77 9.77 0 0 1-1.728-3.618",key:"1q46z8"}],["path",{d:"m16.01 17.93-.23 1.4A2 2 0 0 1 13.8 21H9.5a5.96 5.96 0 0 0 1.49-3.98M8.53 3h5.27a2 2 0 0 1 1.98 1.67l.23 1.4M2 2l20 20",key:"1407gh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B9=U("FishSymbol",[["path",{d:"M2 16s9-15 20-4C11 23 2 8 2 8",key:"h4oh4o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $9=U("Fish",[["path",{d:"M6.5 12c.94-3.46 4.94-6 8.5-6 3.56 0 6.06 2.54 7 6-.94 3.47-3.44 6-7 6s-7.56-2.53-8.5-6Z",key:"15baut"}],["path",{d:"M18 12v.5",key:"18hhni"}],["path",{d:"M16 17.93a9.77 9.77 0 0 1 0-11.86",key:"16dt7o"}],["path",{d:"M7 10.67C7 8 5.58 5.97 2.73 5.5c-1 1.5-1 5 .23 6.5-1.24 1.5-1.24 5-.23 6.5C5.58 18.03 7 16 7 13.33",key:"l9di03"}],["path",{d:"M10.46 7.26C10.2 5.88 9.17 4.24 8 3h5.8a2 2 0 0 1 1.98 1.67l.23 1.4",key:"1kjonw"}],["path",{d:"m16.01 17.93-.23 1.4A2 2 0 0 1 13.8 21H9.5a5.96 5.96 0 0 0 1.49-3.98",key:"1zlm23"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U9=U("FlagOff",[["path",{d:"M8 2c3 0 5 2 8 2s4-1 4-1v11",key:"9rwyz9"}],["path",{d:"M4 22V4",key:"1plyxx"}],["path",{d:"M4 15s1-1 4-1 5 2 8 2",key:"1myooe"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q9=U("FlagTriangleLeft",[["path",{d:"M17 22V2L7 7l10 5",key:"1rmf0r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V9=U("FlagTriangleRight",[["path",{d:"M7 22V2l10 5-10 5",key:"17n18y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lT=U("Flag",[["path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z",key:"i9b6wo"}],["line",{x1:"4",x2:"4",y1:"22",y2:"15",key:"1cm3nv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H9=U("FlameKindling",[["path",{d:"M12 2c1 3 2.5 3.5 3.5 4.5A5 5 0 0 1 17 10a5 5 0 1 1-10 0c0-.3 0-.6.1-.9a2 2 0 1 0 3.3-2C8 4.5 11 2 12 2Z",key:"1ir223"}],["path",{d:"m5 22 14-4",key:"1brv4h"}],["path",{d:"m5 18 14 4",key:"lgyyje"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Df=U("Flame",[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W9=U("FlashlightOff",[["path",{d:"M16 16v4a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2V10c0-2-2-2-2-4",key:"1r120k"}],["path",{d:"M7 2h11v4c0 2-2 2-2 4v1",key:"dz1920"}],["line",{x1:"11",x2:"18",y1:"6",y2:"6",key:"bi1vpe"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G9=U("Flashlight",[["path",{d:"M18 6c0 2-2 2-2 4v10a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2V10c0-2-2-2-2-4V2h12z",key:"1orkel"}],["line",{x1:"6",x2:"18",y1:"6",y2:"6",key:"1z11jq"}],["line",{x1:"12",x2:"12",y1:"12",y2:"12",key:"1f4yc1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K9=U("FlaskConicalOff",[["path",{d:"M10 10 4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-1.272-2.542",key:"59ek9y"}],["path",{d:"M10 2v2.343",key:"15t272"}],["path",{d:"M14 2v6.343",key:"sxr80q"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h9",key:"t5njau"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qw=U("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z9=U("FlaskRound",[["path",{d:"M10 2v7.31",key:"5d1hyh"}],["path",{d:"M14 9.3V1.99",key:"14k4l0"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M14 9.3a6.5 6.5 0 1 1-4 0",key:"1r8fvy"}],["path",{d:"M5.52 16h12.96",key:"46hh1i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y9=U("FlipHorizontal2",[["path",{d:"m3 7 5 5-5 5V7",key:"couhi7"}],["path",{d:"m21 7-5 5 5 5V7",key:"6ouia7"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 14v2",key:"8jcxud"}],["path",{d:"M12 8v2",key:"1woqiv"}],["path",{d:"M12 2v2",key:"tus03m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X9=U("FlipHorizontal",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h3",key:"1i73f7"}],["path",{d:"M16 3h3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-3",key:"saxlbk"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 14v2",key:"8jcxud"}],["path",{d:"M12 8v2",key:"1woqiv"}],["path",{d:"M12 2v2",key:"tus03m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q9=U("FlipVertical2",[["path",{d:"m17 3-5 5-5-5h10",key:"1ftt6x"}],["path",{d:"m17 21-5-5-5 5h10",key:"1m0wmu"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J9=U("FlipVertical",[["path",{d:"M21 8V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v3",key:"14bfxa"}],["path",{d:"M21 16v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-3",key:"14rx03"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e$=U("Flower2",[["path",{d:"M12 5a3 3 0 1 1 3 3m-3-3a3 3 0 1 0-3 3m3-3v1M9 8a3 3 0 1 0 3 3M9 8h1m5 0a3 3 0 1 1-3 3m3-3h-1m-2 3v-1",key:"3pnvol"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["path",{d:"M12 10v12",key:"6ubwww"}],["path",{d:"M12 22c4.2 0 7-1.667 7-5-4.2 0-7 1.667-7 5Z",key:"9hd38g"}],["path",{d:"M12 22c-4.2 0-7-1.667-7-5 4.2 0 7 1.667 7 5Z",key:"ufn41s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const t$=U("Flower",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M12 16.5A4.5 4.5 0 1 1 7.5 12 4.5 4.5 0 1 1 12 7.5a4.5 4.5 0 1 1 4.5 4.5 4.5 4.5 0 1 1-4.5 4.5",key:"14wa3c"}],["path",{d:"M12 7.5V9",key:"1oy5b0"}],["path",{d:"M7.5 12H9",key:"eltsq1"}],["path",{d:"M16.5 12H15",key:"vk5kw4"}],["path",{d:"M12 16.5V15",key:"k7eayi"}],["path",{d:"m8 8 1.88 1.88",key:"nxy4qf"}],["path",{d:"M14.12 9.88 16 8",key:"1lst6k"}],["path",{d:"m8 16 1.88-1.88",key:"h2eex1"}],["path",{d:"M14.12 14.12 16 16",key:"uqkrx3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const r$=U("Focus",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n$=U("FoldHorizontal",[["path",{d:"M2 12h6",key:"1wqiqv"}],["path",{d:"M22 12h-6",key:"1eg9hc"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 8v2",key:"1woqiv"}],["path",{d:"M12 14v2",key:"8jcxud"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m19 9-3 3 3 3",key:"12ol22"}],["path",{d:"m5 15 3-3-3-3",key:"1kdhjc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s$=U("FoldVertical",[["path",{d:"M12 22v-6",key:"6o8u61"}],["path",{d:"M12 8V2",key:"1wkif3"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}],["path",{d:"m15 19-3-3-3 3",key:"e37ymu"}],["path",{d:"m15 5-3 3-3-3",key:"19d6lf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i$=U("FolderArchive",[["circle",{cx:"15",cy:"19",r:"2",key:"u2pros"}],["path",{d:"M20.9 19.8A2 2 0 0 0 22 18V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2h5.1",key:"1jj40k"}],["path",{d:"M15 11v-1",key:"cntcp"}],["path",{d:"M15 17v-2",key:"1279jj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a$=U("FolderCheck",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"m9 13 2 2 4-4",key:"6343dt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o$=U("FolderClock",[["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}],["path",{d:"M7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2",key:"1urifu"}],["path",{d:"M16 14v2l1 1",key:"xth2jh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l$=U("FolderClosed",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M2 10h20",key:"1ir3d8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c$=U("FolderCode",[["path",{d:"M10 10.5 8 13l2 2.5",key:"m4t9c1"}],["path",{d:"m14 10.5 2 2.5-2 2.5",key:"14w2eb"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2z",key:"1u1bxd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n2=U("FolderCog",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["path",{d:"M10.3 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v3.3",key:"1k8050"}],["path",{d:"m21.7 19.4-.9-.3",key:"1qgwi9"}],["path",{d:"m15.2 16.9-.9-.3",key:"1t7mvx"}],["path",{d:"m16.6 21.7.3-.9",key:"1j67ps"}],["path",{d:"m19.1 15.2.3-.9",key:"18r7jp"}],["path",{d:"m19.6 21.7-.4-1",key:"z2vh2"}],["path",{d:"m16.8 15.3-.4-1",key:"1ei7r6"}],["path",{d:"m14.3 19.6 1-.4",key:"11sv9r"}],["path",{d:"m20.7 16.8 1-.4",key:"19m87a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d$=U("FolderDot",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["circle",{cx:"12",cy:"13",r:"1",key:"49l61u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u$=U("FolderDown",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"m15 13-3 3-3-3",key:"6j2sf0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h$=U("FolderGit2",[["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["path",{d:"M18 19c-2.8 0-5-2.2-5-5v8",key:"pkpw2h"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f$=U("FolderGit",[["circle",{cx:"12",cy:"13",r:"2",key:"1c1ljs"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M14 13h3",key:"1dgedf"}],["path",{d:"M7 13h3",key:"1pygq7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p$=U("FolderHeart",[["path",{d:"M11 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v1.5",key:"6hud8k"}],["path",{d:"M13.9 17.45c-1.2-1.2-1.14-2.8-.2-3.73a2.43 2.43 0 0 1 3.44 0l.36.34.34-.34a2.43 2.43 0 0 1 3.45-.01c.95.95 1 2.53-.2 3.74L17.5 21Z",key:"wpff58"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m$=U("FolderInput",[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",key:"fm4g5t"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m9 16 3-3-3-3",key:"6m91ic"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g$=U("FolderKanban",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y$=U("FolderKey",[["circle",{cx:"16",cy:"20",r:"2",key:"1vifvg"}],["path",{d:"M10 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v2",key:"3hgo9p"}],["path",{d:"m22 14-4.5 4.5",key:"1ef6z8"}],["path",{d:"m21 15 1 1",key:"1ejcpy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x$=U("FolderLock",[["rect",{width:"8",height:"5",x:"14",y:"17",rx:"1",key:"19aais"}],["path",{d:"M10 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v2.5",key:"1w6v7t"}],["path",{d:"M20 17v-2a2 2 0 1 0-4 0v2",key:"pwaxnr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v$=U("FolderMinus",[["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _$=U("FolderOpenDot",[["path",{d:"m6 14 1.45-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.55 6a2 2 0 0 1-1.94 1.5H4a2 2 0 0 1-2-2V5c0-1.1.9-2 2-2h3.93a2 2 0 0 1 1.66.9l.82 1.2a2 2 0 0 0 1.66.9H18a2 2 0 0 1 2 2v2",key:"1nmvlm"}],["circle",{cx:"14",cy:"15",r:"1",key:"1gm4qj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const My=U("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b$=U("FolderOutput",[["path",{d:"M2 7.5V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-1.5",key:"1yk7aj"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m5 10-3 3 3 3",key:"1r8ie0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s2=U("FolderPen",[["path",{d:"M2 11.5V5a2 2 0 0 1 2-2h3.9c.7 0 1.3.3 1.7.9l.8 1.2c.4.6 1 .9 1.7.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-9.5",key:"a8xqs0"}],["path",{d:"M11.378 13.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1saktj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w$=U("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j$=U("FolderRoot",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["circle",{cx:"12",cy:"13",r:"2",key:"1c1ljs"}],["path",{d:"M12 15v5",key:"11xva1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k$=U("FolderSearch2",[["circle",{cx:"11.5",cy:"12.5",r:"2.5",key:"1ea5ju"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M13.3 14.3 15 16",key:"1y4v1n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N$=U("FolderSearch",[["path",{d:"M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1",key:"1bw5m7"}],["path",{d:"m21 21-1.9-1.9",key:"1g2n9r"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S$=U("FolderSymlink",[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h7",key:"x1c07l"}],["path",{d:"m8 16 3-3-3-3",key:"rlqrt1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C$=U("FolderSync",[["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v.5",key:"1dkoa9"}],["path",{d:"M12 10v4h4",key:"1czhmt"}],["path",{d:"m12 14 1.535-1.605a5 5 0 0 1 8 1.5",key:"lvuxfi"}],["path",{d:"M22 22v-4h-4",key:"1ewp4q"}],["path",{d:"m22 18-1.535 1.605a5 5 0 0 1-8-1.5",key:"14ync0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M$=U("FolderTree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const T$=U("FolderUp",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"m9 13 3-3 3 3",key:"1pxg3c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A$=U("FolderX",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"m9.5 10.5 5 5",key:"ra9qjz"}],["path",{d:"m14.5 10.5-5 5",key:"l2rkpq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E$=U("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I$=U("Folders",[["path",{d:"M20 17a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3.9a2 2 0 0 1-1.69-.9l-.81-1.2a2 2 0 0 0-1.67-.9H8a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2Z",key:"4u7rpt"}],["path",{d:"M2 8v11a2 2 0 0 0 2 2h14",key:"1eicx1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P$=U("Footprints",[["path",{d:"M4 16v-2.38C4 11.5 2.97 10.5 3 8c.03-2.72 1.49-6 4.5-6C9.37 2 10 3.8 10 5.5c0 3.11-2 5.66-2 8.68V16a2 2 0 1 1-4 0Z",key:"1dudjm"}],["path",{d:"M20 20v-2.38c0-2.12 1.03-3.12 1-5.62-.03-2.72-1.49-6-4.5-6C14.63 6 14 7.8 14 9.5c0 3.11 2 5.66 2 8.68V20a2 2 0 1 0 4 0Z",key:"l2t8xc"}],["path",{d:"M16 17h4",key:"1dejxt"}],["path",{d:"M4 13h4",key:"1bwh8b"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L$=U("Forklift",[["path",{d:"M12 12H5a2 2 0 0 0-2 2v5",key:"7zsz91"}],["circle",{cx:"13",cy:"19",r:"2",key:"wjnkru"}],["circle",{cx:"5",cy:"19",r:"2",key:"v8kfzx"}],["path",{d:"M8 19h3m5-17v17h6M6 12V7c0-1.1.9-2 2-2h3l5 5",key:"13bk1p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O$=U("Forward",[["polyline",{points:"15 17 20 12 15 7",key:"1w3sku"}],["path",{d:"M4 18v-2a4 4 0 0 1 4-4h12",key:"jmiej9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D$=U("Frame",[["line",{x1:"22",x2:"2",y1:"6",y2:"6",key:"15w7dq"}],["line",{x1:"22",x2:"2",y1:"18",y2:"18",key:"1ip48p"}],["line",{x1:"6",x2:"6",y1:"2",y2:"22",key:"a2lnyx"}],["line",{x1:"18",x2:"18",y1:"2",y2:"22",key:"8vb6jd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R$=U("Framer",[["path",{d:"M5 16V9h14V2H5l14 14h-7m-7 0 7 7v-7m-7 0h7",key:"1a2nng"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F$=U("Frown",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M16 16s-1.5-2-4-2-4 2-4 2",key:"epbg0q"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z$=U("Fuel",[["line",{x1:"3",x2:"15",y1:"22",y2:"22",key:"xegly4"}],["line",{x1:"4",x2:"14",y1:"9",y2:"9",key:"xcnuvu"}],["path",{d:"M14 22V4a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v18",key:"16j0yd"}],["path",{d:"M14 13h2a2 2 0 0 1 2 2v2a2 2 0 0 0 2 2a2 2 0 0 0 2-2V9.83a2 2 0 0 0-.59-1.42L18 5",key:"7cu91f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B$=U("Fullscreen",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["rect",{width:"10",height:"8",x:"7",y:"8",rx:"1",key:"vys8me"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $$=U("GalleryHorizontalEnd",[["path",{d:"M2 7v10",key:"a2pl2d"}],["path",{d:"M6 5v14",key:"1kq3d7"}],["rect",{width:"12",height:"18",x:"10",y:"3",rx:"2",key:"13i7bc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U$=U("GalleryHorizontal",[["path",{d:"M2 3v18",key:"pzttux"}],["rect",{width:"12",height:"18",x:"6",y:"3",rx:"2",key:"btr8bg"}],["path",{d:"M22 3v18",key:"6jf3v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q$=U("GalleryThumbnails",[["rect",{width:"18",height:"14",x:"3",y:"3",rx:"2",key:"74y24f"}],["path",{d:"M4 21h1",key:"16zlid"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"M19 21h1",key:"edywat"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V$=U("GalleryVerticalEnd",[["path",{d:"M7 2h10",key:"nczekb"}],["path",{d:"M5 6h14",key:"u2x4p"}],["rect",{width:"18",height:"12",x:"3",y:"10",rx:"2",key:"l0tzu3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H$=U("GalleryVertical",[["path",{d:"M3 2h18",key:"15qxfx"}],["rect",{width:"18",height:"12",x:"3",y:"6",rx:"2",key:"1439r6"}],["path",{d:"M3 22h18",key:"8prr45"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W$=U("Gamepad2",[["line",{x1:"6",x2:"10",y1:"11",y2:"11",key:"1gktln"}],["line",{x1:"8",x2:"8",y1:"9",y2:"13",key:"qnk9ow"}],["line",{x1:"15",x2:"15.01",y1:"12",y2:"12",key:"krot7o"}],["line",{x1:"18",x2:"18.01",y1:"10",y2:"10",key:"1lcuu1"}],["path",{d:"M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z",key:"mfqc10"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G$=U("Gamepad",[["line",{x1:"6",x2:"10",y1:"12",y2:"12",key:"161bw2"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"15",x2:"15.01",y1:"13",y2:"13",key:"dqpgro"}],["line",{x1:"18",x2:"18.01",y1:"11",y2:"11",key:"meh2c"}],["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K$=U("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z$=U("Gavel",[["path",{d:"m14.5 12.5-8 8a2.119 2.119 0 1 1-3-3l8-8",key:"15492f"}],["path",{d:"m16 16 6-6",key:"vzrcl6"}],["path",{d:"m8 8 6-6",key:"18bi4p"}],["path",{d:"m9 7 8 8",key:"5jnvq1"}],["path",{d:"m21 11-8-8",key:"z4y7zo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y$=U("Gem",[["path",{d:"M6 3h12l4 6-10 13L2 9Z",key:"1pcd5k"}],["path",{d:"M11 3 8 9l4 13 4-13-3-6",key:"1fcu3u"}],["path",{d:"M2 9h20",key:"16fsjt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X$=U("Ghost",[["path",{d:"M9 10h.01",key:"qbtxuw"}],["path",{d:"M15 10h.01",key:"1qmjsl"}],["path",{d:"M12 2a8 8 0 0 0-8 8v12l3-3 2.5 2.5L12 19l2.5 2.5L17 19l3 3V10a8 8 0 0 0-8-8z",key:"uwwb07"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qa=U("Gift",[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q$=U("GitBranchPlus",[["path",{d:"M6 3v12",key:"qpgusn"}],["path",{d:"M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"1d02ji"}],["path",{d:"M6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"chk6ph"}],["path",{d:"M15 6a9 9 0 0 0-9 9",key:"or332x"}],["path",{d:"M18 15v6",key:"9wciyi"}],["path",{d:"M21 18h-6",key:"139f0c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J$=U("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i2=U("GitCommitHorizontal",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eU=U("GitCommitVertical",[["path",{d:"M12 3v6",key:"1holv5"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M12 15v6",key:"a9ows0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tU=U("GitCompareArrows",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"M12 18H7a2 2 0 0 1-2-2V9",key:"16sdep"}],["path",{d:"m9 15 3 3-3 3",key:"1m3kbl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rU=U("GitCompare",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nU=U("GitFork",[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sU=U("GitGraph",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M5 9v6",key:"158jrl"}],["circle",{cx:"5",cy:"18",r:"3",key:"104gr9"}],["path",{d:"M12 3v18",key:"108xh3"}],["circle",{cx:"19",cy:"6",r:"3",key:"108a5v"}],["path",{d:"M16 15.7A9 9 0 0 0 19 9",key:"1e3vqb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iU=U("GitMerge",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aU=U("GitPullRequestArrow",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M5 9v12",key:"ih889a"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oU=U("GitPullRequestClosed",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 9v12",key:"1sc30k"}],["path",{d:"m21 3-6 6",key:"16nqsk"}],["path",{d:"m21 9-6-6",key:"9j17rh"}],["path",{d:"M18 11.5V15",key:"65xf6f"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lU=U("GitPullRequestCreateArrow",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M5 9v12",key:"ih889a"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v3",key:"1rbwk6"}],["path",{d:"M19 15v6",key:"10aioa"}],["path",{d:"M22 18h-6",key:"1d5gi5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cU=U("GitPullRequestCreate",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 9v12",key:"1sc30k"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v3",key:"1jb6z3"}],["path",{d:"M18 15v6",key:"9wciyi"}],["path",{d:"M21 18h-6",key:"139f0c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dU=U("GitPullRequestDraft",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M18 6V5",key:"1oao2s"}],["path",{d:"M18 11v-1",key:"11c8tz"}],["line",{x1:"6",x2:"6",y1:"9",y2:"21",key:"rroup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uU=U("GitPullRequest",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["line",{x1:"6",x2:"6",y1:"9",y2:"21",key:"rroup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hU=U("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fU=U("Gitlab",[["path",{d:"m22 13.29-3.33-10a.42.42 0 0 0-.14-.18.38.38 0 0 0-.22-.11.39.39 0 0 0-.23.07.42.42 0 0 0-.14.18l-2.26 6.67H8.32L6.1 3.26a.42.42 0 0 0-.1-.18.38.38 0 0 0-.26-.08.39.39 0 0 0-.23.07.42.42 0 0 0-.14.18L2 13.29a.74.74 0 0 0 .27.83L12 21l9.69-6.88a.71.71 0 0 0 .31-.83Z",key:"148pdi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pU=U("GlassWater",[["path",{d:"M5.116 4.104A1 1 0 0 1 6.11 3h11.78a1 1 0 0 1 .994 1.105L17.19 20.21A2 2 0 0 1 15.2 22H8.8a2 2 0 0 1-2-1.79z",key:"p55z4y"}],["path",{d:"M6 12a5 5 0 0 1 6 0 5 5 0 0 0 6 0",key:"mjntcy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mU=U("Glasses",[["circle",{cx:"6",cy:"15",r:"4",key:"vux9w4"}],["circle",{cx:"18",cy:"15",r:"4",key:"18o8ve"}],["path",{d:"M14 15a2 2 0 0 0-2-2 2 2 0 0 0-2 2",key:"1ag4bs"}],["path",{d:"M2.5 13 5 7c.7-1.3 1.4-2 3-2",key:"1hm1gs"}],["path",{d:"M21.5 13 19 7c-.7-1.3-1.5-2-3-2",key:"1r31ai"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gU=U("GlobeLock",[["path",{d:"M15.686 15A14.5 14.5 0 0 1 12 22a14.5 14.5 0 0 1 0-20 10 10 0 1 0 9.542 13",key:"qkt0x6"}],["path",{d:"M2 12h8.5",key:"ovaggd"}],["path",{d:"M20 6V4a2 2 0 1 0-4 0v2",key:"1of5e8"}],["rect",{width:"8",height:"5",x:"14",y:"6",rx:"1",key:"1fmf51"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OS=U("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yU=U("Goal",[["path",{d:"M12 13V2l8 4-8 4",key:"5wlwwj"}],["path",{d:"M20.561 10.222a9 9 0 1 1-12.55-5.29",key:"1c0wjv"}],["path",{d:"M8.002 9.997a5 5 0 1 0 8.9 2.02",key:"gb1g7m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xU=U("Grab",[["path",{d:"M18 11.5V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1.4",key:"edstyy"}],["path",{d:"M14 10V8a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"19wdwo"}],["path",{d:"M10 9.9V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v5",key:"1lugqo"}],["path",{d:"M6 14a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1hbeus"}],["path",{d:"M18 11a2 2 0 1 1 4 0v3a8 8 0 0 1-8 8h-4a8 8 0 0 1-8-8 2 2 0 1 1 4 0",key:"1etffm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W0=U("GraduationCap",[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vU=U("Grape",[["path",{d:"M22 5V2l-5.89 5.89",key:"1eenpo"}],["circle",{cx:"16.6",cy:"15.89",r:"3",key:"xjtalx"}],["circle",{cx:"8.11",cy:"7.4",r:"3",key:"u2fv6i"}],["circle",{cx:"12.35",cy:"11.65",r:"3",key:"i6i8g7"}],["circle",{cx:"13.91",cy:"5.85",r:"3",key:"6ye0dv"}],["circle",{cx:"18.15",cy:"10.09",r:"3",key:"snx9no"}],["circle",{cx:"6.56",cy:"13.2",r:"3",key:"17x4xg"}],["circle",{cx:"10.8",cy:"17.44",r:"3",key:"1hogw9"}],["circle",{cx:"5",cy:"19",r:"3",key:"1sn6vo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _U=U("Grid2x2Check",[["path",{d:"M12 3v17a1 1 0 0 1-1 1H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6a1 1 0 0 1-1 1H3",key:"11za1p"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a2=U("Grid2x2Plus",[["path",{d:"M12 3v17a1 1 0 0 1-1 1H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6a1 1 0 0 1-1 1H3",key:"11za1p"}],["path",{d:"M16 19h6",key:"xwg31i"}],["path",{d:"M19 22v-6",key:"qhmiwi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bU=U("Grid2x2X",[["path",{d:"M12 3v17a1 1 0 0 1-1 1H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6a1 1 0 0 1-1 1H3",key:"11za1p"}],["path",{d:"m16 16 5 5",key:"8tpb07"}],["path",{d:"m16 21 5-5",key:"193jll"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o2=U("Grid2x2",[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 12h18",key:"1i2n21"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Th=U("Grid3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wU=U("GripHorizontal",[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DS=U("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jU=U("Grip",[["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"19",cy:"5",r:"1",key:"w8mnmm"}],["circle",{cx:"5",cy:"5",r:"1",key:"lttvr7"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}],["circle",{cx:"19",cy:"19",r:"1",key:"shf9b7"}],["circle",{cx:"5",cy:"19",r:"1",key:"bfqh0e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kU=U("Group",[["path",{d:"M3 7V5c0-1.1.9-2 2-2h2",key:"adw53z"}],["path",{d:"M17 3h2c1.1 0 2 .9 2 2v2",key:"an4l38"}],["path",{d:"M21 17v2c0 1.1-.9 2-2 2h-2",key:"144t0e"}],["path",{d:"M7 21H5c-1.1 0-2-.9-2-2v-2",key:"rtnfgi"}],["rect",{width:"7",height:"5",x:"7",y:"7",rx:"1",key:"1eyiv7"}],["rect",{width:"7",height:"5",x:"10",y:"12",rx:"1",key:"1qlmkx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NU=U("Guitar",[["path",{d:"m11.9 12.1 4.514-4.514",key:"109xqo"}],["path",{d:"M20.1 2.3a1 1 0 0 0-1.4 0l-1.114 1.114A2 2 0 0 0 17 4.828v1.344a2 2 0 0 1-.586 1.414A2 2 0 0 1 17.828 7h1.344a2 2 0 0 0 1.414-.586L21.7 5.3a1 1 0 0 0 0-1.4z",key:"txyc8t"}],["path",{d:"m6 16 2 2",key:"16qmzd"}],["path",{d:"M8.2 9.9C8.7 8.8 9.8 8 11 8c2.8 0 5 2.2 5 5 0 1.2-.8 2.3-1.9 2.8l-.9.4A2 2 0 0 0 12 18a4 4 0 0 1-4 4c-3.3 0-6-2.7-6-6a4 4 0 0 1 4-4 2 2 0 0 0 1.8-1.2z",key:"1u8q3z"}],["circle",{cx:"11.5",cy:"12.5",r:".5",fill:"currentColor",key:"16onso"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SU=U("Ham",[["path",{d:"M13.144 21.144A7.274 10.445 45 1 0 2.856 10.856",key:"1k1t7q"}],["path",{d:"M13.144 21.144A7.274 4.365 45 0 0 2.856 10.856a7.274 4.365 45 0 0 10.288 10.288",key:"153t1g"}],["path",{d:"M16.565 10.435 18.6 8.4a2.501 2.501 0 1 0 1.65-4.65 2.5 2.5 0 1 0-4.66 1.66l-2.024 2.025",key:"gzrt0n"}],["path",{d:"m8.5 16.5-1-1",key:"otr954"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CU=U("Hammer",[["path",{d:"m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9",key:"eefl8a"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"b7pghm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MU=U("HandCoins",[["path",{d:"M11 15h2a2 2 0 1 0 0-4h-3c-.6 0-1.1.2-1.4.6L3 17",key:"geh8rc"}],["path",{d:"m7 21 1.6-1.4c.3-.4.8-.6 1.4-.6h4c1.1 0 2.1-.4 2.8-1.2l4.6-4.4a2 2 0 0 0-2.75-2.91l-4.2 3.9",key:"1fto5m"}],["path",{d:"m2 16 6 6",key:"1pfhp9"}],["circle",{cx:"16",cy:"9",r:"2.9",key:"1n0dlu"}],["circle",{cx:"6",cy:"5",r:"3",key:"151irh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TU=U("HandHeart",[["path",{d:"M11 14h2a2 2 0 1 0 0-4h-3c-.6 0-1.1.2-1.4.6L3 16",key:"1ifwr1"}],["path",{d:"m7 20 1.6-1.4c.3-.4.8-.6 1.4-.6h4c1.1 0 2.1-.4 2.8-1.2l4.6-4.4a2 2 0 0 0-2.75-2.91l-4.2 3.9",key:"17abbs"}],["path",{d:"m2 15 6 6",key:"10dquu"}],["path",{d:"M19.5 8.5c.7-.7 1.5-1.6 1.5-2.7A2.73 2.73 0 0 0 16 4a2.78 2.78 0 0 0-5 1.8c0 1.2.8 2 1.5 2.8L16 12Z",key:"1h3036"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l2=U("HandHelping",[["path",{d:"M11 12h2a2 2 0 1 0 0-4h-3c-.6 0-1.1.2-1.4.6L3 14",key:"1j4xps"}],["path",{d:"m7 18 1.6-1.4c.3-.4.8-.6 1.4-.6h4c1.1 0 2.1-.4 2.8-1.2l4.6-4.4a2 2 0 0 0-2.75-2.91l-4.2 3.9",key:"uospg8"}],["path",{d:"m2 13 6 6",key:"16e5sb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AU=U("HandMetal",[["path",{d:"M18 12.5V10a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1.4",key:"wc6myp"}],["path",{d:"M14 11V9a2 2 0 1 0-4 0v2",key:"94qvcw"}],["path",{d:"M10 10.5V5a2 2 0 1 0-4 0v9",key:"m1ah89"}],["path",{d:"m7 15-1.76-1.76a2 2 0 0 0-2.83 2.82l3.6 3.6C7.5 21.14 9.2 22 12 22h2a8 8 0 0 0 8-8V7a2 2 0 1 0-4 0v5",key:"t1skq1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EU=U("HandPlatter",[["path",{d:"M12 3V2",key:"ar7q03"}],["path",{d:"m15.4 17.4 3.2-2.8a2 2 0 1 1 2.8 2.9l-3.6 3.3c-.7.8-1.7 1.2-2.8 1.2h-4c-1.1 0-2.1-.4-2.8-1.2l-1.302-1.464A1 1 0 0 0 6.151 19H5",key:"n2g93r"}],["path",{d:"M2 14h12a2 2 0 0 1 0 4h-2",key:"1o2jem"}],["path",{d:"M4 10h16",key:"img6z1"}],["path",{d:"M5 10a7 7 0 0 1 14 0",key:"1ega1o"}],["path",{d:"M5 14v6a1 1 0 0 1-1 1H2",key:"1hescx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IU=U("Hand",[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PU=U("Handshake",[["path",{d:"m11 17 2 2a1 1 0 1 0 3-3",key:"efffak"}],["path",{d:"m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4",key:"9pr0kb"}],["path",{d:"m21 3 1 11h-2",key:"1tisrp"}],["path",{d:"M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3",key:"1uvwmv"}],["path",{d:"M3 4h8",key:"1ep09j"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LU=U("HardDriveDownload",[["path",{d:"M12 2v8",key:"1q4o3n"}],["path",{d:"m16 6-4 4-4-4",key:"6wukr"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 18h.01",key:"h775k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OU=U("HardDriveUpload",[["path",{d:"m16 6-4-4-4 4",key:"13yo43"}],["path",{d:"M12 2v8",key:"1q4o3n"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 18h.01",key:"h775k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cT=U("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DU=U("HardHat",[["path",{d:"M10 10V5a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v5",key:"1p9q5i"}],["path",{d:"M14 6a6 6 0 0 1 6 6v3",key:"1hnv84"}],["path",{d:"M4 15v-3a6 6 0 0 1 6-6",key:"9ciidu"}],["rect",{x:"2",y:"15",width:"20",height:"4",rx:"1",key:"g3x8cw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RS=U("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RU=U("Haze",[["path",{d:"m5.2 6.2 1.4 1.4",key:"17imol"}],["path",{d:"M2 13h2",key:"13gyu8"}],["path",{d:"M20 13h2",key:"16rner"}],["path",{d:"m17.4 7.6 1.4-1.4",key:"t4xlah"}],["path",{d:"M22 17H2",key:"1gtaj3"}],["path",{d:"M22 21H2",key:"1gy6en"}],["path",{d:"M16 13a4 4 0 0 0-8 0",key:"1dyczq"}],["path",{d:"M12 5V2.5",key:"1vytko"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FU=U("HdmiPort",[["path",{d:"M22 9a1 1 0 0 0-1-1H3a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1h1l2 2h12l2-2h1a1 1 0 0 0 1-1Z",key:"2128wb"}],["path",{d:"M7.5 12h9",key:"1t0ckc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dT=U("Heading1",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uT=U("Heading2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zU=U("Heading3",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BU=U("Heading4",[["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17 10v3a1 1 0 0 0 1 1h3",key:"tj5zdr"}],["path",{d:"M21 10v8",key:"1kdml4"}],["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $U=U("Heading5",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17 13v-3h4",key:"1nvgqp"}],["path",{d:"M17 17.7c.4.2.8.3 1.3.3 1.5 0 2.7-1.1 2.7-2.5S19.8 13 18.3 13H17",key:"2nebdn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UU=U("Heading6",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["circle",{cx:"19",cy:"16",r:"2",key:"15mx69"}],["path",{d:"M20 10c-2 2-3 3.5-3 6",key:"f35dl0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qU=U("Heading",[["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M6 20V4",key:"1w1bmo"}],["path",{d:"M18 20V4",key:"o2hl4u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VU=U("HeadphoneOff",[["path",{d:"M21 14h-1.343",key:"1jdnxi"}],["path",{d:"M9.128 3.47A9 9 0 0 1 21 12v3.343",key:"6kipu2"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M20.414 20.414A2 2 0 0 1 19 21h-1a2 2 0 0 1-2-2v-3",key:"9x50f4"}],["path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 2.636-6.364",key:"1bkxnm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HU=U("Headphones",[["path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3",key:"1xhozi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WU=U("Headset",[["path",{d:"M3 11h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-5Zm0 0a9 9 0 1 1 18 0m0 0v5a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3Z",key:"12oyoe"}],["path",{d:"M21 16v2a4 4 0 0 1-4 4h-5",key:"1x7m43"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GU=U("HeartCrack",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}],["path",{d:"m12 13-1-1 2-2-3-3 2-2",key:"xjdxli"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KU=U("HeartHandshake",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}],["path",{d:"M12 5 9.04 7.96a2.17 2.17 0 0 0 0 3.08c.82.82 2.13.85 3 .07l2.07-1.9a2.82 2.82 0 0 1 3.79 0l2.96 2.66",key:"4oyue0"}],["path",{d:"m18 15-2-2",key:"60u0ii"}],["path",{d:"m15 18-2-2",key:"6p76be"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZU=U("HeartOff",[["line",{x1:"2",y1:"2",x2:"22",y2:"22",key:"1w4vcy"}],["path",{d:"M16.5 16.5 12 21l-7-7c-1.5-1.45-3-3.2-3-5.5a5.5 5.5 0 0 1 2.14-4.35",key:"3mpagl"}],["path",{d:"M8.76 3.1c1.15.22 2.13.78 3.24 1.9 1.5-1.5 2.74-2 4.5-2A5.5 5.5 0 0 1 22 8.5c0 2.12-1.3 3.78-2.67 5.17",key:"1gh3v3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YU=U("HeartPulse",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}],["path",{d:"M3.22 12H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27",key:"1uw2ng"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ql=U("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XU=U("Heater",[["path",{d:"M11 8c2-3-2-3 0-6",key:"1ldv5m"}],["path",{d:"M15.5 8c2-3-2-3 0-6",key:"1otqoz"}],["path",{d:"M6 10h.01",key:"1lbq93"}],["path",{d:"M6 14h.01",key:"zudwn7"}],["path",{d:"M10 16v-4",key:"1c25yv"}],["path",{d:"M14 16v-4",key:"1dkbt8"}],["path",{d:"M18 16v-4",key:"1yg9me"}],["path",{d:"M20 6a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h3",key:"1ubg90"}],["path",{d:"M5 20v2",key:"1abpe8"}],["path",{d:"M19 20v2",key:"kqn6ft"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QU=U("Hexagon",[["path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JU=U("Highlighter",[["path",{d:"m9 11-6 6v3h9l3-3",key:"1a3l36"}],["path",{d:"m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4",key:"14a9rk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FS=U("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eq=U("HopOff",[["path",{d:"M10.82 16.12c1.69.6 3.91.79 5.18.85.28.01.53-.09.7-.27",key:"qyzcap"}],["path",{d:"M11.14 20.57c.52.24 2.44 1.12 4.08 1.37.46.06.86-.25.9-.71.12-1.52-.3-3.43-.5-4.28",key:"y078lb"}],["path",{d:"M16.13 21.05c1.65.63 3.68.84 4.87.91a.9.9 0 0 0 .7-.26",key:"1utre3"}],["path",{d:"M17.99 5.52a20.83 20.83 0 0 1 3.15 4.5.8.8 0 0 1-.68 1.13c-1.17.1-2.5.02-3.9-.25",key:"17o9hm"}],["path",{d:"M20.57 11.14c.24.52 1.12 2.44 1.37 4.08.04.3-.08.59-.31.75",key:"1d1n4p"}],["path",{d:"M4.93 4.93a10 10 0 0 0-.67 13.4c.35.43.96.4 1.17-.12.69-1.71 1.07-5.07 1.07-6.71 1.34.45 3.1.9 4.88.62a.85.85 0 0 0 .48-.24",key:"9uv3tt"}],["path",{d:"M5.52 17.99c1.05.95 2.91 2.42 4.5 3.15a.8.8 0 0 0 1.13-.68c.2-2.34-.33-5.3-1.57-8.28",key:"1292wz"}],["path",{d:"M8.35 2.68a10 10 0 0 1 9.98 1.58c.43.35.4.96-.12 1.17-1.5.6-4.3.98-6.07 1.05",key:"7ozu9p"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tq=U("Hop",[["path",{d:"M10.82 16.12c1.69.6 3.91.79 5.18.85.55.03 1-.42.97-.97-.06-1.27-.26-3.5-.85-5.18",key:"18lxf1"}],["path",{d:"M11.5 6.5c1.64 0 5-.38 6.71-1.07.52-.2.55-.82.12-1.17A10 10 0 0 0 4.26 18.33c.35.43.96.4 1.17-.12.69-1.71 1.07-5.07 1.07-6.71 1.34.45 3.1.9 4.88.62a.88.88 0 0 0 .73-.74c.3-2.14-.15-3.5-.61-4.88",key:"vtfxrw"}],["path",{d:"M15.62 16.95c.2.85.62 2.76.5 4.28a.77.77 0 0 1-.9.7 16.64 16.64 0 0 1-4.08-1.36",key:"13hl71"}],["path",{d:"M16.13 21.05c1.65.63 3.68.84 4.87.91a.9.9 0 0 0 .96-.96 17.68 17.68 0 0 0-.9-4.87",key:"1sl8oj"}],["path",{d:"M16.94 15.62c.86.2 2.77.62 4.29.5a.77.77 0 0 0 .7-.9 16.64 16.64 0 0 0-1.36-4.08",key:"19c6kt"}],["path",{d:"M17.99 5.52a20.82 20.82 0 0 1 3.15 4.5.8.8 0 0 1-.68 1.13c-2.33.2-5.3-.32-8.27-1.57",key:"85ghs3"}],["path",{d:"M4.93 4.93 3 3a.7.7 0 0 1 0-1",key:"x087yj"}],["path",{d:"M9.58 12.18c1.24 2.98 1.77 5.95 1.57 8.28a.8.8 0 0 1-1.13.68 20.82 20.82 0 0 1-4.5-3.15",key:"11xdqo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rq=U("Hospital",[["path",{d:"M12 6v4",key:"16clxf"}],["path",{d:"M14 14h-4",key:"esezmu"}],["path",{d:"M14 18h-4",key:"16mqa2"}],["path",{d:"M14 8h-4",key:"z8ypaz"}],["path",{d:"M18 12h2a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-9a2 2 0 0 1 2-2h2",key:"b1k337"}],["path",{d:"M18 22V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v18",key:"16g51d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nq=U("Hotel",[["path",{d:"M10 22v-6.57",key:"1wmca3"}],["path",{d:"M12 11h.01",key:"z322tv"}],["path",{d:"M12 7h.01",key:"1ivr5q"}],["path",{d:"M14 15.43V22",key:"1q2vjd"}],["path",{d:"M15 16a5 5 0 0 0-6 0",key:"o9wqvi"}],["path",{d:"M16 11h.01",key:"xkw8gn"}],["path",{d:"M16 7h.01",key:"1kdx03"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 7h.01",key:"1vti4s"}],["rect",{x:"4",y:"2",width:"16",height:"20",rx:"2",key:"1uxh74"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sq=U("Hourglass",[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iq=U("HousePlug",[["path",{d:"M10 12V8.964",key:"1vll13"}],["path",{d:"M14 12V8.964",key:"1x3qvg"}],["path",{d:"M15 12a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2v-2a1 1 0 0 1 1-1z",key:"ppykja"}],["path",{d:"M8.5 21H5a2 2 0 0 1-2-2v-9a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2h-5a2 2 0 0 1-2-2v-2",key:"1gvg2z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aq=U("HousePlus",[["path",{d:"M13.22 2.416a2 2 0 0 0-2.511.057l-7 5.999A2 2 0 0 0 3 10v9a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7.354",key:"5phn05"}],["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M15 6h6",key:"1jlkvy"}],["path",{d:"M18 3v6",key:"x1uolp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Hi=U("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c2=U("IceCreamBowl",[["path",{d:"M12 17c5 0 8-2.69 8-6H4c0 3.31 3 6 8 6m-4 4h8m-4-3v3M5.14 11a3.5 3.5 0 1 1 6.71 0",key:"1uxfcu"}],["path",{d:"M12.14 11a3.5 3.5 0 1 1 6.71 0",key:"4k3m1s"}],["path",{d:"M15.5 6.5a3.5 3.5 0 1 0-7 0",key:"zmuahr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d2=U("IceCreamCone",[["path",{d:"m7 11 4.08 10.35a1 1 0 0 0 1.84 0L17 11",key:"1v6356"}],["path",{d:"M17 7A5 5 0 0 0 7 7",key:"151p3v"}],["path",{d:"M17 7a2 2 0 0 1 0 4H7a2 2 0 0 1 0-4",key:"1sdaij"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oq=U("IdCard",[["path",{d:"M16 10h2",key:"8sgtl7"}],["path",{d:"M16 14h2",key:"epxaof"}],["path",{d:"M6.17 15a3 3 0 0 1 5.66 0",key:"n6f512"}],["circle",{cx:"9",cy:"11",r:"2",key:"yxgjnd"}],["rect",{x:"2",y:"5",width:"20",height:"14",rx:"2",key:"qneu4z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lq=U("ImageDown",[["path",{d:"M10.3 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10l-3.1-3.1a2 2 0 0 0-2.814.014L6 21",key:"9csbqa"}],["path",{d:"m14 19 3 3v-5.5",key:"9ldu5r"}],["path",{d:"m17 22 3-3",key:"1nkfve"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cq=U("ImageMinus",[["path",{d:"M21 9v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7",key:"m87ecr"}],["line",{x1:"16",x2:"22",y1:"5",y2:"5",key:"ez7e4s"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dq=U("ImageOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M10.41 10.41a2 2 0 1 1-2.83-2.83",key:"1bzlo9"}],["line",{x1:"13.5",x2:"6",y1:"13.5",y2:"21",key:"1q0aeu"}],["line",{x1:"18",x2:"21",y1:"12",y2:"15",key:"5mozeu"}],["path",{d:"M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59",key:"mmje98"}],["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uq=U("ImagePlay",[["path",{d:"m11 16-5 5",key:"j5f7ct"}],["path",{d:"M11 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6.5",key:"7s81lt"}],["path",{d:"M15.765 22a.5.5 0 0 1-.765-.424V13.38a.5.5 0 0 1 .765-.424l5.878 3.674a1 1 0 0 1 0 1.696z",key:"1omb6s"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zS=U("ImagePlus",[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hq=U("ImageUp",[["path",{d:"M10.3 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10l-3.1-3.1a2 2 0 0 0-2.814.014L6 21",key:"9csbqa"}],["path",{d:"m14 19.5 3-3 3 3",key:"9vmjn0"}],["path",{d:"M17 22v-5.5",key:"1aa6fl"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fq=U("ImageUpscale",[["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M17 21h2a2 2 0 0 0 2-2",key:"130fy9"}],["path",{d:"M21 12v3",key:"1wzk3p"}],["path",{d:"m21 3-5 5",key:"1g5oa7"}],["path",{d:"M3 7V5a2 2 0 0 1 2-2",key:"kk3yz1"}],["path",{d:"m5 21 4.144-4.144a1.21 1.21 0 0 1 1.712 0L13 19",key:"fyekpt"}],["path",{d:"M9 3h3",key:"d52fa"}],["rect",{x:"3",y:"11",width:"10",height:"10",rx:"1",key:"1wpmix"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wo=U("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pq=U("Images",[["path",{d:"M18 22H4a2 2 0 0 1-2-2V6",key:"pblm9e"}],["path",{d:"m22 13-1.296-1.296a2.41 2.41 0 0 0-3.408 0L11 18",key:"nf6bnh"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["rect",{width:"16",height:"16",x:"6",y:"2",rx:"2",key:"12espp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mq=U("Import",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m8 11 4 4 4-4",key:"1dohi6"}],["path",{d:"M8 5H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-4",key:"1ywtjm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gq=U("Inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u2=U("IndentDecrease",[["path",{d:"M21 12H11",key:"wd7e0v"}],["path",{d:"M21 18H11",key:"4wu86t"}],["path",{d:"M21 6H11",key:"6dy1d6"}],["path",{d:"m7 8-4 4 4 4",key:"o5hrat"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h2=U("IndentIncrease",[["path",{d:"M21 12H11",key:"wd7e0v"}],["path",{d:"M21 18H11",key:"4wu86t"}],["path",{d:"M21 6H11",key:"6dy1d6"}],["path",{d:"m3 8 4 4-4 4",key:"1a3j6y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yq=U("IndianRupee",[["path",{d:"M6 3h12",key:"ggurg9"}],["path",{d:"M6 8h12",key:"6g4wlu"}],["path",{d:"m6 13 8.5 8",key:"u1kupk"}],["path",{d:"M6 13h3",key:"wdp6ag"}],["path",{d:"M9 13c6.667 0 6.667-10 0-10",key:"1nkvk2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xq=U("Infinity",[["path",{d:"M12 12c-2-2.67-4-4-6-4a4 4 0 1 0 0 8c2 0 4-1.33 6-4Zm0 0c2 2.67 4 4 6 4a4 4 0 0 0 0-8c-2 0-4 1.33-6 4Z",key:"1z0uae"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vq=U("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _q=U("InspectionPanel",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 7h.01",key:"7u93v4"}],["path",{d:"M17 7h.01",key:"14a9sn"}],["path",{d:"M7 17h.01",key:"19xn7k"}],["path",{d:"M17 17h.01",key:"1sd3ek"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wd=U("Instagram",[["rect",{width:"20",height:"20",x:"2",y:"2",rx:"5",ry:"5",key:"2e1cvw"}],["path",{d:"M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z",key:"9exkf1"}],["line",{x1:"17.5",x2:"17.51",y1:"6.5",y2:"6.5",key:"r4j83e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BS=U("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bq=U("IterationCcw",[["path",{d:"M20 10c0-4.4-3.6-8-8-8s-8 3.6-8 8 3.6 8 8 8h8",key:"4znkd0"}],["polyline",{points:"16 14 20 18 16 22",key:"11njsm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wq=U("IterationCw",[["path",{d:"M4 10c0-4.4 3.6-8 8-8s8 3.6 8 8-3.6 8-8 8H4",key:"tuf4su"}],["polyline",{points:"8 22 4 18 8 14",key:"evkj9s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jq=U("JapaneseYen",[["path",{d:"M12 9.5V21m0-11.5L6 3m6 6.5L18 3",key:"2ej80x"}],["path",{d:"M6 15h12",key:"1hwgt5"}],["path",{d:"M6 11h12",key:"wf4gp6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kq=U("Joystick",[["path",{d:"M21 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-2Z",key:"jg2n2t"}],["path",{d:"M6 15v-2",key:"gd6mvg"}],["path",{d:"M12 15V9",key:"8c7uyn"}],["circle",{cx:"12",cy:"6",r:"3",key:"1gm2ql"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G0=U("Kanban",[["path",{d:"M6 5v11",key:"mdvv1e"}],["path",{d:"M12 5v6",key:"14ar3b"}],["path",{d:"M18 5v14",key:"7ji314"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vw=U("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Nq=U("KeySquare",[["path",{d:"M12.4 2.7a2.5 2.5 0 0 1 3.4 0l5.5 5.5a2.5 2.5 0 0 1 0 3.4l-3.7 3.7a2.5 2.5 0 0 1-3.4 0L8.7 9.8a2.5 2.5 0 0 1 0-3.4z",key:"165ttr"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"m9.4 10.6-6.814 6.814A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814",key:"1ubxi2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hT=U("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sq=U("KeyboardMusic",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M6 8h4",key:"utf9t1"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"M6 12v4",key:"dy92yo"}],["path",{d:"M10 12v4",key:"1fxnav"}],["path",{d:"M14 12v4",key:"1hft58"}],["path",{d:"M18 12v4",key:"tjjnbz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Cq=U("KeyboardOff",[["path",{d:"M 20 4 A2 2 0 0 1 22 6",key:"1g1fkt"}],["path",{d:"M 22 6 L 22 16.41",key:"1qjg3w"}],["path",{d:"M 7 16 L 16 16",key:"n0yqwb"}],["path",{d:"M 9.69 4 L 20 4",key:"kbpcgx"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M20 20H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2",key:"s23sx2"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M8 12h.01",key:"czm47f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mq=U("Keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Tq=U("LampCeiling",[["path",{d:"M12 2v5",key:"nd4vlx"}],["path",{d:"M6 7h12l4 9H2l4-9Z",key:"123d64"}],["path",{d:"M9.17 16a3 3 0 1 0 5.66 0",key:"1061mw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Aq=U("LampDesk",[["path",{d:"m14 5-3 3 2 7 8-8-7-2Z",key:"1b0msb"}],["path",{d:"m14 5-3 3-3-3 3-3 3 3Z",key:"1uemms"}],["path",{d:"M9.5 6.5 4 12l3 6",key:"1bx08v"}],["path",{d:"M3 22v-2c0-1.1.9-2 2-2h4a2 2 0 0 1 2 2v2H3Z",key:"wap775"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Eq=U("LampFloor",[["path",{d:"M9 2h6l3 7H6l3-7Z",key:"wcx6mj"}],["path",{d:"M12 9v13",key:"3n1su1"}],["path",{d:"M9 22h6",key:"1rlq3v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Iq=U("LampWallDown",[["path",{d:"M11 13h6l3 7H8l3-7Z",key:"9n3qlo"}],["path",{d:"M14 13V8a2 2 0 0 0-2-2H8",key:"1hu4hb"}],["path",{d:"M4 9h2a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2H4v6Z",key:"s053bc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pq=U("LampWallUp",[["path",{d:"M11 4h6l3 7H8l3-7Z",key:"11x1ee"}],["path",{d:"M14 11v5a2 2 0 0 1-2 2H8",key:"eutp5o"}],["path",{d:"M4 15h2a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2H4v-6Z",key:"1iuthr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lq=U("Lamp",[["path",{d:"M8 2h8l4 10H4L8 2Z",key:"9dma5w"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M8 22v-2c0-1.1.9-2 2-2h4a2 2 0 0 1 2 2v2H8Z",key:"mwf4oh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Oq=U("LandPlot",[["path",{d:"m12 8 6-3-6-3v10",key:"mvpnpy"}],["path",{d:"m8 11.99-5.5 3.14a1 1 0 0 0 0 1.74l8.5 4.86a2 2 0 0 0 2 0l8.5-4.86a1 1 0 0 0 0-1.74L16 12",key:"ek95tt"}],["path",{d:"m6.49 12.85 11.02 6.3",key:"1kt42w"}],["path",{d:"M17.51 12.85 6.5 19.15",key:"v55bdg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Dq=U("Landmark",[["line",{x1:"3",x2:"21",y1:"22",y2:"22",key:"j8o0r"}],["line",{x1:"6",x2:"6",y1:"18",y2:"11",key:"10tf0k"}],["line",{x1:"10",x2:"10",y1:"18",y2:"11",key:"54lgf6"}],["line",{x1:"14",x2:"14",y1:"18",y2:"11",key:"380y"}],["line",{x1:"18",x2:"18",y1:"18",y2:"11",key:"1kevvc"}],["polygon",{points:"12 2 20 7 4 7",key:"jkujk7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rq=U("Languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fq=U("LaptopMinimalCheck",[["path",{d:"M2 20h20",key:"owomy5"}],["path",{d:"m9 10 2 2 4-4",key:"1gnqz4"}],["rect",{x:"3",y:"4",width:"18",height:"12",rx:"2",key:"8ur36m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f2=U("LaptopMinimal",[["rect",{width:"18",height:"12",x:"3",y:"4",rx:"2",ry:"2",key:"1qhy41"}],["line",{x1:"2",x2:"22",y1:"20",y2:"20",key:"ni3hll"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zq=U("Laptop",[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bq=U("LassoSelect",[["path",{d:"M7 22a5 5 0 0 1-2-4",key:"umushi"}],["path",{d:"M7 16.93c.96.43 1.96.74 2.99.91",key:"ybbtv3"}],["path",{d:"M3.34 14A6.8 6.8 0 0 1 2 10c0-4.42 4.48-8 10-8s10 3.58 10 8a7.19 7.19 0 0 1-.33 2",key:"gt5e1w"}],["path",{d:"M5 18a2 2 0 1 0 0-4 2 2 0 0 0 0 4z",key:"bq3ynw"}],["path",{d:"M14.33 22h-.09a.35.35 0 0 1-.24-.32v-10a.34.34 0 0 1 .33-.34c.08 0 .15.03.21.08l7.34 6a.33.33 0 0 1-.21.59h-4.49l-2.57 3.85a.35.35 0 0 1-.28.14z",key:"72q637"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $q=U("Lasso",[["path",{d:"M7 22a5 5 0 0 1-2-4",key:"umushi"}],["path",{d:"M3.3 14A6.8 6.8 0 0 1 2 10c0-4.4 4.5-8 10-8s10 3.6 10 8-4.5 8-10 8a12 12 0 0 1-5-1",key:"146dds"}],["path",{d:"M5 18a2 2 0 1 0 0-4 2 2 0 0 0 0 4z",key:"bq3ynw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Uq=U("Laugh",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M18 13a6 6 0 0 1-6 5 6 6 0 0 1-6-5h12Z",key:"b2q4dd"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qq=U("Layers2",[["path",{d:"m16.02 12 5.48 3.13a1 1 0 0 1 0 1.74L13 21.74a2 2 0 0 1-2 0l-8.5-4.87a1 1 0 0 1 0-1.74L7.98 12",key:"1cuww1"}],["path",{d:"M13 13.74a2 2 0 0 1-2 0L2.5 8.87a1 1 0 0 1 0-1.74L11 2.26a2 2 0 0 1 2 0l8.5 4.87a1 1 0 0 1 0 1.74Z",key:"pdlvxu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vq=U("Layers3",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m6.08 9.5-3.5 1.6a1 1 0 0 0 0 1.81l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9a1 1 0 0 0 0-1.83l-3.5-1.59",key:"1e5n1m"}],["path",{d:"m6.08 14.5-3.5 1.6a1 1 0 0 0 0 1.81l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9a1 1 0 0 0 0-1.83l-3.5-1.59",key:"1iwflc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Hq=U("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $S=U("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lg=U("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wq=U("LayoutList",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}],["path",{d:"M14 4h7",key:"3xa0d5"}],["path",{d:"M14 9h7",key:"1icrd9"}],["path",{d:"M14 15h7",key:"1mj8o2"}],["path",{d:"M14 20h7",key:"11slyb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gq=U("LayoutPanelLeft",[["rect",{width:"7",height:"18",x:"3",y:"3",rx:"1",key:"2obqm"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kq=U("LayoutPanelTop",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zq=U("LayoutTemplate",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yq=U("Leaf",[["path",{d:"M11 20A7 7 0 0 1 9.8 6.1C15.5 5 17 4.48 19 2c1 2 2 4.18 2 8 0 5.5-4.78 10-10 10Z",key:"nnexq3"}],["path",{d:"M2 21c0-3 1.85-5.36 5.08-6C9.5 14.52 12 13 13 12",key:"mt58a7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xq=U("LeafyGreen",[["path",{d:"M2 22c1.25-.987 2.27-1.975 3.9-2.2a5.56 5.56 0 0 1 3.8 1.5 4 4 0 0 0 6.187-2.353 3.5 3.5 0 0 0 3.69-5.116A3.5 3.5 0 0 0 20.95 8 3.5 3.5 0 1 0 16 3.05a3.5 3.5 0 0 0-5.831 1.373 3.5 3.5 0 0 0-5.116 3.69 4 4 0 0 0-2.348 6.155C3.499 15.42 4.409 16.712 4.2 18.1 3.926 19.743 3.014 20.732 2 22",key:"1134nt"}],["path",{d:"M2 22 17 7",key:"1q7jp2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qq=U("Lectern",[["path",{d:"M16 12h3a2 2 0 0 0 1.902-1.38l1.056-3.333A1 1 0 0 0 21 6H3a1 1 0 0 0-.958 1.287l1.056 3.334A2 2 0 0 0 5 12h3",key:"13jjxg"}],["path",{d:"M18 6V3a1 1 0 0 0-1-1h-3",key:"1550fe"}],["rect",{width:"8",height:"12",x:"8",y:"10",rx:"1",key:"qmu8b6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jq=U("LetterText",[["path",{d:"M15 12h6",key:"upa0zy"}],["path",{d:"M15 6h6",key:"1jlkvy"}],["path",{d:"m3 13 3.553-7.724a.5.5 0 0 1 .894 0L11 13",key:"blevx4"}],["path",{d:"M3 18h18",key:"1h113x"}],["path",{d:"M4 11h6",key:"olkgv1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eV=U("LibraryBig",[["rect",{width:"8",height:"18",x:"3",y:"3",rx:"1",key:"oynpb5"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M20.4 18.9c.2.5-.1 1.1-.6 1.3l-1.9.7c-.5.2-1.1-.1-1.3-.6L11.1 5.1c-.2-.5.1-1.1.6-1.3l1.9-.7c.5-.2 1.1.1 1.3.6Z",key:"1qboyk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const US=U("Library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qS=U("LifeBuoy",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.93 4.93 4.24 4.24",key:"1ymg45"}],["path",{d:"m14.83 9.17 4.24-4.24",key:"1cb5xl"}],["path",{d:"m14.83 14.83 4.24 4.24",key:"q42g0n"}],["path",{d:"m9.17 14.83-4.24 4.24",key:"bqpfvv"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tV=U("Ligature",[["path",{d:"M8 20V8c0-2.2 1.8-4 4-4 1.5 0 2.8.8 3.5 2",key:"1rtphz"}],["path",{d:"M6 12h4",key:"a4o3ry"}],["path",{d:"M14 12h2v8",key:"c1fccl"}],["path",{d:"M6 20h4",key:"1i6q5t"}],["path",{d:"M14 20h4",key:"lzx1xo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rV=U("LightbulbOff",[["path",{d:"M16.8 11.2c.8-.9 1.2-2 1.2-3.2a6 6 0 0 0-9.3-5",key:"1fkcox"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M6.3 6.3a4.67 4.67 0 0 0 1.2 5.2c.7.7 1.3 1.5 1.5 2.5",key:"10m8kw"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K0=U("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nV=U("Link2Off",[["path",{d:"M9 17H7A5 5 0 0 1 7 7",key:"10o201"}],["path",{d:"M15 7h2a5 5 0 0 1 4 8",key:"1d3206"}],["line",{x1:"8",x2:"12",y1:"12",y2:"12",key:"rvw6j4"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rf=U("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bo=U("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tm=U("Linkedin",[["path",{d:"M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-2-2 2 2 0 0 0-2 2v7h-4v-7a6 6 0 0 1 6-6z",key:"c2jq9f"}],["rect",{width:"4",height:"12",x:"2",y:"9",key:"mk3on5"}],["circle",{cx:"4",cy:"4",r:"2",key:"bt5ra8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sV=U("ListCheck",[["path",{d:"M11 18H3",key:"n3j2dh"}],["path",{d:"m15 18 2 2 4-4",key:"1szwhi"}],["path",{d:"M16 12H3",key:"1a2rj7"}],["path",{d:"M16 6H3",key:"1wxfjs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iV=U("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aV=U("ListCollapse",[["path",{d:"m3 10 2.5-2.5L3 5",key:"i6eama"}],["path",{d:"m3 19 2.5-2.5L3 14",key:"w2gmor"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oV=U("ListEnd",[["path",{d:"M16 12H3",key:"1a2rj7"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M10 18H3",key:"13769t"}],["path",{d:"M21 6v10a2 2 0 0 1-2 2h-5",key:"ilrcs8"}],["path",{d:"m16 16-2 2 2 2",key:"kkc6pm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lV=U("ListFilter",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cV=U("ListMinus",[["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"M21 12h-6",key:"bt1uis"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dV=U("ListMusic",[["path",{d:"M21 15V6",key:"h1cx4g"}],["path",{d:"M18.5 18a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Z",key:"8saifv"}],["path",{d:"M12 12H3",key:"18klou"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M12 18H3",key:"11ftsu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VS=U("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uV=U("ListPlus",[["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"M18 9v6",key:"1twb98"}],["path",{d:"M21 12h-6",key:"bt1uis"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hV=U("ListRestart",[["path",{d:"M21 6H3",key:"1jwq7v"}],["path",{d:"M7 12H3",key:"13ou7f"}],["path",{d:"M7 18H3",key:"1sijw9"}],["path",{d:"M12 18a5 5 0 0 0 9-3 4.5 4.5 0 0 0-4.5-4.5c-1.33 0-2.54.54-3.41 1.41L11 14",key:"qth677"}],["path",{d:"M11 10v4h4",key:"172dkj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fV=U("ListStart",[["path",{d:"M16 12H3",key:"1a2rj7"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"M10 6H3",key:"lf8lx7"}],["path",{d:"M21 18V8a2 2 0 0 0-2-2h-5",key:"1hghli"}],["path",{d:"m16 8-2-2 2-2",key:"160uvd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pV=U("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mV=U("ListTree",[["path",{d:"M21 12h-8",key:"1bmf0i"}],["path",{d:"M21 6H8",key:"1pqkrb"}],["path",{d:"M21 18h-8",key:"1tm79t"}],["path",{d:"M3 6v4c0 1.1.9 2 2 2h3",key:"1ywdgy"}],["path",{d:"M3 10v6c0 1.1.9 2 2 2h3",key:"2wc746"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gV=U("ListVideo",[["path",{d:"M12 12H3",key:"18klou"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M12 18H3",key:"11ftsu"}],["path",{d:"m16 12 5 3-5 3v-6Z",key:"zpskkp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yV=U("ListX",[["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"m19 10-4 4",key:"1tz659"}],["path",{d:"m15 10 4 4",key:"1n7nei"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rm=U("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sn=U("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xV=U("LoaderPinwheel",[["path",{d:"M22 12a1 1 0 0 1-10 0 1 1 0 0 0-10 0",key:"1lzz15"}],["path",{d:"M7 20.7a1 1 0 1 1 5-8.7 1 1 0 1 0 5-8.6",key:"1gnrpi"}],["path",{d:"M7 3.3a1 1 0 1 1 5 8.6 1 1 0 1 0 5 8.6",key:"u9yy5q"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vV=U("Loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _V=U("LocateFixed",[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["circle",{cx:"12",cy:"12",r:"7",key:"fim9np"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bV=U("LocateOff",[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["path",{d:"M7.11 7.11C5.83 8.39 5 10.1 5 12c0 3.87 3.13 7 7 7 1.9 0 3.61-.83 4.89-2.11",key:"1oh7ia"}],["path",{d:"M18.71 13.96c.19-.63.29-1.29.29-1.96 0-3.87-3.13-7-7-7-.67 0-1.33.1-1.96.29",key:"3qdecy"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fT=U("Locate",[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["circle",{cx:"12",cy:"12",r:"7",key:"fim9np"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p2=U("LockKeyholeOpen",[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{width:"18",height:"12",x:"3",y:"10",rx:"2",key:"l0tzu3"}],["path",{d:"M7 10V7a5 5 0 0 1 9.33-2.5",key:"car5b7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wV=U("LockKeyhole",[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m2=U("LockOpen",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ff=U("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HS=U("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WS=U("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jV=U("Logs",[["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M3 12h1",key:"lp3yf2"}],["path",{d:"M3 18h1",key:"1eiwyy"}],["path",{d:"M3 6h1",key:"rgxa97"}],["path",{d:"M8 12h1",key:"1con00"}],["path",{d:"M8 18h1",key:"13wk12"}],["path",{d:"M8 6h1",key:"tn6mkg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kV=U("Lollipop",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}],["path",{d:"M11 11a2 2 0 0 0 4 0 4 4 0 0 0-8 0 6 6 0 0 0 12 0",key:"107gwy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NV=U("Luggage",[["path",{d:"M6 20a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2",key:"1m57jg"}],["path",{d:"M8 18V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v14",key:"1l99gc"}],["path",{d:"M10 20h4",key:"ni2waw"}],["circle",{cx:"16",cy:"20",r:"2",key:"1vifvg"}],["circle",{cx:"8",cy:"20",r:"2",key:"ckkr5m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SV=U("Magnet",[["path",{d:"m6 15-4-4 6.75-6.77a7.79 7.79 0 0 1 11 11L13 22l-4-4 6.39-6.36a2.14 2.14 0 0 0-3-3L6 15",key:"1i3lhw"}],["path",{d:"m5 8 4 4",key:"j6kj7e"}],["path",{d:"m12 15 4 4",key:"lnac28"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CV=U("MailCheck",[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"12jkf8"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MV=U("MailMinus",[["path",{d:"M22 15V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"fuxbkv"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M16 19h6",key:"xwg31i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TV=U("MailOpen",[["path",{d:"M21.2 8.4c.5.38.8.97.8 1.6v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V10a2 2 0 0 1 .8-1.6l8-6a2 2 0 0 1 2.4 0l8 6Z",key:"1jhwl8"}],["path",{d:"m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10",key:"1qfld7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AV=U("MailPlus",[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"12jkf8"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M19 16v6",key:"tddt3s"}],["path",{d:"M16 19h6",key:"xwg31i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EV=U("MailQuestion",[["path",{d:"M22 10.5V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h12.5",key:"e61zoh"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M18 15.28c.2-.4.5-.8.9-1a2.1 2.1 0 0 1 2.6.4c.3.4.5.8.5 1.3 0 1.3-2 2-2 2",key:"7z9rxb"}],["path",{d:"M20 22v.01",key:"12bgn6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IV=U("MailSearch",[["path",{d:"M22 12.5V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h7.5",key:"w80f2v"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M18 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z",key:"8lzu5m"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["path",{d:"m22 22-1.5-1.5",key:"1x83k4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PV=U("MailWarning",[["path",{d:"M22 10.5V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h12.5",key:"e61zoh"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M20 14v4",key:"1hm744"}],["path",{d:"M20 22v.01",key:"12bgn6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pT=U("MailX",[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h9",key:"1j9vog"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"m17 17 4 4",key:"1b3523"}],["path",{d:"m21 17-4 4",key:"uinynz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const di=U("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LV=U("Mailbox",[["path",{d:"M22 17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9.5C2 7 4 5 6.5 5H18c2.2 0 4 1.8 4 4v8Z",key:"1lbycx"}],["polyline",{points:"15,9 18,9 18,11",key:"1pm9c0"}],["path",{d:"M6.5 5C9 5 11 7 11 9.5V17a2 2 0 0 1-2 2",key:"15i455"}],["line",{x1:"6",x2:"7",y1:"10",y2:"10",key:"1e2scm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OV=U("Mails",[["rect",{width:"16",height:"13",x:"6",y:"4",rx:"2",key:"1drq3f"}],["path",{d:"m22 7-7.1 3.78c-.57.3-1.23.3-1.8 0L6 7",key:"xn252p"}],["path",{d:"M2 8v11c0 1.1.9 2 2 2h14",key:"n13cji"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DV=U("MapPinCheckInside",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["path",{d:"m9 10 2 2 4-4",key:"1gnqz4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RV=U("MapPinCheck",[["path",{d:"M19.43 12.935c.357-.967.57-1.955.57-2.935a8 8 0 0 0-16 0c0 4.993 5.539 10.193 7.399 11.799a1 1 0 0 0 1.202 0 32.197 32.197 0 0 0 .813-.728",key:"1dq61d"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"m16 18 2 2 4-4",key:"1mkfmb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FV=U("MapPinHouse",[["path",{d:"M15 22a1 1 0 0 1-1-1v-4a1 1 0 0 1 .445-.832l3-2a1 1 0 0 1 1.11 0l3 2A1 1 0 0 1 22 17v4a1 1 0 0 1-1 1z",key:"1p1rcz"}],["path",{d:"M18 10a8 8 0 0 0-16 0c0 4.993 5.539 10.193 7.399 11.799a1 1 0 0 0 .601.2",key:"mcbcs9"}],["path",{d:"M18 22v-3",key:"1t1ugv"}],["circle",{cx:"10",cy:"10",r:"3",key:"1ns7v1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zV=U("MapPinMinusInside",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BV=U("MapPinMinus",[["path",{d:"M18.977 14C19.6 12.701 20 11.343 20 10a8 8 0 0 0-16 0c0 4.993 5.539 10.193 7.399 11.799a1 1 0 0 0 1.202 0 32 32 0 0 0 .824-.738",key:"11uxia"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M16 18h6",key:"987eiv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $V=U("MapPinOff",[["path",{d:"M12.75 7.09a3 3 0 0 1 2.16 2.16",key:"1d4wjd"}],["path",{d:"M17.072 17.072c-1.634 2.17-3.527 3.912-4.471 4.727a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 1.432-4.568",key:"12yil7"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.475 2.818A8 8 0 0 1 20 10c0 1.183-.31 2.377-.81 3.533",key:"lhrkcz"}],["path",{d:"M9.13 9.13a3 3 0 0 0 3.74 3.74",key:"13wojd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UV=U("MapPinPlusInside",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qV=U("MapPinPlus",[["path",{d:"M19.914 11.105A7.298 7.298 0 0 0 20 10a8 8 0 0 0-16 0c0 4.993 5.539 10.193 7.399 11.799a1 1 0 0 0 1.202 0 32 32 0 0 0 .824-.738",key:"fcdtly"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M16 18h6",key:"987eiv"}],["path",{d:"M19 15v6",key:"10aioa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VV=U("MapPinXInside",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["path",{d:"m14.5 7.5-5 5",key:"3lb6iw"}],["path",{d:"m9.5 7.5 5 5",key:"ko136h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HV=U("MapPinX",[["path",{d:"M19.752 11.901A7.78 7.78 0 0 0 20 10a8 8 0 0 0-16 0c0 4.993 5.539 10.193 7.399 11.799a1 1 0 0 0 1.202 0 19 19 0 0 0 .09-.077",key:"y0ewhp"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"m21.5 15.5-5 5",key:"11iqnx"}],["path",{d:"m21.5 20.5-5-5",key:"1bylgx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yl=U("MapPin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WV=U("MapPinned",[["path",{d:"M18 8c0 3.613-3.869 7.429-5.393 8.795a1 1 0 0 1-1.214 0C9.87 15.429 6 11.613 6 8a6 6 0 0 1 12 0",key:"11u0oz"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["path",{d:"M8.714 14h-3.71a1 1 0 0 0-.948.683l-2.004 6A1 1 0 0 0 3 22h18a1 1 0 0 0 .948-1.316l-2-6a1 1 0 0 0-.949-.684h-3.712",key:"q8zwxj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GV=U("Map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KV=U("Martini",[["path",{d:"M8 22h8",key:"rmew8v"}],["path",{d:"M12 11v11",key:"ur9y6a"}],["path",{d:"m19 3-7 8-7-8Z",key:"1sgpiw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZV=U("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z0=U("Maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ty=U("Medal",[["path",{d:"M7.21 15 2.66 7.14a2 2 0 0 1 .13-2.2L4.4 2.8A2 2 0 0 1 6 2h12a2 2 0 0 1 1.6.8l1.6 2.14a2 2 0 0 1 .14 2.2L16.79 15",key:"143lza"}],["path",{d:"M11 12 5.12 2.2",key:"qhuxz6"}],["path",{d:"m13 12 5.88-9.8",key:"hbye0f"}],["path",{d:"M8 7h8",key:"i86dvs"}],["circle",{cx:"12",cy:"17",r:"5",key:"qbz8iq"}],["path",{d:"M12 18v-2h-.5",key:"fawc4q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YV=U("MegaphoneOff",[["path",{d:"M9.26 9.26 3 11v3l14.14 3.14",key:"3429n"}],["path",{d:"M21 15.34V6l-7.31 2.03",key:"4o1dh8"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nm=U("Megaphone",[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XV=U("Meh",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"8",x2:"16",y1:"15",y2:"15",key:"1xb1d9"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QV=U("MemoryStick",[["path",{d:"M6 19v-3",key:"1nvgqn"}],["path",{d:"M10 19v-3",key:"iu8nkm"}],["path",{d:"M14 19v-3",key:"kcehxu"}],["path",{d:"M18 19v-3",key:"1vh91z"}],["path",{d:"M8 11V9",key:"63erz4"}],["path",{d:"M16 11V9",key:"fru6f3"}],["path",{d:"M12 11V9",key:"ha00sb"}],["path",{d:"M2 15h20",key:"16ne18"}],["path",{d:"M2 7a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1.1a2 2 0 0 0 0 3.837V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-5.1a2 2 0 0 0 0-3.837Z",key:"lhddv3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mT=U("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JV=U("Merge",[["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}],["path",{d:"M12 2v10.3a4 4 0 0 1-1.172 2.872L4 22",key:"1hyw0i"}],["path",{d:"m20 22-5-5",key:"1m27yz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eH=U("MessageCircleCode",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22z",key:"k85zhp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tH=U("MessageCircleDashed",[["path",{d:"M13.5 3.1c-.5 0-1-.1-1.5-.1s-1 .1-1.5.1",key:"16ll65"}],["path",{d:"M19.3 6.8a10.45 10.45 0 0 0-2.1-2.1",key:"1nq77a"}],["path",{d:"M20.9 13.5c.1-.5.1-1 .1-1.5s-.1-1-.1-1.5",key:"1sf7wn"}],["path",{d:"M17.2 19.3a10.45 10.45 0 0 0 2.1-2.1",key:"x1hs5g"}],["path",{d:"M10.5 20.9c.5.1 1 .1 1.5.1s1-.1 1.5-.1",key:"19m18z"}],["path",{d:"M3.5 17.5 2 22l4.5-1.5",key:"1f36qi"}],["path",{d:"M3.1 10.5c0 .5-.1 1-.1 1.5s.1 1 .1 1.5",key:"1vz3ju"}],["path",{d:"M6.8 4.7a10.45 10.45 0 0 0-2.1 2.1",key:"19f9do"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rH=U("MessageCircleHeart",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M15.8 9.2a2.5 2.5 0 0 0-3.5 0l-.3.4-.35-.3a2.42 2.42 0 1 0-3.2 3.6l3.6 3.5 3.6-3.5c1.2-1.2 1.1-2.7.2-3.7",key:"43lnbm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nH=U("MessageCircleMore",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M8 12h.01",key:"czm47f"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 12h.01",key:"1l6xoz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sH=U("MessageCircleOff",[["path",{d:"M20.5 14.9A9 9 0 0 0 9.1 3.5",key:"1iebmn"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5.6 5.6C3 8.3 2.2 12.5 4 16l-2 6 6-2c3.4 1.8 7.6 1.1 10.3-1.7",key:"1ov8ce"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iH=U("MessageCirclePlus",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gT=U("MessageCircleQuestion",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aH=U("MessageCircleReply",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}],["path",{d:"M7 12h7a2 2 0 0 1 2 2v1",key:"1gheu4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oH=U("MessageCircleWarning",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lH=U("MessageCircleX",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Hl=U("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cH=U("MessageSquareCode",[["path",{d:"M10 7.5 8 10l2 2.5",key:"xb17xw"}],["path",{d:"m14 7.5 2 2.5-2 2.5",key:"5rap1v"}],["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dH=U("MessageSquareDashed",[["path",{d:"M10 17H7l-4 4v-7",key:"1r71xu"}],["path",{d:"M14 17h1",key:"nufu4t"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M21 14v1a2 2 0 0 1-2 2",key:"29akq3"}],["path",{d:"M21 9v1",key:"mxsmne"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M9 3h1",key:"1yesri"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uH=U("MessageSquareDiff",[["path",{d:"m5 19-2 2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2",key:"1xuzuj"}],["path",{d:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 17h6",key:"r8uit2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hH=U("MessageSquareDot",[["path",{d:"M11.7 3H5a2 2 0 0 0-2 2v16l4-4h12a2 2 0 0 0 2-2v-2.7",key:"uodpkb"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fH=U("MessageSquareHeart",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M14.8 7.5a1.84 1.84 0 0 0-2.6 0l-.2.3-.3-.3a1.84 1.84 0 1 0-2.4 2.8L12 13l2.7-2.7c.9-.9.8-2.1.1-2.8",key:"1blaws"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pH=U("MessageSquareLock",[["path",{d:"M19 15v-2a2 2 0 1 0-4 0v2",key:"h3d1vz"}],["path",{d:"M9 17H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v3.5",key:"xsnnhn"}],["rect",{x:"13",y:"15",width:"8",height:"5",rx:"1",key:"1ccwuk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mH=U("MessageSquareMore",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M16 10h.01",key:"1m94wz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gH=U("MessageSquareOff",[["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M3.6 3.6c-.4.3-.6.8-.6 1.4v16l4-4h10",key:"pwpm4a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yH=U("MessageSquarePlus",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xH=U("MessageSquareQuote",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M8 12a2 2 0 0 0 2-2V8H8",key:"1jfesj"}],["path",{d:"M14 12a2 2 0 0 0 2-2V8h-2",key:"1dq9mh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vH=U("MessageSquareReply",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"m10 7-3 3 3 3",key:"1eugdv"}],["path",{d:"M17 13v-1a2 2 0 0 0-2-2H7",key:"ernfh3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _H=U("MessageSquareShare",[["path",{d:"M21 12v3a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h7",key:"tqtdkg"}],["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"m16 8 5-5",key:"15mbrl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bH=U("MessageSquareText",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M13 8H7",key:"14i4kc"}],["path",{d:"M17 12H7",key:"16if0g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wH=U("MessageSquareWarning",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M12 7v2",key:"stiyo7"}],["path",{d:"M12 13h.01",key:"y0uutt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jH=U("MessageSquareX",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"m14.5 7.5-5 5",key:"3lb6iw"}],["path",{d:"m9.5 7.5 5 5",key:"ko136h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wl=U("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kH=U("MessagesSquare",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NH=U("MicOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M18.89 13.23A7.12 7.12 0 0 0 19 12v-2",key:"80xlxr"}],["path",{d:"M5 10v2a7 7 0 0 0 12 5",key:"p2k8kg"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g2=U("MicVocal",[["path",{d:"m11 7.601-5.994 8.19a1 1 0 0 0 .1 1.298l.817.818a1 1 0 0 0 1.314.087L15.09 12",key:"80a601"}],["path",{d:"M16.5 21.174C15.5 20.5 14.372 20 13 20c-2.058 0-3.928 2.356-6 2-2.072-.356-2.775-3.369-1.5-4.5",key:"j0ngtp"}],["circle",{cx:"16",cy:"7",r:"5",key:"d08jfb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yT=U("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SH=U("Microchip",[["path",{d:"M18 12h2",key:"quuxs7"}],["path",{d:"M18 16h2",key:"zsn3lv"}],["path",{d:"M18 20h2",key:"9x5y9y"}],["path",{d:"M18 4h2",key:"1luxfb"}],["path",{d:"M18 8h2",key:"nxqzg"}],["path",{d:"M4 12h2",key:"1ltxp0"}],["path",{d:"M4 16h2",key:"8a5zha"}],["path",{d:"M4 20h2",key:"27dk57"}],["path",{d:"M4 4h2",key:"10groj"}],["path",{d:"M4 8h2",key:"18vq6w"}],["path",{d:"M8 2a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2h-1.5c-.276 0-.494.227-.562.495a2 2 0 0 1-3.876 0C9.994 2.227 9.776 2 9.5 2z",key:"1681fp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CH=U("Microscope",[["path",{d:"M6 18h8",key:"1borvv"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M14 22a7 7 0 1 0 0-14h-1",key:"1jwaiy"}],["path",{d:"M9 14h2",key:"197e7h"}],["path",{d:"M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z",key:"1bmzmy"}],["path",{d:"M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3",key:"1drr47"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MH=U("Microwave",[["rect",{width:"20",height:"15",x:"2",y:"4",rx:"2",key:"2no95f"}],["rect",{width:"8",height:"7",x:"6",y:"8",rx:"1",key:"zh9wx"}],["path",{d:"M18 8v7",key:"o5zi4n"}],["path",{d:"M6 19v2",key:"1loha6"}],["path",{d:"M18 19v2",key:"1dawf0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TH=U("Milestone",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M12 3v3",key:"1n5kay"}],["path",{d:"M4 6a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h13a2 2 0 0 0 1.152-.365l3.424-2.317a1 1 0 0 0 0-1.635l-3.424-2.318A2 2 0 0 0 17 6z",key:"1btarq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AH=U("MilkOff",[["path",{d:"M8 2h8",key:"1ssgc1"}],["path",{d:"M9 2v1.343M15 2v2.789a4 4 0 0 0 .672 2.219l.656.984a4 4 0 0 1 .672 2.22v1.131M7.8 7.8l-.128.192A4 4 0 0 0 7 10.212V20a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2v-3",key:"y0ejgx"}],["path",{d:"M7 15a6.47 6.47 0 0 1 5 0 6.472 6.472 0 0 0 3.435.435",key:"iaxqsy"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EH=U("Milk",[["path",{d:"M8 2h8",key:"1ssgc1"}],["path",{d:"M9 2v2.789a4 4 0 0 1-.672 2.219l-.656.984A4 4 0 0 0 7 10.212V20a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2v-9.789a4 4 0 0 0-.672-2.219l-.656-.984A4 4 0 0 1 15 4.788V2",key:"qtp12x"}],["path",{d:"M7 15a6.472 6.472 0 0 1 5 0 6.47 6.47 0 0 0 5 0",key:"ygeh44"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IH=U("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PH=U("Minimize",[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y0=U("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LH=U("MonitorCheck",[["path",{d:"m9 10 2 2 4-4",key:"1gnqz4"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OH=U("MonitorCog",[["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"m15.2 4.9-.9-.4",key:"12wd2u"}],["path",{d:"m15.2 7.1-.9.4",key:"1r2vl7"}],["path",{d:"m16.9 3.2-.4-.9",key:"3zbo91"}],["path",{d:"m16.9 8.8-.4.9",key:"1qr2dn"}],["path",{d:"m19.5 2.3-.4.9",key:"1rjrkq"}],["path",{d:"m19.5 9.7-.4-.9",key:"heryx5"}],["path",{d:"m21.7 4.5-.9.4",key:"17fqt1"}],["path",{d:"m21.7 7.5-.9-.4",key:"14zyni"}],["path",{d:"M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7",key:"1tnzv8"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DH=U("MonitorDot",[["circle",{cx:"19",cy:"6",r:"3",key:"108a5v"}],["path",{d:"M22 12v3a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h9",key:"1fet9y"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RH=U("MonitorDown",[["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"m15 10-3 3-3-3",key:"lzhmyn"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FH=U("MonitorOff",[["path",{d:"M17 17H4a2 2 0 0 1-2-2V5c0-1.5 1-2 1-2",key:"k0q8oc"}],["path",{d:"M22 15V5a2 2 0 0 0-2-2H9",key:"cp1ac0"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zH=U("MonitorPause",[["path",{d:"M10 13V7",key:"1u13u9"}],["path",{d:"M14 13V7",key:"1vj9om"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BH=U("MonitorPlay",[["path",{d:"M10 7.75a.75.75 0 0 1 1.142-.638l3.664 2.249a.75.75 0 0 1 0 1.278l-3.664 2.25a.75.75 0 0 1-1.142-.64z",key:"1pctta"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $H=U("MonitorSmartphone",[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8",key:"10dyio"}],["path",{d:"M10 19v-3.96 3.15",key:"1irgej"}],["path",{d:"M7 19h5",key:"qswx4l"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2",key:"1egngj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UH=U("MonitorSpeaker",[["path",{d:"M5.5 20H8",key:"1k40s5"}],["path",{d:"M17 9h.01",key:"1j24nn"}],["rect",{width:"10",height:"16",x:"12",y:"4",rx:"2",key:"ixliua"}],["path",{d:"M8 6H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h4",key:"1mp6e1"}],["circle",{cx:"17",cy:"15",r:"1",key:"tqvash"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qH=U("MonitorStop",[["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}],["rect",{x:"9",y:"7",width:"6",height:"6",rx:"1",key:"5m2oou"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VH=U("MonitorUp",[["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}],["path",{d:"M12 13V7",key:"h0r20n"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HH=U("MonitorX",[["path",{d:"m14.5 12.5-5-5",key:"1jahn5"}],["path",{d:"m9.5 12.5 5-5",key:"1k2t7b"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GS=U("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WH=U("MoonStar",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9",key:"4ay0iu"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GH=U("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KH=U("MountainSnow",[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}],["path",{d:"M4.14 15.08c2.62-1.57 5.24-1.43 7.86.42 2.74 1.94 5.49 2 8.23.19",key:"1pvmmp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZH=U("Mountain",[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YH=U("MouseOff",[["path",{d:"M12 6v.343",key:"1gyhex"}],["path",{d:"M18.218 18.218A7 7 0 0 1 5 15V9a7 7 0 0 1 .782-3.218",key:"ukzz01"}],["path",{d:"M19 13.343V9A7 7 0 0 0 8.56 2.902",key:"104jy9"}],["path",{d:"M22 22 2 2",key:"1r8tn9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XH=U("MousePointer2",[["path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z",key:"edeuup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QH=U("MousePointerBan",[["path",{d:"M2.034 2.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.944L8.204 7.545a1 1 0 0 0-.66.66l-1.066 3.443a.5.5 0 0 1-.944.033z",key:"11pp1i"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}],["path",{d:"m11.8 11.8 8.4 8.4",key:"oogvdj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JH=U("MousePointerClick",[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eW=U("MousePointer",[["path",{d:"M12.586 12.586 19 19",key:"ea5xo7"}],["path",{d:"M3.688 3.037a.497.497 0 0 0-.651.651l6.5 15.999a.501.501 0 0 0 .947-.062l1.569-6.083a2 2 0 0 1 1.448-1.479l6.124-1.579a.5.5 0 0 0 .063-.947z",key:"277e5u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tW=U("Mouse",[["rect",{x:"5",y:"2",width:"14",height:"20",rx:"7",key:"11ol66"}],["path",{d:"M12 6v4",key:"16clxf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y2=U("Move3d",[["path",{d:"M5 3v16h16",key:"1mqmf9"}],["path",{d:"m5 19 6-6",key:"jh6hbb"}],["path",{d:"m2 6 3-3 3 3",key:"tkyvxa"}],["path",{d:"m18 16 3 3-3 3",key:"1d4glt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rW=U("MoveDiagonal2",[["path",{d:"M19 13v6h-6",key:"1hxl6d"}],["path",{d:"M5 11V5h6",key:"12e2xe"}],["path",{d:"m5 5 14 14",key:"11anup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nW=U("MoveDiagonal",[["path",{d:"M11 19H5v-6",key:"8awifj"}],["path",{d:"M13 5h6v6",key:"7voy1q"}],["path",{d:"M19 5 5 19",key:"wwaj1z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sW=U("MoveDownLeft",[["path",{d:"M11 19H5V13",key:"1akmht"}],["path",{d:"M19 5L5 19",key:"72u4yj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iW=U("MoveDownRight",[["path",{d:"M19 13V19H13",key:"10vkzq"}],["path",{d:"M5 5L19 19",key:"5zm2fv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aW=U("MoveDown",[["path",{d:"M8 18L12 22L16 18",key:"cskvfv"}],["path",{d:"M12 2V22",key:"r89rzk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oW=U("MoveHorizontal",[["path",{d:"m18 8 4 4-4 4",key:"1ak13k"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lW=U("MoveLeft",[["path",{d:"M6 8L2 12L6 16",key:"kyvwex"}],["path",{d:"M2 12H22",key:"1m8cig"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cW=U("MoveRight",[["path",{d:"M18 8L22 12L18 16",key:"1r0oui"}],["path",{d:"M2 12H22",key:"1m8cig"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dW=U("MoveUpLeft",[["path",{d:"M5 11V5H11",key:"3q78g9"}],["path",{d:"M5 5L19 19",key:"5zm2fv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uW=U("MoveUpRight",[["path",{d:"M13 5H19V11",key:"1n1gyv"}],["path",{d:"M19 5L5 19",key:"72u4yj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hW=U("MoveUp",[["path",{d:"M8 6L12 2L16 6",key:"1yvkyx"}],["path",{d:"M12 2V22",key:"r89rzk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fW=U("MoveVertical",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m8 18 4 4 4-4",key:"bh5tu3"}],["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pW=U("Move",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m19 9 3 3-3 3",key:"1mg7y2"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mW=U("Music2",[["circle",{cx:"8",cy:"18",r:"4",key:"1fc0mg"}],["path",{d:"M12 18V2l7 4",key:"g04rme"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gW=U("Music3",[["circle",{cx:"12",cy:"18",r:"4",key:"m3r9ws"}],["path",{d:"M16 18V2",key:"40x2m5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yW=U("Music4",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["path",{d:"m9 9 12-2",key:"1e64n2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xW=U("Music",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vW=U("Navigation2Off",[["path",{d:"M9.31 9.31 5 21l7-4 7 4-1.17-3.17",key:"qoq2o2"}],["path",{d:"M14.53 8.88 12 2l-1.17 3.17",key:"k3sjzy"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _W=U("Navigation2",[["polygon",{points:"12 2 19 21 12 17 5 21 12 2",key:"x8c0qg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bW=U("NavigationOff",[["path",{d:"M8.43 8.43 3 11l8 2 2 8 2.57-5.43",key:"1vdtb7"}],["path",{d:"M17.39 11.73 22 2l-9.73 4.61",key:"tya3r6"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xT=U("Navigation",[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wW=U("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ay=U("Newspaper",[["path",{d:"M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2",key:"7pis2x"}],["path",{d:"M18 14h-8",key:"sponae"}],["path",{d:"M15 18h-5",key:"95g1m2"}],["path",{d:"M10 6h8v4h-8V6Z",key:"smlsk5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jW=U("Nfc",[["path",{d:"M6 8.32a7.43 7.43 0 0 1 0 7.36",key:"9iaqei"}],["path",{d:"M9.46 6.21a11.76 11.76 0 0 1 0 11.58",key:"1yha7l"}],["path",{d:"M12.91 4.1a15.91 15.91 0 0 1 .01 15.8",key:"4iu2gk"}],["path",{d:"M16.37 2a20.16 20.16 0 0 1 0 20",key:"sap9u2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kW=U("NotebookPen",[["path",{d:"M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4",key:"re6nr2"}],["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["path",{d:"M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"pqwjuv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NW=U("NotebookTabs",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M15 2v20",key:"dcj49h"}],["path",{d:"M15 7h5",key:"1xj5lc"}],["path",{d:"M15 12h5",key:"w5shd9"}],["path",{d:"M15 17h5",key:"1qaofu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SW=U("NotebookText",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M9.5 8h5",key:"11mslq"}],["path",{d:"M9.5 12H16",key:"ktog6x"}],["path",{d:"M9.5 16H14",key:"p1seyn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CW=U("Notebook",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M16 2v20",key:"rotuqe"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MW=U("NotepadTextDashed",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v2",key:"j91f56"}],["path",{d:"M20 12v2",key:"w8o0tu"}],["path",{d:"M20 18v2a2 2 0 0 1-2 2h-1",key:"1c9ggx"}],["path",{d:"M13 22h-2",key:"191ugt"}],["path",{d:"M7 22H6a2 2 0 0 1-2-2v-2",key:"1rt9px"}],["path",{d:"M4 14v-2",key:"1v0sqh"}],["path",{d:"M4 8V6a2 2 0 0 1 2-2h2",key:"1mwabg"}],["path",{d:"M8 10h6",key:"3oa6kw"}],["path",{d:"M8 14h8",key:"1fgep2"}],["path",{d:"M8 18h5",key:"17enja"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TW=U("NotepadText",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"16",height:"18",x:"4",y:"4",rx:"2",key:"1u9h20"}],["path",{d:"M8 10h6",key:"3oa6kw"}],["path",{d:"M8 14h8",key:"1fgep2"}],["path",{d:"M8 18h5",key:"17enja"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AW=U("NutOff",[["path",{d:"M12 4V2",key:"1k5q1u"}],["path",{d:"M5 10v4a7.004 7.004 0 0 0 5.277 6.787c.412.104.802.292 1.102.592L12 22l.621-.621c.3-.3.69-.488 1.102-.592a7.01 7.01 0 0 0 4.125-2.939",key:"1xcvy9"}],["path",{d:"M19 10v3.343",key:"163tfc"}],["path",{d:"M12 12c-1.349-.573-1.905-1.005-2.5-2-.546.902-1.048 1.353-2.5 2-1.018-.644-1.46-1.08-2-2-1.028.71-1.69.918-3 1 1.081-1.048 1.757-2.03 2-3 .194-.776.84-1.551 1.79-2.21m11.654 5.997c.887-.457 1.28-.891 1.556-1.787 1.032.916 1.683 1.157 3 1-1.297-1.036-1.758-2.03-2-3-.5-2-4-4-8-4-.74 0-1.461.068-2.15.192",key:"17914v"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EW=U("Nut",[["path",{d:"M12 4V2",key:"1k5q1u"}],["path",{d:"M5 10v4a7.004 7.004 0 0 0 5.277 6.787c.412.104.802.292 1.102.592L12 22l.621-.621c.3-.3.69-.488 1.102-.592A7.003 7.003 0 0 0 19 14v-4",key:"1tgyif"}],["path",{d:"M12 4C8 4 4.5 6 4 8c-.243.97-.919 1.952-2 3 1.31-.082 1.972-.29 3-1 .54.92.982 1.356 2 2 1.452-.647 1.954-1.098 2.5-2 .595.995 1.151 1.427 2.5 2 1.31-.621 1.862-1.058 2.5-2 .629.977 1.162 1.423 2.5 2 1.209-.548 1.68-.967 2-2 1.032.916 1.683 1.157 3 1-1.297-1.036-1.758-2.03-2-3-.5-2-4-4-8-4Z",key:"tnsqj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x2=U("OctagonAlert",[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IW=U("OctagonMinus",[["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v2=U("OctagonPause",[["path",{d:"M10 15V9",key:"1lckn7"}],["path",{d:"M14 15V9",key:"1muqhk"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _2=U("OctagonX",[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PW=U("Octagon",[["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LW=U("Omega",[["path",{d:"M3 20h4.5a.5.5 0 0 0 .5-.5v-.282a.52.52 0 0 0-.247-.437 8 8 0 1 1 8.494-.001.52.52 0 0 0-.247.438v.282a.5.5 0 0 0 .5.5H21",key:"1x94xo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OW=U("Option",[["path",{d:"M3 3h6l6 18h6",key:"ph9rgk"}],["path",{d:"M14 3h7",key:"16f0ms"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DW=U("Orbit",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["circle",{cx:"19",cy:"5",r:"2",key:"mhkx31"}],["circle",{cx:"5",cy:"19",r:"2",key:"v8kfzx"}],["path",{d:"M10.4 21.9a10 10 0 0 0 9.941-15.416",key:"eohfx2"}],["path",{d:"M13.5 2.1a10 10 0 0 0-9.841 15.416",key:"19pvbm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RW=U("Origami",[["path",{d:"M12 12V4a1 1 0 0 1 1-1h6.297a1 1 0 0 1 .651 1.759l-4.696 4.025",key:"1bx4vc"}],["path",{d:"m12 21-7.414-7.414A2 2 0 0 1 4 12.172V6.415a1.002 1.002 0 0 1 1.707-.707L20 20.009",key:"1h3km6"}],["path",{d:"m12.214 3.381 8.414 14.966a1 1 0 0 1-.167 1.199l-1.168 1.163a1 1 0 0 1-.706.291H6.351a1 1 0 0 1-.625-.219L3.25 18.8a1 1 0 0 1 .631-1.781l4.165.027",key:"1hj4wg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FW=U("Package2",[["path",{d:"M3 9h18v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V9Z",key:"1ront0"}],["path",{d:"m3 9 2.45-4.9A2 2 0 0 1 7.24 3h9.52a2 2 0 0 1 1.8 1.1L21 9",key:"19h2x1"}],["path",{d:"M12 3v6",key:"1holv5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zW=U("PackageCheck",[["path",{d:"m16 16 2 2 4-4",key:"gfu2re"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BW=U("PackageMinus",[["path",{d:"M16 16h6",key:"100bgy"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $W=U("PackageOpen",[["path",{d:"M12 22v-9",key:"x3hkom"}],["path",{d:"M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z",key:"2ntwy6"}],["path",{d:"M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13",key:"1pmm1c"}],["path",{d:"M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z",key:"12ttoo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UW=U("PackagePlus",[["path",{d:"M16 16h6",key:"100bgy"}],["path",{d:"M19 13v6",key:"85cyf1"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qW=U("PackageSearch",[["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["circle",{cx:"18.5",cy:"15.5",r:"2.5",key:"b5zd12"}],["path",{d:"M20.27 17.27 22 19",key:"1l4muz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VW=U("PackageX",[["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["path",{d:"m17 13 5 5m-5 0 5-5",key:"im3w4b"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Tl=U("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HW=U("PaintBucket",[["path",{d:"m19 11-8-8-8.6 8.6a2 2 0 0 0 0 2.8l5.2 5.2c.8.8 2 .8 2.8 0L19 11Z",key:"irua1i"}],["path",{d:"m5 2 5 5",key:"1lls2c"}],["path",{d:"M2 13h15",key:"1hkzvu"}],["path",{d:"M22 20a2 2 0 1 1-4 0c0-1.6 1.7-2.4 2-4 .3 1.6 2 2.4 2 4Z",key:"xk76lq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WW=U("PaintRoller",[["rect",{width:"16",height:"6",x:"2",y:"2",rx:"2",key:"jcyz7m"}],["path",{d:"M10 16v-2a2 2 0 0 1 2-2h8a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2",key:"1b9h7c"}],["rect",{width:"4",height:"6",x:"8",y:"16",rx:"1",key:"d6e7yl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b2=U("PaintbrushVertical",[["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M14 2v4",key:"qmzblu"}],["path",{d:"M17 2a1 1 0 0 1 1 1v9H6V3a1 1 0 0 1 1-1z",key:"ycvu00"}],["path",{d:"M6 12a1 1 0 0 0-1 1v1a2 2 0 0 0 2 2h2a1 1 0 0 1 1 1v2.9a2 2 0 1 0 4 0V17a1 1 0 0 1 1-1h2a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1",key:"iw4wnp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GW=U("Paintbrush",[["path",{d:"m14.622 17.897-10.68-2.913",key:"vj2p1u"}],["path",{d:"M18.376 2.622a1 1 0 1 1 3.002 3.002L17.36 9.643a.5.5 0 0 0 0 .707l.944.944a2.41 2.41 0 0 1 0 3.408l-.944.944a.5.5 0 0 1-.707 0L8.354 7.348a.5.5 0 0 1 0-.707l.944-.944a2.41 2.41 0 0 1 3.408 0l.944.944a.5.5 0 0 0 .707 0z",key:"18tc5c"}],["path",{d:"M9 8c-1.804 2.71-3.97 3.46-6.583 3.948a.507.507 0 0 0-.302.819l7.32 8.883a1 1 0 0 0 1.185.204C12.735 20.405 16 16.792 16 15",key:"ytzfxy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gd=U("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KW=U("PanelBottomClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"m15 8-3 3-3-3",key:"1oxy1z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w2=U("PanelBottomDashed",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M14 15h1",key:"171nev"}],["path",{d:"M19 15h2",key:"1vnucp"}],["path",{d:"M3 15h2",key:"8bym0q"}],["path",{d:"M9 15h1",key:"1tg3ks"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZW=U("PanelBottomOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YW=U("PanelBottom",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h18",key:"5xshup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j2=U("PanelLeftClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k2=U("PanelLeftDashed",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 14v1",key:"askpd8"}],["path",{d:"M9 19v2",key:"16tejx"}],["path",{d:"M9 3v2",key:"1noubl"}],["path",{d:"M9 9v1",key:"19ebxg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N2=U("PanelLeftOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S2=U("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XW=U("PanelRightClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C2=U("PanelRightDashed",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 14v1",key:"ilsfch"}],["path",{d:"M15 19v2",key:"1fst2f"}],["path",{d:"M15 3v2",key:"z204g4"}],["path",{d:"M15 9v1",key:"z2a8b1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QW=U("PanelRightOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JW=U("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eG=U("PanelTopClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"m9 16 3-3 3 3",key:"1idcnm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M2=U("PanelTopDashed",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M14 9h1",key:"l0svgy"}],["path",{d:"M19 9h2",key:"te2zfg"}],["path",{d:"M3 9h2",key:"1h4ldw"}],["path",{d:"M9 9h1",key:"15jzuz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tG=U("PanelTopOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"m15 14-3 3-3-3",key:"g215vf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rG=U("PanelTop",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nG=U("PanelsLeftBottom",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M9 15h12",key:"5ijen5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sG=U("PanelsRightBottom",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h12",key:"1wkqb3"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yx=U("PanelsTopLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iG=U("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aG=U("Parentheses",[["path",{d:"M8 21s-4-3-4-9 4-9 4-9",key:"uto9ud"}],["path",{d:"M16 3s4 3 4 9-4 9-4 9",key:"4w2vsq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oG=U("ParkingMeter",[["path",{d:"M11 15h2",key:"199qp6"}],["path",{d:"M12 12v3",key:"158kv8"}],["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M15.282 19a1 1 0 0 0 .948-.68l2.37-6.988a7 7 0 1 0-13.2 0l2.37 6.988a1 1 0 0 0 .948.68z",key:"1jofit"}],["path",{d:"M9 9a3 3 0 1 1 6 0",key:"jdoeu8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $h=U("PartyPopper",[["path",{d:"M5.8 11.3 2 22l10.7-3.79",key:"gwxi1d"}],["path",{d:"M4 3h.01",key:"1vcuye"}],["path",{d:"M22 8h.01",key:"1mrtc2"}],["path",{d:"M15 2h.01",key:"1cjtqr"}],["path",{d:"M22 20h.01",key:"1mrys2"}],["path",{d:"m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10",key:"hbicv8"}],["path",{d:"m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17",key:"1i94pl"}],["path",{d:"m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7",key:"1cofks"}],["path",{d:"M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z",key:"4kbmks"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zf=U("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lG=U("PawPrint",[["circle",{cx:"11",cy:"4",r:"2",key:"vol9p0"}],["circle",{cx:"18",cy:"8",r:"2",key:"17gozi"}],["circle",{cx:"20",cy:"16",r:"2",key:"1v9bxh"}],["path",{d:"M9 10a5 5 0 0 1 5 5v3.5a3.5 3.5 0 0 1-6.84 1.045Q6.52 17.48 4.46 16.84A3.5 3.5 0 0 1 5.5 10Z",key:"1ydw1z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cG=U("PcCase",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",key:"1uq1d7"}],["path",{d:"M15 14h.01",key:"1kp3bh"}],["path",{d:"M9 6h6",key:"dgm16u"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const T2=U("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dG=U("PenOff",[["path",{d:"m10 10-6.157 6.162a2 2 0 0 0-.5.833l-1.322 4.36a.5.5 0 0 0 .622.624l4.358-1.323a2 2 0 0 0 .83-.5L14 13.982",key:"bjo8r8"}],["path",{d:"m12.829 7.172 4.359-4.346a1 1 0 1 1 3.986 3.986l-4.353 4.353",key:"16h5ne"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KS=U("PenTool",[["path",{d:"M15.707 21.293a1 1 0 0 1-1.414 0l-1.586-1.586a1 1 0 0 1 0-1.414l5.586-5.586a1 1 0 0 1 1.414 0l1.586 1.586a1 1 0 0 1 0 1.414z",key:"nt11vn"}],["path",{d:"m18 13-1.375-6.874a1 1 0 0 0-.746-.776L3.235 2.028a1 1 0 0 0-1.207 1.207L5.35 15.879a1 1 0 0 0 .776.746L13 18",key:"15qc1e"}],["path",{d:"m2.3 2.3 7.286 7.286",key:"1wuzzi"}],["circle",{cx:"11",cy:"11",r:"2",key:"xmgehs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xx=U("Pen",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uG=U("PencilLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}],["path",{d:"m15 5 3 3",key:"1w25hb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hG=U("PencilOff",[["path",{d:"m10 10-6.157 6.162a2 2 0 0 0-.5.833l-1.322 4.36a.5.5 0 0 0 .622.624l4.358-1.323a2 2 0 0 0 .83-.5L14 13.982",key:"bjo8r8"}],["path",{d:"m12.829 7.172 4.359-4.346a1 1 0 1 1 3.986 3.986l-4.353 4.353",key:"16h5ne"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fG=U("PencilRuler",[["path",{d:"M13 7 8.7 2.7a2.41 2.41 0 0 0-3.4 0L2.7 5.3a2.41 2.41 0 0 0 0 3.4L7 13",key:"orapub"}],["path",{d:"m8 6 2-2",key:"115y1s"}],["path",{d:"m18 16 2-2",key:"ee94s4"}],["path",{d:"m17 11 4.3 4.3c.94.94.94 2.46 0 3.4l-2.6 2.6c-.94.94-2.46.94-3.4 0L11 17",key:"cfq27r"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ma=U("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pG=U("Pentagon",[["path",{d:"M10.83 2.38a2 2 0 0 1 2.34 0l8 5.74a2 2 0 0 1 .73 2.25l-3.04 9.26a2 2 0 0 1-1.9 1.37H7.04a2 2 0 0 1-1.9-1.37L2.1 10.37a2 2 0 0 1 .73-2.25z",key:"2hea0t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZS=U("Percent",[["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5",key:"4mh3h7"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5",key:"1mdrzq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mG=U("PersonStanding",[["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["path",{d:"m9 20 3-6 3 6",key:"se2kox"}],["path",{d:"m6 8 6 2 6-2",key:"4o3us4"}],["path",{d:"M12 10v4",key:"1kjpxc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gG=U("PhilippinePeso",[["path",{d:"M20 11H4",key:"6ut86h"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"M7 21V4a1 1 0 0 1 1-1h4a1 1 0 0 1 0 12H7",key:"1ana5r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yG=U("PhoneCall",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}],["path",{d:"M14.05 2a9 9 0 0 1 8 7.94",key:"vmijpz"}],["path",{d:"M14.05 6A5 5 0 0 1 18 10",key:"13nbpp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xG=U("PhoneForwarded",[["polyline",{points:"18 2 22 6 18 10",key:"6vjanh"}],["line",{x1:"14",x2:"22",y1:"6",y2:"6",key:"1jsywh"}],["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vG=U("PhoneIncoming",[["polyline",{points:"16 2 16 8 22 8",key:"1ygljm"}],["line",{x1:"22",x2:"16",y1:"2",y2:"8",key:"1xzwqn"}],["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _G=U("PhoneMissed",[["line",{x1:"22",x2:"16",y1:"2",y2:"8",key:"1xzwqn"}],["line",{x1:"16",x2:"22",y1:"2",y2:"8",key:"13zxdn"}],["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bG=U("PhoneOff",[["path",{d:"M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-3.33-2.67m-2.67-3.34a19.79 19.79 0 0 1-3.07-8.63A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91",key:"z86iuo"}],["line",{x1:"22",x2:"2",y1:"2",y2:"22",key:"11kh81"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wG=U("PhoneOutgoing",[["polyline",{points:"22 8 22 2 16 2",key:"1g204g"}],["line",{x1:"16",x2:"22",y1:"8",y2:"2",key:"1ggias"}],["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wa=U("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jG=U("Pi",[["line",{x1:"9",x2:"9",y1:"4",y2:"20",key:"ovs5a5"}],["path",{d:"M4 7c0-1.7 1.3-3 3-3h13",key:"10pag4"}],["path",{d:"M18 20c-1.7 0-3-1.3-3-3V4",key:"1gaosr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kG=U("Piano",[["path",{d:"M18.5 8c-1.4 0-2.6-.8-3.2-2A6.87 6.87 0 0 0 2 9v11a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-8.5C22 9.6 20.4 8 18.5 8",key:"lag0yf"}],["path",{d:"M2 14h20",key:"myj16y"}],["path",{d:"M6 14v4",key:"9ng0ue"}],["path",{d:"M10 14v4",key:"1v8uk5"}],["path",{d:"M14 14v4",key:"1tqops"}],["path",{d:"M18 14v4",key:"18uqwm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NG=U("Pickaxe",[["path",{d:"M14.531 12.469 6.619 20.38a1 1 0 1 1-3-3l7.912-7.912",key:"we99rg"}],["path",{d:"M15.686 4.314A12.5 12.5 0 0 0 5.461 2.958 1 1 0 0 0 5.58 4.71a22 22 0 0 1 6.318 3.393",key:"1w6hck"}],["path",{d:"M17.7 3.7a1 1 0 0 0-1.4 0l-4.6 4.6a1 1 0 0 0 0 1.4l2.6 2.6a1 1 0 0 0 1.4 0l4.6-4.6a1 1 0 0 0 0-1.4z",key:"15hgfx"}],["path",{d:"M19.686 8.314a12.501 12.501 0 0 1 1.356 10.225 1 1 0 0 1-1.751-.119 22 22 0 0 0-3.393-6.319",key:"452b4h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SG=U("PictureInPicture2",[["path",{d:"M21 9V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10c0 1.1.9 2 2 2h4",key:"daa4of"}],["rect",{width:"10",height:"7",x:"12",y:"13",rx:"2",key:"1nb8gs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CG=U("PictureInPicture",[["path",{d:"M8 4.5v5H3m-1-6 6 6m13 0v-3c0-1.16-.84-2-2-2h-7m-9 9v2c0 1.05.95 2 2 2h3",key:"bcd8fb"}],["rect",{width:"10",height:"7",x:"12",y:"13.5",ry:"2",key:"136fx3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MG=U("PiggyBank",[["path",{d:"M19 5c-1.5 0-2.8 1.4-3 2-3.5-1.5-11-.3-11 5 0 1.8 0 3 2 4.5V20h4v-2h3v2h4v-4c1-.5 1.7-1 2-2h2v-4h-2c0-1-.5-1.5-1-2V5z",key:"1ivx2i"}],["path",{d:"M2 9v1c0 1.1.9 2 2 2h1",key:"nm575m"}],["path",{d:"M16 11h.01",key:"xkw8gn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TG=U("PilcrowLeft",[["path",{d:"M14 3v11",key:"mlfb7b"}],["path",{d:"M14 9h-3a3 3 0 0 1 0-6h9",key:"1ulc19"}],["path",{d:"M18 3v11",key:"1phi0r"}],["path",{d:"M22 18H2l4-4",key:"yt65j9"}],["path",{d:"m6 22-4-4",key:"6jgyf5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AG=U("PilcrowRight",[["path",{d:"M10 3v11",key:"o3l5kj"}],["path",{d:"M10 9H7a1 1 0 0 1 0-6h8",key:"1wb1nc"}],["path",{d:"M14 3v11",key:"mlfb7b"}],["path",{d:"m18 14 4 4H2",key:"4r8io1"}],["path",{d:"m22 18-4 4",key:"1hjjrd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EG=U("Pilcrow",[["path",{d:"M13 4v16",key:"8vvj80"}],["path",{d:"M17 4v16",key:"7dpous"}],["path",{d:"M19 4H9.5a4.5 4.5 0 0 0 0 9H13",key:"sh4n9v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IG=U("PillBottle",[["path",{d:"M18 11h-4a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h4",key:"17ldeb"}],["path",{d:"M6 7v13a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7",key:"nc37y6"}],["rect",{width:"16",height:"5",x:"4",y:"2",rx:"1",key:"3jeezo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PG=U("Pill",[["path",{d:"m10.5 20.5 10-10a4.95 4.95 0 1 0-7-7l-10 10a4.95 4.95 0 1 0 7 7Z",key:"wa1lgi"}],["path",{d:"m8.5 8.5 7 7",key:"rvfmvr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vT=U("PinOff",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X0=U("Pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LG=U("Pipette",[["path",{d:"m2 22 1-1h3l9-9",key:"1sre89"}],["path",{d:"M3 21v-3l9-9",key:"hpe2y6"}],["path",{d:"m15 6 3.4-3.4a2.1 2.1 0 1 1 3 3L18 9l.4.4a2.1 2.1 0 1 1-3 3l-3.8-3.8a2.1 2.1 0 1 1 3-3l.4.4Z",key:"196du1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OG=U("Pizza",[["path",{d:"m12 14-1 1",key:"11onhr"}],["path",{d:"m13.75 18.25-1.25 1.42",key:"1yisr3"}],["path",{d:"M17.775 5.654a15.68 15.68 0 0 0-12.121 12.12",key:"1qtqk6"}],["path",{d:"M18.8 9.3a1 1 0 0 0 2.1 7.7",key:"fbbbr2"}],["path",{d:"M21.964 20.732a1 1 0 0 1-1.232 1.232l-18-5a1 1 0 0 1-.695-1.232A19.68 19.68 0 0 1 15.732 2.037a1 1 0 0 1 1.232.695z",key:"1hyfdd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DG=U("PlaneLanding",[["path",{d:"M2 22h20",key:"272qi7"}],["path",{d:"M3.77 10.77 2 9l2-4.5 1.1.55c.55.28.9.84.9 1.45s.35 1.17.9 1.45L8 8.5l3-6 1.05.53a2 2 0 0 1 1.09 1.52l.72 5.4a2 2 0 0 0 1.09 1.52l4.4 2.2c.42.22.78.55 1.01.96l.6 1.03c.49.88-.06 1.98-1.06 2.1l-1.18.15c-.47.06-.95-.02-1.37-.24L4.29 11.15a2 2 0 0 1-.52-.38Z",key:"1ma21e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RG=U("PlaneTakeoff",[["path",{d:"M2 22h20",key:"272qi7"}],["path",{d:"M6.36 17.4 4 17l-2-4 1.1-.55a2 2 0 0 1 1.8 0l.17.1a2 2 0 0 0 1.8 0L8 12 5 6l.9-.45a2 2 0 0 1 2.09.2l4.02 3a2 2 0 0 0 2.1.2l4.19-2.06a2.41 2.41 0 0 1 1.73-.17L21 7a1.4 1.4 0 0 1 .87 1.99l-.38.76c-.23.46-.6.84-1.07 1.08L7.58 17.2a2 2 0 0 1-1.22.18Z",key:"fkigj9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FG=U("Plane",[["path",{d:"M17.8 19.2 16 11l3.5-3.5C21 6 21.5 4 21 3c-1-.5-3 0-4.5 1.5L13 8 4.8 6.2c-.5-.1-.9.1-1.1.5l-.3.5c-.2.5-.1 1 .3 1.3L9 12l-2 3H4l-1 1 3 2 2 3 1-1v-3l3-2 3.5 5.3c.3.4.8.5 1.3.3l.5-.2c.4-.3.6-.7.5-1.2z",key:"1v9wt8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wc=U("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zG=U("Plug2",[["path",{d:"M9 2v6",key:"17ngun"}],["path",{d:"M15 2v6",key:"s7yy2p"}],["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M5 8h14",key:"pcz4l3"}],["path",{d:"M6 11V8h12v3a6 6 0 1 1-12 0Z",key:"wtfw2c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A2=U("PlugZap",[["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m18 3-4 4h6l-4 4",key:"16psg9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BG=U("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sn=U("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $G=U("PocketKnife",[["path",{d:"M3 2v1c0 1 2 1 2 2S3 6 3 7s2 1 2 2-2 1-2 2 2 1 2 2",key:"19w3oe"}],["path",{d:"M18 6h.01",key:"1v4wsw"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M20.83 8.83a4 4 0 0 0-5.66-5.66l-12 12a4 4 0 1 0 5.66 5.66Z",key:"6fykxj"}],["path",{d:"M18 11.66V22a4 4 0 0 0 4-4V6",key:"1utzek"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UG=U("Pocket",[["path",{d:"M4 3h16a2 2 0 0 1 2 2v6a10 10 0 0 1-10 10A10 10 0 0 1 2 11V5a2 2 0 0 1 2-2z",key:"1mz881"}],["polyline",{points:"8 10 12 14 16 10",key:"w4mbv5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qG=U("Podcast",[["path",{d:"M16.85 18.58a9 9 0 1 0-9.7 0",key:"d71mpg"}],["path",{d:"M8 14a5 5 0 1 1 8 0",key:"fc81rn"}],["circle",{cx:"12",cy:"11",r:"1",key:"1gvufo"}],["path",{d:"M13 17a1 1 0 1 0-2 0l.5 4.5a.5.5 0 1 0 1 0Z",key:"za5kbj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VG=U("PointerOff",[["path",{d:"M10 4.5V4a2 2 0 0 0-2.41-1.957",key:"jsi14n"}],["path",{d:"M13.9 8.4a2 2 0 0 0-1.26-1.295",key:"hirc7f"}],["path",{d:"M21.7 16.2A8 8 0 0 0 22 14v-3a2 2 0 1 0-4 0v-1a2 2 0 0 0-3.63-1.158",key:"1jxb2e"}],["path",{d:"m7 15-1.8-1.8a2 2 0 0 0-2.79 2.86L6 19.7a7.74 7.74 0 0 0 6 2.3h2a8 8 0 0 0 5.657-2.343",key:"10r7hm"}],["path",{d:"M6 6v8",key:"tv5xkp"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HG=U("Pointer",[["path",{d:"M22 14a8 8 0 0 1-8 8",key:"56vcr3"}],["path",{d:"M18 11v-1a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1agjmk"}],["path",{d:"M14 10V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1",key:"wdbh2u"}],["path",{d:"M10 9.5V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v10",key:"1ibuk9"}],["path",{d:"M18 11a2 2 0 1 1 4 0v3a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"g6ys72"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WG=U("Popcorn",[["path",{d:"M18 8a2 2 0 0 0 0-4 2 2 0 0 0-4 0 2 2 0 0 0-4 0 2 2 0 0 0-4 0 2 2 0 0 0 0 4",key:"10td1f"}],["path",{d:"M10 22 9 8",key:"yjptiv"}],["path",{d:"m14 22 1-14",key:"8jwc8b"}],["path",{d:"M20 8c.5 0 .9.4.8 1l-2.6 12c-.1.5-.7 1-1.2 1H7c-.6 0-1.1-.4-1.2-1L3.2 9c-.1-.6.3-1 .8-1Z",key:"1qo33t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GG=U("Popsicle",[["path",{d:"M18.6 14.4c.8-.8.8-2 0-2.8l-8.1-8.1a4.95 4.95 0 1 0-7.1 7.1l8.1 8.1c.9.7 2.1.7 2.9-.1Z",key:"1o68ps"}],["path",{d:"m22 22-5.5-5.5",key:"17o70y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KG=U("PoundSterling",[["path",{d:"M18 7c0-5.333-8-5.333-8 0",key:"1prm2n"}],["path",{d:"M10 7v14",key:"18tmcs"}],["path",{d:"M6 21h12",key:"4dkmi1"}],["path",{d:"M6 13h10",key:"ybwr4a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZG=U("PowerOff",[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YG=U("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XG=U("Presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QG=U("PrinterCheck",[["path",{d:"M13.5 22H7a1 1 0 0 1-1-1v-6a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v.5",key:"qeb09x"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}],["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v2",key:"1md90i"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JG=U("Printer",[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eK=U("Projector",[["path",{d:"M5 7 3 5",key:"1yys58"}],["path",{d:"M9 6V3",key:"1ptz9u"}],["path",{d:"m13 7 2-2",key:"1w3vmq"}],["circle",{cx:"9",cy:"13",r:"3",key:"1mma13"}],["path",{d:"M11.83 12H20a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h2.17",key:"2frwzc"}],["path",{d:"M16 16h2",key:"dnq2od"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tK=U("Proportions",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M12 9v11",key:"1fnkrn"}],["path",{d:"M2 9h13a2 2 0 0 1 2 2v9",key:"11z3ex"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rK=U("Puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nK=U("Pyramid",[["path",{d:"M2.5 16.88a1 1 0 0 1-.32-1.43l9-13.02a1 1 0 0 1 1.64 0l9 13.01a1 1 0 0 1-.32 1.44l-8.51 4.86a2 2 0 0 1-1.98 0Z",key:"aenxs0"}],["path",{d:"M12 2v20",key:"t6zp3m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sK=U("QrCode",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iK=U("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aK=U("Rabbit",[["path",{d:"M13 16a3 3 0 0 1 2.24 5",key:"1epib5"}],["path",{d:"M18 12h.01",key:"yjnet6"}],["path",{d:"M18 21h-8a4 4 0 0 1-4-4 7 7 0 0 1 7-7h.2L9.6 6.4a1 1 0 1 1 2.8-2.8L15.8 7h.2c3.3 0 6 2.7 6 6v1a2 2 0 0 1-2 2h-1a3 3 0 0 0-3 3",key:"ue9ozu"}],["path",{d:"M20 8.54V4a2 2 0 1 0-4 0v3",key:"49iql8"}],["path",{d:"M7.612 12.524a3 3 0 1 0-1.6 4.3",key:"1e33i0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oK=U("Radar",[["path",{d:"M19.07 4.93A10 10 0 0 0 6.99 3.34",key:"z3du51"}],["path",{d:"M4 6h.01",key:"oypzma"}],["path",{d:"M2.29 9.62A10 10 0 1 0 21.31 8.35",key:"qzzz0"}],["path",{d:"M16.24 7.76A6 6 0 1 0 8.23 16.67",key:"1yjesh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M17.99 11.66A6 6 0 0 1 15.77 16.67",key:"1u2y91"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"m13.41 10.59 5.66-5.66",key:"mhq4k0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lK=U("Radiation",[["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M7.5 4.2c-.3-.5-.9-.7-1.3-.4C3.9 5.5 2.3 8.1 2 11c-.1.5.4 1 1 1h5c0-1.5.8-2.8 2-3.4-1.1-1.9-2-3.5-2.5-4.4z",key:"wy49g3"}],["path",{d:"M21 12c.6 0 1-.4 1-1-.3-2.9-1.8-5.5-4.1-7.1-.4-.3-1.1-.2-1.3.3-.6.9-1.5 2.5-2.6 4.3 1.2.7 2 2 2 3.5h5z",key:"vklnvr"}],["path",{d:"M7.5 19.8c-.3.5-.1 1.1.4 1.3 2.6 1.2 5.6 1.2 8.2 0 .5-.2.7-.8.4-1.3-.5-.9-1.4-2.5-2.5-4.3-1.2.7-2.8.7-4 0-1.1 1.8-2 3.4-2.5 4.3z",key:"wkdf1o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cK=U("Radical",[["path",{d:"M3 12h3.28a1 1 0 0 1 .948.684l2.298 7.934a.5.5 0 0 0 .96-.044L13.82 4.771A1 1 0 0 1 14.792 4H21",key:"1mqj8i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dK=U("RadioReceiver",[["path",{d:"M5 16v2",key:"g5qcv5"}],["path",{d:"M19 16v2",key:"1gbaio"}],["rect",{width:"20",height:"8",x:"2",y:"8",rx:"2",key:"vjsjur"}],["path",{d:"M18 12h.01",key:"yjnet6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uK=U("RadioTower",[["path",{d:"M4.9 16.1C1 12.2 1 5.8 4.9 1.9",key:"s0qx1y"}],["path",{d:"M7.8 4.7a6.14 6.14 0 0 0-.8 7.5",key:"1idnkw"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}],["path",{d:"M16.2 4.8c2 2 2.26 5.11.8 7.47",key:"ojru2q"}],["path",{d:"M19.1 1.9a9.96 9.96 0 0 1 0 14.1",key:"rhi7fg"}],["path",{d:"M9.5 18h5",key:"mfy3pd"}],["path",{d:"m8 22 4-11 4 11",key:"25yftu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Hw=U("Radio",[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hK=U("Radius",[["path",{d:"M20.34 17.52a10 10 0 1 0-2.82 2.82",key:"fydyku"}],["circle",{cx:"19",cy:"19",r:"2",key:"17f5cg"}],["path",{d:"m13.41 13.41 4.18 4.18",key:"1gqbwc"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fK=U("RailSymbol",[["path",{d:"M5 15h14",key:"m0yey3"}],["path",{d:"M5 9h14",key:"7tsvo6"}],["path",{d:"m14 20-5-5 6-6-5-5",key:"1jo42i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pK=U("Rainbow",[["path",{d:"M22 17a10 10 0 0 0-20 0",key:"ozegv"}],["path",{d:"M6 17a6 6 0 0 1 12 0",key:"5giftw"}],["path",{d:"M10 17a2 2 0 0 1 4 0",key:"gnsikk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mK=U("Rat",[["path",{d:"M17 5c0-1.7-1.3-3-3-3s-3 1.3-3 3c0 .8.3 1.5.8 2H11c-3.9 0-7 3.1-7 7c0 2.2 1.8 4 4 4",key:"1wq71c"}],["path",{d:"M16.8 3.9c.3-.3.6-.5 1-.7 1.5-.6 3.3.1 3.9 1.6.6 1.5-.1 3.3-1.6 3.9l1.6 2.8c.2.3.2.7.2 1-.2.8-.9 1.2-1.7 1.1 0 0-1.6-.3-2.7-.6H17c-1.7 0-3 1.3-3 3",key:"1crdmb"}],["path",{d:"M13.2 18a3 3 0 0 0-2.2-5",key:"1ol3lk"}],["path",{d:"M13 22H4a2 2 0 0 1 0-4h12",key:"bt3f23"}],["path",{d:"M16 9h.01",key:"1bdo4e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gK=U("Ratio",[["rect",{width:"12",height:"20",x:"6",y:"2",rx:"2",key:"1oxtiu"}],["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yK=U("ReceiptCent",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M12 6.5v11",key:"ecfhkf"}],["path",{d:"M15 9.4a4 4 0 1 0 0 5.2",key:"1makmb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xK=U("ReceiptEuro",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M8 12h5",key:"1g6qi8"}],["path",{d:"M16 9.5a4 4 0 1 0 0 5.2",key:"b2px4r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vK=U("ReceiptIndianRupee",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M8 7h8",key:"i86dvs"}],["path",{d:"M12 17.5 8 15h1a4 4 0 0 0 0-8",key:"grpkl4"}],["path",{d:"M8 11h8",key:"vwpz6n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _K=U("ReceiptJapaneseYen",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"m12 10 3-3",key:"1mc12w"}],["path",{d:"m9 7 3 3v7.5",key:"39i0xv"}],["path",{d:"M9 11h6",key:"1fldmi"}],["path",{d:"M9 15h6",key:"cctwl0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bK=U("ReceiptPoundSterling",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M8 13h5",key:"1k9z8w"}],["path",{d:"M10 17V9.5a2.5 2.5 0 0 1 5 0",key:"1dzgp0"}],["path",{d:"M8 17h7",key:"8mjdqu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wK=U("ReceiptRussianRuble",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M8 15h5",key:"vxg57a"}],["path",{d:"M8 11h5a2 2 0 1 0 0-4h-3v10",key:"1usi5u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jK=U("ReceiptSwissFranc",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M10 17V7h5",key:"k7jq18"}],["path",{d:"M10 11h4",key:"1i0mka"}],["path",{d:"M8 15h5",key:"vxg57a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kK=U("ReceiptText",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M14 8H8",key:"1l3xfs"}],["path",{d:"M16 12H8",key:"1fr5h0"}],["path",{d:"M13 16H8",key:"wsln4y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NK=U("Receipt",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 17.5v-11",key:"1jc1ny"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E2=U("RectangleEllipsis",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M17 12h.01",key:"1m0b6t"}],["path",{d:"M7 12h.01",key:"eqddd0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SK=U("RectangleHorizontal",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CK=U("RectangleVertical",[["rect",{width:"12",height:"20",x:"6",y:"2",rx:"2",key:"1oxtiu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MK=U("Recycle",[["path",{d:"M7 19H4.815a1.83 1.83 0 0 1-1.57-.881 1.785 1.785 0 0 1-.004-1.784L7.196 9.5",key:"x6z5xu"}],["path",{d:"M11 19h8.203a1.83 1.83 0 0 0 1.556-.89 1.784 1.784 0 0 0 0-1.775l-1.226-2.12",key:"1x4zh5"}],["path",{d:"m14 16-3 3 3 3",key:"f6jyew"}],["path",{d:"M8.293 13.596 7.196 9.5 3.1 10.598",key:"wf1obh"}],["path",{d:"m9.344 5.811 1.093-1.892A1.83 1.83 0 0 1 11.985 3a1.784 1.784 0 0 1 1.546.888l3.943 6.843",key:"9tzpgr"}],["path",{d:"m13.378 9.633 4.096 1.098 1.097-4.096",key:"1oe83g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TK=U("Redo2",[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AK=U("RedoDot",[["circle",{cx:"12",cy:"17",r:"1",key:"1ixnty"}],["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YS=U("Redo",[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EK=U("RefreshCcwDot",[["path",{d:"M3 2v6h6",key:"18ldww"}],["path",{d:"M21 12A9 9 0 0 0 6 5.3L3 8",key:"1pbrqz"}],["path",{d:"M21 22v-6h-6",key:"usdfbe"}],["path",{d:"M3 12a9 9 0 0 0 15 6.7l3-2.7",key:"1hosoe"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IK=U("RefreshCcw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PK=U("RefreshCwOff",[["path",{d:"M21 8L18.74 5.74A9.75 9.75 0 0 0 12 3C11 3 10.03 3.16 9.13 3.47",key:"1krf6h"}],["path",{d:"M8 16H3v5",key:"1cv678"}],["path",{d:"M3 12C3 9.51 4 7.26 5.64 5.64",key:"ruvoct"}],["path",{d:"m3 16 2.26 2.26A9.75 9.75 0 0 0 12 21c2.49 0 4.74-1 6.36-2.64",key:"19q130"}],["path",{d:"M21 12c0 1-.16 1.97-.47 2.87",key:"4w8emr"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M22 22 2 2",key:"1r8tn9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Dl=U("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LK=U("Refrigerator",[["path",{d:"M5 6a4 4 0 0 1 4-4h6a4 4 0 0 1 4 4v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6Z",key:"fpq118"}],["path",{d:"M5 10h14",key:"elsbfy"}],["path",{d:"M15 7v6",key:"1nx30x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OK=U("Regex",[["path",{d:"M17 3v10",key:"15fgeh"}],["path",{d:"m12.67 5.5 8.66 5",key:"1gpheq"}],["path",{d:"m12.67 10.5 8.66-5",key:"1dkfa6"}],["path",{d:"M9 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-2z",key:"swwfx4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DK=U("RemoveFormatting",[["path",{d:"M4 7V4h16v3",key:"9msm58"}],["path",{d:"M5 20h6",key:"1h6pxn"}],["path",{d:"M13 4 8 20",key:"kqq6aj"}],["path",{d:"m15 15 5 5",key:"me55sn"}],["path",{d:"m20 15-5 5",key:"11p7ol"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RK=U("Repeat1",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}],["path",{d:"M11 10h1v4",key:"70cz1p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FK=U("Repeat2",[["path",{d:"m2 9 3-3 3 3",key:"1ltn5i"}],["path",{d:"M13 18H7a2 2 0 0 1-2-2V6",key:"1r6tfw"}],["path",{d:"m22 15-3 3-3-3",key:"4rnwn2"}],["path",{d:"M11 6h6a2 2 0 0 1 2 2v10",key:"2f72bc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zK=U("Repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BK=U("ReplaceAll",[["path",{d:"M14 14a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2",key:"1yyzbs"}],["path",{d:"M14 4a2 2 0 0 1 2-2",key:"1w2hp7"}],["path",{d:"M16 10a2 2 0 0 1-2-2",key:"shjach"}],["path",{d:"M20 14a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2",key:"zfj4xr"}],["path",{d:"M20 2a2 2 0 0 1 2 2",key:"188mtx"}],["path",{d:"M22 8a2 2 0 0 1-2 2",key:"ddf4tu"}],["path",{d:"m3 7 3 3 3-3",key:"x25e72"}],["path",{d:"M6 10V5a 3 3 0 0 1 3-3h1",key:"1ageje"}],["rect",{x:"2",y:"14",width:"8",height:"8",rx:"2",key:"4rksxw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $K=U("Replace",[["path",{d:"M14 4a2 2 0 0 1 2-2",key:"1w2hp7"}],["path",{d:"M16 10a2 2 0 0 1-2-2",key:"shjach"}],["path",{d:"M20 2a2 2 0 0 1 2 2",key:"188mtx"}],["path",{d:"M22 8a2 2 0 0 1-2 2",key:"ddf4tu"}],["path",{d:"m3 7 3 3 3-3",key:"x25e72"}],["path",{d:"M6 10V5a3 3 0 0 1 3-3h1",key:"3y3t5z"}],["rect",{x:"2",y:"14",width:"8",height:"8",rx:"2",key:"4rksxw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UK=U("ReplyAll",[["polyline",{points:"7 17 2 12 7 7",key:"t83bqg"}],["polyline",{points:"12 17 7 12 12 7",key:"1g4ajm"}],["path",{d:"M22 18v-2a4 4 0 0 0-4-4H7",key:"1fcyog"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _T=U("Reply",[["polyline",{points:"9 17 4 12 9 7",key:"hvgpf2"}],["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qK=U("Rewind",[["polygon",{points:"11 19 2 12 11 5 11 19",key:"14yba5"}],["polygon",{points:"22 19 13 12 22 5 22 19",key:"1pi1cj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VK=U("Ribbon",[["path",{d:"M12 11.22C11 9.997 10 9 10 8a2 2 0 0 1 4 0c0 1-.998 2.002-2.01 3.22",key:"1rnhq3"}],["path",{d:"m12 18 2.57-3.5",key:"116vt7"}],["path",{d:"M6.243 9.016a7 7 0 0 1 11.507-.009",key:"10dq0b"}],["path",{d:"M9.35 14.53 12 11.22",key:"tdsyp2"}],["path",{d:"M9.35 14.53C7.728 12.246 6 10.221 6 7a6 5 0 0 1 12 0c-.005 3.22-1.778 5.235-3.43 7.5l3.557 4.527a1 1 0 0 1-.203 1.43l-1.894 1.36a1 1 0 0 1-1.384-.215L12 18l-2.679 3.593a1 1 0 0 1-1.39.213l-1.865-1.353a1 1 0 0 1-.203-1.422z",key:"nmifey"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cg=U("Rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HK=U("RockingChair",[["polyline",{points:"3.5 2 6.5 12.5 18 12.5",key:"y3iy52"}],["line",{x1:"9.5",x2:"5.5",y1:"12.5",y2:"20",key:"19vg5i"}],["line",{x1:"15",x2:"18.5",y1:"12.5",y2:"20",key:"1inpmv"}],["path",{d:"M2.75 18a13 13 0 0 0 18.5 0",key:"1nquas"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WK=U("RollerCoaster",[["path",{d:"M6 19V5",key:"1r845m"}],["path",{d:"M10 19V6.8",key:"9j2tfs"}],["path",{d:"M14 19v-7.8",key:"10s8qv"}],["path",{d:"M18 5v4",key:"1tajlv"}],["path",{d:"M18 19v-6",key:"ielfq3"}],["path",{d:"M22 19V9",key:"158nzp"}],["path",{d:"M2 19V9a4 4 0 0 1 4-4c2 0 4 1.33 6 4s4 4 6 4a4 4 0 1 0-3-6.65",key:"1930oh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I2=U("Rotate3d",[["path",{d:"M16.466 7.5C15.643 4.237 13.952 2 12 2 9.239 2 7 6.477 7 12s2.239 10 5 10c.342 0 .677-.069 1-.2",key:"10n0gc"}],["path",{d:"m15.194 13.707 3.814 1.86-1.86 3.814",key:"16shm9"}],["path",{d:"M19 15.57c-1.804.885-4.274 1.43-7 1.43-5.523 0-10-2.239-10-5s4.477-5 10-5c4.838 0 8.873 1.718 9.8 4",key:"1lxi77"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GK=U("RotateCcwSquare",[["path",{d:"M20 9V7a2 2 0 0 0-2-2h-6",key:"19z8uc"}],["path",{d:"m15 2-3 3 3 3",key:"177bxs"}],["path",{d:"M20 13v5a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h2",key:"d36hnl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XS=U("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KK=U("RotateCwSquare",[["path",{d:"M12 5H6a2 2 0 0 0-2 2v3",key:"l96uqu"}],["path",{d:"m9 8 3-3-3-3",key:"1gzgc3"}],["path",{d:"M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2",key:"1w2k5h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bT=U("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZK=U("RouteOff",[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5c.4 0 .9-.1 1.3-.2",key:"1effex"}],["path",{d:"M5.2 5.2A3.5 3.53 0 0 0 6.5 12H12",key:"k9y2ds"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M21 15.3a3.5 3.5 0 0 0-3.3-3.3",key:"11nlu2"}],["path",{d:"M15 5h-4.3",key:"6537je"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YK=U("Route",[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XK=U("Router",[["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6.01 18H6",key:"19vcac"}],["path",{d:"M10.01 18H10",key:"uamcmx"}],["path",{d:"M15 10v4",key:"qjz1xs"}],["path",{d:"M17.84 7.17a4 4 0 0 0-5.66 0",key:"1rif40"}],["path",{d:"M20.66 4.34a8 8 0 0 0-11.31 0",key:"6a5xfq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P2=U("Rows2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L2=U("Rows3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QK=U("Rows4",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 7.5H3",key:"1hm9pq"}],["path",{d:"M21 12H3",key:"2avoz0"}],["path",{d:"M21 16.5H3",key:"n7jzkj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JK=U("Rss",[["path",{d:"M4 11a9 9 0 0 1 9 9",key:"pv89mb"}],["path",{d:"M4 4a16 16 0 0 1 16 16",key:"k0647b"}],["circle",{cx:"5",cy:"19",r:"1",key:"bfqh0e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eZ=U("Ruler",[["path",{d:"M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z",key:"icamh8"}],["path",{d:"m14.5 12.5 2-2",key:"inckbg"}],["path",{d:"m11.5 9.5 2-2",key:"fmmyf7"}],["path",{d:"m8.5 6.5 2-2",key:"vc6u1g"}],["path",{d:"m17.5 15.5 2-2",key:"wo5hmg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tZ=U("RussianRuble",[["path",{d:"M6 11h8a4 4 0 0 0 0-8H9v18",key:"18ai8t"}],["path",{d:"M6 15h8",key:"1y8f6l"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rZ=U("Sailboat",[["path",{d:"M22 18H2a4 4 0 0 0 4 4h12a4 4 0 0 0 4-4Z",key:"1404fh"}],["path",{d:"M21 14 10 2 3 14h18Z",key:"1nzg7v"}],["path",{d:"M10 2v16",key:"1labyt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nZ=U("Salad",[["path",{d:"M7 21h10",key:"1b0cd5"}],["path",{d:"M12 21a9 9 0 0 0 9-9H3a9 9 0 0 0 9 9Z",key:"4rw317"}],["path",{d:"M11.38 12a2.4 2.4 0 0 1-.4-4.77 2.4 2.4 0 0 1 3.2-2.77 2.4 2.4 0 0 1 3.47-.63 2.4 2.4 0 0 1 3.37 3.37 2.4 2.4 0 0 1-1.1 3.7 2.51 2.51 0 0 1 .03 1.1",key:"10xrj0"}],["path",{d:"m13 12 4-4",key:"1hckqy"}],["path",{d:"M10.9 7.25A3.99 3.99 0 0 0 4 10c0 .73.2 1.41.54 2",key:"1p4srx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sZ=U("Sandwich",[["path",{d:"m2.37 11.223 8.372-6.777a2 2 0 0 1 2.516 0l8.371 6.777",key:"f1wd0e"}],["path",{d:"M21 15a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-5.25",key:"1pfu07"}],["path",{d:"M3 15a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h9",key:"1oq9qw"}],["path",{d:"m6.67 15 6.13 4.6a2 2 0 0 0 2.8-.4l3.15-4.2",key:"1fnwu5"}],["rect",{width:"20",height:"4",x:"2",y:"11",rx:"1",key:"itshg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iZ=U("SatelliteDish",[["path",{d:"M4 10a7.31 7.31 0 0 0 10 10Z",key:"1fzpp3"}],["path",{d:"m9 15 3-3",key:"88sc13"}],["path",{d:"M17 13a6 6 0 0 0-6-6",key:"15cc6u"}],["path",{d:"M21 13A10 10 0 0 0 11 3",key:"11nf8s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aZ=U("Satellite",[["path",{d:"M13 7 9 3 5 7l4 4",key:"vyckw6"}],["path",{d:"m17 11 4 4-4 4-4-4",key:"rchckc"}],["path",{d:"m8 12 4 4 6-6-4-4Z",key:"1sshf7"}],["path",{d:"m16 8 3-3",key:"x428zp"}],["path",{d:"M9 21a6 6 0 0 0-6-6",key:"1iajcf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oZ=U("SaveAll",[["path",{d:"M10 2v3a1 1 0 0 0 1 1h5",key:"1xspal"}],["path",{d:"M18 18v-6a1 1 0 0 0-1-1h-6a1 1 0 0 0-1 1v6",key:"1ra60u"}],["path",{d:"M18 22H4a2 2 0 0 1-2-2V6",key:"pblm9e"}],["path",{d:"M8 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9.172a2 2 0 0 1 1.414.586l2.828 2.828A2 2 0 0 1 22 6.828V16a2 2 0 0 1-2.01 2z",key:"1yve0x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lZ=U("SaveOff",[["path",{d:"M13 13H8a1 1 0 0 0-1 1v7",key:"h8g396"}],["path",{d:"M14 8h1",key:"1lfen6"}],["path",{d:"M17 21v-4",key:"1yknxs"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M20.41 20.41A2 2 0 0 1 19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 .59-1.41",key:"1t4vdl"}],["path",{d:"M29.5 11.5s5 5 4 5",key:"zzn4i6"}],["path",{d:"M9 3h6.2a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V15",key:"24cby9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dg=U("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O2=U("Scale3d",[["path",{d:"M5 7v11a1 1 0 0 0 1 1h11",key:"13dt1j"}],["path",{d:"M5.293 18.707 11 13",key:"ezgbsx"}],["circle",{cx:"19",cy:"19",r:"2",key:"17f5cg"}],["circle",{cx:"5",cy:"5",r:"2",key:"1gwv83"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cZ=U("Scale",[["path",{d:"m16 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"7g6ntu"}],["path",{d:"m2 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"ijws7r"}],["path",{d:"M7 21h10",key:"1b0cd5"}],["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 7h2c2 0 5-1 7-2 2 1 5 2 7 2h2",key:"3gwbw2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dZ=U("Scaling",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M14 15H9v-5",key:"pi4jk9"}],["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M21 3 9 15",key:"15kdhq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uZ=U("ScanBarcode",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M8 7v10",key:"23sfjj"}],["path",{d:"M12 7v10",key:"jspqdw"}],["path",{d:"M17 7v10",key:"578dap"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hZ=U("ScanEye",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fZ=U("ScanFace",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"M15 9h.01",key:"x1ddxp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pZ=U("ScanLine",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M7 12h10",key:"b7w52i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mZ=U("ScanQrCode",[["path",{d:"M17 12v4a1 1 0 0 1-1 1h-4",key:"uk4fdo"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M17 8V7",key:"q2g9wo"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M7 17h.01",key:"19xn7k"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["rect",{x:"7",y:"7",width:"5",height:"5",rx:"1",key:"m9kyts"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gZ=U("ScanSearch",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"m16 16-1.9-1.9",key:"1dq9hf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yZ=U("ScanText",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M7 8h8",key:"1jbsf9"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M7 16h6",key:"1vyc9m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xZ=U("Scan",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vZ=U("School",[["path",{d:"M14 22v-4a2 2 0 1 0-4 0v4",key:"hhkicm"}],["path",{d:"m18 10 3.447 1.724a1 1 0 0 1 .553.894V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-7.382a1 1 0 0 1 .553-.894L6 10",key:"1xqip1"}],["path",{d:"M18 5v17",key:"1sw6gf"}],["path",{d:"m4 6 7.106-3.553a2 2 0 0 1 1.788 0L20 6",key:"9d2mlk"}],["path",{d:"M6 5v17",key:"1xfsm0"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _Z=U("ScissorsLineDashed",[["path",{d:"M5.42 9.42 8 12",key:"12pkuq"}],["circle",{cx:"4",cy:"8",r:"2",key:"107mxr"}],["path",{d:"m14 6-8.58 8.58",key:"gvzu5l"}],["circle",{cx:"4",cy:"16",r:"2",key:"1ehqvc"}],["path",{d:"M10.8 14.8 14 18",key:"ax7m9r"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bZ=U("Scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wZ=U("ScreenShareOff",[["path",{d:"M13 3H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-3",key:"i8wdob"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"m22 3-5 5",key:"12jva0"}],["path",{d:"m17 3 5 5",key:"k36vhe"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jZ=U("ScreenShare",[["path",{d:"M13 3H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-3",key:"i8wdob"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"m17 8 5-5",key:"fqif7o"}],["path",{d:"M17 3h5v5",key:"1o3tu8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kZ=U("ScrollText",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NZ=U("Scroll",[["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SZ=U("SearchCheck",[["path",{d:"m8 11 2 2 4-4",key:"1sed1v"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CZ=U("SearchCode",[["path",{d:"m13 13.5 2-2.5-2-2.5",key:"1rvxrh"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}],["path",{d:"M9 8.5 7 11l2 2.5",key:"6ffwbx"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MZ=U("SearchSlash",[["path",{d:"m13.5 8.5-5 5",key:"1cs55j"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TZ=U("SearchX",[["path",{d:"m13.5 8.5-5 5",key:"1cs55j"}],["path",{d:"m8.5 8.5 5 5",key:"a8mexj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ti=U("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AZ=U("Section",[["path",{d:"M16 5a4 3 0 0 0-8 0c0 4 8 3 8 7a4 3 0 0 1-8 0",key:"vqan6v"}],["path",{d:"M8 19a4 3 0 0 0 8 0c0-4-8-3-8-7a4 3 0 0 1 8 0",key:"wdjd8o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D2=U("SendHorizontal",[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EZ=U("SendToBack",[["rect",{x:"14",y:"14",width:"8",height:"8",rx:"2",key:"1b0bso"}],["rect",{x:"2",y:"2",width:"8",height:"8",rx:"2",key:"1x09vl"}],["path",{d:"M7 14v1a2 2 0 0 0 2 2h1",key:"pao6x6"}],["path",{d:"M14 7h1a2 2 0 0 1 2 2v1",key:"19tdru"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const To=U("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IZ=U("SeparatorHorizontal",[["line",{x1:"3",x2:"21",y1:"12",y2:"12",key:"10d38w"}],["polyline",{points:"8 8 12 4 16 8",key:"zo8t4w"}],["polyline",{points:"16 16 12 20 8 16",key:"1oyrid"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PZ=U("SeparatorVertical",[["line",{x1:"12",x2:"12",y1:"3",y2:"21",key:"1efggb"}],["polyline",{points:"8 8 4 12 8 16",key:"bnfmv4"}],["polyline",{points:"16 16 20 12 16 8",key:"u90052"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LZ=U("ServerCog",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M4.5 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-.5",key:"tn8das"}],["path",{d:"M4.5 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-.5",key:"1g2pve"}],["path",{d:"M6 6h.01",key:"1utrut"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"m15.7 13.4-.9-.3",key:"1jwmzr"}],["path",{d:"m9.2 10.9-.9-.3",key:"qapnim"}],["path",{d:"m10.6 15.7.3-.9",key:"quwk0k"}],["path",{d:"m13.6 15.7-.4-1",key:"cb9xp7"}],["path",{d:"m10.8 9.3-.4-1",key:"1uaiz5"}],["path",{d:"m8.3 13.6 1-.4",key:"s6srou"}],["path",{d:"m14.7 10.8 1-.4",key:"4d31cq"}],["path",{d:"m13.4 8.3-.3.9",key:"1bm987"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OZ=U("ServerCrash",[["path",{d:"M6 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-2",key:"4b9dqc"}],["path",{d:"M6 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-2",key:"22nnkd"}],["path",{d:"M6 6h.01",key:"1utrut"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"m13 6-4 6h6l-4 6",key:"14hqih"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DZ=U("ServerOff",[["path",{d:"M7 2h13a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-5",key:"bt2siv"}],["path",{d:"M10 10 2.5 2.5C2 2 2 2.5 2 5v3a2 2 0 0 0 2 2h6z",key:"1hjrv1"}],["path",{d:"M22 17v-1a2 2 0 0 0-2-2h-1",key:"1iynyr"}],["path",{d:"M4 14a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16.5l1-.5.5.5-8-8H4z",key:"161ggg"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RZ=U("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FZ=U("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const id=U("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zZ=U("Shapes",[["path",{d:"M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z",key:"1bo67w"}],["rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",key:"1bkyp8"}],["circle",{cx:"17.5",cy:"17.5",r:"3.5",key:"w3z12y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kd=U("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wT=U("Share",[["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["polyline",{points:"16 6 12 2 8 6",key:"m901s6"}],["line",{x1:"12",x2:"12",y1:"2",y2:"15",key:"1p0rca"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BZ=U("Sheet",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["line",{x1:"3",x2:"21",y1:"9",y2:"9",key:"1vqk6q"}],["line",{x1:"3",x2:"21",y1:"15",y2:"15",key:"o2sbyz"}],["line",{x1:"9",x2:"9",y1:"9",y2:"21",key:"1ib60c"}],["line",{x1:"15",x2:"15",y1:"9",y2:"21",key:"1n26ft"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $Z=U("Shell",[["path",{d:"M14 11a2 2 0 1 1-4 0 4 4 0 0 1 8 0 6 6 0 0 1-12 0 8 8 0 0 1 16 0 10 10 0 1 1-20 0 11.93 11.93 0 0 1 2.42-7.22 2 2 0 1 1 3.16 2.44",key:"1cn552"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UZ=U("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qZ=U("ShieldBan",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m4.243 5.21 14.39 12.472",key:"1c9a7c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jT=U("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VZ=U("ShieldEllipsis",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M8 12h.01",key:"czm47f"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 12h.01",key:"1l6xoz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HZ=U("ShieldHalf",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 22V2",key:"zs6s6o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WZ=U("ShieldMinus",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M9 12h6",key:"1c52cq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GZ=U("ShieldOff",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KZ=U("ShieldPlus",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M9 12h6",key:"1c52cq"}],["path",{d:"M12 9v6",key:"199k2o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZZ=U("ShieldQuestion",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R2=U("ShieldX",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sm=U("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YZ=U("ShipWheel",[["circle",{cx:"12",cy:"12",r:"8",key:"46899m"}],["path",{d:"M12 2v7.5",key:"1e5rl5"}],["path",{d:"m19 5-5.23 5.23",key:"1ezxxf"}],["path",{d:"M22 12h-7.5",key:"le1719"}],["path",{d:"m19 19-5.23-5.23",key:"p3fmgn"}],["path",{d:"M12 14.5V22",key:"dgcmos"}],["path",{d:"M10.23 13.77 5 19",key:"qwopd4"}],["path",{d:"M9.5 12H2",key:"r7bup8"}],["path",{d:"M10.23 10.23 5 5",key:"k2y7lj"}],["circle",{cx:"12",cy:"12",r:"2.5",key:"ix0uyj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XZ=U("Ship",[["path",{d:"M12 10.189V14",key:"1p8cqu"}],["path",{d:"M12 2v3",key:"qbqxhf"}],["path",{d:"M19 13V7a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2v6",key:"qpkstq"}],["path",{d:"M19.38 20A11.6 11.6 0 0 0 21 14l-8.188-3.639a2 2 0 0 0-1.624 0L3 14a11.6 11.6 0 0 0 2.81 7.76",key:"7tigtc"}],["path",{d:"M2 21c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1s1.2 1 2.5 1c2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"1924j5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QZ=U("Shirt",[["path",{d:"M20.38 3.46 16 2a4 4 0 0 1-8 0L3.62 3.46a2 2 0 0 0-1.34 2.23l.58 3.47a1 1 0 0 0 .99.84H6v10c0 1.1.9 2 2 2h8a2 2 0 0 0 2-2V10h2.15a1 1 0 0 0 .99-.84l.58-3.47a2 2 0 0 0-1.34-2.23z",key:"1wgbhj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ug=U("ShoppingBag",[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JZ=U("ShoppingBasket",[["path",{d:"m15 11-1 9",key:"5wnq3a"}],["path",{d:"m19 11-4-7",key:"cnml18"}],["path",{d:"M2 11h20",key:"3eubbj"}],["path",{d:"m3.5 11 1.6 7.4a2 2 0 0 0 2 1.6h9.8a2 2 0 0 0 2-1.6l1.7-7.4",key:"yiazzp"}],["path",{d:"M4.5 15.5h15",key:"13mye1"}],["path",{d:"m5 11 4-7",key:"116ra9"}],["path",{d:"m9 11 1 9",key:"1ojof7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sh=U("ShoppingCart",[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eY=U("Shovel",[["path",{d:"M2 22v-5l5-5 5 5-5 5z",key:"1fh25c"}],["path",{d:"M9.5 14.5 16 8",key:"1smz5x"}],["path",{d:"m17 2 5 5-.5.5a3.53 3.53 0 0 1-5 0s0 0 0 0a3.53 3.53 0 0 1 0-5L17 2",key:"1q8uv5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tY=U("ShowerHead",[["path",{d:"m4 4 2.5 2.5",key:"uv2vmf"}],["path",{d:"M13.5 6.5a4.95 4.95 0 0 0-7 7",key:"frdkwv"}],["path",{d:"M15 5 5 15",key:"1ag8rq"}],["path",{d:"M14 17v.01",key:"eokfpp"}],["path",{d:"M10 16v.01",key:"14uyyl"}],["path",{d:"M13 13v.01",key:"1v1k97"}],["path",{d:"M16 10v.01",key:"5169yg"}],["path",{d:"M11 20v.01",key:"cj92p8"}],["path",{d:"M17 14v.01",key:"11cswd"}],["path",{d:"M20 11v.01",key:"19e0od"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rY=U("Shrink",[["path",{d:"m15 15 6 6m-6-6v4.8m0-4.8h4.8",key:"17vawe"}],["path",{d:"M9 19.8V15m0 0H4.2M9 15l-6 6",key:"chjx8e"}],["path",{d:"M15 4.2V9m0 0h4.8M15 9l6-6",key:"lav6yq"}],["path",{d:"M9 4.2V9m0 0H4.2M9 9 3 3",key:"1pxi2q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nY=U("Shrub",[["path",{d:"M12 22v-7l-2-2",key:"eqv9mc"}],["path",{d:"M17 8v.8A6 6 0 0 1 13.8 20H10A6.5 6.5 0 0 1 7 8a5 5 0 0 1 10 0Z",key:"ubcgy"}],["path",{d:"m14 14-2 2",key:"847xa2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sY=U("Shuffle",[["path",{d:"m18 14 4 4-4 4",key:"10pe0f"}],["path",{d:"m18 2 4 4-4 4",key:"pucp1d"}],["path",{d:"M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22",key:"1ailkh"}],["path",{d:"M2 6h1.972a4 4 0 0 1 3.6 2.2",key:"km57vx"}],["path",{d:"M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45",key:"os18l9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iY=U("Sigma",[["path",{d:"M18 7V5a1 1 0 0 0-1-1H6.5a.5.5 0 0 0-.4.8l4.5 6a2 2 0 0 1 0 2.4l-4.5 6a.5.5 0 0 0 .4.8H17a1 1 0 0 0 1-1v-2",key:"wuwx1p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aY=U("SignalHigh",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}],["path",{d:"M12 20v-8",key:"i3yub9"}],["path",{d:"M17 20V8",key:"1tkaf5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oY=U("SignalLow",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lY=U("SignalMedium",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}],["path",{d:"M12 20v-8",key:"i3yub9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cY=U("SignalZero",[["path",{d:"M2 20h.01",key:"4haj6o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dY=U("Signal",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}],["path",{d:"M12 20v-8",key:"i3yub9"}],["path",{d:"M17 20V8",key:"1tkaf5"}],["path",{d:"M22 4v16",key:"sih9yq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uY=U("Signature",[["path",{d:"m21 17-2.156-1.868A.5.5 0 0 0 18 15.5v.5a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1c0-2.545-3.991-3.97-8.5-4a1 1 0 0 0 0 5c4.153 0 4.745-11.295 5.708-13.5a2.5 2.5 0 1 1 3.31 3.284",key:"y32ogt"}],["path",{d:"M3 21h18",key:"itz85i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hY=U("SignpostBig",[["path",{d:"M10 9H4L2 7l2-2h6",key:"1hq7x2"}],["path",{d:"M14 5h6l2 2-2 2h-6",key:"bv62ej"}],["path",{d:"M10 22V4a2 2 0 1 1 4 0v18",key:"eqpcf2"}],["path",{d:"M8 22h8",key:"rmew8v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fY=U("Signpost",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M12 3v3",key:"1n5kay"}],["path",{d:"M18 6a2 2 0 0 1 1.387.56l2.307 2.22a1 1 0 0 1 0 1.44l-2.307 2.22A2 2 0 0 1 18 13H6a2 2 0 0 1-1.387-.56l-2.306-2.22a1 1 0 0 1 0-1.44l2.306-2.22A2 2 0 0 1 6 6z",key:"gqqp9m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pY=U("Siren",[["path",{d:"M7 18v-6a5 5 0 1 1 10 0v6",key:"pcx96s"}],["path",{d:"M5 21a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-1a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2z",key:"1b4s83"}],["path",{d:"M21 12h1",key:"jtio3y"}],["path",{d:"M18.5 4.5 18 5",key:"g5sp9y"}],["path",{d:"M2 12h1",key:"1uaihz"}],["path",{d:"M12 2v1",key:"11qlp1"}],["path",{d:"m4.929 4.929.707.707",key:"1i51kw"}],["path",{d:"M12 12v6",key:"3ahymv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mY=U("SkipBack",[["polygon",{points:"19 20 9 12 19 4 19 20",key:"o2sva"}],["line",{x1:"5",x2:"5",y1:"19",y2:"5",key:"1ocqjk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gY=U("SkipForward",[["polygon",{points:"5 4 15 12 5 20 5 4",key:"16p6eg"}],["line",{x1:"19",x2:"19",y1:"5",y2:"19",key:"futhcm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yY=U("Skull",[["path",{d:"m12.5 17-.5-1-.5 1h1z",key:"3me087"}],["path",{d:"M15 22a1 1 0 0 0 1-1v-1a2 2 0 0 0 1.56-3.25 8 8 0 1 0-11.12 0A2 2 0 0 0 8 20v1a1 1 0 0 0 1 1z",key:"1o5pge"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xY=U("Slack",[["rect",{width:"3",height:"8",x:"13",y:"2",rx:"1.5",key:"diqz80"}],["path",{d:"M19 8.5V10h1.5A1.5 1.5 0 1 0 19 8.5",key:"183iwg"}],["rect",{width:"3",height:"8",x:"8",y:"14",rx:"1.5",key:"hqg7r1"}],["path",{d:"M5 15.5V14H3.5A1.5 1.5 0 1 0 5 15.5",key:"76g71w"}],["rect",{width:"8",height:"3",x:"14",y:"13",rx:"1.5",key:"1kmz0a"}],["path",{d:"M15.5 19H14v1.5a1.5 1.5 0 1 0 1.5-1.5",key:"jc4sz0"}],["rect",{width:"8",height:"3",x:"2",y:"8",rx:"1.5",key:"1omvl4"}],["path",{d:"M8.5 5H10V3.5A1.5 1.5 0 1 0 8.5 5",key:"16f3cl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vY=U("Slash",[["path",{d:"M22 2 2 22",key:"y4kqgn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _Y=U("Slice",[["path",{d:"M11 16.586V19a1 1 0 0 1-1 1H2L18.37 3.63a1 1 0 1 1 3 3l-9.663 9.663a1 1 0 0 1-1.414 0L8 14",key:"1sllp5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kT=U("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F2=U("SlidersVertical",[["line",{x1:"4",x2:"4",y1:"21",y2:"14",key:"1p332r"}],["line",{x1:"4",x2:"4",y1:"10",y2:"3",key:"gb41h5"}],["line",{x1:"12",x2:"12",y1:"21",y2:"12",key:"hf2csr"}],["line",{x1:"12",x2:"12",y1:"8",y2:"3",key:"1kfi7u"}],["line",{x1:"20",x2:"20",y1:"21",y2:"16",key:"1lhrwl"}],["line",{x1:"20",x2:"20",y1:"12",y2:"3",key:"16vvfq"}],["line",{x1:"2",x2:"6",y1:"14",y2:"14",key:"1uebub"}],["line",{x1:"10",x2:"14",y1:"8",y2:"8",key:"1yglbp"}],["line",{x1:"18",x2:"22",y1:"16",y2:"16",key:"1jxqpz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bY=U("SmartphoneCharging",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12.667 8 10 12h4l-2.667 4",key:"h9lk2d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wY=U("SmartphoneNfc",[["rect",{width:"7",height:"12",x:"2",y:"6",rx:"1",key:"5nje8w"}],["path",{d:"M13 8.32a7.43 7.43 0 0 1 0 7.36",key:"1g306n"}],["path",{d:"M16.46 6.21a11.76 11.76 0 0 1 0 11.58",key:"uqvjvo"}],["path",{d:"M19.91 4.1a15.91 15.91 0 0 1 .01 15.8",key:"ujntz3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q0=U("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jY=U("SmilePlus",[["path",{d:"M22 11v1a10 10 0 1 1-9-10",key:"ew0xw9"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}],["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kY=U("Smile",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NY=U("Snail",[["path",{d:"M2 13a6 6 0 1 0 12 0 4 4 0 1 0-8 0 2 2 0 0 0 4 0",key:"hneq2s"}],["circle",{cx:"10",cy:"13",r:"8",key:"194lz3"}],["path",{d:"M2 21h12c4.4 0 8-3.6 8-8V7a2 2 0 1 0-4 0v6",key:"ixqyt7"}],["path",{d:"M18 3 19.1 5.2",key:"9tjm43"}],["path",{d:"M22 3 20.9 5.2",key:"j3odrs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SY=U("Snowflake",[["line",{x1:"2",x2:"22",y1:"12",y2:"12",key:"1dnqot"}],["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"m20 16-4-4 4-4",key:"rquw4f"}],["path",{d:"m4 8 4 4-4 4",key:"12s3z9"}],["path",{d:"m16 4-4 4-4-4",key:"1tumq1"}],["path",{d:"m8 20 4-4 4 4",key:"9p200w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CY=U("Sofa",[["path",{d:"M20 9V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v3",key:"1dgpiv"}],["path",{d:"M2 16a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5a2 2 0 0 0-4 0v1.5a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1-.5-.5V11a2 2 0 0 0-4 0z",key:"xacw8m"}],["path",{d:"M4 18v2",key:"jwo5n2"}],["path",{d:"M20 18v2",key:"1ar1qi"}],["path",{d:"M12 4v9",key:"oqhhn3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MY=U("Soup",[["path",{d:"M12 21a9 9 0 0 0 9-9H3a9 9 0 0 0 9 9Z",key:"4rw317"}],["path",{d:"M7 21h10",key:"1b0cd5"}],["path",{d:"M19.5 12 22 6",key:"shfsr5"}],["path",{d:"M16.25 3c.27.1.8.53.75 1.36-.06.83-.93 1.2-1 2.02-.05.78.34 1.24.73 1.62",key:"rpc6vp"}],["path",{d:"M11.25 3c.27.1.8.53.74 1.36-.05.83-.93 1.2-.98 2.02-.06.78.33 1.24.72 1.62",key:"1lf63m"}],["path",{d:"M6.25 3c.27.1.8.53.75 1.36-.06.83-.93 1.2-1 2.02-.05.78.34 1.24.74 1.62",key:"97tijn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TY=U("Space",[["path",{d:"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1",key:"lt2kga"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AY=U("Spade",[["path",{d:"M5 9c-1.5 1.5-3 3.2-3 5.5A5.5 5.5 0 0 0 7.5 20c1.8 0 3-.5 4.5-2 1.5 1.5 2.7 2 4.5 2a5.5 5.5 0 0 0 5.5-5.5c0-2.3-1.5-4-3-5.5l-7-7-7 7Z",key:"40bo9n"}],["path",{d:"M12 18v4",key:"jadmvz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EY=U("Sparkle",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mi=U("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IY=U("Speaker",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M12 6h.01",key:"1vi96p"}],["circle",{cx:"12",cy:"14",r:"4",key:"1jruaj"}],["path",{d:"M12 14h.01",key:"1etili"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PY=U("Speech",[["path",{d:"M8.8 20v-4.1l1.9.2a2.3 2.3 0 0 0 2.164-2.1V8.3A5.37 5.37 0 0 0 2 8.25c0 2.8.656 3.054 1 4.55a5.77 5.77 0 0 1 .029 2.758L2 20",key:"11atix"}],["path",{d:"M19.8 17.8a7.5 7.5 0 0 0 .003-10.603",key:"yol142"}],["path",{d:"M17 15a3.5 3.5 0 0 0-.025-4.975",key:"ssbmkc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LY=U("SpellCheck2",[["path",{d:"m6 16 6-12 6 12",key:"1b4byz"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M4 21c1.1 0 1.1-1 2.3-1s1.1 1 2.3 1c1.1 0 1.1-1 2.3-1 1.1 0 1.1 1 2.3 1 1.1 0 1.1-1 2.3-1 1.1 0 1.1 1 2.3 1 1.1 0 1.1-1 2.3-1",key:"8mdmtu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OY=U("SpellCheck",[["path",{d:"m6 16 6-12 6 12",key:"1b4byz"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"m16 20 2 2 4-4",key:"13tcca"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DY=U("Spline",[["circle",{cx:"19",cy:"5",r:"2",key:"mhkx31"}],["circle",{cx:"5",cy:"19",r:"2",key:"v8kfzx"}],["path",{d:"M5 17A12 12 0 0 1 17 5",key:"1okkup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RY=U("Split",[["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M8 3H3v5",key:"15dfkv"}],["path",{d:"M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3",key:"1qrqzj"}],["path",{d:"m15 9 6-6",key:"ko1vev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FY=U("SprayCan",[["path",{d:"M3 3h.01",key:"159qn6"}],["path",{d:"M7 5h.01",key:"1hq22a"}],["path",{d:"M11 7h.01",key:"1osv80"}],["path",{d:"M3 7h.01",key:"1xzrh3"}],["path",{d:"M7 9h.01",key:"19b3jx"}],["path",{d:"M3 11h.01",key:"1eifu7"}],["rect",{width:"4",height:"4",x:"15",y:"5",key:"mri9e4"}],["path",{d:"m19 9 2 2v10c0 .6-.4 1-1 1h-6c-.6 0-1-.4-1-1V11l2-2",key:"aib6hk"}],["path",{d:"m13 14 8-2",key:"1d7bmk"}],["path",{d:"m13 19 8-2",key:"1y2vml"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zY=U("Sprout",[["path",{d:"M7 20h10",key:"e6iznv"}],["path",{d:"M10 20c5.5-2.5.8-6.4 3-10",key:"161w41"}],["path",{d:"M9.5 9.4c1.1.8 1.8 2.2 2.3 3.7-2 .4-3.5.4-4.8-.3-1.2-.6-2.3-1.9-3-4.2 2.8-.5 4.4 0 5.5.8z",key:"9gtqwd"}],["path",{d:"M14.1 6a7 7 0 0 0-1.1 4c1.9-.1 3.3-.6 4.3-1.4 1-1 1.6-2.3 1.7-4.6-2.7.1-4 1-4.9 2z",key:"bkxnd2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z2=U("SquareActivity",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M17 12h-2l-2 5-2-10-2 5H7",key:"15hlnc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B2=U("SquareArrowDownLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m16 8-8 8",key:"166keh"}],["path",{d:"M16 16H8V8",key:"1w2ppm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $2=U("SquareArrowDownRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m8 8 8 8",key:"1imecy"}],["path",{d:"M16 8v8H8",key:"1lbpgo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U2=U("SquareArrowDown",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"m8 12 4 4 4-4",key:"k98ssh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q2=U("SquareArrowLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m12 8-4 4 4 4",key:"15vm53"}],["path",{d:"M16 12H8",key:"1fr5h0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V2=U("SquareArrowOutDownLeft",[["path",{d:"M13 21h6a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v6",key:"14qz4y"}],["path",{d:"m3 21 9-9",key:"1jfql5"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H2=U("SquareArrowOutDownRight",[["path",{d:"M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6",key:"14rsvq"}],["path",{d:"m21 21-9-9",key:"1et2py"}],["path",{d:"M21 15v6h-6",key:"1jko0i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W2=U("SquareArrowOutUpLeft",[["path",{d:"M13 3h6a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-6",key:"14mv1t"}],["path",{d:"m3 3 9 9",key:"rks13r"}],["path",{d:"M3 9V3h6",key:"ira0h2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G2=U("SquareArrowOutUpRight",[["path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6",key:"y09zxi"}],["path",{d:"m21 3-9 9",key:"mpx6sq"}],["path",{d:"M15 3h6v6",key:"1q9fwt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K2=U("SquareArrowRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"m12 16 4-4-4-4",key:"1i9zcv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z2=U("SquareArrowUpLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 16V8h8",key:"19xb1h"}],["path",{d:"M16 16 8 8",key:"1qdy8n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y2=U("SquareArrowUpRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 8h8v8",key:"b65dnt"}],["path",{d:"m8 16 8-8",key:"13b9ih"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X2=U("SquareArrowUp",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q2=U("SquareAsterisk",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"m8.5 14 7-4",key:"12hpby"}],["path",{d:"m8.5 10 7 4",key:"wwy2dy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J2=U("SquareBottomDashedScissors",[["path",{d:"M4 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2",key:"1vzg26"}],["path",{d:"M10 22H8",key:"euku7a"}],["path",{d:"M16 22h-2",key:"18d249"}],["circle",{cx:"8",cy:"8",r:"2",key:"14cg06"}],["path",{d:"M9.414 9.414 12 12",key:"qz4lzr"}],["path",{d:"M14.8 14.8 18 18",key:"11flf1"}],["circle",{cx:"8",cy:"16",r:"2",key:"1acxsx"}],["path",{d:"m18 6-8.586 8.586",key:"11kzk1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bm=U("SquareChartGantt",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 8h7",key:"kbo1nt"}],["path",{d:"M8 12h6",key:"ikassy"}],["path",{d:"M11 16h5",key:"oq65wt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qx=U("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eb=U("SquareCheck",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tb=U("SquareChevronDown",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rb=U("SquareChevronLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m14 16-4-4 4-4",key:"ojs7w8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nb=U("SquareChevronRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sb=U("SquareChevronUp",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m8 14 4-4 4 4",key:"fy2ptz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ib=U("SquareCode",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BY=U("SquareDashedBottomCode",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["path",{d:"M5 21a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2",key:"as5y1o"}],["path",{d:"M9 21h1",key:"15o7lz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $Y=U("SquareDashedBottom",[["path",{d:"M5 21a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2",key:"as5y1o"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M14 21h1",key:"v9vybs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ab=U("SquareDashedKanban",[["path",{d:"M8 7v7",key:"1x2jlm"}],["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M16 7v9",key:"1hp2iy"}],["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M9 3h1",key:"1yesri"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M21 9v1",key:"mxsmne"}],["path",{d:"M21 14v1",key:"169vum"}],["path",{d:"M21 19a2 2 0 0 1-2 2",key:"1j7049"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M3 14v1",key:"vnatye"}],["path",{d:"M3 9v1",key:"1r0deq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ob=U("SquareDashedMousePointer",[["path",{d:"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z",key:"xwnzip"}],["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M9 3h1",key:"1yesri"}],["path",{d:"M9 21h2",key:"1qve2z"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M21 9v2",key:"p14lih"}],["path",{d:"M3 14v1",key:"vnatye"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lb=U("SquareDashed",[["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M21 19a2 2 0 0 1-2 2",key:"1j7049"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M9 3h1",key:"1yesri"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M21 9v1",key:"mxsmne"}],["path",{d:"M3 14v1",key:"vnatye"}],["path",{d:"M21 14v1",key:"169vum"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cb=U("SquareDivide",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}],["line",{x1:"12",x2:"12",y1:"16",y2:"16",key:"aqc6ln"}],["line",{x1:"12",x2:"12",y1:"8",y2:"8",key:"1mkcni"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const db=U("SquareDot",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ub=U("SquareEqual",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 10h10",key:"1101jm"}],["path",{d:"M7 14h10",key:"1mhdw3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hb=U("SquareFunction",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M9 17c2 0 2.8-1 2.8-2.8V10c0-2 1-3.3 3.2-3",key:"m1af9g"}],["path",{d:"M9 11.2h5.7",key:"3zgcl2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fb=U("SquareKanban",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 7v7",key:"1x2jlm"}],["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M16 7v9",key:"1hp2iy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pb=U("SquareLibrary",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 7v10",key:"d5nglc"}],["path",{d:"M11 7v10",key:"pptsnr"}],["path",{d:"m15 7 2 10",key:"1m7qm5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mb=U("SquareM",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 16V8l4 4 4-4v8",key:"141u4e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gb=U("SquareMenu",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 8h10",key:"1jw688"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yb=U("SquareMinus",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xb=U("SquareMousePointer",[["path",{d:"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z",key:"xwnzip"}],["path",{d:"M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6",key:"14rsvq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vb=U("SquareParkingOff",[["path",{d:"M3.6 3.6A2 2 0 0 1 5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-.59 1.41",key:"9l1ft6"}],["path",{d:"M3 8.7V19a2 2 0 0 0 2 2h10.3",key:"17knke"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M13 13a3 3 0 1 0 0-6H9v2",key:"uoagbd"}],["path",{d:"M9 17v-2.3",key:"1jxgo2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _b=U("SquareParking",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 17V7h4a3 3 0 0 1 0 6H9",key:"1dfk2c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jl=U("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bb=U("SquarePercent",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"M15 15h.01",key:"lqbp3k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wb=U("SquarePi",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 7h10",key:"udp07y"}],["path",{d:"M10 7v10",key:"i1d9ee"}],["path",{d:"M16 17a2 2 0 0 1-2-2V7",key:"ftwdc7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jb=U("SquarePilcrow",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 12H9.5a2.5 2.5 0 0 1 0-5H17",key:"1l9586"}],["path",{d:"M12 7v10",key:"jspqdw"}],["path",{d:"M16 7v10",key:"lavkr4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kb=U("SquarePlay",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m9 8 6 4-6 4Z",key:"f1r3lt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Nb=U("SquarePlus",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sb=U("SquarePower",[["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M7.998 9.003a5 5 0 1 0 8-.005",key:"1pek45"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UY=U("SquareRadical",[["path",{d:"M7 12h2l2 5 2-10h4",key:"1fxv6h"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Cb=U("SquareScissors",[["rect",{width:"20",height:"20",x:"2",y:"2",rx:"2",key:"1btzen"}],["circle",{cx:"8",cy:"8",r:"2",key:"14cg06"}],["path",{d:"M9.414 9.414 12 12",key:"qz4lzr"}],["path",{d:"M14.8 14.8 18 18",key:"11flf1"}],["circle",{cx:"8",cy:"16",r:"2",key:"1acxsx"}],["path",{d:"m18 6-8.586 8.586",key:"11kzk1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mb=U("SquareSigma",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M16 8.9V7H8l4 5-4 5h8v-1.9",key:"9nih0i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Tb=U("SquareSlash",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ab=U("SquareSplitHorizontal",[["path",{d:"M8 19H5c-1 0-2-1-2-2V7c0-1 1-2 2-2h3",key:"lubmu8"}],["path",{d:"M16 5h3c1 0 2 1 2 2v10c0 1-1 2-2 2h-3",key:"1ag34g"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Eb=U("SquareSplitVertical",[["path",{d:"M5 8V5c0-1 1-2 2-2h10c1 0 2 1 2 2v3",key:"1pi83i"}],["path",{d:"M19 16v3c0 1-1 2-2 2H7c-1 0-2-1-2-2v-3",key:"ido5k7"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qY=U("SquareSquare",[["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VY=U("SquareStack",[["path",{d:"M4 10c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h4c1.1 0 2 .9 2 2",key:"4i38lg"}],["path",{d:"M10 16c-1.1 0-2-.9-2-2v-4c0-1.1.9-2 2-2h4c1.1 0 2 .9 2 2",key:"mlte4a"}],["rect",{width:"8",height:"8",x:"14",y:"14",rx:"2",key:"1fa9i4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ib=U("SquareTerminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pb=U("SquareUserRound",[["path",{d:"M18 21a6 6 0 0 0-12 0",key:"kaz2du"}],["circle",{cx:"12",cy:"11",r:"4",key:"1gt34v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lb=U("SquareUser",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 21v-2a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2",key:"1m6ac2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ob=U("SquareX",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const im=U("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HY=U("Squircle",[["path",{d:"M12 3c7.2 0 9 1.8 9 9s-1.8 9-9 9-9-1.8-9-9 1.8-9 9-9",key:"garfkc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WY=U("Squirrel",[["path",{d:"M15.236 22a3 3 0 0 0-2.2-5",key:"21bitc"}],["path",{d:"M16 20a3 3 0 0 1 3-3h1a2 2 0 0 0 2-2v-2a4 4 0 0 0-4-4V4",key:"oh0fg0"}],["path",{d:"M18 13h.01",key:"9veqaj"}],["path",{d:"M18 6a4 4 0 0 0-4 4 7 7 0 0 0-7 7c0-5 4-5 4-10.5a4.5 4.5 0 1 0-9 0 2.5 2.5 0 0 0 5 0C7 10 3 11 3 17c0 2.8 2.2 5 5 5h10",key:"980v8a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GY=U("Stamp",[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M19.27 13.73A2.5 2.5 0 0 0 17.5 13h-11A2.5 2.5 0 0 0 4 15.5V17a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-1.5c0-.66-.26-1.3-.73-1.77Z",key:"1sy9ra"}],["path",{d:"M14 13V8.5C14 7 15 7 15 5a3 3 0 0 0-3-3c-1.66 0-3 1-3 3s1 2 1 3.5V13",key:"cnxgux"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KY=U("StarHalf",[["path",{d:"M12 18.338a2.1 2.1 0 0 0-.987.244L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.12 2.12 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.12 2.12 0 0 0 1.597-1.16l2.309-4.679A.53.53 0 0 1 12 2",key:"2ksp49"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZY=U("StarOff",[["path",{d:"M8.34 8.34 2 9.27l5 4.87L5.82 21 12 17.77 18.18 21l-.59-3.43",key:"16m0ql"}],["path",{d:"M18.42 12.76 22 9.27l-6.91-1L12 2l-1.44 2.91",key:"1vt8nq"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ca=U("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YY=U("StepBack",[["line",{x1:"18",x2:"18",y1:"20",y2:"4",key:"cun8e5"}],["polygon",{points:"14,20 4,12 14,4",key:"ypakod"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XY=U("StepForward",[["line",{x1:"6",x2:"6",y1:"4",y2:"20",key:"fy8qot"}],["polygon",{points:"10,4 20,12 10,20",key:"1mc1pf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QY=U("Stethoscope",[["path",{d:"M11 2v2",key:"1539x4"}],["path",{d:"M5 2v2",key:"1yf1q8"}],["path",{d:"M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1",key:"rb5t3r"}],["path",{d:"M8 15a6 6 0 0 0 12 0v-3",key:"x18d4x"}],["circle",{cx:"20",cy:"10",r:"2",key:"ts1r5v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JY=U("Sticker",[["path",{d:"M15.5 3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h14a2 2 0 0 0 2-2V8.5L15.5 3Z",key:"1wis1t"}],["path",{d:"M14 3v4a2 2 0 0 0 2 2h4",key:"36rjfy"}],["path",{d:"M8 13h.01",key:"1sbv64"}],["path",{d:"M16 13h.01",key:"wip0gl"}],["path",{d:"M10 16s.8 1 2 1c1.3 0 2-1 2-1",key:"1vvgv3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eX=U("StickyNote",[["path",{d:"M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8Z",key:"qazsjp"}],["path",{d:"M15 3v4a2 2 0 0 0 2 2h4",key:"40519r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tX=U("Store",[["path",{d:"m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7",key:"ztvudi"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["path",{d:"M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4",key:"2ebpfo"}],["path",{d:"M2 7h20",key:"1fcdvo"}],["path",{d:"M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7",key:"6c3vgh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rX=U("StretchHorizontal",[["rect",{width:"20",height:"6",x:"2",y:"4",rx:"2",key:"qdearl"}],["rect",{width:"20",height:"6",x:"2",y:"14",rx:"2",key:"1xrn6j"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nX=U("StretchVertical",[["rect",{width:"6",height:"20",x:"4",y:"2",rx:"2",key:"19qu7m"}],["rect",{width:"6",height:"20",x:"14",y:"2",rx:"2",key:"24v0nk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sX=U("Strikethrough",[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iX=U("Subscript",[["path",{d:"m4 5 8 8",key:"1eunvl"}],["path",{d:"m12 5-8 8",key:"1ah0jp"}],["path",{d:"M20 19h-4c0-1.5.44-2 1.5-2.5S20 15.33 20 14c0-.47-.17-.93-.48-1.29a2.11 2.11 0 0 0-2.62-.44c-.42.24-.74.62-.9 1.07",key:"e8ta8j"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aX=U("SunDim",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 4h.01",key:"1ujb9j"}],["path",{d:"M20 12h.01",key:"1ykeid"}],["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M4 12h.01",key:"158zrr"}],["path",{d:"M17.657 6.343h.01",key:"31pqzk"}],["path",{d:"M17.657 17.657h.01",key:"jehnf4"}],["path",{d:"M6.343 17.657h.01",key:"gdk6ow"}],["path",{d:"M6.343 6.343h.01",key:"1uurf0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oX=U("SunMedium",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 3v1",key:"1asbbs"}],["path",{d:"M12 20v1",key:"1wcdkc"}],["path",{d:"M3 12h1",key:"lp3yf2"}],["path",{d:"M20 12h1",key:"1vloll"}],["path",{d:"m18.364 5.636-.707.707",key:"1hakh0"}],["path",{d:"m6.343 17.657-.707.707",key:"18m9nf"}],["path",{d:"m5.636 5.636.707.707",key:"1xv1c5"}],["path",{d:"m17.657 17.657.707.707",key:"vl76zb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lX=U("SunMoon",[["path",{d:"M12 8a2.83 2.83 0 0 0 4 4 4 4 0 1 1-4-4",key:"1fu5g2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.9 4.9 1.4 1.4",key:"b9915j"}],["path",{d:"m17.7 17.7 1.4 1.4",key:"qc3ed3"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.3 17.7-1.4 1.4",key:"5gca6"}],["path",{d:"m19.1 4.9-1.4 1.4",key:"wpu9u6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cX=U("SunSnow",[["path",{d:"M10 9a3 3 0 1 0 0 6",key:"6zmtdl"}],["path",{d:"M2 12h1",key:"1uaihz"}],["path",{d:"M14 21V3",key:"1llu3z"}],["path",{d:"M10 4V3",key:"pkzwkn"}],["path",{d:"M10 21v-1",key:"1u8rkd"}],["path",{d:"m3.64 18.36.7-.7",key:"105rm9"}],["path",{d:"m4.34 6.34-.7-.7",key:"d3unjp"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"m17 4-3 3",key:"15jcng"}],["path",{d:"m14 17 3 3",key:"6tlq38"}],["path",{d:"m21 15-3-3 3-3",key:"1nlnje"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ww=U("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dX=U("Sunrise",[["path",{d:"M12 2v8",key:"1q4o3n"}],["path",{d:"m4.93 10.93 1.41 1.41",key:"2a7f42"}],["path",{d:"M2 18h2",key:"j10viu"}],["path",{d:"M20 18h2",key:"wocana"}],["path",{d:"m19.07 10.93-1.41 1.41",key:"15zs5n"}],["path",{d:"M22 22H2",key:"19qnx5"}],["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}],["path",{d:"M16 18a4 4 0 0 0-8 0",key:"1lzouq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uX=U("Sunset",[["path",{d:"M12 10V2",key:"16sf7g"}],["path",{d:"m4.93 10.93 1.41 1.41",key:"2a7f42"}],["path",{d:"M2 18h2",key:"j10viu"}],["path",{d:"M20 18h2",key:"wocana"}],["path",{d:"m19.07 10.93-1.41 1.41",key:"15zs5n"}],["path",{d:"M22 22H2",key:"19qnx5"}],["path",{d:"m16 6-4 4-4-4",key:"6wukr"}],["path",{d:"M16 18a4 4 0 0 0-8 0",key:"1lzouq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hX=U("Superscript",[["path",{d:"m4 19 8-8",key:"hr47gm"}],["path",{d:"m12 19-8-8",key:"1dhhmo"}],["path",{d:"M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06",key:"1dfcux"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fX=U("SwatchBook",[["path",{d:"M11 17a4 4 0 0 1-8 0V5a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2Z",key:"1ldrpk"}],["path",{d:"M16.7 13H19a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H7",key:"11i5po"}],["path",{d:"M 7 17h.01",key:"1euzgo"}],["path",{d:"m11 8 2.3-2.3a2.4 2.4 0 0 1 3.404.004L18.6 7.6a2.4 2.4 0 0 1 .026 3.434L9.9 19.8",key:"o2gii7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pX=U("SwissFranc",[["path",{d:"M10 21V3h8",key:"br2l0g"}],["path",{d:"M6 16h9",key:"2py0wn"}],["path",{d:"M10 9.5h7",key:"13dmhz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mX=U("SwitchCamera",[["path",{d:"M11 19H4a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h5",key:"mtk2lu"}],["path",{d:"M13 5h7a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-5",key:"120jsl"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"m18 22-3-3 3-3",key:"kgdoj7"}],["path",{d:"m6 2 3 3-3 3",key:"1fnbkv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gX=U("Sword",[["polyline",{points:"14.5 17.5 3 6 3 3 6 3 17.5 14.5",key:"1hfsw2"}],["line",{x1:"13",x2:"19",y1:"19",y2:"13",key:"1vrmhu"}],["line",{x1:"16",x2:"20",y1:"16",y2:"20",key:"1bron3"}],["line",{x1:"19",x2:"21",y1:"21",y2:"19",key:"13pww6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yX=U("Swords",[["polyline",{points:"14.5 17.5 3 6 3 3 6 3 17.5 14.5",key:"1hfsw2"}],["line",{x1:"13",x2:"19",y1:"19",y2:"13",key:"1vrmhu"}],["line",{x1:"16",x2:"20",y1:"16",y2:"20",key:"1bron3"}],["line",{x1:"19",x2:"21",y1:"21",y2:"19",key:"13pww6"}],["polyline",{points:"14.5 6.5 18 3 21 3 21 6 17.5 9.5",key:"hbey2j"}],["line",{x1:"5",x2:"9",y1:"14",y2:"18",key:"1hf58s"}],["line",{x1:"7",x2:"4",y1:"17",y2:"20",key:"pidxm4"}],["line",{x1:"3",x2:"5",y1:"19",y2:"21",key:"1pehsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xX=U("Syringe",[["path",{d:"m18 2 4 4",key:"22kx64"}],["path",{d:"m17 7 3-3",key:"1w1zoj"}],["path",{d:"M19 9 8.7 19.3c-1 1-2.5 1-3.4 0l-.6-.6c-1-1-1-2.5 0-3.4L15 5",key:"1exhtz"}],["path",{d:"m9 11 4 4",key:"rovt3i"}],["path",{d:"m5 19-3 3",key:"59f2uf"}],["path",{d:"m14 4 6 6",key:"yqp9t2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NT=U("Table2",[["path",{d:"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",key:"gugj83"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vX=U("TableCellsMerge",[["path",{d:"M12 21v-6",key:"lihzve"}],["path",{d:"M12 9V3",key:"da5inc"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M3 9h18",key:"1pudct"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _X=U("TableCellsSplit",[["path",{d:"M12 15V9",key:"8c7uyn"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M3 9h18",key:"1pudct"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bX=U("TableColumnsSplit",[["path",{d:"M14 14v2",key:"w2a1xv"}],["path",{d:"M14 20v2",key:"1lq872"}],["path",{d:"M14 2v2",key:"6buw04"}],["path",{d:"M14 8v2",key:"i67w9a"}],["path",{d:"M2 15h8",key:"82wtch"}],["path",{d:"M2 3h6a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H2",key:"up0l64"}],["path",{d:"M2 9h8",key:"yelfik"}],["path",{d:"M22 15h-4",key:"1es58f"}],["path",{d:"M22 3h-2a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h2",key:"pdjoqf"}],["path",{d:"M22 9h-4",key:"1luja7"}],["path",{d:"M5 3v18",key:"14hmio"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wX=U("TableOfContents",[["path",{d:"M16 12H3",key:"1a2rj7"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M21 12h.01",key:"msek7k"}],["path",{d:"M21 18h.01",key:"1e8rq1"}],["path",{d:"M21 6h.01",key:"1koanj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jX=U("TableProperties",[["path",{d:"M15 3v18",key:"14nvp0"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kX=U("TableRowsSplit",[["path",{d:"M14 10h2",key:"1lstlu"}],["path",{d:"M15 22v-8",key:"1fwwgm"}],["path",{d:"M15 2v4",key:"1044rn"}],["path",{d:"M2 10h2",key:"1r8dkt"}],["path",{d:"M20 10h2",key:"1ug425"}],["path",{d:"M3 19h18",key:"awlh7x"}],["path",{d:"M3 22v-6a2 2 135 0 1 2-2h14a2 2 45 0 1 2 2v6",key:"ibqhof"}],["path",{d:"M3 2v2a2 2 45 0 0 2 2h14a2 2 135 0 0 2-2V2",key:"1uenja"}],["path",{d:"M8 10h2",key:"66od0"}],["path",{d:"M9 22v-8",key:"fmnu31"}],["path",{d:"M9 2v4",key:"j1yeou"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NX=U("Table",[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SX=U("TabletSmartphone",[["rect",{width:"10",height:"14",x:"3",y:"8",rx:"2",key:"1vrsiq"}],["path",{d:"M5 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2h-2.4",key:"1j4zmg"}],["path",{d:"M8 18h.01",key:"lrp35t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CX=U("Tablet",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["line",{x1:"12",x2:"12.01",y1:"18",y2:"18",key:"1dp563"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MX=U("Tablets",[["circle",{cx:"7",cy:"7",r:"5",key:"x29byf"}],["circle",{cx:"17",cy:"17",r:"5",key:"1op1d2"}],["path",{d:"M12 17h10",key:"ls21zv"}],["path",{d:"m3.46 10.54 7.08-7.08",key:"1rehiu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gw=U("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TX=U("Tags",[["path",{d:"m15 5 6.3 6.3a2.4 2.4 0 0 1 0 3.4L17 19",key:"1cbfv1"}],["path",{d:"M9.586 5.586A2 2 0 0 0 8.172 5H3a1 1 0 0 0-1 1v5.172a2 2 0 0 0 .586 1.414L8.29 18.29a2.426 2.426 0 0 0 3.42 0l3.58-3.58a2.426 2.426 0 0 0 0-3.42z",key:"135mg7"}],["circle",{cx:"6.5",cy:"9.5",r:".5",fill:"currentColor",key:"5pm5xn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AX=U("Tally1",[["path",{d:"M4 4v16",key:"6qkkli"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EX=U("Tally2",[["path",{d:"M4 4v16",key:"6qkkli"}],["path",{d:"M9 4v16",key:"81ygyz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IX=U("Tally3",[["path",{d:"M4 4v16",key:"6qkkli"}],["path",{d:"M9 4v16",key:"81ygyz"}],["path",{d:"M14 4v16",key:"12vmem"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PX=U("Tally4",[["path",{d:"M4 4v16",key:"6qkkli"}],["path",{d:"M9 4v16",key:"81ygyz"}],["path",{d:"M14 4v16",key:"12vmem"}],["path",{d:"M19 4v16",key:"8ij5ei"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LX=U("Tally5",[["path",{d:"M4 4v16",key:"6qkkli"}],["path",{d:"M9 4v16",key:"81ygyz"}],["path",{d:"M14 4v16",key:"12vmem"}],["path",{d:"M19 4v16",key:"8ij5ei"}],["path",{d:"M22 6 2 18",key:"h9moai"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OX=U("Tangent",[["circle",{cx:"17",cy:"4",r:"2",key:"y5j2s2"}],["path",{d:"M15.59 5.41 5.41 15.59",key:"l0vprr"}],["circle",{cx:"4",cy:"17",r:"2",key:"9p4efm"}],["path",{d:"M12 22s-4-9-1.5-11.5S22 12 22 12",key:"1twk4o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ey=U("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DX=U("Telescope",[["path",{d:"m10.065 12.493-6.18 1.318a.934.934 0 0 1-1.108-.702l-.537-2.15a1.07 1.07 0 0 1 .691-1.265l13.504-4.44",key:"k4qptu"}],["path",{d:"m13.56 11.747 4.332-.924",key:"19l80z"}],["path",{d:"m16 21-3.105-6.21",key:"7oh9d"}],["path",{d:"M16.485 5.94a2 2 0 0 1 1.455-2.425l1.09-.272a1 1 0 0 1 1.212.727l1.515 6.06a1 1 0 0 1-.727 1.213l-1.09.272a2 2 0 0 1-2.425-1.455z",key:"m7xp4m"}],["path",{d:"m6.158 8.633 1.114 4.456",key:"74o979"}],["path",{d:"m8 21 3.105-6.21",key:"1fvxut"}],["circle",{cx:"12",cy:"13",r:"2",key:"1c1ljs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RX=U("TentTree",[["circle",{cx:"4",cy:"4",r:"2",key:"bt5ra8"}],["path",{d:"m14 5 3-3 3 3",key:"1sorif"}],["path",{d:"m14 10 3-3 3 3",key:"1jyi9h"}],["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M17 14H7l-5 8h20Z",key:"13ar7p"}],["path",{d:"M8 14v8",key:"1ghmqk"}],["path",{d:"m9 14 5 8",key:"13pgi6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FX=U("Tent",[["path",{d:"M3.5 21 14 3",key:"1szst5"}],["path",{d:"M20.5 21 10 3",key:"1310c3"}],["path",{d:"M15.5 21 12 15l-3.5 6",key:"1ddtfw"}],["path",{d:"M2 21h20",key:"1nyx9w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zX=U("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Db=U("TestTubeDiagonal",[["path",{d:"M21 7 6.82 21.18a2.83 2.83 0 0 1-3.99-.01a2.83 2.83 0 0 1 0-4L17 3",key:"1ub6xw"}],["path",{d:"m16 2 6 6",key:"1gw87d"}],["path",{d:"M12 16H4",key:"1cjfip"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BX=U("TestTube",[["path",{d:"M14.5 2v17.5c0 1.4-1.1 2.5-2.5 2.5c-1.4 0-2.5-1.1-2.5-2.5V2",key:"125lnx"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M14.5 16h-5",key:"1ox875"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $X=U("TestTubes",[["path",{d:"M9 2v17.5A2.5 2.5 0 0 1 6.5 22A2.5 2.5 0 0 1 4 19.5V2",key:"1hjrqt"}],["path",{d:"M20 2v17.5a2.5 2.5 0 0 1-2.5 2.5a2.5 2.5 0 0 1-2.5-2.5V2",key:"16lc8n"}],["path",{d:"M3 2h7",key:"7s29d5"}],["path",{d:"M14 2h7",key:"7sicin"}],["path",{d:"M9 16H4",key:"1bfye3"}],["path",{d:"M20 16h-5",key:"ddnjpe"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UX=U("TextCursorInput",[["path",{d:"M5 4h1a3 3 0 0 1 3 3 3 3 0 0 1 3-3h1",key:"18xjzo"}],["path",{d:"M13 20h-1a3 3 0 0 1-3-3 3 3 0 0 1-3 3H5",key:"fj48gi"}],["path",{d:"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1",key:"1n9rhb"}],["path",{d:"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7",key:"13ksps"}],["path",{d:"M9 7v10",key:"1vc8ob"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qX=U("TextCursor",[["path",{d:"M17 22h-1a4 4 0 0 1-4-4V6a4 4 0 0 1 4-4h1",key:"uvaxm9"}],["path",{d:"M7 22h1a4 4 0 0 0 4-4v-1",key:"11xy8d"}],["path",{d:"M7 2h1a4 4 0 0 1 4 4v1",key:"1uw06m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VX=U("TextQuote",[["path",{d:"M17 6H3",key:"16j9eg"}],["path",{d:"M21 12H8",key:"scolzb"}],["path",{d:"M21 18H8",key:"1wfozv"}],["path",{d:"M3 12v6",key:"fv4c87"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HX=U("TextSearch",[["path",{d:"M21 6H3",key:"1jwq7v"}],["path",{d:"M10 12H3",key:"1ulcyk"}],["path",{d:"M10 18H3",key:"13769t"}],["circle",{cx:"17",cy:"15",r:"3",key:"1upz2a"}],["path",{d:"m21 19-1.9-1.9",key:"dwi7p8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rb=U("TextSelect",[["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M21 19a2 2 0 0 1-2 2",key:"1j7049"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M9 3h1",key:"1yesri"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M21 9v1",key:"mxsmne"}],["path",{d:"M3 14v1",key:"vnatye"}],["path",{d:"M21 14v1",key:"169vum"}],["line",{x1:"7",x2:"15",y1:"8",y2:"8",key:"1758g8"}],["line",{x1:"7",x2:"17",y1:"12",y2:"12",key:"197423"}],["line",{x1:"7",x2:"13",y1:"16",y2:"16",key:"37cgm6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WX=U("Text",[["path",{d:"M17 6.1H3",key:"wptmhv"}],["path",{d:"M21 12.1H3",key:"1j38uz"}],["path",{d:"M15.1 18H3",key:"1nb16a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GX=U("Theater",[["path",{d:"M2 10s3-3 3-8",key:"3xiif0"}],["path",{d:"M22 10s-3-3-3-8",key:"ioaa5q"}],["path",{d:"M10 2c0 4.4-3.6 8-8 8",key:"16fkpi"}],["path",{d:"M14 2c0 4.4 3.6 8 8 8",key:"b9eulq"}],["path",{d:"M2 10s2 2 2 5",key:"1au1lb"}],["path",{d:"M22 10s-2 2-2 5",key:"qi2y5e"}],["path",{d:"M8 15h8",key:"45n4r"}],["path",{d:"M2 22v-1a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v1",key:"1vsc2m"}],["path",{d:"M14 22v-1a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v1",key:"hrha4u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KX=U("ThermometerSnowflake",[["path",{d:"M2 12h10",key:"19562f"}],["path",{d:"M9 4v16",key:"81ygyz"}],["path",{d:"m3 9 3 3-3 3",key:"1sas0l"}],["path",{d:"M12 6 9 9 6 6",key:"pfrgxu"}],["path",{d:"m6 18 3-3 1.5 1.5",key:"1e277p"}],["path",{d:"M20 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"iof6y5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZX=U("ThermometerSun",[["path",{d:"M12 9a4 4 0 0 0-2 7.5",key:"1jvsq6"}],["path",{d:"M12 3v2",key:"1w22ol"}],["path",{d:"m6.6 18.4-1.4 1.4",key:"w2yidj"}],["path",{d:"M20 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"iof6y5"}],["path",{d:"M4 13H2",key:"118le4"}],["path",{d:"M6.34 7.34 4.93 5.93",key:"1brd51"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YX=U("Thermometer",[["path",{d:"M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"17jzev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ST=U("ThumbsDown",[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zd=U("ThumbsUp",[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XX=U("TicketCheck",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QX=U("TicketMinus",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M9 12h6",key:"1c52cq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JX=U("TicketPercent",[["path",{d:"M2 9a3 3 0 1 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 1 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"1l48ns"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M15 15h.01",key:"lqbp3k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eQ=U("TicketPlus",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M9 12h6",key:"1c52cq"}],["path",{d:"M12 9v6",key:"199k2o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tQ=U("TicketSlash",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"m9.5 14.5 5-5",key:"qviqfa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rQ=U("TicketX",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"m9.5 14.5 5-5",key:"qviqfa"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CT=U("Ticket",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M13 5v2",key:"dyzc3o"}],["path",{d:"M13 17v2",key:"1ont0d"}],["path",{d:"M13 11v2",key:"1wjjxi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nQ=U("TicketsPlane",[["path",{d:"M10.5 17h1.227a2 2 0 0 0 1.345-.52L18 12",key:"16muxl"}],["path",{d:"m12 13.5 3.75.5",key:"1i9qhk"}],["path",{d:"m4.5 8 10.58-5.06a1 1 0 0 1 1.342.488L18.5 8",key:"12lg5p"}],["path",{d:"M6 10V8",key:"1y41hn"}],["path",{d:"M6 14v1",key:"cao2tf"}],["path",{d:"M6 19v2",key:"1loha6"}],["rect",{x:"2",y:"8",width:"20",height:"13",rx:"2",key:"p3bz5l"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sQ=U("Tickets",[["path",{d:"m4.5 8 10.58-5.06a1 1 0 0 1 1.342.488L18.5 8",key:"12lg5p"}],["path",{d:"M6 10V8",key:"1y41hn"}],["path",{d:"M6 14v1",key:"cao2tf"}],["path",{d:"M6 19v2",key:"1loha6"}],["rect",{x:"2",y:"8",width:"20",height:"13",rx:"2",key:"p3bz5l"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iQ=U("TimerOff",[["path",{d:"M10 2h4",key:"n1abiw"}],["path",{d:"M4.6 11a8 8 0 0 0 1.7 8.7 8 8 0 0 0 8.7 1.7",key:"10he05"}],["path",{d:"M7.4 7.4a8 8 0 0 1 10.3 1 8 8 0 0 1 .9 10.2",key:"15f7sh"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M12 12v-2",key:"fwoke6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aQ=U("TimerReset",[["path",{d:"M10 2h4",key:"n1abiw"}],["path",{d:"M12 14v-4",key:"1evpnu"}],["path",{d:"M4 13a8 8 0 0 1 8-7 8 8 0 1 1-5.3 14L4 17.6",key:"1ts96g"}],["path",{d:"M9 17H4v5",key:"8t5av"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oQ=U("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lQ=U("ToggleLeft",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"8",cy:"12",r:"2",key:"1nvbw3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cQ=U("ToggleRight",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"16",cy:"12",r:"2",key:"4ma0v8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dQ=U("Toilet",[["path",{d:"M7 12h13a1 1 0 0 1 1 1 5 5 0 0 1-5 5h-.598a.5.5 0 0 0-.424.765l1.544 2.47a.5.5 0 0 1-.424.765H5.402a.5.5 0 0 1-.424-.765L7 18",key:"kc4kqr"}],["path",{d:"M8 18a5 5 0 0 1-5-5V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v8",key:"1tqs57"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uQ=U("Tornado",[["path",{d:"M21 4H3",key:"1hwok0"}],["path",{d:"M18 8H6",key:"41n648"}],["path",{d:"M19 12H9",key:"1g4lpz"}],["path",{d:"M16 16h-6",key:"1j5d54"}],["path",{d:"M11 20H9",key:"39obr8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hQ=U("Torus",[["ellipse",{cx:"12",cy:"11",rx:"3",ry:"2",key:"1b2qxu"}],["ellipse",{cx:"12",cy:"12.5",rx:"10",ry:"8.5",key:"h8emeu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fQ=U("TouchpadOff",[["path",{d:"M4 4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16",key:"lnt0bk"}],["path",{d:"M2 14h12",key:"d8icqz"}],["path",{d:"M22 14h-2",key:"jrx26d"}],["path",{d:"M12 20v-6",key:"1rm09r"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M22 16V6a2 2 0 0 0-2-2H10",key:"11y8e4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pQ=U("Touchpad",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M2 14h20",key:"myj16y"}],["path",{d:"M12 20v-6",key:"1rm09r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mQ=U("TowerControl",[["path",{d:"M18.2 12.27 20 6H4l1.8 6.27a1 1 0 0 0 .95.73h10.5a1 1 0 0 0 .96-.73Z",key:"1pledb"}],["path",{d:"M8 13v9",key:"hmv0ci"}],["path",{d:"M16 22v-9",key:"ylnf1u"}],["path",{d:"m9 6 1 7",key:"dpdgam"}],["path",{d:"m15 6-1 7",key:"ls7zgu"}],["path",{d:"M12 6V2",key:"1pj48d"}],["path",{d:"M13 2h-2",key:"mj6ths"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gQ=U("ToyBrick",[["rect",{width:"18",height:"12",x:"3",y:"8",rx:"1",key:"158fvp"}],["path",{d:"M10 8V5c0-.6-.4-1-1-1H6a1 1 0 0 0-1 1v3",key:"s0042v"}],["path",{d:"M19 8V5c0-.6-.4-1-1-1h-3a1 1 0 0 0-1 1v3",key:"9wmeh2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yQ=U("Tractor",[["path",{d:"m10 11 11 .9a1 1 0 0 1 .8 1.1l-.665 4.158a1 1 0 0 1-.988.842H20",key:"she1j9"}],["path",{d:"M16 18h-5",key:"bq60fd"}],["path",{d:"M18 5a1 1 0 0 0-1 1v5.573",key:"1kv8ia"}],["path",{d:"M3 4h8.129a1 1 0 0 1 .99.863L13 11.246",key:"1q1ert"}],["path",{d:"M4 11V4",key:"9ft8pt"}],["path",{d:"M7 15h.01",key:"k5ht0j"}],["path",{d:"M8 10.1V4",key:"1jgyzo"}],["circle",{cx:"18",cy:"18",r:"2",key:"1emm8v"}],["circle",{cx:"7",cy:"15",r:"5",key:"ddtuc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xQ=U("TrafficCone",[["path",{d:"M9.3 6.2a4.55 4.55 0 0 0 5.4 0",key:"flyxqv"}],["path",{d:"M7.9 10.7c.9.8 2.4 1.3 4.1 1.3s3.2-.5 4.1-1.3",key:"1nlxxg"}],["path",{d:"M13.9 3.5a1.93 1.93 0 0 0-3.8-.1l-3 10c-.1.2-.1.4-.1.6 0 1.7 2.2 3 5 3s5-1.3 5-3c0-.2 0-.4-.1-.5Z",key:"vz7x1l"}],["path",{d:"m7.5 12.2-4.7 2.7c-.5.3-.8.7-.8 1.1s.3.8.8 1.1l7.6 4.5c.9.5 2.1.5 3 0l7.6-4.5c.7-.3 1-.7 1-1.1s-.3-.8-.8-1.1l-4.7-2.8",key:"1xfzlw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vQ=U("TrainFrontTunnel",[["path",{d:"M2 22V12a10 10 0 1 1 20 0v10",key:"o0fyp0"}],["path",{d:"M15 6.8v1.4a3 2.8 0 1 1-6 0V6.8",key:"m8q3n9"}],["path",{d:"M10 15h.01",key:"44in9x"}],["path",{d:"M14 15h.01",key:"5mohn5"}],["path",{d:"M10 19a4 4 0 0 1-4-4v-3a6 6 0 1 1 12 0v3a4 4 0 0 1-4 4Z",key:"hckbmu"}],["path",{d:"m9 19-2 3",key:"iij7hm"}],["path",{d:"m15 19 2 3",key:"npx8sa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _Q=U("TrainFront",[["path",{d:"M8 3.1V7a4 4 0 0 0 8 0V3.1",key:"1v71zp"}],["path",{d:"m9 15-1-1",key:"1yrq24"}],["path",{d:"m15 15 1-1",key:"1t0d6s"}],["path",{d:"M9 19c-2.8 0-5-2.2-5-5v-4a8 8 0 0 1 16 0v4c0 2.8-2.2 5-5 5Z",key:"1p0hjs"}],["path",{d:"m8 19-2 3",key:"13i0xs"}],["path",{d:"m16 19 2 3",key:"xo31yx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bQ=U("TrainTrack",[["path",{d:"M2 17 17 2",key:"18b09t"}],["path",{d:"m2 14 8 8",key:"1gv9hu"}],["path",{d:"m5 11 8 8",key:"189pqp"}],["path",{d:"m8 8 8 8",key:"1imecy"}],["path",{d:"m11 5 8 8",key:"ummqn6"}],["path",{d:"m14 2 8 8",key:"1vk7dn"}],["path",{d:"M7 22 22 7",key:"15mb1i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fb=U("TramFront",[["rect",{width:"16",height:"16",x:"4",y:"3",rx:"2",key:"1wxw4b"}],["path",{d:"M4 11h16",key:"mpoxn0"}],["path",{d:"M12 3v8",key:"1h2ygw"}],["path",{d:"m8 19-2 3",key:"13i0xs"}],["path",{d:"m18 22-2-3",key:"1p0ohu"}],["path",{d:"M8 15h.01",key:"a7atzg"}],["path",{d:"M16 15h.01",key:"rnfrdf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xn=U("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wQ=U("Trash",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jQ=U("TreeDeciduous",[["path",{d:"M8 19a4 4 0 0 1-2.24-7.32A3.5 3.5 0 0 1 9 6.03V6a3 3 0 1 1 6 0v.04a3.5 3.5 0 0 1 3.24 5.65A4 4 0 0 1 16 19Z",key:"oadzkq"}],["path",{d:"M12 19v3",key:"npa21l"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zb=U("TreePalm",[["path",{d:"M13 8c0-2.76-2.46-5-5.5-5S2 5.24 2 8h2l1-1 1 1h4",key:"foxbe7"}],["path",{d:"M13 7.14A5.82 5.82 0 0 1 16.5 6c3.04 0 5.5 2.24 5.5 5h-3l-1-1-1 1h-3",key:"18arnh"}],["path",{d:"M5.89 9.71c-2.15 2.15-2.3 5.47-.35 7.43l4.24-4.25.7-.7.71-.71 2.12-2.12c-1.95-1.96-5.27-1.8-7.42.35",key:"ywahnh"}],["path",{d:"M11 15.5c.5 2.5-.17 4.5-1 6.5h4c2-5.5-.5-12-1-14",key:"ft0feo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kQ=U("TreePine",[["path",{d:"m17 14 3 3.3a1 1 0 0 1-.7 1.7H4.7a1 1 0 0 1-.7-1.7L7 14h-.3a1 1 0 0 1-.7-1.7L9 9h-.2A1 1 0 0 1 8 7.3L12 3l4 4.3a1 1 0 0 1-.8 1.7H15l3 3.3a1 1 0 0 1-.7 1.7H17Z",key:"cpyugq"}],["path",{d:"M12 22v-3",key:"kmzjlo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NQ=U("Trees",[["path",{d:"M10 10v.2A3 3 0 0 1 8.9 16H5a3 3 0 0 1-1-5.8V10a3 3 0 0 1 6 0Z",key:"1l6gj6"}],["path",{d:"M7 16v6",key:"1a82de"}],["path",{d:"M13 19v3",key:"13sx9i"}],["path",{d:"M12 19h8.3a1 1 0 0 0 .7-1.7L18 14h.3a1 1 0 0 0 .7-1.7L16 9h.2a1 1 0 0 0 .8-1.7L13 3l-1.4 1.5",key:"1sj9kv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SQ=U("Trello",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["rect",{width:"3",height:"9",x:"7",y:"7",key:"14n3xi"}],["rect",{width:"3",height:"5",x:"14",y:"7",key:"s4azjd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kw=U("TrendingDown",[["polyline",{points:"22 17 13.5 8.5 8.5 13.5 2 7",key:"1r2t7k"}],["polyline",{points:"16 17 22 17 22 11",key:"11uiuu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CQ=U("TrendingUpDown",[["path",{d:"M14.828 14.828 21 21",key:"ar5fw7"}],["path",{d:"M21 16v5h-5",key:"1ck2sf"}],["path",{d:"m21 3-9 9-4-4-6 6",key:"1h02xo"}],["path",{d:"M21 8V3h-5",key:"1qoq8a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bf=U("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ph=U("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MQ=U("TriangleRight",[["path",{d:"M22 18a2 2 0 0 1-2 2H3c-1.1 0-1.3-.6-.4-1.3L20.4 4.3c.9-.7 1.6-.4 1.6.7Z",key:"183wce"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TQ=U("Triangle",[["path",{d:"M13.73 4a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"14u9p9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qa=U("Trophy",[["path",{d:"M6 9H4.5a2.5 2.5 0 0 1 0-5H6",key:"17hqa7"}],["path",{d:"M18 9h1.5a2.5 2.5 0 0 0 0-5H18",key:"lmptdp"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22",key:"1nw9bq"}],["path",{d:"M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22",key:"1np0yb"}],["path",{d:"M18 2H6v7a6 6 0 0 0 12 0V2Z",key:"u46fv3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MT=U("Truck",[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",key:"lysw3i"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AQ=U("Turtle",[["path",{d:"m12 10 2 4v3a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-3a8 8 0 1 0-16 0v3a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-3l2-4h4Z",key:"1lbbv7"}],["path",{d:"M4.82 7.9 8 10",key:"m9wose"}],["path",{d:"M15.18 7.9 12 10",key:"p8dp2u"}],["path",{d:"M16.93 10H20a2 2 0 0 1 0 4H2",key:"12nsm7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EQ=U("TvMinimalPlay",[["path",{d:"M10 7.75a.75.75 0 0 1 1.142-.638l3.664 2.249a.75.75 0 0 1 0 1.278l-3.664 2.25a.75.75 0 0 1-1.142-.64z",key:"1pctta"}],["path",{d:"M7 21h10",key:"1b0cd5"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bb=U("TvMinimal",[["path",{d:"M7 21h10",key:"1b0cd5"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IQ=U("Tv",[["rect",{width:"20",height:"15",x:"2",y:"7",rx:"2",ry:"2",key:"10ag99"}],["polyline",{points:"17 2 12 7 7 2",key:"11pgbg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PQ=U("Twitch",[["path",{d:"M21 2H3v16h5v4l4-4h5l4-4V2zm-10 9V7m5 4V7",key:"c0yzno"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LQ=U("Twitter",[["path",{d:"M22 4s-.7 2.1-2 3.4c1.6 10-9.4 17.3-18 11.6 2.2.1 4.4-.6 6-2C3 15.5.5 9.6 3 5c2.2 2.6 5.6 4.1 9 4-.9-4.2 4-6.6 7-3.8 1.1 0 3-1.2 3-1.2z",key:"pff0z6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OQ=U("TypeOutline",[["path",{d:"M14 16.5a.5.5 0 0 0 .5.5h.5a2 2 0 0 1 0 4H9a2 2 0 0 1 0-4h.5a.5.5 0 0 0 .5-.5v-9a.5.5 0 0 0-.5-.5h-3a.5.5 0 0 0-.5.5V8a2 2 0 0 1-4 0V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v3a2 2 0 0 1-4 0v-.5a.5.5 0 0 0-.5-.5h-3a.5.5 0 0 0-.5.5Z",key:"1reda3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DQ=U("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RQ=U("UmbrellaOff",[["path",{d:"M12 2v1",key:"11qlp1"}],["path",{d:"M15.5 21a1.85 1.85 0 0 1-3.5-1v-8H2a10 10 0 0 1 3.428-6.575",key:"eki10q"}],["path",{d:"M17.5 12H22A10 10 0 0 0 9.004 3.455",key:"n2ayka"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FQ=U("Umbrella",[["path",{d:"M22 12a10.06 10.06 1 0 0-20 0Z",key:"1teyop"}],["path",{d:"M12 12v8a2 2 0 0 0 4 0",key:"ulpmoc"}],["path",{d:"M12 2v1",key:"11qlp1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zQ=U("Underline",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BQ=U("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $Q=U("UndoDot",[["path",{d:"M21 17a9 9 0 0 0-15-6.7L3 13",key:"8mp6z9"}],["path",{d:"M3 7v6h6",key:"1v2h90"}],["circle",{cx:"12",cy:"17",r:"1",key:"1ixnty"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QS=U("Undo",[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UQ=U("UnfoldHorizontal",[["path",{d:"M16 12h6",key:"15xry1"}],["path",{d:"M8 12H2",key:"1jqql6"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 8v2",key:"1woqiv"}],["path",{d:"M12 14v2",key:"8jcxud"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m19 15 3-3-3-3",key:"wjy7rq"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qQ=U("UnfoldVertical",[["path",{d:"M12 22v-6",key:"6o8u61"}],["path",{d:"M12 8V2",key:"1wkif3"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m15 5-3-3-3 3",key:"itvq4r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VQ=U("Ungroup",[["rect",{width:"8",height:"6",x:"5",y:"4",rx:"1",key:"nzclkv"}],["rect",{width:"8",height:"6",x:"11",y:"14",rx:"1",key:"4tytwb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $b=U("University",[["circle",{cx:"12",cy:"10",r:"1",key:"1gnqs8"}],["path",{d:"M22 20V8h-4l-6-4-6 4H2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2",key:"1qj5sn"}],["path",{d:"M6 17v.01",key:"roodi6"}],["path",{d:"M6 13v.01",key:"67c122"}],["path",{d:"M18 17v.01",key:"12ktxm"}],["path",{d:"M18 13v.01",key:"tn1rt1"}],["path",{d:"M14 22v-5a2 2 0 0 0-2-2a2 2 0 0 0-2 2v5",key:"11g7fi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HQ=U("Unlink2",[["path",{d:"M15 7h2a5 5 0 0 1 0 10h-2m-6 0H7A5 5 0 0 1 7 7h2",key:"1re2ne"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TT=U("Unlink",[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WQ=U("Unplug",[["path",{d:"m19 5 3-3",key:"yk6iyv"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z",key:"1snsnr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ao=U("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GQ=U("Usb",[["circle",{cx:"10",cy:"7",r:"1",key:"dypaad"}],["circle",{cx:"4",cy:"20",r:"1",key:"22iqad"}],["path",{d:"M4.7 19.3 19 5",key:"1enqfc"}],["path",{d:"m21 3-3 1 2 2Z",key:"d3ov82"}],["path",{d:"M9.26 7.68 5 12l2 5",key:"1esawj"}],["path",{d:"m10 14 5 2 3.5-3.5",key:"v8oal5"}],["path",{d:"m18 12 1-1 1 1-1 1Z",key:"1bh22v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zw=U("UserCheck",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AT=U("UserCog",[["circle",{cx:"18",cy:"15",r:"3",key:"gjjjvw"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M10 15H6a4 4 0 0 0-4 4v2",key:"1nfge6"}],["path",{d:"m21.7 16.4-.9-.3",key:"12j9ji"}],["path",{d:"m15.2 13.9-.9-.3",key:"1fdjdi"}],["path",{d:"m16.6 18.7.3-.9",key:"heedtr"}],["path",{d:"m19.1 12.2.3-.9",key:"1af3ki"}],["path",{d:"m19.6 18.7-.4-1",key:"1x9vze"}],["path",{d:"m16.8 12.3-.4-1",key:"vqeiwj"}],["path",{d:"m14.3 16.6 1-.4",key:"1qlj63"}],["path",{d:"m20.7 13.8 1-.4",key:"1v5t8k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KQ=U("UserMinus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZQ=U("UserPen",[["path",{d:"M11.5 15H7a4 4 0 0 0-4 4v2",key:"15lzij"}],["path",{d:"M21.378 16.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1817ys"}],["circle",{cx:"10",cy:"7",r:"4",key:"e45bow"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J0=U("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ub=U("UserRoundCheck",[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qb=U("UserRoundCog",[["path",{d:"M2 21a8 8 0 0 1 10.434-7.62",key:"1yezr2"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["path",{d:"m19.5 14.3-.4.9",key:"1eb35c"}],["path",{d:"m16.9 20.8-.4.9",key:"dfjc4z"}],["path",{d:"m21.7 19.5-.9-.4",key:"q4dx6b"}],["path",{d:"m15.2 16.9-.9-.4",key:"1r0w5f"}],["path",{d:"m21.7 16.5-.9.4",key:"1knoei"}],["path",{d:"m15.2 19.1-.9.4",key:"j188fs"}],["path",{d:"m19.5 21.7-.4-.9",key:"1tonu5"}],["path",{d:"m16.9 15.2-.4-.9",key:"699xu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vb=U("UserRoundMinus",[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 19h-6",key:"vcuq98"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YQ=U("UserRoundPen",[["path",{d:"M2 21a8 8 0 0 1 10.821-7.487",key:"1c8h7z"}],["path",{d:"M21.378 16.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1817ys"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Hb=U("UserRoundPlus",[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M19 16v6",key:"tddt3s"}],["path",{d:"M22 19h-6",key:"vcuq98"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XQ=U("UserRoundSearch",[["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M2 21a8 8 0 0 1 10.434-7.62",key:"1yezr2"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["path",{d:"m22 22-1.9-1.9",key:"1e5ubv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wb=U("UserRoundX",[["path",{d:"M2 21a8 8 0 0 1 11.873-7",key:"74fkxq"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"m17 17 5 5",key:"p7ous7"}],["path",{d:"m22 17-5 5",key:"gqnmv0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gb=U("UserRound",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QQ=U("UserSearch",[["circle",{cx:"10",cy:"7",r:"4",key:"e45bow"}],["path",{d:"M10.3 15H7a4 4 0 0 0-4 4v2",key:"3bnktk"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["path",{d:"m21 21-1.9-1.9",key:"1g2n9r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JQ=U("UserX",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jc=U("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kb=U("UsersRound",[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hs=U("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zb=U("UtensilsCrossed",[["path",{d:"m16 2-2.3 2.3a3 3 0 0 0 0 4.2l1.8 1.8a3 3 0 0 0 4.2 0L22 8",key:"n7qcjb"}],["path",{d:"M15 15 3.3 3.3a4.2 4.2 0 0 0 0 6l7.3 7.3c.7.7 2 .7 2.8 0L15 15Zm0 0 7 7",key:"d0u48b"}],["path",{d:"m2.1 21.8 6.4-6.3",key:"yn04lh"}],["path",{d:"m19 5-7 7",key:"194lzd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yb=U("Utensils",[["path",{d:"M3 2v7c0 1.1.9 2 2 2h4a2 2 0 0 0 2-2V2",key:"cjf0a3"}],["path",{d:"M7 2v20",key:"1473qp"}],["path",{d:"M21 15V2a5 5 0 0 0-5 5v6c0 1.1.9 2 2 2h3Zm0 0v7",key:"j28e5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eJ=U("UtilityPole",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"M2 5h20",key:"1fs1ex"}],["path",{d:"M3 3v2",key:"9imdir"}],["path",{d:"M7 3v2",key:"n0os7"}],["path",{d:"M17 3v2",key:"1l2re6"}],["path",{d:"M21 3v2",key:"1duuac"}],["path",{d:"m19 5-7 7-7-7",key:"133zxf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ET=U("Variable",[["path",{d:"M8 21s-4-3-4-9 4-9 4-9",key:"uto9ud"}],["path",{d:"M16 3s4 3 4 9-4 9-4 9",key:"4w2vsq"}],["line",{x1:"15",x2:"9",y1:"9",y2:"15",key:"f7djnv"}],["line",{x1:"9",x2:"15",y1:"9",y2:"15",key:"1shsy8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tJ=U("Vault",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}],["path",{d:"m7.9 7.9 2.7 2.7",key:"hpeyl3"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}],["path",{d:"m13.4 10.6 2.7-2.7",key:"264c1n"}],["circle",{cx:"7.5",cy:"16.5",r:".5",fill:"currentColor",key:"nkw3mc"}],["path",{d:"m7.9 16.1 2.7-2.7",key:"p81g5e"}],["circle",{cx:"16.5",cy:"16.5",r:".5",fill:"currentColor",key:"fubopw"}],["path",{d:"m13.4 13.4 2.7 2.7",key:"abhel3"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rJ=U("Vegan",[["path",{d:"M16 8q6 0 6-6-6 0-6 6",key:"qsyyc4"}],["path",{d:"M17.41 3.59a10 10 0 1 0 3 3",key:"41m9h7"}],["path",{d:"M2 2a26.6 26.6 0 0 1 10 20c.9-6.82 1.5-9.5 4-14",key:"qiv7li"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nJ=U("VenetianMask",[["path",{d:"M18 11c-1.5 0-2.5.5-3 2",key:"1fod00"}],["path",{d:"M4 6a2 2 0 0 0-2 2v4a5 5 0 0 0 5 5 8 8 0 0 1 5 2 8 8 0 0 1 5-2 5 5 0 0 0 5-5V8a2 2 0 0 0-2-2h-3a8 8 0 0 0-5 2 8 8 0 0 0-5-2z",key:"d70hit"}],["path",{d:"M6 11c1.5 0 2.5.5 3 2",key:"136fht"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sJ=U("VibrateOff",[["path",{d:"m2 8 2 2-2 2 2 2-2 2",key:"sv1b1"}],["path",{d:"m22 8-2 2 2 2-2 2 2 2",key:"101i4y"}],["path",{d:"M8 8v10c0 .55.45 1 1 1h6c.55 0 1-.45 1-1v-2",key:"1hbad5"}],["path",{d:"M16 10.34V6c0-.55-.45-1-1-1h-4.34",key:"1x5tf0"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iJ=U("Vibrate",[["path",{d:"m2 8 2 2-2 2 2 2-2 2",key:"sv1b1"}],["path",{d:"m22 8-2 2 2 2-2 2 2 2",key:"101i4y"}],["rect",{width:"8",height:"14",x:"8",y:"5",rx:"1",key:"1oyrl4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aJ=U("VideoOff",[["path",{d:"M10.66 6H14a2 2 0 0 1 2 2v2.5l5.248-3.062A.5.5 0 0 1 22 7.87v8.196",key:"w8jjjt"}],["path",{d:"M16 16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h2",key:"1xawa7"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gi=U("Video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oJ=U("Videotape",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M2 8h20",key:"d11cs7"}],["circle",{cx:"8",cy:"14",r:"2",key:"1k2qr5"}],["path",{d:"M8 12h8",key:"1wcyev"}],["circle",{cx:"16",cy:"14",r:"2",key:"14k7lr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lJ=U("View",[["path",{d:"M21 17v2a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-2",key:"mrq65r"}],["path",{d:"M21 7V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2",key:"be3xqs"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cJ=U("Voicemail",[["circle",{cx:"6",cy:"12",r:"4",key:"1ehtga"}],["circle",{cx:"18",cy:"12",r:"4",key:"4vafl8"}],["line",{x1:"6",x2:"18",y1:"16",y2:"16",key:"pmt8us"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dJ=U("Volleyball",[["path",{d:"M11.1 7.1a16.55 16.55 0 0 1 10.9 4",key:"2880wi"}],["path",{d:"M12 12a12.6 12.6 0 0 1-8.7 5",key:"113sja"}],["path",{d:"M16.8 13.6a16.55 16.55 0 0 1-9 7.5",key:"1qmsgl"}],["path",{d:"M20.7 17a12.8 12.8 0 0 0-8.7-5 13.3 13.3 0 0 1 0-10",key:"1bmeqp"}],["path",{d:"M6.3 3.8a16.55 16.55 0 0 0 1.9 11.5",key:"iekzv9"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uJ=U("Volume1",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hJ=U("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fJ=U("VolumeOff",[["path",{d:"M16 9a5 5 0 0 1 .95 2.293",key:"1fgyg8"}],["path",{d:"M19.364 5.636a9 9 0 0 1 1.889 9.96",key:"l3zxae"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"m7 7-.587.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298V11",key:"1gbwow"}],["path",{d:"M9.828 4.172A.686.686 0 0 1 11 4.657v.686",key:"s2je0y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pJ=U("VolumeX",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mJ=U("Volume",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gJ=U("Vote",[["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}],["path",{d:"M5 7c0-1.1.9-2 2-2h10a2 2 0 0 1 2 2v12H5V7Z",key:"1ezoue"}],["path",{d:"M22 19H2",key:"nuriw5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yJ=U("WalletCards",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2",key:"4125el"}],["path",{d:"M3 11h3c.8 0 1.6.3 2.1.9l1.1.9c1.6 1.6 4.1 1.6 5.7 0l1.1-.9c.5-.5 1.3-.9 2.1-.9H21",key:"1dpki6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xb=U("WalletMinimal",[["path",{d:"M17 14h.01",key:"7oqj8z"}],["path",{d:"M7 7h12a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14",key:"u1rqew"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xJ=U("Wallet",[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vJ=U("Wallpaper",[["circle",{cx:"8",cy:"9",r:"2",key:"gjzl9d"}],["path",{d:"m9 17 6.1-6.1a2 2 0 0 1 2.81.01L22 15V5a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2",key:"69xh40"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["path",{d:"M12 17v4",key:"1riwvh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qb=U("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _J=U("Wand",[["path",{d:"M15 4V2",key:"z1p9b7"}],["path",{d:"M15 16v-2",key:"px0unx"}],["path",{d:"M8 9h2",key:"1g203m"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M17.8 11.8 19 13",key:"yihg8r"}],["path",{d:"M15 9h.01",key:"x1ddxp"}],["path",{d:"M17.8 6.2 19 5",key:"fd4us0"}],["path",{d:"m3 21 9-9",key:"1jfql5"}],["path",{d:"M12.2 6.2 11 5",key:"i3da3b"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bJ=U("Warehouse",[["path",{d:"M22 8.35V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8.35A2 2 0 0 1 3.26 6.5l8-3.2a2 2 0 0 1 1.48 0l8 3.2A2 2 0 0 1 22 8.35Z",key:"gksnxg"}],["path",{d:"M6 18h12",key:"9pbo8z"}],["path",{d:"M6 14h12",key:"4cwo0f"}],["rect",{width:"12",height:"12",x:"6",y:"10",key:"apd30q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wJ=U("WashingMachine",[["path",{d:"M3 6h3",key:"155dbl"}],["path",{d:"M17 6h.01",key:"e2y6kg"}],["rect",{width:"18",height:"20",x:"3",y:"2",rx:"2",key:"od3kk9"}],["circle",{cx:"12",cy:"13",r:"5",key:"nlbqau"}],["path",{d:"M12 18a2.5 2.5 0 0 0 0-5 2.5 2.5 0 0 1 0-5",key:"17lach"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jJ=U("Watch",[["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["polyline",{points:"12 10 12 12 13 13",key:"19dquz"}],["path",{d:"m16.13 7.66-.81-4.05a2 2 0 0 0-2-1.61h-2.68a2 2 0 0 0-2 1.61l-.78 4.05",key:"18k57s"}],["path",{d:"m7.88 16.36.8 4a2 2 0 0 0 2 1.61h2.72a2 2 0 0 0 2-1.61l.81-4.05",key:"16ny36"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kJ=U("Waves",[["path",{d:"M2 6c.6.5 1.2 1 2.5 1C7 7 7 5 9.5 5c2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"knzxuh"}],["path",{d:"M2 12c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"2jd2cc"}],["path",{d:"M2 18c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"rd2r6e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NJ=U("Waypoints",[["circle",{cx:"12",cy:"4.5",r:"2.5",key:"r5ysbb"}],["path",{d:"m10.2 6.3-3.9 3.9",key:"1nzqf6"}],["circle",{cx:"4.5",cy:"12",r:"2.5",key:"jydg6v"}],["path",{d:"M7 12h10",key:"b7w52i"}],["circle",{cx:"19.5",cy:"12",r:"2.5",key:"1piiel"}],["path",{d:"m13.8 17.7 3.9-3.9",key:"1wyg1y"}],["circle",{cx:"12",cy:"19.5",r:"2.5",key:"13o1pw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SJ=U("Webcam",[["circle",{cx:"12",cy:"10",r:"8",key:"1gshiw"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 22h10",key:"10w4w3"}],["path",{d:"M12 22v-4",key:"1utk9m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CJ=U("WebhookOff",[["path",{d:"M17 17h-5c-1.09-.02-1.94.92-2.5 1.9A3 3 0 1 1 2.57 15",key:"1tvl6x"}],["path",{d:"M9 3.4a4 4 0 0 1 6.52.66",key:"q04jfq"}],["path",{d:"m6 17 3.1-5.8a2.5 2.5 0 0 0 .057-2.05",key:"azowf0"}],["path",{d:"M20.3 20.3a4 4 0 0 1-2.3.7",key:"5joiws"}],["path",{d:"M18.6 13a4 4 0 0 1 3.357 3.414",key:"cangb8"}],["path",{d:"m12 6 .6 1",key:"tpjl1n"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MJ=U("Webhook",[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TJ=U("Weight",[["circle",{cx:"12",cy:"5",r:"3",key:"rqqgnr"}],["path",{d:"M6.5 8a2 2 0 0 0-1.905 1.46L2.1 18.5A2 2 0 0 0 4 21h16a2 2 0 0 0 1.925-2.54L19.4 9.5A2 2 0 0 0 17.48 8Z",key:"56o5sh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AJ=U("WheatOff",[["path",{d:"m2 22 10-10",key:"28ilpk"}],["path",{d:"m16 8-1.17 1.17",key:"1qqm82"}],["path",{d:"M3.47 12.53 5 11l1.53 1.53a3.5 3.5 0 0 1 0 4.94L5 19l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"1rdhi6"}],["path",{d:"m8 8-.53.53a3.5 3.5 0 0 0 0 4.94L9 15l1.53-1.53c.55-.55.88-1.25.98-1.97",key:"4wz8re"}],["path",{d:"M10.91 5.26c.15-.26.34-.51.56-.73L13 3l1.53 1.53a3.5 3.5 0 0 1 .28 4.62",key:"rves66"}],["path",{d:"M20 2h2v2a4 4 0 0 1-4 4h-2V6a4 4 0 0 1 4-4Z",key:"19rau1"}],["path",{d:"M11.47 17.47 13 19l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L5 19l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"tc8ph9"}],["path",{d:"m16 16-.53.53a3.5 3.5 0 0 1-4.94 0L9 15l1.53-1.53a3.49 3.49 0 0 1 1.97-.98",key:"ak46r"}],["path",{d:"M18.74 13.09c.26-.15.51-.34.73-.56L21 11l-1.53-1.53a3.5 3.5 0 0 0-4.62-.28",key:"1tw520"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EJ=U("Wheat",[["path",{d:"M2 22 16 8",key:"60hf96"}],["path",{d:"M3.47 12.53 5 11l1.53 1.53a3.5 3.5 0 0 1 0 4.94L5 19l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"1rdhi6"}],["path",{d:"M7.47 8.53 9 7l1.53 1.53a3.5 3.5 0 0 1 0 4.94L9 15l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"1sdzmb"}],["path",{d:"M11.47 4.53 13 3l1.53 1.53a3.5 3.5 0 0 1 0 4.94L13 11l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"eoatbi"}],["path",{d:"M20 2h2v2a4 4 0 0 1-4 4h-2V6a4 4 0 0 1 4-4Z",key:"19rau1"}],["path",{d:"M11.47 17.47 13 19l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L5 19l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"tc8ph9"}],["path",{d:"M15.47 13.47 17 15l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L9 15l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"2m8kc5"}],["path",{d:"M19.47 9.47 21 11l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L13 11l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"vex3ng"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IJ=U("WholeWord",[["circle",{cx:"7",cy:"12",r:"3",key:"12clwm"}],["path",{d:"M10 9v6",key:"17i7lo"}],["circle",{cx:"17",cy:"12",r:"3",key:"gl7c2s"}],["path",{d:"M14 7v8",key:"dl84cr"}],["path",{d:"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1",key:"lt2kga"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PJ=U("WifiHigh",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LJ=U("WifiLow",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OJ=U("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DJ=U("WifiZero",[["path",{d:"M12 20h.01",key:"zekei9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RJ=U("Wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FJ=U("WindArrowDown",[["path",{d:"M10 2v8",key:"d4bbey"}],["path",{d:"M12.8 21.6A2 2 0 1 0 14 18H2",key:"19kp1d"}],["path",{d:"M17.5 10a2.5 2.5 0 1 1 2 4H2",key:"19kpjc"}],["path",{d:"m6 6 4 4 4-4",key:"k13n16"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zJ=U("Wind",[["path",{d:"M12.8 19.6A2 2 0 1 0 14 16H2",key:"148xed"}],["path",{d:"M17.5 8a2.5 2.5 0 1 1 2 4H2",key:"1u4tom"}],["path",{d:"M9.8 4.4A2 2 0 1 1 11 8H2",key:"75valh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BJ=U("WineOff",[["path",{d:"M8 22h8",key:"rmew8v"}],["path",{d:"M7 10h3m7 0h-1.343",key:"v48bem"}],["path",{d:"M12 15v7",key:"t2xh3l"}],["path",{d:"M7.307 7.307A12.33 12.33 0 0 0 7 10a5 5 0 0 0 7.391 4.391M8.638 2.981C8.75 2.668 8.872 2.34 9 2h6c1.5 4 2 6 2 8 0 .407-.05.809-.145 1.198",key:"1ymjlu"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $J=U("Wine",[["path",{d:"M8 22h8",key:"rmew8v"}],["path",{d:"M7 10h10",key:"1101jm"}],["path",{d:"M12 15v7",key:"t2xh3l"}],["path",{d:"M12 15a5 5 0 0 0 5-5c0-2-.5-4-2-8H9c-1.5 4-2 6-2 8a5 5 0 0 0 5 5Z",key:"10ffi3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UJ=U("Workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qJ=U("Worm",[["path",{d:"m19 12-1.5 3",key:"9bcu4o"}],["path",{d:"M19.63 18.81 22 20",key:"121v98"}],["path",{d:"M6.47 8.23a1.68 1.68 0 0 1 2.44 1.93l-.64 2.08a6.76 6.76 0 0 0 10.16 7.67l.42-.27a1 1 0 1 0-2.73-4.21l-.42.27a1.76 1.76 0 0 1-2.63-1.99l.64-2.08A6.66 6.66 0 0 0 3.94 3.9l-.7.4a1 1 0 1 0 2.55 4.34z",key:"1tij6q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VJ=U("WrapText",[["line",{x1:"3",x2:"21",y1:"6",y2:"6",key:"4m8b97"}],["path",{d:"M3 12h15a3 3 0 1 1 0 6h-4",key:"1cl7v7"}],["polyline",{points:"16 16 14 18 16 20",key:"1jznyi"}],["line",{x1:"3",x2:"10",y1:"18",y2:"18",key:"1h33wv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Iy=U("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ms=U("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HJ=U("Youtube",[["path",{d:"M2.5 17a24.12 24.12 0 0 1 0-10 2 2 0 0 1 1.4-1.4 49.56 49.56 0 0 1 16.2 0A2 2 0 0 1 21.5 7a24.12 24.12 0 0 1 0 10 2 2 0 0 1-1.4 1.4 49.55 49.55 0 0 1-16.2 0A2 2 0 0 1 2.5 17",key:"1q2vi4"}],["path",{d:"m10 15 5-3-5-3z",key:"1jp15x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WJ=U("ZapOff",[["path",{d:"M10.513 4.856 13.12 2.17a.5.5 0 0 1 .86.46l-1.377 4.317",key:"193nxd"}],["path",{d:"M15.656 10H20a1 1 0 0 1 .78 1.63l-1.72 1.773",key:"27a7lr"}],["path",{d:"M16.273 16.273 10.88 21.83a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14H4a1 1 0 0 1-.78-1.63l4.507-4.643",key:"1e0qe9"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e1=U("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JS=U("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e4=U("ZoomOut",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FKe=Object.freeze(Object.defineProperty({__proto__:null,AArrowDown:YL,AArrowUp:XL,ALargeSmall:QL,Accessibility:JL,Activity:ig,AirVent:eO,Airplay:tO,AlarmClock:nO,AlarmClockCheck:Bv,AlarmClockMinus:$v,AlarmClockOff:rO,AlarmClockPlus:Uv,AlarmSmoke:sO,Album:iO,AlignCenter:MS,AlignCenterHorizontal:aO,AlignCenterVertical:oO,AlignEndHorizontal:lO,AlignEndVertical:cO,AlignHorizontalDistributeCenter:dO,AlignHorizontalDistributeEnd:uO,AlignHorizontalDistributeStart:hO,AlignHorizontalJustifyCenter:fO,AlignHorizontalJustifyEnd:pO,AlignHorizontalJustifyStart:mO,AlignHorizontalSpaceAround:gO,AlignHorizontalSpaceBetween:yO,AlignJustify:xO,AlignLeft:TS,AlignRight:AS,AlignStartHorizontal:vO,AlignStartVertical:_O,AlignVerticalDistributeCenter:bO,AlignVerticalDistributeEnd:wO,AlignVerticalDistributeStart:jO,AlignVerticalJustifyCenter:kO,AlignVerticalJustifyEnd:NO,AlignVerticalJustifyStart:SO,AlignVerticalSpaceAround:CO,AlignVerticalSpaceBetween:MO,Ambulance:TO,Ampersand:AO,Ampersands:EO,Amphora:IO,Anchor:PO,Angry:LO,Annoyed:OO,Antenna:DO,Anvil:RO,Aperture:FO,AppWindow:sT,AppWindowMac:zO,Apple:BO,Archive:qO,ArchiveRestore:$O,ArchiveX:UO,Armchair:VO,ArrowBigDown:WO,ArrowBigDownDash:HO,ArrowBigLeft:KO,ArrowBigLeftDash:GO,ArrowBigRight:YO,ArrowBigRightDash:ZO,ArrowBigUp:QO,ArrowBigUpDash:XO,ArrowDown:ES,ArrowDown01:JO,ArrowDown10:eD,ArrowDownAZ:qv,ArrowDownFromLine:tD,ArrowDownLeft:rD,ArrowDownNarrowWide:nD,ArrowDownRight:sD,ArrowDownToDot:iD,ArrowDownToLine:aD,ArrowDownUp:oD,ArrowDownWideNarrow:Vv,ArrowDownZA:Hv,ArrowLeft:Va,ArrowLeftFromLine:lD,ArrowLeftRight:cD,ArrowLeftToLine:dD,ArrowRight:Ho,ArrowRightFromLine:uD,ArrowRightLeft:hD,ArrowRightToLine:fD,ArrowUp:$0,ArrowUp01:pD,ArrowUp10:mD,ArrowUpAZ:Wv,ArrowUpDown:B0,ArrowUpFromDot:gD,ArrowUpFromLine:yD,ArrowUpLeft:xD,ArrowUpNarrowWide:Gv,ArrowUpRight:vD,ArrowUpToLine:_D,ArrowUpWideNarrow:bD,ArrowUpZA:Kv,ArrowsUpFromLine:wD,Asterisk:jD,AtSign:kD,Atom:ND,AudioLines:SD,AudioWaveform:CD,Award:Cu,Axe:MD,Axis3d:Zv,Baby:TD,Backpack:AD,Badge:WD,BadgeAlert:ED,BadgeCent:ID,BadgeCheck:Yv,BadgeDollarSign:PD,BadgeEuro:LD,BadgeHelp:OD,BadgeIndianRupee:DD,BadgeInfo:RD,BadgeJapaneseYen:FD,BadgeMinus:zD,BadgePercent:BD,BadgePlus:$D,BadgePoundSterling:UD,BadgeRussianRuble:qD,BadgeSwissFranc:VD,BadgeX:HD,BaggageClaim:GD,Ban:KD,Banana:ZD,Bandage:YD,Banknote:XD,Barcode:QD,Baseline:JD,Bath:Lf,Battery:i8,BatteryCharging:e8,BatteryFull:t8,BatteryLow:r8,BatteryMedium:n8,BatteryWarning:s8,Beaker:a8,Bean:l8,BeanOff:o8,Bed:Of,BedDouble:c8,BedSingle:d8,Beef:u8,Beer:f8,BeerOff:h8,Bell:ag,BellDot:p8,BellElectric:m8,BellMinus:g8,BellOff:Ow,BellPlus:y8,BellRing:x8,BetweenHorizontalEnd:Xv,BetweenHorizontalStart:Qv,BetweenVerticalEnd:v8,BetweenVerticalStart:_8,BicepsFlexed:b8,Bike:w8,Binary:j8,Binoculars:k8,Biohazard:N8,Bird:S8,Bitcoin:C8,Blend:M8,Blinds:T8,Blocks:A8,Bluetooth:L8,BluetoothConnected:E8,BluetoothOff:I8,BluetoothSearching:P8,Bold:IS,Bolt:O8,Bomb:D8,Bone:R8,Book:iR,BookA:F8,BookAudio:z8,BookCheck:B8,BookCopy:$8,BookDashed:Jv,BookDown:U8,BookHeadphones:q8,BookHeart:V8,BookImage:H8,BookKey:W8,BookLock:G8,BookMarked:K8,BookMinus:Z8,BookOpen:iT,BookOpenCheck:Y8,BookOpenText:X8,BookPlus:Q8,BookText:J8,BookType:eR,BookUp:rR,BookUp2:tR,BookUser:nR,BookX:sR,Bookmark:Jp,BookmarkCheck:aR,BookmarkMinus:oR,BookmarkPlus:lR,BookmarkX:cR,BoomBox:dR,Bot:PS,BotMessageSquare:uR,BotOff:hR,Box:fR,Boxes:pR,Braces:e_,Brackets:mR,Brain:xR,BrainCircuit:gR,BrainCog:yR,BrickWall:vR,Briefcase:dh,BriefcaseBusiness:_R,BriefcaseConveyorBelt:bR,BriefcaseMedical:wR,BringToFront:jR,Brush:kR,Bug:CR,BugOff:NR,BugPlay:SR,Building:LS,Building2:ra,Bus:TR,BusFront:MR,Cable:ER,CableCar:AR,Cake:og,CakeSlice:IR,Calculator:PR,Calendar:li,Calendar1:LR,CalendarArrowDown:OR,CalendarArrowUp:DR,CalendarCheck:FR,CalendarCheck2:RR,CalendarClock:zR,CalendarCog:BR,CalendarDays:em,CalendarFold:$R,CalendarHeart:UR,CalendarMinus:VR,CalendarMinus2:qR,CalendarOff:HR,CalendarPlus:Dw,CalendarPlus2:WR,CalendarRange:GR,CalendarSearch:KR,CalendarSync:ZR,CalendarX:XR,CalendarX2:YR,Camera:Rw,CameraOff:QR,Candy:tF,CandyCane:JR,CandyOff:eF,Cannabis:rF,Captions:t_,CaptionsOff:nF,Car:aF,CarFront:sF,CarTaxiFront:iF,Caravan:oF,Carrot:lF,CaseLower:cF,CaseSensitive:dF,CaseUpper:uF,CassetteTape:hF,Cast:fF,Castle:pF,Cat:mF,Cctv:gF,ChartArea:r_,ChartBar:s_,ChartBarBig:n_,ChartBarDecreasing:yF,ChartBarIncreasing:xF,ChartBarStacked:vF,ChartCandlestick:i_,ChartColumn:xc,ChartColumnBig:a_,ChartColumnDecreasing:_F,ChartColumnIncreasing:o_,ChartColumnStacked:bF,ChartGantt:wF,ChartLine:l_,ChartNetwork:jF,ChartNoAxesColumn:d_,ChartNoAxesColumnDecreasing:kF,ChartNoAxesColumnIncreasing:c_,ChartNoAxesCombined:NF,ChartNoAxesGantt:u_,ChartPie:h_,ChartScatter:f_,ChartSpline:SF,Check:Ba,CheckCheck:CF,ChefHat:MF,Cherry:TF,ChevronDown:uh,ChevronFirst:AF,ChevronLast:EF,ChevronLeft:sd,ChevronRight:Ha,ChevronUp:U0,ChevronsDown:PF,ChevronsDownUp:IF,ChevronsLeft:DF,ChevronsLeftRight:OF,ChevronsLeftRightEllipsis:LF,ChevronsRight:FF,ChevronsRightLeft:RF,ChevronsUp:zF,ChevronsUpDown:Fw,Chrome:BF,Church:$F,Cigarette:qF,CigaretteOff:UF,Circle:Mu,CircleAlert:Bl,CircleArrowDown:p_,CircleArrowLeft:m_,CircleArrowOutDownLeft:g_,CircleArrowOutDownRight:y_,CircleArrowOutUpLeft:x_,CircleArrowOutUpRight:v_,CircleArrowRight:__,CircleArrowUp:b_,CircleCheck:io,CircleCheckBig:za,CircleChevronDown:w_,CircleChevronLeft:j_,CircleChevronRight:k_,CircleChevronUp:N_,CircleDashed:VF,CircleDivide:S_,CircleDollarSign:HF,CircleDot:GF,CircleDotDashed:WF,CircleEllipsis:KF,CircleEqual:ZF,CircleFadingArrowUp:YF,CircleFadingPlus:XF,CircleGauge:C_,CircleHelp:my,CircleMinus:M_,CircleOff:QF,CircleParking:A_,CircleParkingOff:T_,CirclePause:E_,CirclePercent:I_,CirclePlay:Sf,CirclePlus:P_,CirclePower:L_,CircleSlash:JF,CircleSlash2:O_,CircleStop:D_,CircleUser:F_,CircleUserRound:R_,CircleX:Lc,CircuitBoard:ez,Citrus:tz,Clapperboard:rz,Clipboard:dz,ClipboardCheck:aT,ClipboardCopy:nz,ClipboardList:sz,ClipboardMinus:iz,ClipboardPaste:az,ClipboardPen:B_,ClipboardPenLine:z_,ClipboardPlus:oz,ClipboardType:lz,ClipboardX:cz,Clock:Xi,Clock1:uz,Clock10:hz,Clock11:fz,Clock12:pz,Clock2:mz,Clock3:gz,Clock4:yz,Clock5:xz,Clock6:vz,Clock7:_z,Clock8:bz,Clock9:wz,ClockAlert:jz,ClockArrowDown:kz,ClockArrowUp:Nz,Cloud:Bz,CloudAlert:Sz,CloudCog:Cz,CloudDownload:$_,CloudDrizzle:Mz,CloudFog:Tz,CloudHail:Az,CloudLightning:Ez,CloudMoon:Pz,CloudMoonRain:Iz,CloudOff:Lz,CloudRain:Dz,CloudRainWind:Oz,CloudSnow:Rz,CloudSun:zz,CloudSunRain:Fz,CloudUpload:U_,Cloudy:$z,Clover:Uz,Club:qz,Code:zw,CodeXml:q_,Codepen:Vz,Codesandbox:Hz,Coffee:Wz,Cog:Gz,Coins:Kz,Columns2:V_,Columns3:H_,Columns4:Zz,Combine:Yz,Command:Xz,Compass:Qz,Component:Jz,Computer:e7,ConciergeBell:t7,Cone:r7,Construction:n7,Contact:s7,ContactRound:W_,Container:i7,Contrast:a7,Cookie:o7,CookingPot:l7,Copy:Ul,CopyCheck:c7,CopyMinus:d7,CopyPlus:u7,CopySlash:h7,CopyX:f7,Copyleft:p7,Copyright:m7,CornerDownLeft:g7,CornerDownRight:y7,CornerLeftDown:x7,CornerLeftUp:v7,CornerRightDown:_7,CornerRightUp:b7,CornerUpLeft:w7,CornerUpRight:j7,Cpu:k7,CreativeCommons:N7,CreditCard:q0,Croissant:S7,Crop:C7,Cross:M7,Crosshair:T7,Crown:Bw,Cuboid:A7,CupSoda:E7,Currency:I7,Cylinder:P7,Dam:L7,Database:R7,DatabaseBackup:O7,DatabaseZap:D7,Delete:F7,Dessert:z7,Diameter:B7,Diamond:q7,DiamondMinus:$7,DiamondPercent:G_,DiamondPlus:U7,Dice1:V7,Dice2:H7,Dice3:W7,Dice4:G7,Dice5:K7,Dice6:Z7,Dices:Y7,Diff:X7,Disc:tB,Disc2:Q7,Disc3:J7,DiscAlbum:eB,Divide:rB,Dna:sB,DnaOff:nB,Dock:iB,Dog:aB,DollarSign:Cd,Donut:oB,DoorClosed:lB,DoorOpen:oT,Dot:cB,Download:Mo,DraftingCompass:dB,Drama:uB,Dribbble:hB,Drill:fB,Droplet:pB,Droplets:mB,Drum:gB,Drumstick:yB,Dumbbell:xB,Ear:_B,EarOff:vB,Earth:K_,EarthLock:bB,Eclipse:wB,Egg:NB,EggFried:jB,EggOff:kB,Ellipsis:Zm,EllipsisVertical:gy,Equal:MB,EqualApproximately:SB,EqualNot:CB,Eraser:TB,EthernetPort:AB,Euro:EB,Expand:IB,ExternalLink:Fs,Eye:Ml,EyeClosed:PB,EyeOff:$w,Facebook:Md,Factory:LB,Fan:OB,FastForward:DB,Feather:RB,Fence:FB,FerrisWheel:zB,Figma:BB,File:L9,FileArchive:$B,FileAudio:qB,FileAudio2:UB,FileAxis3d:Z_,FileBadge:HB,FileBadge2:VB,FileBox:WB,FileChartColumn:X_,FileChartColumnIncreasing:Y_,FileChartLine:Q_,FileChartPie:J_,FileCheck:KB,FileCheck2:GB,FileClock:ZB,FileCode:XB,FileCode2:YB,FileCog:e2,FileDiff:QB,FileDigit:JB,FileDown:e9,FileHeart:t9,FileImage:V0,FileInput:r9,FileJson:s9,FileJson2:n9,FileKey:a9,FileKey2:i9,FileLock:l9,FileLock2:o9,FileMinus:d9,FileMinus2:c9,FileMusic:u9,FileOutput:h9,FilePen:r2,FilePenLine:t2,FilePlus:p9,FilePlus2:f9,FileQuestion:m9,FileScan:g9,FileSearch:x9,FileSearch2:y9,FileSliders:v9,FileSpreadsheet:H0,FileStack:_9,FileSymlink:b9,FileTerminal:w9,FileText:Ai,FileType:k9,FileType2:j9,FileUp:N9,FileUser:S9,FileVideo:M9,FileVideo2:C9,FileVolume:A9,FileVolume2:T9,FileWarning:E9,FileX:P9,FileX2:I9,Files:O9,Film:wd,Filter:Uw,FilterX:D9,Fingerprint:R9,FireExtinguisher:F9,Fish:$9,FishOff:z9,FishSymbol:B9,Flag:lT,FlagOff:U9,FlagTriangleLeft:q9,FlagTriangleRight:V9,Flame:Df,FlameKindling:H9,Flashlight:G9,FlashlightOff:W9,FlaskConical:qw,FlaskConicalOff:K9,FlaskRound:Z9,FlipHorizontal:X9,FlipHorizontal2:Y9,FlipVertical:J9,FlipVertical2:Q9,Flower:t$,Flower2:e$,Focus:r$,FoldHorizontal:n$,FoldVertical:s$,Folder:E$,FolderArchive:i$,FolderCheck:a$,FolderClock:o$,FolderClosed:l$,FolderCode:c$,FolderCog:n2,FolderDot:d$,FolderDown:u$,FolderGit:f$,FolderGit2:h$,FolderHeart:p$,FolderInput:m$,FolderKanban:g$,FolderKey:y$,FolderLock:x$,FolderMinus:v$,FolderOpen:My,FolderOpenDot:_$,FolderOutput:b$,FolderPen:s2,FolderPlus:w$,FolderRoot:j$,FolderSearch:N$,FolderSearch2:k$,FolderSymlink:S$,FolderSync:C$,FolderTree:M$,FolderUp:T$,FolderX:A$,Folders:I$,Footprints:P$,Forklift:L$,Forward:O$,Frame:D$,Framer:R$,Frown:F$,Fuel:z$,Fullscreen:B$,GalleryHorizontal:U$,GalleryHorizontalEnd:$$,GalleryThumbnails:q$,GalleryVertical:H$,GalleryVerticalEnd:V$,Gamepad:G$,Gamepad2:W$,Gauge:K$,Gavel:Z$,Gem:Y$,Ghost:X$,Gift:Qa,GitBranch:J$,GitBranchPlus:Q$,GitCommitHorizontal:i2,GitCommitVertical:eU,GitCompare:rU,GitCompareArrows:tU,GitFork:nU,GitGraph:sU,GitMerge:iU,GitPullRequest:uU,GitPullRequestArrow:aU,GitPullRequestClosed:oU,GitPullRequestCreate:cU,GitPullRequestCreateArrow:lU,GitPullRequestDraft:dU,Github:hU,Gitlab:fU,GlassWater:pU,Glasses:mU,Globe:OS,GlobeLock:gU,Goal:yU,Grab:xU,GraduationCap:W0,Grape:vU,Grid2x2:o2,Grid2x2Check:_U,Grid2x2Plus:a2,Grid2x2X:bU,Grid3x3:Th,Grip:jU,GripHorizontal:wU,GripVertical:DS,Group:kU,Guitar:NU,Ham:SU,Hammer:CU,Hand:IU,HandCoins:MU,HandHeart:TU,HandHelping:l2,HandMetal:AU,HandPlatter:EU,Handshake:PU,HardDrive:cT,HardDriveDownload:LU,HardDriveUpload:OU,HardHat:DU,Hash:RS,Haze:RU,HdmiPort:FU,Heading:qU,Heading1:dT,Heading2:uT,Heading3:zU,Heading4:BU,Heading5:$U,Heading6:UU,HeadphoneOff:VU,Headphones:HU,Headset:WU,Heart:ql,HeartCrack:GU,HeartHandshake:KU,HeartOff:ZU,HeartPulse:YU,Heater:XU,Hexagon:QU,Highlighter:JU,History:FS,Hop:tq,HopOff:eq,Hospital:rq,Hotel:nq,Hourglass:sq,House:Hi,HousePlug:iq,HousePlus:aq,IceCreamBowl:c2,IceCreamCone:d2,IdCard:oq,Image:Wo,ImageDown:lq,ImageMinus:cq,ImageOff:dq,ImagePlay:uq,ImagePlus:zS,ImageUp:hq,ImageUpscale:fq,Images:pq,Import:mq,Inbox:gq,IndentDecrease:u2,IndentIncrease:h2,IndianRupee:yq,Infinity:xq,Info:vq,InspectionPanel:_q,Instagram:Wd,Italic:BS,IterationCcw:bq,IterationCw:wq,JapaneseYen:jq,Joystick:kq,Kanban:G0,Key:hT,KeyRound:Vw,KeySquare:Nq,Keyboard:Mq,KeyboardMusic:Sq,KeyboardOff:Cq,Lamp:Lq,LampCeiling:Tq,LampDesk:Aq,LampFloor:Eq,LampWallDown:Iq,LampWallUp:Pq,LandPlot:Oq,Landmark:Dq,Languages:Rq,Laptop:zq,LaptopMinimal:f2,LaptopMinimalCheck:Fq,Lasso:$q,LassoSelect:Bq,Laugh:Uq,Layers:Hq,Layers2:qq,Layers3:Vq,LayoutDashboard:$S,LayoutGrid:lg,LayoutList:Wq,LayoutPanelLeft:Gq,LayoutPanelTop:Kq,LayoutTemplate:Zq,Leaf:Yq,LeafyGreen:Xq,Lectern:Qq,LetterText:Jq,Library:US,LibraryBig:eV,LifeBuoy:qS,Ligature:tV,Lightbulb:K0,LightbulbOff:rV,Link:bo,Link2:Rf,Link2Off:nV,Linkedin:tm,List:rm,ListCheck:sV,ListChecks:iV,ListCollapse:aV,ListEnd:oV,ListFilter:lV,ListMinus:cV,ListMusic:dV,ListOrdered:VS,ListPlus:uV,ListRestart:hV,ListStart:fV,ListTodo:pV,ListTree:mV,ListVideo:gV,ListX:yV,Loader:vV,LoaderCircle:sn,LoaderPinwheel:xV,Locate:fT,LocateFixed:_V,LocateOff:bV,Lock:Ff,LockKeyhole:wV,LockKeyholeOpen:p2,LockOpen:m2,LogIn:HS,LogOut:WS,Logs:jV,Lollipop:kV,Luggage:NV,Magnet:SV,Mail:di,MailCheck:CV,MailMinus:MV,MailOpen:TV,MailPlus:AV,MailQuestion:EV,MailSearch:IV,MailWarning:PV,MailX:pT,Mailbox:LV,Mails:OV,Map:GV,MapPin:yl,MapPinCheck:RV,MapPinCheckInside:DV,MapPinHouse:FV,MapPinMinus:BV,MapPinMinusInside:zV,MapPinOff:$V,MapPinPlus:qV,MapPinPlusInside:UV,MapPinX:HV,MapPinXInside:VV,MapPinned:WV,Martini:KV,Maximize:Z0,Maximize2:ZV,Medal:Ty,Megaphone:nm,MegaphoneOff:YV,Meh:XV,MemoryStick:QV,Menu:mT,Merge:JV,MessageCircle:Hl,MessageCircleCode:eH,MessageCircleDashed:tH,MessageCircleHeart:rH,MessageCircleMore:nH,MessageCircleOff:sH,MessageCirclePlus:iH,MessageCircleQuestion:gT,MessageCircleReply:aH,MessageCircleWarning:oH,MessageCircleX:lH,MessageSquare:Wl,MessageSquareCode:cH,MessageSquareDashed:dH,MessageSquareDiff:uH,MessageSquareDot:hH,MessageSquareHeart:fH,MessageSquareLock:pH,MessageSquareMore:mH,MessageSquareOff:gH,MessageSquarePlus:yH,MessageSquareQuote:xH,MessageSquareReply:vH,MessageSquareShare:_H,MessageSquareText:bH,MessageSquareWarning:wH,MessageSquareX:jH,MessagesSquare:kH,Mic:yT,MicOff:NH,MicVocal:g2,Microchip:SH,Microscope:CH,Microwave:MH,Milestone:TH,Milk:EH,MilkOff:AH,Minimize:PH,Minimize2:IH,Minus:Y0,Monitor:GS,MonitorCheck:LH,MonitorCog:OH,MonitorDot:DH,MonitorDown:RH,MonitorOff:FH,MonitorPause:zH,MonitorPlay:BH,MonitorSmartphone:$H,MonitorSpeaker:UH,MonitorStop:qH,MonitorUp:VH,MonitorX:HH,Moon:GH,MoonStar:WH,Mountain:ZH,MountainSnow:KH,Mouse:tW,MouseOff:YH,MousePointer:eW,MousePointer2:XH,MousePointerBan:QH,MousePointerClick:JH,Move:pW,Move3d:y2,MoveDiagonal:nW,MoveDiagonal2:rW,MoveDown:aW,MoveDownLeft:sW,MoveDownRight:iW,MoveHorizontal:oW,MoveLeft:lW,MoveRight:cW,MoveUp:hW,MoveUpLeft:dW,MoveUpRight:uW,MoveVertical:fW,Music:xW,Music2:mW,Music3:gW,Music4:yW,Navigation:xT,Navigation2:_W,Navigation2Off:vW,NavigationOff:bW,Network:wW,Newspaper:Ay,Nfc:jW,Notebook:CW,NotebookPen:kW,NotebookTabs:NW,NotebookText:SW,NotepadText:TW,NotepadTextDashed:MW,Nut:EW,NutOff:AW,Octagon:PW,OctagonAlert:x2,OctagonMinus:IW,OctagonPause:v2,OctagonX:_2,Omega:LW,Option:OW,Orbit:DW,Origami:RW,Package:Tl,Package2:FW,PackageCheck:zW,PackageMinus:BW,PackageOpen:$W,PackagePlus:UW,PackageSearch:qW,PackageX:VW,PaintBucket:HW,PaintRoller:WW,Paintbrush:GW,PaintbrushVertical:b2,Palette:Gd,PanelBottom:YW,PanelBottomClose:KW,PanelBottomDashed:w2,PanelBottomOpen:ZW,PanelLeft:S2,PanelLeftClose:j2,PanelLeftDashed:k2,PanelLeftOpen:N2,PanelRight:JW,PanelRightClose:XW,PanelRightDashed:C2,PanelRightOpen:QW,PanelTop:rG,PanelTopClose:eG,PanelTopDashed:M2,PanelTopOpen:tG,PanelsLeftBottom:nG,PanelsRightBottom:sG,PanelsTopLeft:Yx,Paperclip:iG,Parentheses:aG,ParkingMeter:oG,PartyPopper:$h,Pause:zf,PawPrint:lG,PcCase:cG,Pen:Xx,PenLine:T2,PenOff:dG,PenTool:KS,Pencil:ma,PencilLine:uG,PencilOff:hG,PencilRuler:fG,Pentagon:pG,Percent:ZS,PersonStanding:mG,PhilippinePeso:gG,Phone:Wa,PhoneCall:yG,PhoneForwarded:xG,PhoneIncoming:vG,PhoneMissed:_G,PhoneOff:bG,PhoneOutgoing:wG,Pi:jG,Piano:kG,Pickaxe:NG,PictureInPicture:CG,PictureInPicture2:SG,PiggyBank:MG,Pilcrow:EG,PilcrowLeft:TG,PilcrowRight:AG,Pill:PG,PillBottle:IG,Pin:X0,PinOff:vT,Pipette:LG,Pizza:OG,Plane:FG,PlaneLanding:DG,PlaneTakeoff:RG,Play:wc,Plug:BG,Plug2:zG,PlugZap:A2,Plus:Sn,Pocket:UG,PocketKnife:$G,Podcast:qG,Pointer:HG,PointerOff:VG,Popcorn:WG,Popsicle:GG,PoundSterling:KG,Power:YG,PowerOff:ZG,Presentation:XG,Printer:JG,PrinterCheck:QG,Projector:eK,Proportions:tK,Puzzle:rK,Pyramid:nK,QrCode:sK,Quote:iK,Rabbit:aK,Radar:oK,Radiation:lK,Radical:cK,Radio:Hw,RadioReceiver:dK,RadioTower:uK,Radius:hK,RailSymbol:fK,Rainbow:pK,Rat:mK,Ratio:gK,Receipt:NK,ReceiptCent:yK,ReceiptEuro:xK,ReceiptIndianRupee:vK,ReceiptJapaneseYen:_K,ReceiptPoundSterling:bK,ReceiptRussianRuble:wK,ReceiptSwissFranc:jK,ReceiptText:kK,RectangleEllipsis:E2,RectangleHorizontal:SK,RectangleVertical:CK,Recycle:MK,Redo:YS,Redo2:TK,RedoDot:AK,RefreshCcw:IK,RefreshCcwDot:EK,RefreshCw:Dl,RefreshCwOff:PK,Refrigerator:LK,Regex:OK,RemoveFormatting:DK,Repeat:zK,Repeat1:RK,Repeat2:FK,Replace:$K,ReplaceAll:BK,Reply:_T,ReplyAll:UK,Rewind:qK,Ribbon:VK,Rocket:cg,RockingChair:HK,RollerCoaster:WK,Rotate3d:I2,RotateCcw:XS,RotateCcwSquare:GK,RotateCw:bT,RotateCwSquare:KK,Route:YK,RouteOff:ZK,Router:XK,Rows2:P2,Rows3:L2,Rows4:QK,Rss:JK,Ruler:eZ,RussianRuble:tZ,Sailboat:rZ,Salad:nZ,Sandwich:sZ,Satellite:aZ,SatelliteDish:iZ,Save:dg,SaveAll:oZ,SaveOff:lZ,Scale:cZ,Scale3d:O2,Scaling:dZ,Scan:xZ,ScanBarcode:uZ,ScanEye:hZ,ScanFace:fZ,ScanLine:pZ,ScanQrCode:mZ,ScanSearch:gZ,ScanText:yZ,School:vZ,Scissors:bZ,ScissorsLineDashed:_Z,ScreenShare:jZ,ScreenShareOff:wZ,Scroll:NZ,ScrollText:kZ,Search:Ti,SearchCheck:SZ,SearchCode:CZ,SearchSlash:MZ,SearchX:TZ,Section:AZ,Send:To,SendHorizontal:D2,SendToBack:EZ,SeparatorHorizontal:IZ,SeparatorVertical:PZ,Server:RZ,ServerCog:LZ,ServerCrash:OZ,ServerOff:DZ,Settings:id,Settings2:FZ,Shapes:zZ,Share:wT,Share2:Kd,Sheet:BZ,Shell:$Z,Shield:sm,ShieldAlert:UZ,ShieldBan:qZ,ShieldCheck:jT,ShieldEllipsis:VZ,ShieldHalf:HZ,ShieldMinus:WZ,ShieldOff:GZ,ShieldPlus:KZ,ShieldQuestion:ZZ,ShieldX:R2,Ship:XZ,ShipWheel:YZ,Shirt:QZ,ShoppingBag:ug,ShoppingBasket:JZ,ShoppingCart:sh,Shovel:eY,ShowerHead:tY,Shrink:rY,Shrub:nY,Shuffle:sY,Sigma:iY,Signal:dY,SignalHigh:aY,SignalLow:oY,SignalMedium:lY,SignalZero:cY,Signature:uY,Signpost:fY,SignpostBig:hY,Siren:pY,SkipBack:mY,SkipForward:gY,Skull:yY,Slack:xY,Slash:vY,Slice:_Y,SlidersHorizontal:kT,SlidersVertical:F2,Smartphone:Q0,SmartphoneCharging:bY,SmartphoneNfc:wY,Smile:kY,SmilePlus:jY,Snail:NY,Snowflake:SY,Sofa:CY,Soup:MY,Space:TY,Spade:AY,Sparkle:EY,Sparkles:Mi,Speaker:IY,Speech:PY,SpellCheck:OY,SpellCheck2:LY,Spline:DY,Split:RY,SprayCan:FY,Sprout:zY,Square:im,SquareActivity:z2,SquareArrowDown:U2,SquareArrowDownLeft:B2,SquareArrowDownRight:$2,SquareArrowLeft:q2,SquareArrowOutDownLeft:V2,SquareArrowOutDownRight:H2,SquareArrowOutUpLeft:W2,SquareArrowOutUpRight:G2,SquareArrowRight:K2,SquareArrowUp:X2,SquareArrowUpLeft:Z2,SquareArrowUpRight:Y2,SquareAsterisk:Q2,SquareBottomDashedScissors:J2,SquareChartGantt:Bm,SquareCheck:eb,SquareCheckBig:Qx,SquareChevronDown:tb,SquareChevronLeft:rb,SquareChevronRight:nb,SquareChevronUp:sb,SquareCode:ib,SquareDashed:lb,SquareDashedBottom:$Y,SquareDashedBottomCode:BY,SquareDashedKanban:ab,SquareDashedMousePointer:ob,SquareDivide:cb,SquareDot:db,SquareEqual:ub,SquareFunction:hb,SquareKanban:fb,SquareLibrary:pb,SquareM:mb,SquareMenu:gb,SquareMinus:yb,SquareMousePointer:xb,SquareParking:_b,SquareParkingOff:vb,SquarePen:Jl,SquarePercent:bb,SquarePi:wb,SquarePilcrow:jb,SquarePlay:kb,SquarePlus:Nb,SquarePower:Sb,SquareRadical:UY,SquareScissors:Cb,SquareSigma:Mb,SquareSlash:Tb,SquareSplitHorizontal:Ab,SquareSplitVertical:Eb,SquareSquare:qY,SquareStack:VY,SquareTerminal:Ib,SquareUser:Lb,SquareUserRound:Pb,SquareX:Ob,Squircle:HY,Squirrel:WY,Stamp:GY,Star:Ca,StarHalf:KY,StarOff:ZY,StepBack:YY,StepForward:XY,Stethoscope:QY,Sticker:JY,StickyNote:eX,Store:tX,StretchHorizontal:rX,StretchVertical:nX,Strikethrough:sX,Subscript:iX,Sun:Ww,SunDim:aX,SunMedium:oX,SunMoon:lX,SunSnow:cX,Sunrise:dX,Sunset:uX,Superscript:hX,SwatchBook:fX,SwissFranc:pX,SwitchCamera:mX,Sword:gX,Swords:yX,Syringe:xX,Table:NX,Table2:NT,TableCellsMerge:vX,TableCellsSplit:_X,TableColumnsSplit:bX,TableOfContents:wX,TableProperties:jX,TableRowsSplit:kX,Tablet:CX,TabletSmartphone:SX,Tablets:MX,Tag:Gw,Tags:TX,Tally1:AX,Tally2:EX,Tally3:IX,Tally4:PX,Tally5:LX,Tangent:OX,Target:Ey,Telescope:DX,Tent:FX,TentTree:RX,Terminal:zX,TestTube:BX,TestTubeDiagonal:Db,TestTubes:$X,Text:WX,TextCursor:qX,TextCursorInput:UX,TextQuote:VX,TextSearch:HX,TextSelect:Rb,Theater:GX,Thermometer:YX,ThermometerSnowflake:KX,ThermometerSun:ZX,ThumbsDown:ST,ThumbsUp:Zd,Ticket:CT,TicketCheck:XX,TicketMinus:QX,TicketPercent:JX,TicketPlus:eQ,TicketSlash:tQ,TicketX:rQ,Tickets:sQ,TicketsPlane:nQ,Timer:oQ,TimerOff:iQ,TimerReset:aQ,ToggleLeft:lQ,ToggleRight:cQ,Toilet:dQ,Tornado:uQ,Torus:hQ,Touchpad:pQ,TouchpadOff:fQ,TowerControl:mQ,ToyBrick:gQ,Tractor:yQ,TrafficCone:xQ,TrainFront:_Q,TrainFrontTunnel:vQ,TrainTrack:bQ,TramFront:Fb,Trash:wQ,Trash2:Xn,TreeDeciduous:jQ,TreePalm:zb,TreePine:kQ,Trees:NQ,Trello:SQ,TrendingDown:Kw,TrendingUp:Bf,TrendingUpDown:CQ,Triangle:TQ,TriangleAlert:Ph,TriangleRight:MQ,Trophy:qa,Truck:MT,Turtle:AQ,Tv:IQ,TvMinimal:Bb,TvMinimalPlay:EQ,Twitch:PQ,Twitter:LQ,Type:DQ,TypeOutline:OQ,Umbrella:FQ,UmbrellaOff:RQ,Underline:zQ,Undo:QS,Undo2:BQ,UndoDot:$Q,UnfoldHorizontal:UQ,UnfoldVertical:qQ,Ungroup:VQ,University:$b,Unlink:TT,Unlink2:HQ,Unplug:WQ,Upload:Ao,Usb:GQ,User:jc,UserCheck:Zw,UserCog:AT,UserMinus:KQ,UserPen:ZQ,UserPlus:J0,UserRound:Gb,UserRoundCheck:Ub,UserRoundCog:qb,UserRoundMinus:Vb,UserRoundPen:YQ,UserRoundPlus:Hb,UserRoundSearch:XQ,UserRoundX:Wb,UserSearch:QQ,UserX:JQ,Users:hs,UsersRound:Kb,Utensils:Yb,UtensilsCrossed:Zb,UtilityPole:eJ,Variable:ET,Vault:tJ,Vegan:rJ,VenetianMask:nJ,Vibrate:iJ,VibrateOff:sJ,Video:Gi,VideoOff:aJ,Videotape:oJ,View:lJ,Voicemail:cJ,Volleyball:dJ,Volume:mJ,Volume1:uJ,Volume2:hJ,VolumeOff:fJ,VolumeX:pJ,Vote:gJ,Wallet:xJ,WalletCards:yJ,WalletMinimal:Xb,Wallpaper:vJ,Wand:_J,WandSparkles:Qb,Warehouse:bJ,WashingMachine:wJ,Watch:jJ,Waves:kJ,Waypoints:NJ,Webcam:SJ,Webhook:MJ,WebhookOff:CJ,Weight:TJ,Wheat:EJ,WheatOff:AJ,WholeWord:IJ,Wifi:RJ,WifiHigh:PJ,WifiLow:LJ,WifiOff:OJ,WifiZero:DJ,Wind:zJ,WindArrowDown:FJ,Wine:$J,WineOff:BJ,Workflow:UJ,Worm:qJ,WrapText:VJ,Wrench:Iy,X:Ms,Youtube:HJ,Zap:e1,ZapOff:WJ,ZoomIn:JS,ZoomOut:e4},Symbol.toStringTag,{value:"Module"}));/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oAe=Object.freeze(Object.defineProperty({__proto__:null,AArrowDown:YL,AArrowDownIcon:YL,AArrowUp:XL,AArrowUpIcon:XL,ALargeSmall:QL,ALargeSmallIcon:QL,Accessibility:JL,AccessibilityIcon:JL,Activity:ig,ActivityIcon:ig,ActivitySquare:z2,ActivitySquareIcon:z2,AirVent:eO,AirVentIcon:eO,Airplay:tO,AirplayIcon:tO,AlarmCheck:Bv,AlarmCheckIcon:Bv,AlarmClock:nO,AlarmClockCheck:Bv,AlarmClockCheckIcon:Bv,AlarmClockIcon:nO,AlarmClockMinus:$v,AlarmClockMinusIcon:$v,AlarmClockOff:rO,AlarmClockOffIcon:rO,AlarmClockPlus:Uv,AlarmClockPlusIcon:Uv,AlarmMinus:$v,AlarmMinusIcon:$v,AlarmPlus:Uv,AlarmPlusIcon:Uv,AlarmSmoke:sO,AlarmSmokeIcon:sO,Album:iO,AlbumIcon:iO,AlertCircle:Bl,AlertCircleIcon:Bl,AlertOctagon:x2,AlertOctagonIcon:x2,AlertTriangle:Ph,AlertTriangleIcon:Ph,AlignCenter:MS,AlignCenterHorizontal:aO,AlignCenterHorizontalIcon:aO,AlignCenterIcon:MS,AlignCenterVertical:oO,AlignCenterVerticalIcon:oO,AlignEndHorizontal:lO,AlignEndHorizontalIcon:lO,AlignEndVertical:cO,AlignEndVerticalIcon:cO,AlignHorizontalDistributeCenter:dO,AlignHorizontalDistributeCenterIcon:dO,AlignHorizontalDistributeEnd:uO,AlignHorizontalDistributeEndIcon:uO,AlignHorizontalDistributeStart:hO,AlignHorizontalDistributeStartIcon:hO,AlignHorizontalJustifyCenter:fO,AlignHorizontalJustifyCenterIcon:fO,AlignHorizontalJustifyEnd:pO,AlignHorizontalJustifyEndIcon:pO,AlignHorizontalJustifyStart:mO,AlignHorizontalJustifyStartIcon:mO,AlignHorizontalSpaceAround:gO,AlignHorizontalSpaceAroundIcon:gO,AlignHorizontalSpaceBetween:yO,AlignHorizontalSpaceBetweenIcon:yO,AlignJustify:xO,AlignJustifyIcon:xO,AlignLeft:TS,AlignLeftIcon:TS,AlignRight:AS,AlignRightIcon:AS,AlignStartHorizontal:vO,AlignStartHorizontalIcon:vO,AlignStartVertical:_O,AlignStartVerticalIcon:_O,AlignVerticalDistributeCenter:bO,AlignVerticalDistributeCenterIcon:bO,AlignVerticalDistributeEnd:wO,AlignVerticalDistributeEndIcon:wO,AlignVerticalDistributeStart:jO,AlignVerticalDistributeStartIcon:jO,AlignVerticalJustifyCenter:kO,AlignVerticalJustifyCenterIcon:kO,AlignVerticalJustifyEnd:NO,AlignVerticalJustifyEndIcon:NO,AlignVerticalJustifyStart:SO,AlignVerticalJustifyStartIcon:SO,AlignVerticalSpaceAround:CO,AlignVerticalSpaceAroundIcon:CO,AlignVerticalSpaceBetween:MO,AlignVerticalSpaceBetweenIcon:MO,Ambulance:TO,AmbulanceIcon:TO,Ampersand:AO,AmpersandIcon:AO,Ampersands:EO,AmpersandsIcon:EO,Amphora:IO,AmphoraIcon:IO,Anchor:PO,AnchorIcon:PO,Angry:LO,AngryIcon:LO,Annoyed:OO,AnnoyedIcon:OO,Antenna:DO,AntennaIcon:DO,Anvil:RO,AnvilIcon:RO,Aperture:FO,ApertureIcon:FO,AppWindow:sT,AppWindowIcon:sT,AppWindowMac:zO,AppWindowMacIcon:zO,Apple:BO,AppleIcon:BO,Archive:qO,ArchiveIcon:qO,ArchiveRestore:$O,ArchiveRestoreIcon:$O,ArchiveX:UO,ArchiveXIcon:UO,AreaChart:r_,AreaChartIcon:r_,Armchair:VO,ArmchairIcon:VO,ArrowBigDown:WO,ArrowBigDownDash:HO,ArrowBigDownDashIcon:HO,ArrowBigDownIcon:WO,ArrowBigLeft:KO,ArrowBigLeftDash:GO,ArrowBigLeftDashIcon:GO,ArrowBigLeftIcon:KO,ArrowBigRight:YO,ArrowBigRightDash:ZO,ArrowBigRightDashIcon:ZO,ArrowBigRightIcon:YO,ArrowBigUp:QO,ArrowBigUpDash:XO,ArrowBigUpDashIcon:XO,ArrowBigUpIcon:QO,ArrowDown:ES,ArrowDown01:JO,ArrowDown01Icon:JO,ArrowDown10:eD,ArrowDown10Icon:eD,ArrowDownAZ:qv,ArrowDownAZIcon:qv,ArrowDownAz:qv,ArrowDownAzIcon:qv,ArrowDownCircle:p_,ArrowDownCircleIcon:p_,ArrowDownFromLine:tD,ArrowDownFromLineIcon:tD,ArrowDownIcon:ES,ArrowDownLeft:rD,ArrowDownLeftFromCircle:g_,ArrowDownLeftFromCircleIcon:g_,ArrowDownLeftFromSquare:V2,ArrowDownLeftFromSquareIcon:V2,ArrowDownLeftIcon:rD,ArrowDownLeftSquare:B2,ArrowDownLeftSquareIcon:B2,ArrowDownNarrowWide:nD,ArrowDownNarrowWideIcon:nD,ArrowDownRight:sD,ArrowDownRightFromCircle:y_,ArrowDownRightFromCircleIcon:y_,ArrowDownRightFromSquare:H2,ArrowDownRightFromSquareIcon:H2,ArrowDownRightIcon:sD,ArrowDownRightSquare:$2,ArrowDownRightSquareIcon:$2,ArrowDownSquare:U2,ArrowDownSquareIcon:U2,ArrowDownToDot:iD,ArrowDownToDotIcon:iD,ArrowDownToLine:aD,ArrowDownToLineIcon:aD,ArrowDownUp:oD,ArrowDownUpIcon:oD,ArrowDownWideNarrow:Vv,ArrowDownWideNarrowIcon:Vv,ArrowDownZA:Hv,ArrowDownZAIcon:Hv,ArrowDownZa:Hv,ArrowDownZaIcon:Hv,ArrowLeft:Va,ArrowLeftCircle:m_,ArrowLeftCircleIcon:m_,ArrowLeftFromLine:lD,ArrowLeftFromLineIcon:lD,ArrowLeftIcon:Va,ArrowLeftRight:cD,ArrowLeftRightIcon:cD,ArrowLeftSquare:q2,ArrowLeftSquareIcon:q2,ArrowLeftToLine:dD,ArrowLeftToLineIcon:dD,ArrowRight:Ho,ArrowRightCircle:__,ArrowRightCircleIcon:__,ArrowRightFromLine:uD,ArrowRightFromLineIcon:uD,ArrowRightIcon:Ho,ArrowRightLeft:hD,ArrowRightLeftIcon:hD,ArrowRightSquare:K2,ArrowRightSquareIcon:K2,ArrowRightToLine:fD,ArrowRightToLineIcon:fD,ArrowUp:$0,ArrowUp01:pD,ArrowUp01Icon:pD,ArrowUp10:mD,ArrowUp10Icon:mD,ArrowUpAZ:Wv,ArrowUpAZIcon:Wv,ArrowUpAz:Wv,ArrowUpAzIcon:Wv,ArrowUpCircle:b_,ArrowUpCircleIcon:b_,ArrowUpDown:B0,ArrowUpDownIcon:B0,ArrowUpFromDot:gD,ArrowUpFromDotIcon:gD,ArrowUpFromLine:yD,ArrowUpFromLineIcon:yD,ArrowUpIcon:$0,ArrowUpLeft:xD,ArrowUpLeftFromCircle:x_,ArrowUpLeftFromCircleIcon:x_,ArrowUpLeftFromSquare:W2,ArrowUpLeftFromSquareIcon:W2,ArrowUpLeftIcon:xD,ArrowUpLeftSquare:Z2,ArrowUpLeftSquareIcon:Z2,ArrowUpNarrowWide:Gv,ArrowUpNarrowWideIcon:Gv,ArrowUpRight:vD,ArrowUpRightFromCircle:v_,ArrowUpRightFromCircleIcon:v_,ArrowUpRightFromSquare:G2,ArrowUpRightFromSquareIcon:G2,ArrowUpRightIcon:vD,ArrowUpRightSquare:Y2,ArrowUpRightSquareIcon:Y2,ArrowUpSquare:X2,ArrowUpSquareIcon:X2,ArrowUpToLine:_D,ArrowUpToLineIcon:_D,ArrowUpWideNarrow:bD,ArrowUpWideNarrowIcon:bD,ArrowUpZA:Kv,ArrowUpZAIcon:Kv,ArrowUpZa:Kv,ArrowUpZaIcon:Kv,ArrowsUpFromLine:wD,ArrowsUpFromLineIcon:wD,Asterisk:jD,AsteriskIcon:jD,AsteriskSquare:Q2,AsteriskSquareIcon:Q2,AtSign:kD,AtSignIcon:kD,Atom:ND,AtomIcon:ND,AudioLines:SD,AudioLinesIcon:SD,AudioWaveform:CD,AudioWaveformIcon:CD,Award:Cu,AwardIcon:Cu,Axe:MD,AxeIcon:MD,Axis3D:Zv,Axis3DIcon:Zv,Axis3d:Zv,Axis3dIcon:Zv,Baby:TD,BabyIcon:TD,Backpack:AD,BackpackIcon:AD,Badge:WD,BadgeAlert:ED,BadgeAlertIcon:ED,BadgeCent:ID,BadgeCentIcon:ID,BadgeCheck:Yv,BadgeCheckIcon:Yv,BadgeDollarSign:PD,BadgeDollarSignIcon:PD,BadgeEuro:LD,BadgeEuroIcon:LD,BadgeHelp:OD,BadgeHelpIcon:OD,BadgeIcon:WD,BadgeIndianRupee:DD,BadgeIndianRupeeIcon:DD,BadgeInfo:RD,BadgeInfoIcon:RD,BadgeJapaneseYen:FD,BadgeJapaneseYenIcon:FD,BadgeMinus:zD,BadgeMinusIcon:zD,BadgePercent:BD,BadgePercentIcon:BD,BadgePlus:$D,BadgePlusIcon:$D,BadgePoundSterling:UD,BadgePoundSterlingIcon:UD,BadgeRussianRuble:qD,BadgeRussianRubleIcon:qD,BadgeSwissFranc:VD,BadgeSwissFrancIcon:VD,BadgeX:HD,BadgeXIcon:HD,BaggageClaim:GD,BaggageClaimIcon:GD,Ban:KD,BanIcon:KD,Banana:ZD,BananaIcon:ZD,Bandage:YD,BandageIcon:YD,Banknote:XD,BanknoteIcon:XD,BarChart:c_,BarChart2:d_,BarChart2Icon:d_,BarChart3:xc,BarChart3Icon:xc,BarChart4:o_,BarChart4Icon:o_,BarChartBig:a_,BarChartBigIcon:a_,BarChartHorizontal:s_,BarChartHorizontalBig:n_,BarChartHorizontalBigIcon:n_,BarChartHorizontalIcon:s_,BarChartIcon:c_,Barcode:QD,BarcodeIcon:QD,Baseline:JD,BaselineIcon:JD,Bath:Lf,BathIcon:Lf,Battery:i8,BatteryCharging:e8,BatteryChargingIcon:e8,BatteryFull:t8,BatteryFullIcon:t8,BatteryIcon:i8,BatteryLow:r8,BatteryLowIcon:r8,BatteryMedium:n8,BatteryMediumIcon:n8,BatteryWarning:s8,BatteryWarningIcon:s8,Beaker:a8,BeakerIcon:a8,Bean:l8,BeanIcon:l8,BeanOff:o8,BeanOffIcon:o8,Bed:Of,BedDouble:c8,BedDoubleIcon:c8,BedIcon:Of,BedSingle:d8,BedSingleIcon:d8,Beef:u8,BeefIcon:u8,Beer:f8,BeerIcon:f8,BeerOff:h8,BeerOffIcon:h8,Bell:ag,BellDot:p8,BellDotIcon:p8,BellElectric:m8,BellElectricIcon:m8,BellIcon:ag,BellMinus:g8,BellMinusIcon:g8,BellOff:Ow,BellOffIcon:Ow,BellPlus:y8,BellPlusIcon:y8,BellRing:x8,BellRingIcon:x8,BetweenHorizonalEnd:Xv,BetweenHorizonalEndIcon:Xv,BetweenHorizonalStart:Qv,BetweenHorizonalStartIcon:Qv,BetweenHorizontalEnd:Xv,BetweenHorizontalEndIcon:Xv,BetweenHorizontalStart:Qv,BetweenHorizontalStartIcon:Qv,BetweenVerticalEnd:v8,BetweenVerticalEndIcon:v8,BetweenVerticalStart:_8,BetweenVerticalStartIcon:_8,BicepsFlexed:b8,BicepsFlexedIcon:b8,Bike:w8,BikeIcon:w8,Binary:j8,BinaryIcon:j8,Binoculars:k8,BinocularsIcon:k8,Biohazard:N8,BiohazardIcon:N8,Bird:S8,BirdIcon:S8,Bitcoin:C8,BitcoinIcon:C8,Blend:M8,BlendIcon:M8,Blinds:T8,BlindsIcon:T8,Blocks:A8,BlocksIcon:A8,Bluetooth:L8,BluetoothConnected:E8,BluetoothConnectedIcon:E8,BluetoothIcon:L8,BluetoothOff:I8,BluetoothOffIcon:I8,BluetoothSearching:P8,BluetoothSearchingIcon:P8,Bold:IS,BoldIcon:IS,Bolt:O8,BoltIcon:O8,Bomb:D8,BombIcon:D8,Bone:R8,BoneIcon:R8,Book:iR,BookA:F8,BookAIcon:F8,BookAudio:z8,BookAudioIcon:z8,BookCheck:B8,BookCheckIcon:B8,BookCopy:$8,BookCopyIcon:$8,BookDashed:Jv,BookDashedIcon:Jv,BookDown:U8,BookDownIcon:U8,BookHeadphones:q8,BookHeadphonesIcon:q8,BookHeart:V8,BookHeartIcon:V8,BookIcon:iR,BookImage:H8,BookImageIcon:H8,BookKey:W8,BookKeyIcon:W8,BookLock:G8,BookLockIcon:G8,BookMarked:K8,BookMarkedIcon:K8,BookMinus:Z8,BookMinusIcon:Z8,BookOpen:iT,BookOpenCheck:Y8,BookOpenCheckIcon:Y8,BookOpenIcon:iT,BookOpenText:X8,BookOpenTextIcon:X8,BookPlus:Q8,BookPlusIcon:Q8,BookTemplate:Jv,BookTemplateIcon:Jv,BookText:J8,BookTextIcon:J8,BookType:eR,BookTypeIcon:eR,BookUp:rR,BookUp2:tR,BookUp2Icon:tR,BookUpIcon:rR,BookUser:nR,BookUserIcon:nR,BookX:sR,BookXIcon:sR,Bookmark:Jp,BookmarkCheck:aR,BookmarkCheckIcon:aR,BookmarkIcon:Jp,BookmarkMinus:oR,BookmarkMinusIcon:oR,BookmarkPlus:lR,BookmarkPlusIcon:lR,BookmarkX:cR,BookmarkXIcon:cR,BoomBox:dR,BoomBoxIcon:dR,Bot:PS,BotIcon:PS,BotMessageSquare:uR,BotMessageSquareIcon:uR,BotOff:hR,BotOffIcon:hR,Box:fR,BoxIcon:fR,BoxSelect:lb,BoxSelectIcon:lb,Boxes:pR,BoxesIcon:pR,Braces:e_,BracesIcon:e_,Brackets:mR,BracketsIcon:mR,Brain:xR,BrainCircuit:gR,BrainCircuitIcon:gR,BrainCog:yR,BrainCogIcon:yR,BrainIcon:xR,BrickWall:vR,BrickWallIcon:vR,Briefcase:dh,BriefcaseBusiness:_R,BriefcaseBusinessIcon:_R,BriefcaseConveyorBelt:bR,BriefcaseConveyorBeltIcon:bR,BriefcaseIcon:dh,BriefcaseMedical:wR,BriefcaseMedicalIcon:wR,BringToFront:jR,BringToFrontIcon:jR,Brush:kR,BrushIcon:kR,Bug:CR,BugIcon:CR,BugOff:NR,BugOffIcon:NR,BugPlay:SR,BugPlayIcon:SR,Building:LS,Building2:ra,Building2Icon:ra,BuildingIcon:LS,Bus:TR,BusFront:MR,BusFrontIcon:MR,BusIcon:TR,Cable:ER,CableCar:AR,CableCarIcon:AR,CableIcon:ER,Cake:og,CakeIcon:og,CakeSlice:IR,CakeSliceIcon:IR,Calculator:PR,CalculatorIcon:PR,Calendar:li,Calendar1:LR,Calendar1Icon:LR,CalendarArrowDown:OR,CalendarArrowDownIcon:OR,CalendarArrowUp:DR,CalendarArrowUpIcon:DR,CalendarCheck:FR,CalendarCheck2:RR,CalendarCheck2Icon:RR,CalendarCheckIcon:FR,CalendarClock:zR,CalendarClockIcon:zR,CalendarCog:BR,CalendarCogIcon:BR,CalendarDays:em,CalendarDaysIcon:em,CalendarFold:$R,CalendarFoldIcon:$R,CalendarHeart:UR,CalendarHeartIcon:UR,CalendarIcon:li,CalendarMinus:VR,CalendarMinus2:qR,CalendarMinus2Icon:qR,CalendarMinusIcon:VR,CalendarOff:HR,CalendarOffIcon:HR,CalendarPlus:Dw,CalendarPlus2:WR,CalendarPlus2Icon:WR,CalendarPlusIcon:Dw,CalendarRange:GR,CalendarRangeIcon:GR,CalendarSearch:KR,CalendarSearchIcon:KR,CalendarSync:ZR,CalendarSyncIcon:ZR,CalendarX:XR,CalendarX2:YR,CalendarX2Icon:YR,CalendarXIcon:XR,Camera:Rw,CameraIcon:Rw,CameraOff:QR,CameraOffIcon:QR,CandlestickChart:i_,CandlestickChartIcon:i_,Candy:tF,CandyCane:JR,CandyCaneIcon:JR,CandyIcon:tF,CandyOff:eF,CandyOffIcon:eF,Cannabis:rF,CannabisIcon:rF,Captions:t_,CaptionsIcon:t_,CaptionsOff:nF,CaptionsOffIcon:nF,Car:aF,CarFront:sF,CarFrontIcon:sF,CarIcon:aF,CarTaxiFront:iF,CarTaxiFrontIcon:iF,Caravan:oF,CaravanIcon:oF,Carrot:lF,CarrotIcon:lF,CaseLower:cF,CaseLowerIcon:cF,CaseSensitive:dF,CaseSensitiveIcon:dF,CaseUpper:uF,CaseUpperIcon:uF,CassetteTape:hF,CassetteTapeIcon:hF,Cast:fF,CastIcon:fF,Castle:pF,CastleIcon:pF,Cat:mF,CatIcon:mF,Cctv:gF,CctvIcon:gF,ChartArea:r_,ChartAreaIcon:r_,ChartBar:s_,ChartBarBig:n_,ChartBarBigIcon:n_,ChartBarDecreasing:yF,ChartBarDecreasingIcon:yF,ChartBarIcon:s_,ChartBarIncreasing:xF,ChartBarIncreasingIcon:xF,ChartBarStacked:vF,ChartBarStackedIcon:vF,ChartCandlestick:i_,ChartCandlestickIcon:i_,ChartColumn:xc,ChartColumnBig:a_,ChartColumnBigIcon:a_,ChartColumnDecreasing:_F,ChartColumnDecreasingIcon:_F,ChartColumnIcon:xc,ChartColumnIncreasing:o_,ChartColumnIncreasingIcon:o_,ChartColumnStacked:bF,ChartColumnStackedIcon:bF,ChartGantt:wF,ChartGanttIcon:wF,ChartLine:l_,ChartLineIcon:l_,ChartNetwork:jF,ChartNetworkIcon:jF,ChartNoAxesColumn:d_,ChartNoAxesColumnDecreasing:kF,ChartNoAxesColumnDecreasingIcon:kF,ChartNoAxesColumnIcon:d_,ChartNoAxesColumnIncreasing:c_,ChartNoAxesColumnIncreasingIcon:c_,ChartNoAxesCombined:NF,ChartNoAxesCombinedIcon:NF,ChartNoAxesGantt:u_,ChartNoAxesGanttIcon:u_,ChartPie:h_,ChartPieIcon:h_,ChartScatter:f_,ChartScatterIcon:f_,ChartSpline:SF,ChartSplineIcon:SF,Check:Ba,CheckCheck:CF,CheckCheckIcon:CF,CheckCircle:za,CheckCircle2:io,CheckCircle2Icon:io,CheckCircleIcon:za,CheckIcon:Ba,CheckSquare:Qx,CheckSquare2:eb,CheckSquare2Icon:eb,CheckSquareIcon:Qx,ChefHat:MF,ChefHatIcon:MF,Cherry:TF,CherryIcon:TF,ChevronDown:uh,ChevronDownCircle:w_,ChevronDownCircleIcon:w_,ChevronDownIcon:uh,ChevronDownSquare:tb,ChevronDownSquareIcon:tb,ChevronFirst:AF,ChevronFirstIcon:AF,ChevronLast:EF,ChevronLastIcon:EF,ChevronLeft:sd,ChevronLeftCircle:j_,ChevronLeftCircleIcon:j_,ChevronLeftIcon:sd,ChevronLeftSquare:rb,ChevronLeftSquareIcon:rb,ChevronRight:Ha,ChevronRightCircle:k_,ChevronRightCircleIcon:k_,ChevronRightIcon:Ha,ChevronRightSquare:nb,ChevronRightSquareIcon:nb,ChevronUp:U0,ChevronUpCircle:N_,ChevronUpCircleIcon:N_,ChevronUpIcon:U0,ChevronUpSquare:sb,ChevronUpSquareIcon:sb,ChevronsDown:PF,ChevronsDownIcon:PF,ChevronsDownUp:IF,ChevronsDownUpIcon:IF,ChevronsLeft:DF,ChevronsLeftIcon:DF,ChevronsLeftRight:OF,ChevronsLeftRightEllipsis:LF,ChevronsLeftRightEllipsisIcon:LF,ChevronsLeftRightIcon:OF,ChevronsRight:FF,ChevronsRightIcon:FF,ChevronsRightLeft:RF,ChevronsRightLeftIcon:RF,ChevronsUp:zF,ChevronsUpDown:Fw,ChevronsUpDownIcon:Fw,ChevronsUpIcon:zF,Chrome:BF,ChromeIcon:BF,Church:$F,ChurchIcon:$F,Cigarette:qF,CigaretteIcon:qF,CigaretteOff:UF,CigaretteOffIcon:UF,Circle:Mu,CircleAlert:Bl,CircleAlertIcon:Bl,CircleArrowDown:p_,CircleArrowDownIcon:p_,CircleArrowLeft:m_,CircleArrowLeftIcon:m_,CircleArrowOutDownLeft:g_,CircleArrowOutDownLeftIcon:g_,CircleArrowOutDownRight:y_,CircleArrowOutDownRightIcon:y_,CircleArrowOutUpLeft:x_,CircleArrowOutUpLeftIcon:x_,CircleArrowOutUpRight:v_,CircleArrowOutUpRightIcon:v_,CircleArrowRight:__,CircleArrowRightIcon:__,CircleArrowUp:b_,CircleArrowUpIcon:b_,CircleCheck:io,CircleCheckBig:za,CircleCheckBigIcon:za,CircleCheckIcon:io,CircleChevronDown:w_,CircleChevronDownIcon:w_,CircleChevronLeft:j_,CircleChevronLeftIcon:j_,CircleChevronRight:k_,CircleChevronRightIcon:k_,CircleChevronUp:N_,CircleChevronUpIcon:N_,CircleDashed:VF,CircleDashedIcon:VF,CircleDivide:S_,CircleDivideIcon:S_,CircleDollarSign:HF,CircleDollarSignIcon:HF,CircleDot:GF,CircleDotDashed:WF,CircleDotDashedIcon:WF,CircleDotIcon:GF,CircleEllipsis:KF,CircleEllipsisIcon:KF,CircleEqual:ZF,CircleEqualIcon:ZF,CircleFadingArrowUp:YF,CircleFadingArrowUpIcon:YF,CircleFadingPlus:XF,CircleFadingPlusIcon:XF,CircleGauge:C_,CircleGaugeIcon:C_,CircleHelp:my,CircleHelpIcon:my,CircleIcon:Mu,CircleMinus:M_,CircleMinusIcon:M_,CircleOff:QF,CircleOffIcon:QF,CircleParking:A_,CircleParkingIcon:A_,CircleParkingOff:T_,CircleParkingOffIcon:T_,CirclePause:E_,CirclePauseIcon:E_,CirclePercent:I_,CirclePercentIcon:I_,CirclePlay:Sf,CirclePlayIcon:Sf,CirclePlus:P_,CirclePlusIcon:P_,CirclePower:L_,CirclePowerIcon:L_,CircleSlash:JF,CircleSlash2:O_,CircleSlash2Icon:O_,CircleSlashIcon:JF,CircleSlashed:O_,CircleSlashedIcon:O_,CircleStop:D_,CircleStopIcon:D_,CircleUser:F_,CircleUserIcon:F_,CircleUserRound:R_,CircleUserRoundIcon:R_,CircleX:Lc,CircleXIcon:Lc,CircuitBoard:ez,CircuitBoardIcon:ez,Citrus:tz,CitrusIcon:tz,Clapperboard:rz,ClapperboardIcon:rz,Clipboard:dz,ClipboardCheck:aT,ClipboardCheckIcon:aT,ClipboardCopy:nz,ClipboardCopyIcon:nz,ClipboardEdit:B_,ClipboardEditIcon:B_,ClipboardIcon:dz,ClipboardList:sz,ClipboardListIcon:sz,ClipboardMinus:iz,ClipboardMinusIcon:iz,ClipboardPaste:az,ClipboardPasteIcon:az,ClipboardPen:B_,ClipboardPenIcon:B_,ClipboardPenLine:z_,ClipboardPenLineIcon:z_,ClipboardPlus:oz,ClipboardPlusIcon:oz,ClipboardSignature:z_,ClipboardSignatureIcon:z_,ClipboardType:lz,ClipboardTypeIcon:lz,ClipboardX:cz,ClipboardXIcon:cz,Clock:Xi,Clock1:uz,Clock10:hz,Clock10Icon:hz,Clock11:fz,Clock11Icon:fz,Clock12:pz,Clock12Icon:pz,Clock1Icon:uz,Clock2:mz,Clock2Icon:mz,Clock3:gz,Clock3Icon:gz,Clock4:yz,Clock4Icon:yz,Clock5:xz,Clock5Icon:xz,Clock6:vz,Clock6Icon:vz,Clock7:_z,Clock7Icon:_z,Clock8:bz,Clock8Icon:bz,Clock9:wz,Clock9Icon:wz,ClockAlert:jz,ClockAlertIcon:jz,ClockArrowDown:kz,ClockArrowDownIcon:kz,ClockArrowUp:Nz,ClockArrowUpIcon:Nz,ClockIcon:Xi,Cloud:Bz,CloudAlert:Sz,CloudAlertIcon:Sz,CloudCog:Cz,CloudCogIcon:Cz,CloudDownload:$_,CloudDownloadIcon:$_,CloudDrizzle:Mz,CloudDrizzleIcon:Mz,CloudFog:Tz,CloudFogIcon:Tz,CloudHail:Az,CloudHailIcon:Az,CloudIcon:Bz,CloudLightning:Ez,CloudLightningIcon:Ez,CloudMoon:Pz,CloudMoonIcon:Pz,CloudMoonRain:Iz,CloudMoonRainIcon:Iz,CloudOff:Lz,CloudOffIcon:Lz,CloudRain:Dz,CloudRainIcon:Dz,CloudRainWind:Oz,CloudRainWindIcon:Oz,CloudSnow:Rz,CloudSnowIcon:Rz,CloudSun:zz,CloudSunIcon:zz,CloudSunRain:Fz,CloudSunRainIcon:Fz,CloudUpload:U_,CloudUploadIcon:U_,Cloudy:$z,CloudyIcon:$z,Clover:Uz,CloverIcon:Uz,Club:qz,ClubIcon:qz,Code:zw,Code2:q_,Code2Icon:q_,CodeIcon:zw,CodeSquare:ib,CodeSquareIcon:ib,CodeXml:q_,CodeXmlIcon:q_,Codepen:Vz,CodepenIcon:Vz,Codesandbox:Hz,CodesandboxIcon:Hz,Coffee:Wz,CoffeeIcon:Wz,Cog:Gz,CogIcon:Gz,Coins:Kz,CoinsIcon:Kz,Columns:V_,Columns2:V_,Columns2Icon:V_,Columns3:H_,Columns3Icon:H_,Columns4:Zz,Columns4Icon:Zz,ColumnsIcon:V_,Combine:Yz,CombineIcon:Yz,Command:Xz,CommandIcon:Xz,Compass:Qz,CompassIcon:Qz,Component:Jz,ComponentIcon:Jz,Computer:e7,ComputerIcon:e7,ConciergeBell:t7,ConciergeBellIcon:t7,Cone:r7,ConeIcon:r7,Construction:n7,ConstructionIcon:n7,Contact:s7,Contact2:W_,Contact2Icon:W_,ContactIcon:s7,ContactRound:W_,ContactRoundIcon:W_,Container:i7,ContainerIcon:i7,Contrast:a7,ContrastIcon:a7,Cookie:o7,CookieIcon:o7,CookingPot:l7,CookingPotIcon:l7,Copy:Ul,CopyCheck:c7,CopyCheckIcon:c7,CopyIcon:Ul,CopyMinus:d7,CopyMinusIcon:d7,CopyPlus:u7,CopyPlusIcon:u7,CopySlash:h7,CopySlashIcon:h7,CopyX:f7,CopyXIcon:f7,Copyleft:p7,CopyleftIcon:p7,Copyright:m7,CopyrightIcon:m7,CornerDownLeft:g7,CornerDownLeftIcon:g7,CornerDownRight:y7,CornerDownRightIcon:y7,CornerLeftDown:x7,CornerLeftDownIcon:x7,CornerLeftUp:v7,CornerLeftUpIcon:v7,CornerRightDown:_7,CornerRightDownIcon:_7,CornerRightUp:b7,CornerRightUpIcon:b7,CornerUpLeft:w7,CornerUpLeftIcon:w7,CornerUpRight:j7,CornerUpRightIcon:j7,Cpu:k7,CpuIcon:k7,CreativeCommons:N7,CreativeCommonsIcon:N7,CreditCard:q0,CreditCardIcon:q0,Croissant:S7,CroissantIcon:S7,Crop:C7,CropIcon:C7,Cross:M7,CrossIcon:M7,Crosshair:T7,CrosshairIcon:T7,Crown:Bw,CrownIcon:Bw,Cuboid:A7,CuboidIcon:A7,CupSoda:E7,CupSodaIcon:E7,CurlyBraces:e_,CurlyBracesIcon:e_,Currency:I7,CurrencyIcon:I7,Cylinder:P7,CylinderIcon:P7,Dam:L7,DamIcon:L7,Database:R7,DatabaseBackup:O7,DatabaseBackupIcon:O7,DatabaseIcon:R7,DatabaseZap:D7,DatabaseZapIcon:D7,Delete:F7,DeleteIcon:F7,Dessert:z7,DessertIcon:z7,Diameter:B7,DiameterIcon:B7,Diamond:q7,DiamondIcon:q7,DiamondMinus:$7,DiamondMinusIcon:$7,DiamondPercent:G_,DiamondPercentIcon:G_,DiamondPlus:U7,DiamondPlusIcon:U7,Dice1:V7,Dice1Icon:V7,Dice2:H7,Dice2Icon:H7,Dice3:W7,Dice3Icon:W7,Dice4:G7,Dice4Icon:G7,Dice5:K7,Dice5Icon:K7,Dice6:Z7,Dice6Icon:Z7,Dices:Y7,DicesIcon:Y7,Diff:X7,DiffIcon:X7,Disc:tB,Disc2:Q7,Disc2Icon:Q7,Disc3:J7,Disc3Icon:J7,DiscAlbum:eB,DiscAlbumIcon:eB,DiscIcon:tB,Divide:rB,DivideCircle:S_,DivideCircleIcon:S_,DivideIcon:rB,DivideSquare:cb,DivideSquareIcon:cb,Dna:sB,DnaIcon:sB,DnaOff:nB,DnaOffIcon:nB,Dock:iB,DockIcon:iB,Dog:aB,DogIcon:aB,DollarSign:Cd,DollarSignIcon:Cd,Donut:oB,DonutIcon:oB,DoorClosed:lB,DoorClosedIcon:lB,DoorOpen:oT,DoorOpenIcon:oT,Dot:cB,DotIcon:cB,DotSquare:db,DotSquareIcon:db,Download:Mo,DownloadCloud:$_,DownloadCloudIcon:$_,DownloadIcon:Mo,DraftingCompass:dB,DraftingCompassIcon:dB,Drama:uB,DramaIcon:uB,Dribbble:hB,DribbbleIcon:hB,Drill:fB,DrillIcon:fB,Droplet:pB,DropletIcon:pB,Droplets:mB,DropletsIcon:mB,Drum:gB,DrumIcon:gB,Drumstick:yB,DrumstickIcon:yB,Dumbbell:xB,DumbbellIcon:xB,Ear:_B,EarIcon:_B,EarOff:vB,EarOffIcon:vB,Earth:K_,EarthIcon:K_,EarthLock:bB,EarthLockIcon:bB,Eclipse:wB,EclipseIcon:wB,Edit:Jl,Edit2:Xx,Edit2Icon:Xx,Edit3:T2,Edit3Icon:T2,EditIcon:Jl,Egg:NB,EggFried:jB,EggFriedIcon:jB,EggIcon:NB,EggOff:kB,EggOffIcon:kB,Ellipsis:Zm,EllipsisIcon:Zm,EllipsisVertical:gy,EllipsisVerticalIcon:gy,Equal:MB,EqualApproximately:SB,EqualApproximatelyIcon:SB,EqualIcon:MB,EqualNot:CB,EqualNotIcon:CB,EqualSquare:ub,EqualSquareIcon:ub,Eraser:TB,EraserIcon:TB,EthernetPort:AB,EthernetPortIcon:AB,Euro:EB,EuroIcon:EB,Expand:IB,ExpandIcon:IB,ExternalLink:Fs,ExternalLinkIcon:Fs,Eye:Ml,EyeClosed:PB,EyeClosedIcon:PB,EyeIcon:Ml,EyeOff:$w,EyeOffIcon:$w,Facebook:Md,FacebookIcon:Md,Factory:LB,FactoryIcon:LB,Fan:OB,FanIcon:OB,FastForward:DB,FastForwardIcon:DB,Feather:RB,FeatherIcon:RB,Fence:FB,FenceIcon:FB,FerrisWheel:zB,FerrisWheelIcon:zB,Figma:BB,FigmaIcon:BB,File:L9,FileArchive:$B,FileArchiveIcon:$B,FileAudio:qB,FileAudio2:UB,FileAudio2Icon:UB,FileAudioIcon:qB,FileAxis3D:Z_,FileAxis3DIcon:Z_,FileAxis3d:Z_,FileAxis3dIcon:Z_,FileBadge:HB,FileBadge2:VB,FileBadge2Icon:VB,FileBadgeIcon:HB,FileBarChart:Y_,FileBarChart2:X_,FileBarChart2Icon:X_,FileBarChartIcon:Y_,FileBox:WB,FileBoxIcon:WB,FileChartColumn:X_,FileChartColumnIcon:X_,FileChartColumnIncreasing:Y_,FileChartColumnIncreasingIcon:Y_,FileChartLine:Q_,FileChartLineIcon:Q_,FileChartPie:J_,FileChartPieIcon:J_,FileCheck:KB,FileCheck2:GB,FileCheck2Icon:GB,FileCheckIcon:KB,FileClock:ZB,FileClockIcon:ZB,FileCode:XB,FileCode2:YB,FileCode2Icon:YB,FileCodeIcon:XB,FileCog:e2,FileCog2:e2,FileCog2Icon:e2,FileCogIcon:e2,FileDiff:QB,FileDiffIcon:QB,FileDigit:JB,FileDigitIcon:JB,FileDown:e9,FileDownIcon:e9,FileEdit:r2,FileEditIcon:r2,FileHeart:t9,FileHeartIcon:t9,FileIcon:L9,FileImage:V0,FileImageIcon:V0,FileInput:r9,FileInputIcon:r9,FileJson:s9,FileJson2:n9,FileJson2Icon:n9,FileJsonIcon:s9,FileKey:a9,FileKey2:i9,FileKey2Icon:i9,FileKeyIcon:a9,FileLineChart:Q_,FileLineChartIcon:Q_,FileLock:l9,FileLock2:o9,FileLock2Icon:o9,FileLockIcon:l9,FileMinus:d9,FileMinus2:c9,FileMinus2Icon:c9,FileMinusIcon:d9,FileMusic:u9,FileMusicIcon:u9,FileOutput:h9,FileOutputIcon:h9,FilePen:r2,FilePenIcon:r2,FilePenLine:t2,FilePenLineIcon:t2,FilePieChart:J_,FilePieChartIcon:J_,FilePlus:p9,FilePlus2:f9,FilePlus2Icon:f9,FilePlusIcon:p9,FileQuestion:m9,FileQuestionIcon:m9,FileScan:g9,FileScanIcon:g9,FileSearch:x9,FileSearch2:y9,FileSearch2Icon:y9,FileSearchIcon:x9,FileSignature:t2,FileSignatureIcon:t2,FileSliders:v9,FileSlidersIcon:v9,FileSpreadsheet:H0,FileSpreadsheetIcon:H0,FileStack:_9,FileStackIcon:_9,FileSymlink:b9,FileSymlinkIcon:b9,FileTerminal:w9,FileTerminalIcon:w9,FileText:Ai,FileTextIcon:Ai,FileType:k9,FileType2:j9,FileType2Icon:j9,FileTypeIcon:k9,FileUp:N9,FileUpIcon:N9,FileUser:S9,FileUserIcon:S9,FileVideo:M9,FileVideo2:C9,FileVideo2Icon:C9,FileVideoIcon:M9,FileVolume:A9,FileVolume2:T9,FileVolume2Icon:T9,FileVolumeIcon:A9,FileWarning:E9,FileWarningIcon:E9,FileX:P9,FileX2:I9,FileX2Icon:I9,FileXIcon:P9,Files:O9,FilesIcon:O9,Film:wd,FilmIcon:wd,Filter:Uw,FilterIcon:Uw,FilterX:D9,FilterXIcon:D9,Fingerprint:R9,FingerprintIcon:R9,FireExtinguisher:F9,FireExtinguisherIcon:F9,Fish:$9,FishIcon:$9,FishOff:z9,FishOffIcon:z9,FishSymbol:B9,FishSymbolIcon:B9,Flag:lT,FlagIcon:lT,FlagOff:U9,FlagOffIcon:U9,FlagTriangleLeft:q9,FlagTriangleLeftIcon:q9,FlagTriangleRight:V9,FlagTriangleRightIcon:V9,Flame:Df,FlameIcon:Df,FlameKindling:H9,FlameKindlingIcon:H9,Flashlight:G9,FlashlightIcon:G9,FlashlightOff:W9,FlashlightOffIcon:W9,FlaskConical:qw,FlaskConicalIcon:qw,FlaskConicalOff:K9,FlaskConicalOffIcon:K9,FlaskRound:Z9,FlaskRoundIcon:Z9,FlipHorizontal:X9,FlipHorizontal2:Y9,FlipHorizontal2Icon:Y9,FlipHorizontalIcon:X9,FlipVertical:J9,FlipVertical2:Q9,FlipVertical2Icon:Q9,FlipVerticalIcon:J9,Flower:t$,Flower2:e$,Flower2Icon:e$,FlowerIcon:t$,Focus:r$,FocusIcon:r$,FoldHorizontal:n$,FoldHorizontalIcon:n$,FoldVertical:s$,FoldVerticalIcon:s$,Folder:E$,FolderArchive:i$,FolderArchiveIcon:i$,FolderCheck:a$,FolderCheckIcon:a$,FolderClock:o$,FolderClockIcon:o$,FolderClosed:l$,FolderClosedIcon:l$,FolderCode:c$,FolderCodeIcon:c$,FolderCog:n2,FolderCog2:n2,FolderCog2Icon:n2,FolderCogIcon:n2,FolderDot:d$,FolderDotIcon:d$,FolderDown:u$,FolderDownIcon:u$,FolderEdit:s2,FolderEditIcon:s2,FolderGit:f$,FolderGit2:h$,FolderGit2Icon:h$,FolderGitIcon:f$,FolderHeart:p$,FolderHeartIcon:p$,FolderIcon:E$,FolderInput:m$,FolderInputIcon:m$,FolderKanban:g$,FolderKanbanIcon:g$,FolderKey:y$,FolderKeyIcon:y$,FolderLock:x$,FolderLockIcon:x$,FolderMinus:v$,FolderMinusIcon:v$,FolderOpen:My,FolderOpenDot:_$,FolderOpenDotIcon:_$,FolderOpenIcon:My,FolderOutput:b$,FolderOutputIcon:b$,FolderPen:s2,FolderPenIcon:s2,FolderPlus:w$,FolderPlusIcon:w$,FolderRoot:j$,FolderRootIcon:j$,FolderSearch:N$,FolderSearch2:k$,FolderSearch2Icon:k$,FolderSearchIcon:N$,FolderSymlink:S$,FolderSymlinkIcon:S$,FolderSync:C$,FolderSyncIcon:C$,FolderTree:M$,FolderTreeIcon:M$,FolderUp:T$,FolderUpIcon:T$,FolderX:A$,FolderXIcon:A$,Folders:I$,FoldersIcon:I$,Footprints:P$,FootprintsIcon:P$,ForkKnife:Yb,ForkKnifeCrossed:Zb,ForkKnifeCrossedIcon:Zb,ForkKnifeIcon:Yb,Forklift:L$,ForkliftIcon:L$,FormInput:E2,FormInputIcon:E2,Forward:O$,ForwardIcon:O$,Frame:D$,FrameIcon:D$,Framer:R$,FramerIcon:R$,Frown:F$,FrownIcon:F$,Fuel:z$,FuelIcon:z$,Fullscreen:B$,FullscreenIcon:B$,FunctionSquare:hb,FunctionSquareIcon:hb,GalleryHorizontal:U$,GalleryHorizontalEnd:$$,GalleryHorizontalEndIcon:$$,GalleryHorizontalIcon:U$,GalleryThumbnails:q$,GalleryThumbnailsIcon:q$,GalleryVertical:H$,GalleryVerticalEnd:V$,GalleryVerticalEndIcon:V$,GalleryVerticalIcon:H$,Gamepad:G$,Gamepad2:W$,Gamepad2Icon:W$,GamepadIcon:G$,GanttChart:u_,GanttChartIcon:u_,GanttChartSquare:Bm,GanttChartSquareIcon:Bm,Gauge:K$,GaugeCircle:C_,GaugeCircleIcon:C_,GaugeIcon:K$,Gavel:Z$,GavelIcon:Z$,Gem:Y$,GemIcon:Y$,Ghost:X$,GhostIcon:X$,Gift:Qa,GiftIcon:Qa,GitBranch:J$,GitBranchIcon:J$,GitBranchPlus:Q$,GitBranchPlusIcon:Q$,GitCommit:i2,GitCommitHorizontal:i2,GitCommitHorizontalIcon:i2,GitCommitIcon:i2,GitCommitVertical:eU,GitCommitVerticalIcon:eU,GitCompare:rU,GitCompareArrows:tU,GitCompareArrowsIcon:tU,GitCompareIcon:rU,GitFork:nU,GitForkIcon:nU,GitGraph:sU,GitGraphIcon:sU,GitMerge:iU,GitMergeIcon:iU,GitPullRequest:uU,GitPullRequestArrow:aU,GitPullRequestArrowIcon:aU,GitPullRequestClosed:oU,GitPullRequestClosedIcon:oU,GitPullRequestCreate:cU,GitPullRequestCreateArrow:lU,GitPullRequestCreateArrowIcon:lU,GitPullRequestCreateIcon:cU,GitPullRequestDraft:dU,GitPullRequestDraftIcon:dU,GitPullRequestIcon:uU,Github:hU,GithubIcon:hU,Gitlab:fU,GitlabIcon:fU,GlassWater:pU,GlassWaterIcon:pU,Glasses:mU,GlassesIcon:mU,Globe:OS,Globe2:K_,Globe2Icon:K_,GlobeIcon:OS,GlobeLock:gU,GlobeLockIcon:gU,Goal:yU,GoalIcon:yU,Grab:xU,GrabIcon:xU,GraduationCap:W0,GraduationCapIcon:W0,Grape:vU,GrapeIcon:vU,Grid:Th,Grid2X2:o2,Grid2X2Icon:o2,Grid2X2Plus:a2,Grid2X2PlusIcon:a2,Grid2x2:o2,Grid2x2Check:_U,Grid2x2CheckIcon:_U,Grid2x2Icon:o2,Grid2x2Plus:a2,Grid2x2PlusIcon:a2,Grid2x2X:bU,Grid2x2XIcon:bU,Grid3X3:Th,Grid3X3Icon:Th,Grid3x3:Th,Grid3x3Icon:Th,GridIcon:Th,Grip:jU,GripHorizontal:wU,GripHorizontalIcon:wU,GripIcon:jU,GripVertical:DS,GripVerticalIcon:DS,Group:kU,GroupIcon:kU,Guitar:NU,GuitarIcon:NU,Ham:SU,HamIcon:SU,Hammer:CU,HammerIcon:CU,Hand:IU,HandCoins:MU,HandCoinsIcon:MU,HandHeart:TU,HandHeartIcon:TU,HandHelping:l2,HandHelpingIcon:l2,HandIcon:IU,HandMetal:AU,HandMetalIcon:AU,HandPlatter:EU,HandPlatterIcon:EU,Handshake:PU,HandshakeIcon:PU,HardDrive:cT,HardDriveDownload:LU,HardDriveDownloadIcon:LU,HardDriveIcon:cT,HardDriveUpload:OU,HardDriveUploadIcon:OU,HardHat:DU,HardHatIcon:DU,Hash:RS,HashIcon:RS,Haze:RU,HazeIcon:RU,HdmiPort:FU,HdmiPortIcon:FU,Heading:qU,Heading1:dT,Heading1Icon:dT,Heading2:uT,Heading2Icon:uT,Heading3:zU,Heading3Icon:zU,Heading4:BU,Heading4Icon:BU,Heading5:$U,Heading5Icon:$U,Heading6:UU,Heading6Icon:UU,HeadingIcon:qU,HeadphoneOff:VU,HeadphoneOffIcon:VU,Headphones:HU,HeadphonesIcon:HU,Headset:WU,HeadsetIcon:WU,Heart:ql,HeartCrack:GU,HeartCrackIcon:GU,HeartHandshake:KU,HeartHandshakeIcon:KU,HeartIcon:ql,HeartOff:ZU,HeartOffIcon:ZU,HeartPulse:YU,HeartPulseIcon:YU,Heater:XU,HeaterIcon:XU,HelpCircle:my,HelpCircleIcon:my,HelpingHand:l2,HelpingHandIcon:l2,Hexagon:QU,HexagonIcon:QU,Highlighter:JU,HighlighterIcon:JU,History:FS,HistoryIcon:FS,Home:Hi,HomeIcon:Hi,Hop:tq,HopIcon:tq,HopOff:eq,HopOffIcon:eq,Hospital:rq,HospitalIcon:rq,Hotel:nq,HotelIcon:nq,Hourglass:sq,HourglassIcon:sq,House:Hi,HouseIcon:Hi,HousePlug:iq,HousePlugIcon:iq,HousePlus:aq,HousePlusIcon:aq,IceCream:d2,IceCream2:c2,IceCream2Icon:c2,IceCreamBowl:c2,IceCreamBowlIcon:c2,IceCreamCone:d2,IceCreamConeIcon:d2,IceCreamIcon:d2,Icon:aAe,IdCard:oq,IdCardIcon:oq,Image:Wo,ImageDown:lq,ImageDownIcon:lq,ImageIcon:Wo,ImageMinus:cq,ImageMinusIcon:cq,ImageOff:dq,ImageOffIcon:dq,ImagePlay:uq,ImagePlayIcon:uq,ImagePlus:zS,ImagePlusIcon:zS,ImageUp:hq,ImageUpIcon:hq,ImageUpscale:fq,ImageUpscaleIcon:fq,Images:pq,ImagesIcon:pq,Import:mq,ImportIcon:mq,Inbox:gq,InboxIcon:gq,Indent:h2,IndentDecrease:u2,IndentDecreaseIcon:u2,IndentIcon:h2,IndentIncrease:h2,IndentIncreaseIcon:h2,IndianRupee:yq,IndianRupeeIcon:yq,Infinity:xq,InfinityIcon:xq,Info:vq,InfoIcon:vq,Inspect:xb,InspectIcon:xb,InspectionPanel:_q,InspectionPanelIcon:_q,Instagram:Wd,InstagramIcon:Wd,Italic:BS,ItalicIcon:BS,IterationCcw:bq,IterationCcwIcon:bq,IterationCw:wq,IterationCwIcon:wq,JapaneseYen:jq,JapaneseYenIcon:jq,Joystick:kq,JoystickIcon:kq,Kanban:G0,KanbanIcon:G0,KanbanSquare:fb,KanbanSquareDashed:ab,KanbanSquareDashedIcon:ab,KanbanSquareIcon:fb,Key:hT,KeyIcon:hT,KeyRound:Vw,KeyRoundIcon:Vw,KeySquare:Nq,KeySquareIcon:Nq,Keyboard:Mq,KeyboardIcon:Mq,KeyboardMusic:Sq,KeyboardMusicIcon:Sq,KeyboardOff:Cq,KeyboardOffIcon:Cq,Lamp:Lq,LampCeiling:Tq,LampCeilingIcon:Tq,LampDesk:Aq,LampDeskIcon:Aq,LampFloor:Eq,LampFloorIcon:Eq,LampIcon:Lq,LampWallDown:Iq,LampWallDownIcon:Iq,LampWallUp:Pq,LampWallUpIcon:Pq,LandPlot:Oq,LandPlotIcon:Oq,Landmark:Dq,LandmarkIcon:Dq,Languages:Rq,LanguagesIcon:Rq,Laptop:zq,Laptop2:f2,Laptop2Icon:f2,LaptopIcon:zq,LaptopMinimal:f2,LaptopMinimalCheck:Fq,LaptopMinimalCheckIcon:Fq,LaptopMinimalIcon:f2,Lasso:$q,LassoIcon:$q,LassoSelect:Bq,LassoSelectIcon:Bq,Laugh:Uq,LaughIcon:Uq,Layers:Hq,Layers2:qq,Layers2Icon:qq,Layers3:Vq,Layers3Icon:Vq,LayersIcon:Hq,Layout:Yx,LayoutDashboard:$S,LayoutDashboardIcon:$S,LayoutGrid:lg,LayoutGridIcon:lg,LayoutIcon:Yx,LayoutList:Wq,LayoutListIcon:Wq,LayoutPanelLeft:Gq,LayoutPanelLeftIcon:Gq,LayoutPanelTop:Kq,LayoutPanelTopIcon:Kq,LayoutTemplate:Zq,LayoutTemplateIcon:Zq,Leaf:Yq,LeafIcon:Yq,LeafyGreen:Xq,LeafyGreenIcon:Xq,Lectern:Qq,LecternIcon:Qq,LetterText:Jq,LetterTextIcon:Jq,Library:US,LibraryBig:eV,LibraryBigIcon:eV,LibraryIcon:US,LibrarySquare:pb,LibrarySquareIcon:pb,LifeBuoy:qS,LifeBuoyIcon:qS,Ligature:tV,LigatureIcon:tV,Lightbulb:K0,LightbulbIcon:K0,LightbulbOff:rV,LightbulbOffIcon:rV,LineChart:l_,LineChartIcon:l_,Link:bo,Link2:Rf,Link2Icon:Rf,Link2Off:nV,Link2OffIcon:nV,LinkIcon:bo,Linkedin:tm,LinkedinIcon:tm,List:rm,ListCheck:sV,ListCheckIcon:sV,ListChecks:iV,ListChecksIcon:iV,ListCollapse:aV,ListCollapseIcon:aV,ListEnd:oV,ListEndIcon:oV,ListFilter:lV,ListFilterIcon:lV,ListIcon:rm,ListMinus:cV,ListMinusIcon:cV,ListMusic:dV,ListMusicIcon:dV,ListOrdered:VS,ListOrderedIcon:VS,ListPlus:uV,ListPlusIcon:uV,ListRestart:hV,ListRestartIcon:hV,ListStart:fV,ListStartIcon:fV,ListTodo:pV,ListTodoIcon:pV,ListTree:mV,ListTreeIcon:mV,ListVideo:gV,ListVideoIcon:gV,ListX:yV,ListXIcon:yV,Loader:vV,Loader2:sn,Loader2Icon:sn,LoaderCircle:sn,LoaderCircleIcon:sn,LoaderIcon:vV,LoaderPinwheel:xV,LoaderPinwheelIcon:xV,Locate:fT,LocateFixed:_V,LocateFixedIcon:_V,LocateIcon:fT,LocateOff:bV,LocateOffIcon:bV,Lock:Ff,LockIcon:Ff,LockKeyhole:wV,LockKeyholeIcon:wV,LockKeyholeOpen:p2,LockKeyholeOpenIcon:p2,LockOpen:m2,LockOpenIcon:m2,LogIn:HS,LogInIcon:HS,LogOut:WS,LogOutIcon:WS,Logs:jV,LogsIcon:jV,Lollipop:kV,LollipopIcon:kV,LucideAArrowDown:YL,LucideAArrowUp:XL,LucideALargeSmall:QL,LucideAccessibility:JL,LucideActivity:ig,LucideActivitySquare:z2,LucideAirVent:eO,LucideAirplay:tO,LucideAlarmCheck:Bv,LucideAlarmClock:nO,LucideAlarmClockCheck:Bv,LucideAlarmClockMinus:$v,LucideAlarmClockOff:rO,LucideAlarmClockPlus:Uv,LucideAlarmMinus:$v,LucideAlarmPlus:Uv,LucideAlarmSmoke:sO,LucideAlbum:iO,LucideAlertCircle:Bl,LucideAlertOctagon:x2,LucideAlertTriangle:Ph,LucideAlignCenter:MS,LucideAlignCenterHorizontal:aO,LucideAlignCenterVertical:oO,LucideAlignEndHorizontal:lO,LucideAlignEndVertical:cO,LucideAlignHorizontalDistributeCenter:dO,LucideAlignHorizontalDistributeEnd:uO,LucideAlignHorizontalDistributeStart:hO,LucideAlignHorizontalJustifyCenter:fO,LucideAlignHorizontalJustifyEnd:pO,LucideAlignHorizontalJustifyStart:mO,LucideAlignHorizontalSpaceAround:gO,LucideAlignHorizontalSpaceBetween:yO,LucideAlignJustify:xO,LucideAlignLeft:TS,LucideAlignRight:AS,LucideAlignStartHorizontal:vO,LucideAlignStartVertical:_O,LucideAlignVerticalDistributeCenter:bO,LucideAlignVerticalDistributeEnd:wO,LucideAlignVerticalDistributeStart:jO,LucideAlignVerticalJustifyCenter:kO,LucideAlignVerticalJustifyEnd:NO,LucideAlignVerticalJustifyStart:SO,LucideAlignVerticalSpaceAround:CO,LucideAlignVerticalSpaceBetween:MO,LucideAmbulance:TO,LucideAmpersand:AO,LucideAmpersands:EO,LucideAmphora:IO,LucideAnchor:PO,LucideAngry:LO,LucideAnnoyed:OO,LucideAntenna:DO,LucideAnvil:RO,LucideAperture:FO,LucideAppWindow:sT,LucideAppWindowMac:zO,LucideApple:BO,LucideArchive:qO,LucideArchiveRestore:$O,LucideArchiveX:UO,LucideAreaChart:r_,LucideArmchair:VO,LucideArrowBigDown:WO,LucideArrowBigDownDash:HO,LucideArrowBigLeft:KO,LucideArrowBigLeftDash:GO,LucideArrowBigRight:YO,LucideArrowBigRightDash:ZO,LucideArrowBigUp:QO,LucideArrowBigUpDash:XO,LucideArrowDown:ES,LucideArrowDown01:JO,LucideArrowDown10:eD,LucideArrowDownAZ:qv,LucideArrowDownAz:qv,LucideArrowDownCircle:p_,LucideArrowDownFromLine:tD,LucideArrowDownLeft:rD,LucideArrowDownLeftFromCircle:g_,LucideArrowDownLeftFromSquare:V2,LucideArrowDownLeftSquare:B2,LucideArrowDownNarrowWide:nD,LucideArrowDownRight:sD,LucideArrowDownRightFromCircle:y_,LucideArrowDownRightFromSquare:H2,LucideArrowDownRightSquare:$2,LucideArrowDownSquare:U2,LucideArrowDownToDot:iD,LucideArrowDownToLine:aD,LucideArrowDownUp:oD,LucideArrowDownWideNarrow:Vv,LucideArrowDownZA:Hv,LucideArrowDownZa:Hv,LucideArrowLeft:Va,LucideArrowLeftCircle:m_,LucideArrowLeftFromLine:lD,LucideArrowLeftRight:cD,LucideArrowLeftSquare:q2,LucideArrowLeftToLine:dD,LucideArrowRight:Ho,LucideArrowRightCircle:__,LucideArrowRightFromLine:uD,LucideArrowRightLeft:hD,LucideArrowRightSquare:K2,LucideArrowRightToLine:fD,LucideArrowUp:$0,LucideArrowUp01:pD,LucideArrowUp10:mD,LucideArrowUpAZ:Wv,LucideArrowUpAz:Wv,LucideArrowUpCircle:b_,LucideArrowUpDown:B0,LucideArrowUpFromDot:gD,LucideArrowUpFromLine:yD,LucideArrowUpLeft:xD,LucideArrowUpLeftFromCircle:x_,LucideArrowUpLeftFromSquare:W2,LucideArrowUpLeftSquare:Z2,LucideArrowUpNarrowWide:Gv,LucideArrowUpRight:vD,LucideArrowUpRightFromCircle:v_,LucideArrowUpRightFromSquare:G2,LucideArrowUpRightSquare:Y2,LucideArrowUpSquare:X2,LucideArrowUpToLine:_D,LucideArrowUpWideNarrow:bD,LucideArrowUpZA:Kv,LucideArrowUpZa:Kv,LucideArrowsUpFromLine:wD,LucideAsterisk:jD,LucideAsteriskSquare:Q2,LucideAtSign:kD,LucideAtom:ND,LucideAudioLines:SD,LucideAudioWaveform:CD,LucideAward:Cu,LucideAxe:MD,LucideAxis3D:Zv,LucideAxis3d:Zv,LucideBaby:TD,LucideBackpack:AD,LucideBadge:WD,LucideBadgeAlert:ED,LucideBadgeCent:ID,LucideBadgeCheck:Yv,LucideBadgeDollarSign:PD,LucideBadgeEuro:LD,LucideBadgeHelp:OD,LucideBadgeIndianRupee:DD,LucideBadgeInfo:RD,LucideBadgeJapaneseYen:FD,LucideBadgeMinus:zD,LucideBadgePercent:BD,LucideBadgePlus:$D,LucideBadgePoundSterling:UD,LucideBadgeRussianRuble:qD,LucideBadgeSwissFranc:VD,LucideBadgeX:HD,LucideBaggageClaim:GD,LucideBan:KD,LucideBanana:ZD,LucideBandage:YD,LucideBanknote:XD,LucideBarChart:c_,LucideBarChart2:d_,LucideBarChart3:xc,LucideBarChart4:o_,LucideBarChartBig:a_,LucideBarChartHorizontal:s_,LucideBarChartHorizontalBig:n_,LucideBarcode:QD,LucideBaseline:JD,LucideBath:Lf,LucideBattery:i8,LucideBatteryCharging:e8,LucideBatteryFull:t8,LucideBatteryLow:r8,LucideBatteryMedium:n8,LucideBatteryWarning:s8,LucideBeaker:a8,LucideBean:l8,LucideBeanOff:o8,LucideBed:Of,LucideBedDouble:c8,LucideBedSingle:d8,LucideBeef:u8,LucideBeer:f8,LucideBeerOff:h8,LucideBell:ag,LucideBellDot:p8,LucideBellElectric:m8,LucideBellMinus:g8,LucideBellOff:Ow,LucideBellPlus:y8,LucideBellRing:x8,LucideBetweenHorizonalEnd:Xv,LucideBetweenHorizonalStart:Qv,LucideBetweenHorizontalEnd:Xv,LucideBetweenHorizontalStart:Qv,LucideBetweenVerticalEnd:v8,LucideBetweenVerticalStart:_8,LucideBicepsFlexed:b8,LucideBike:w8,LucideBinary:j8,LucideBinoculars:k8,LucideBiohazard:N8,LucideBird:S8,LucideBitcoin:C8,LucideBlend:M8,LucideBlinds:T8,LucideBlocks:A8,LucideBluetooth:L8,LucideBluetoothConnected:E8,LucideBluetoothOff:I8,LucideBluetoothSearching:P8,LucideBold:IS,LucideBolt:O8,LucideBomb:D8,LucideBone:R8,LucideBook:iR,LucideBookA:F8,LucideBookAudio:z8,LucideBookCheck:B8,LucideBookCopy:$8,LucideBookDashed:Jv,LucideBookDown:U8,LucideBookHeadphones:q8,LucideBookHeart:V8,LucideBookImage:H8,LucideBookKey:W8,LucideBookLock:G8,LucideBookMarked:K8,LucideBookMinus:Z8,LucideBookOpen:iT,LucideBookOpenCheck:Y8,LucideBookOpenText:X8,LucideBookPlus:Q8,LucideBookTemplate:Jv,LucideBookText:J8,LucideBookType:eR,LucideBookUp:rR,LucideBookUp2:tR,LucideBookUser:nR,LucideBookX:sR,LucideBookmark:Jp,LucideBookmarkCheck:aR,LucideBookmarkMinus:oR,LucideBookmarkPlus:lR,LucideBookmarkX:cR,LucideBoomBox:dR,LucideBot:PS,LucideBotMessageSquare:uR,LucideBotOff:hR,LucideBox:fR,LucideBoxSelect:lb,LucideBoxes:pR,LucideBraces:e_,LucideBrackets:mR,LucideBrain:xR,LucideBrainCircuit:gR,LucideBrainCog:yR,LucideBrickWall:vR,LucideBriefcase:dh,LucideBriefcaseBusiness:_R,LucideBriefcaseConveyorBelt:bR,LucideBriefcaseMedical:wR,LucideBringToFront:jR,LucideBrush:kR,LucideBug:CR,LucideBugOff:NR,LucideBugPlay:SR,LucideBuilding:LS,LucideBuilding2:ra,LucideBus:TR,LucideBusFront:MR,LucideCable:ER,LucideCableCar:AR,LucideCake:og,LucideCakeSlice:IR,LucideCalculator:PR,LucideCalendar:li,LucideCalendar1:LR,LucideCalendarArrowDown:OR,LucideCalendarArrowUp:DR,LucideCalendarCheck:FR,LucideCalendarCheck2:RR,LucideCalendarClock:zR,LucideCalendarCog:BR,LucideCalendarDays:em,LucideCalendarFold:$R,LucideCalendarHeart:UR,LucideCalendarMinus:VR,LucideCalendarMinus2:qR,LucideCalendarOff:HR,LucideCalendarPlus:Dw,LucideCalendarPlus2:WR,LucideCalendarRange:GR,LucideCalendarSearch:KR,LucideCalendarSync:ZR,LucideCalendarX:XR,LucideCalendarX2:YR,LucideCamera:Rw,LucideCameraOff:QR,LucideCandlestickChart:i_,LucideCandy:tF,LucideCandyCane:JR,LucideCandyOff:eF,LucideCannabis:rF,LucideCaptions:t_,LucideCaptionsOff:nF,LucideCar:aF,LucideCarFront:sF,LucideCarTaxiFront:iF,LucideCaravan:oF,LucideCarrot:lF,LucideCaseLower:cF,LucideCaseSensitive:dF,LucideCaseUpper:uF,LucideCassetteTape:hF,LucideCast:fF,LucideCastle:pF,LucideCat:mF,LucideCctv:gF,LucideChartArea:r_,LucideChartBar:s_,LucideChartBarBig:n_,LucideChartBarDecreasing:yF,LucideChartBarIncreasing:xF,LucideChartBarStacked:vF,LucideChartCandlestick:i_,LucideChartColumn:xc,LucideChartColumnBig:a_,LucideChartColumnDecreasing:_F,LucideChartColumnIncreasing:o_,LucideChartColumnStacked:bF,LucideChartGantt:wF,LucideChartLine:l_,LucideChartNetwork:jF,LucideChartNoAxesColumn:d_,LucideChartNoAxesColumnDecreasing:kF,LucideChartNoAxesColumnIncreasing:c_,LucideChartNoAxesCombined:NF,LucideChartNoAxesGantt:u_,LucideChartPie:h_,LucideChartScatter:f_,LucideChartSpline:SF,LucideCheck:Ba,LucideCheckCheck:CF,LucideCheckCircle:za,LucideCheckCircle2:io,LucideCheckSquare:Qx,LucideCheckSquare2:eb,LucideChefHat:MF,LucideCherry:TF,LucideChevronDown:uh,LucideChevronDownCircle:w_,LucideChevronDownSquare:tb,LucideChevronFirst:AF,LucideChevronLast:EF,LucideChevronLeft:sd,LucideChevronLeftCircle:j_,LucideChevronLeftSquare:rb,LucideChevronRight:Ha,LucideChevronRightCircle:k_,LucideChevronRightSquare:nb,LucideChevronUp:U0,LucideChevronUpCircle:N_,LucideChevronUpSquare:sb,LucideChevronsDown:PF,LucideChevronsDownUp:IF,LucideChevronsLeft:DF,LucideChevronsLeftRight:OF,LucideChevronsLeftRightEllipsis:LF,LucideChevronsRight:FF,LucideChevronsRightLeft:RF,LucideChevronsUp:zF,LucideChevronsUpDown:Fw,LucideChrome:BF,LucideChurch:$F,LucideCigarette:qF,LucideCigaretteOff:UF,LucideCircle:Mu,LucideCircleAlert:Bl,LucideCircleArrowDown:p_,LucideCircleArrowLeft:m_,LucideCircleArrowOutDownLeft:g_,LucideCircleArrowOutDownRight:y_,LucideCircleArrowOutUpLeft:x_,LucideCircleArrowOutUpRight:v_,LucideCircleArrowRight:__,LucideCircleArrowUp:b_,LucideCircleCheck:io,LucideCircleCheckBig:za,LucideCircleChevronDown:w_,LucideCircleChevronLeft:j_,LucideCircleChevronRight:k_,LucideCircleChevronUp:N_,LucideCircleDashed:VF,LucideCircleDivide:S_,LucideCircleDollarSign:HF,LucideCircleDot:GF,LucideCircleDotDashed:WF,LucideCircleEllipsis:KF,LucideCircleEqual:ZF,LucideCircleFadingArrowUp:YF,LucideCircleFadingPlus:XF,LucideCircleGauge:C_,LucideCircleHelp:my,LucideCircleMinus:M_,LucideCircleOff:QF,LucideCircleParking:A_,LucideCircleParkingOff:T_,LucideCirclePause:E_,LucideCirclePercent:I_,LucideCirclePlay:Sf,LucideCirclePlus:P_,LucideCirclePower:L_,LucideCircleSlash:JF,LucideCircleSlash2:O_,LucideCircleSlashed:O_,LucideCircleStop:D_,LucideCircleUser:F_,LucideCircleUserRound:R_,LucideCircleX:Lc,LucideCircuitBoard:ez,LucideCitrus:tz,LucideClapperboard:rz,LucideClipboard:dz,LucideClipboardCheck:aT,LucideClipboardCopy:nz,LucideClipboardEdit:B_,LucideClipboardList:sz,LucideClipboardMinus:iz,LucideClipboardPaste:az,LucideClipboardPen:B_,LucideClipboardPenLine:z_,LucideClipboardPlus:oz,LucideClipboardSignature:z_,LucideClipboardType:lz,LucideClipboardX:cz,LucideClock:Xi,LucideClock1:uz,LucideClock10:hz,LucideClock11:fz,LucideClock12:pz,LucideClock2:mz,LucideClock3:gz,LucideClock4:yz,LucideClock5:xz,LucideClock6:vz,LucideClock7:_z,LucideClock8:bz,LucideClock9:wz,LucideClockAlert:jz,LucideClockArrowDown:kz,LucideClockArrowUp:Nz,LucideCloud:Bz,LucideCloudAlert:Sz,LucideCloudCog:Cz,LucideCloudDownload:$_,LucideCloudDrizzle:Mz,LucideCloudFog:Tz,LucideCloudHail:Az,LucideCloudLightning:Ez,LucideCloudMoon:Pz,LucideCloudMoonRain:Iz,LucideCloudOff:Lz,LucideCloudRain:Dz,LucideCloudRainWind:Oz,LucideCloudSnow:Rz,LucideCloudSun:zz,LucideCloudSunRain:Fz,LucideCloudUpload:U_,LucideCloudy:$z,LucideClover:Uz,LucideClub:qz,LucideCode:zw,LucideCode2:q_,LucideCodeSquare:ib,LucideCodeXml:q_,LucideCodepen:Vz,LucideCodesandbox:Hz,LucideCoffee:Wz,LucideCog:Gz,LucideCoins:Kz,LucideColumns:V_,LucideColumns2:V_,LucideColumns3:H_,LucideColumns4:Zz,LucideCombine:Yz,LucideCommand:Xz,LucideCompass:Qz,LucideComponent:Jz,LucideComputer:e7,LucideConciergeBell:t7,LucideCone:r7,LucideConstruction:n7,LucideContact:s7,LucideContact2:W_,LucideContactRound:W_,LucideContainer:i7,LucideContrast:a7,LucideCookie:o7,LucideCookingPot:l7,LucideCopy:Ul,LucideCopyCheck:c7,LucideCopyMinus:d7,LucideCopyPlus:u7,LucideCopySlash:h7,LucideCopyX:f7,LucideCopyleft:p7,LucideCopyright:m7,LucideCornerDownLeft:g7,LucideCornerDownRight:y7,LucideCornerLeftDown:x7,LucideCornerLeftUp:v7,LucideCornerRightDown:_7,LucideCornerRightUp:b7,LucideCornerUpLeft:w7,LucideCornerUpRight:j7,LucideCpu:k7,LucideCreativeCommons:N7,LucideCreditCard:q0,LucideCroissant:S7,LucideCrop:C7,LucideCross:M7,LucideCrosshair:T7,LucideCrown:Bw,LucideCuboid:A7,LucideCupSoda:E7,LucideCurlyBraces:e_,LucideCurrency:I7,LucideCylinder:P7,LucideDam:L7,LucideDatabase:R7,LucideDatabaseBackup:O7,LucideDatabaseZap:D7,LucideDelete:F7,LucideDessert:z7,LucideDiameter:B7,LucideDiamond:q7,LucideDiamondMinus:$7,LucideDiamondPercent:G_,LucideDiamondPlus:U7,LucideDice1:V7,LucideDice2:H7,LucideDice3:W7,LucideDice4:G7,LucideDice5:K7,LucideDice6:Z7,LucideDices:Y7,LucideDiff:X7,LucideDisc:tB,LucideDisc2:Q7,LucideDisc3:J7,LucideDiscAlbum:eB,LucideDivide:rB,LucideDivideCircle:S_,LucideDivideSquare:cb,LucideDna:sB,LucideDnaOff:nB,LucideDock:iB,LucideDog:aB,LucideDollarSign:Cd,LucideDonut:oB,LucideDoorClosed:lB,LucideDoorOpen:oT,LucideDot:cB,LucideDotSquare:db,LucideDownload:Mo,LucideDownloadCloud:$_,LucideDraftingCompass:dB,LucideDrama:uB,LucideDribbble:hB,LucideDrill:fB,LucideDroplet:pB,LucideDroplets:mB,LucideDrum:gB,LucideDrumstick:yB,LucideDumbbell:xB,LucideEar:_B,LucideEarOff:vB,LucideEarth:K_,LucideEarthLock:bB,LucideEclipse:wB,LucideEdit:Jl,LucideEdit2:Xx,LucideEdit3:T2,LucideEgg:NB,LucideEggFried:jB,LucideEggOff:kB,LucideEllipsis:Zm,LucideEllipsisVertical:gy,LucideEqual:MB,LucideEqualApproximately:SB,LucideEqualNot:CB,LucideEqualSquare:ub,LucideEraser:TB,LucideEthernetPort:AB,LucideEuro:EB,LucideExpand:IB,LucideExternalLink:Fs,LucideEye:Ml,LucideEyeClosed:PB,LucideEyeOff:$w,LucideFacebook:Md,LucideFactory:LB,LucideFan:OB,LucideFastForward:DB,LucideFeather:RB,LucideFence:FB,LucideFerrisWheel:zB,LucideFigma:BB,LucideFile:L9,LucideFileArchive:$B,LucideFileAudio:qB,LucideFileAudio2:UB,LucideFileAxis3D:Z_,LucideFileAxis3d:Z_,LucideFileBadge:HB,LucideFileBadge2:VB,LucideFileBarChart:Y_,LucideFileBarChart2:X_,LucideFileBox:WB,LucideFileChartColumn:X_,LucideFileChartColumnIncreasing:Y_,LucideFileChartLine:Q_,LucideFileChartPie:J_,LucideFileCheck:KB,LucideFileCheck2:GB,LucideFileClock:ZB,LucideFileCode:XB,LucideFileCode2:YB,LucideFileCog:e2,LucideFileCog2:e2,LucideFileDiff:QB,LucideFileDigit:JB,LucideFileDown:e9,LucideFileEdit:r2,LucideFileHeart:t9,LucideFileImage:V0,LucideFileInput:r9,LucideFileJson:s9,LucideFileJson2:n9,LucideFileKey:a9,LucideFileKey2:i9,LucideFileLineChart:Q_,LucideFileLock:l9,LucideFileLock2:o9,LucideFileMinus:d9,LucideFileMinus2:c9,LucideFileMusic:u9,LucideFileOutput:h9,LucideFilePen:r2,LucideFilePenLine:t2,LucideFilePieChart:J_,LucideFilePlus:p9,LucideFilePlus2:f9,LucideFileQuestion:m9,LucideFileScan:g9,LucideFileSearch:x9,LucideFileSearch2:y9,LucideFileSignature:t2,LucideFileSliders:v9,LucideFileSpreadsheet:H0,LucideFileStack:_9,LucideFileSymlink:b9,LucideFileTerminal:w9,LucideFileText:Ai,LucideFileType:k9,LucideFileType2:j9,LucideFileUp:N9,LucideFileUser:S9,LucideFileVideo:M9,LucideFileVideo2:C9,LucideFileVolume:A9,LucideFileVolume2:T9,LucideFileWarning:E9,LucideFileX:P9,LucideFileX2:I9,LucideFiles:O9,LucideFilm:wd,LucideFilter:Uw,LucideFilterX:D9,LucideFingerprint:R9,LucideFireExtinguisher:F9,LucideFish:$9,LucideFishOff:z9,LucideFishSymbol:B9,LucideFlag:lT,LucideFlagOff:U9,LucideFlagTriangleLeft:q9,LucideFlagTriangleRight:V9,LucideFlame:Df,LucideFlameKindling:H9,LucideFlashlight:G9,LucideFlashlightOff:W9,LucideFlaskConical:qw,LucideFlaskConicalOff:K9,LucideFlaskRound:Z9,LucideFlipHorizontal:X9,LucideFlipHorizontal2:Y9,LucideFlipVertical:J9,LucideFlipVertical2:Q9,LucideFlower:t$,LucideFlower2:e$,LucideFocus:r$,LucideFoldHorizontal:n$,LucideFoldVertical:s$,LucideFolder:E$,LucideFolderArchive:i$,LucideFolderCheck:a$,LucideFolderClock:o$,LucideFolderClosed:l$,LucideFolderCode:c$,LucideFolderCog:n2,LucideFolderCog2:n2,LucideFolderDot:d$,LucideFolderDown:u$,LucideFolderEdit:s2,LucideFolderGit:f$,LucideFolderGit2:h$,LucideFolderHeart:p$,LucideFolderInput:m$,LucideFolderKanban:g$,LucideFolderKey:y$,LucideFolderLock:x$,LucideFolderMinus:v$,LucideFolderOpen:My,LucideFolderOpenDot:_$,LucideFolderOutput:b$,LucideFolderPen:s2,LucideFolderPlus:w$,LucideFolderRoot:j$,LucideFolderSearch:N$,LucideFolderSearch2:k$,LucideFolderSymlink:S$,LucideFolderSync:C$,LucideFolderTree:M$,LucideFolderUp:T$,LucideFolderX:A$,LucideFolders:I$,LucideFootprints:P$,LucideForkKnife:Yb,LucideForkKnifeCrossed:Zb,LucideForklift:L$,LucideFormInput:E2,LucideForward:O$,LucideFrame:D$,LucideFramer:R$,LucideFrown:F$,LucideFuel:z$,LucideFullscreen:B$,LucideFunctionSquare:hb,LucideGalleryHorizontal:U$,LucideGalleryHorizontalEnd:$$,LucideGalleryThumbnails:q$,LucideGalleryVertical:H$,LucideGalleryVerticalEnd:V$,LucideGamepad:G$,LucideGamepad2:W$,LucideGanttChart:u_,LucideGanttChartSquare:Bm,LucideGauge:K$,LucideGaugeCircle:C_,LucideGavel:Z$,LucideGem:Y$,LucideGhost:X$,LucideGift:Qa,LucideGitBranch:J$,LucideGitBranchPlus:Q$,LucideGitCommit:i2,LucideGitCommitHorizontal:i2,LucideGitCommitVertical:eU,LucideGitCompare:rU,LucideGitCompareArrows:tU,LucideGitFork:nU,LucideGitGraph:sU,LucideGitMerge:iU,LucideGitPullRequest:uU,LucideGitPullRequestArrow:aU,LucideGitPullRequestClosed:oU,LucideGitPullRequestCreate:cU,LucideGitPullRequestCreateArrow:lU,LucideGitPullRequestDraft:dU,LucideGithub:hU,LucideGitlab:fU,LucideGlassWater:pU,LucideGlasses:mU,LucideGlobe:OS,LucideGlobe2:K_,LucideGlobeLock:gU,LucideGoal:yU,LucideGrab:xU,LucideGraduationCap:W0,LucideGrape:vU,LucideGrid:Th,LucideGrid2X2:o2,LucideGrid2X2Plus:a2,LucideGrid2x2:o2,LucideGrid2x2Check:_U,LucideGrid2x2Plus:a2,LucideGrid2x2X:bU,LucideGrid3X3:Th,LucideGrid3x3:Th,LucideGrip:jU,LucideGripHorizontal:wU,LucideGripVertical:DS,LucideGroup:kU,LucideGuitar:NU,LucideHam:SU,LucideHammer:CU,LucideHand:IU,LucideHandCoins:MU,LucideHandHeart:TU,LucideHandHelping:l2,LucideHandMetal:AU,LucideHandPlatter:EU,LucideHandshake:PU,LucideHardDrive:cT,LucideHardDriveDownload:LU,LucideHardDriveUpload:OU,LucideHardHat:DU,LucideHash:RS,LucideHaze:RU,LucideHdmiPort:FU,LucideHeading:qU,LucideHeading1:dT,LucideHeading2:uT,LucideHeading3:zU,LucideHeading4:BU,LucideHeading5:$U,LucideHeading6:UU,LucideHeadphoneOff:VU,LucideHeadphones:HU,LucideHeadset:WU,LucideHeart:ql,LucideHeartCrack:GU,LucideHeartHandshake:KU,LucideHeartOff:ZU,LucideHeartPulse:YU,LucideHeater:XU,LucideHelpCircle:my,LucideHelpingHand:l2,LucideHexagon:QU,LucideHighlighter:JU,LucideHistory:FS,LucideHome:Hi,LucideHop:tq,LucideHopOff:eq,LucideHospital:rq,LucideHotel:nq,LucideHourglass:sq,LucideHouse:Hi,LucideHousePlug:iq,LucideHousePlus:aq,LucideIceCream:d2,LucideIceCream2:c2,LucideIceCreamBowl:c2,LucideIceCreamCone:d2,LucideIdCard:oq,LucideImage:Wo,LucideImageDown:lq,LucideImageMinus:cq,LucideImageOff:dq,LucideImagePlay:uq,LucideImagePlus:zS,LucideImageUp:hq,LucideImageUpscale:fq,LucideImages:pq,LucideImport:mq,LucideInbox:gq,LucideIndent:h2,LucideIndentDecrease:u2,LucideIndentIncrease:h2,LucideIndianRupee:yq,LucideInfinity:xq,LucideInfo:vq,LucideInspect:xb,LucideInspectionPanel:_q,LucideInstagram:Wd,LucideItalic:BS,LucideIterationCcw:bq,LucideIterationCw:wq,LucideJapaneseYen:jq,LucideJoystick:kq,LucideKanban:G0,LucideKanbanSquare:fb,LucideKanbanSquareDashed:ab,LucideKey:hT,LucideKeyRound:Vw,LucideKeySquare:Nq,LucideKeyboard:Mq,LucideKeyboardMusic:Sq,LucideKeyboardOff:Cq,LucideLamp:Lq,LucideLampCeiling:Tq,LucideLampDesk:Aq,LucideLampFloor:Eq,LucideLampWallDown:Iq,LucideLampWallUp:Pq,LucideLandPlot:Oq,LucideLandmark:Dq,LucideLanguages:Rq,LucideLaptop:zq,LucideLaptop2:f2,LucideLaptopMinimal:f2,LucideLaptopMinimalCheck:Fq,LucideLasso:$q,LucideLassoSelect:Bq,LucideLaugh:Uq,LucideLayers:Hq,LucideLayers2:qq,LucideLayers3:Vq,LucideLayout:Yx,LucideLayoutDashboard:$S,LucideLayoutGrid:lg,LucideLayoutList:Wq,LucideLayoutPanelLeft:Gq,LucideLayoutPanelTop:Kq,LucideLayoutTemplate:Zq,LucideLeaf:Yq,LucideLeafyGreen:Xq,LucideLectern:Qq,LucideLetterText:Jq,LucideLibrary:US,LucideLibraryBig:eV,LucideLibrarySquare:pb,LucideLifeBuoy:qS,LucideLigature:tV,LucideLightbulb:K0,LucideLightbulbOff:rV,LucideLineChart:l_,LucideLink:bo,LucideLink2:Rf,LucideLink2Off:nV,LucideLinkedin:tm,LucideList:rm,LucideListCheck:sV,LucideListChecks:iV,LucideListCollapse:aV,LucideListEnd:oV,LucideListFilter:lV,LucideListMinus:cV,LucideListMusic:dV,LucideListOrdered:VS,LucideListPlus:uV,LucideListRestart:hV,LucideListStart:fV,LucideListTodo:pV,LucideListTree:mV,LucideListVideo:gV,LucideListX:yV,LucideLoader:vV,LucideLoader2:sn,LucideLoaderCircle:sn,LucideLoaderPinwheel:xV,LucideLocate:fT,LucideLocateFixed:_V,LucideLocateOff:bV,LucideLock:Ff,LucideLockKeyhole:wV,LucideLockKeyholeOpen:p2,LucideLockOpen:m2,LucideLogIn:HS,LucideLogOut:WS,LucideLogs:jV,LucideLollipop:kV,LucideLuggage:NV,LucideMSquare:mb,LucideMagnet:SV,LucideMail:di,LucideMailCheck:CV,LucideMailMinus:MV,LucideMailOpen:TV,LucideMailPlus:AV,LucideMailQuestion:EV,LucideMailSearch:IV,LucideMailWarning:PV,LucideMailX:pT,LucideMailbox:LV,LucideMails:OV,LucideMap:GV,LucideMapPin:yl,LucideMapPinCheck:RV,LucideMapPinCheckInside:DV,LucideMapPinHouse:FV,LucideMapPinMinus:BV,LucideMapPinMinusInside:zV,LucideMapPinOff:$V,LucideMapPinPlus:qV,LucideMapPinPlusInside:UV,LucideMapPinX:HV,LucideMapPinXInside:VV,LucideMapPinned:WV,LucideMartini:KV,LucideMaximize:Z0,LucideMaximize2:ZV,LucideMedal:Ty,LucideMegaphone:nm,LucideMegaphoneOff:YV,LucideMeh:XV,LucideMemoryStick:QV,LucideMenu:mT,LucideMenuSquare:gb,LucideMerge:JV,LucideMessageCircle:Hl,LucideMessageCircleCode:eH,LucideMessageCircleDashed:tH,LucideMessageCircleHeart:rH,LucideMessageCircleMore:nH,LucideMessageCircleOff:sH,LucideMessageCirclePlus:iH,LucideMessageCircleQuestion:gT,LucideMessageCircleReply:aH,LucideMessageCircleWarning:oH,LucideMessageCircleX:lH,LucideMessageSquare:Wl,LucideMessageSquareCode:cH,LucideMessageSquareDashed:dH,LucideMessageSquareDiff:uH,LucideMessageSquareDot:hH,LucideMessageSquareHeart:fH,LucideMessageSquareLock:pH,LucideMessageSquareMore:mH,LucideMessageSquareOff:gH,LucideMessageSquarePlus:yH,LucideMessageSquareQuote:xH,LucideMessageSquareReply:vH,LucideMessageSquareShare:_H,LucideMessageSquareText:bH,LucideMessageSquareWarning:wH,LucideMessageSquareX:jH,LucideMessagesSquare:kH,LucideMic:yT,LucideMic2:g2,LucideMicOff:NH,LucideMicVocal:g2,LucideMicrochip:SH,LucideMicroscope:CH,LucideMicrowave:MH,LucideMilestone:TH,LucideMilk:EH,LucideMilkOff:AH,LucideMinimize:PH,LucideMinimize2:IH,LucideMinus:Y0,LucideMinusCircle:M_,LucideMinusSquare:yb,LucideMonitor:GS,LucideMonitorCheck:LH,LucideMonitorCog:OH,LucideMonitorDot:DH,LucideMonitorDown:RH,LucideMonitorOff:FH,LucideMonitorPause:zH,LucideMonitorPlay:BH,LucideMonitorSmartphone:$H,LucideMonitorSpeaker:UH,LucideMonitorStop:qH,LucideMonitorUp:VH,LucideMonitorX:HH,LucideMoon:GH,LucideMoonStar:WH,LucideMoreHorizontal:Zm,LucideMoreVertical:gy,LucideMountain:ZH,LucideMountainSnow:KH,LucideMouse:tW,LucideMouseOff:YH,LucideMousePointer:eW,LucideMousePointer2:XH,LucideMousePointerBan:QH,LucideMousePointerClick:JH,LucideMousePointerSquareDashed:ob,LucideMove:pW,LucideMove3D:y2,LucideMove3d:y2,LucideMoveDiagonal:nW,LucideMoveDiagonal2:rW,LucideMoveDown:aW,LucideMoveDownLeft:sW,LucideMoveDownRight:iW,LucideMoveHorizontal:oW,LucideMoveLeft:lW,LucideMoveRight:cW,LucideMoveUp:hW,LucideMoveUpLeft:dW,LucideMoveUpRight:uW,LucideMoveVertical:fW,LucideMusic:xW,LucideMusic2:mW,LucideMusic3:gW,LucideMusic4:yW,LucideNavigation:xT,LucideNavigation2:_W,LucideNavigation2Off:vW,LucideNavigationOff:bW,LucideNetwork:wW,LucideNewspaper:Ay,LucideNfc:jW,LucideNotebook:CW,LucideNotebookPen:kW,LucideNotebookTabs:NW,LucideNotebookText:SW,LucideNotepadText:TW,LucideNotepadTextDashed:MW,LucideNut:EW,LucideNutOff:AW,LucideOctagon:PW,LucideOctagonAlert:x2,LucideOctagonMinus:IW,LucideOctagonPause:v2,LucideOctagonX:_2,LucideOmega:LW,LucideOption:OW,LucideOrbit:DW,LucideOrigami:RW,LucideOutdent:u2,LucidePackage:Tl,LucidePackage2:FW,LucidePackageCheck:zW,LucidePackageMinus:BW,LucidePackageOpen:$W,LucidePackagePlus:UW,LucidePackageSearch:qW,LucidePackageX:VW,LucidePaintBucket:HW,LucidePaintRoller:WW,LucidePaintbrush:GW,LucidePaintbrush2:b2,LucidePaintbrushVertical:b2,LucidePalette:Gd,LucidePalmtree:zb,LucidePanelBottom:YW,LucidePanelBottomClose:KW,LucidePanelBottomDashed:w2,LucidePanelBottomInactive:w2,LucidePanelBottomOpen:ZW,LucidePanelLeft:S2,LucidePanelLeftClose:j2,LucidePanelLeftDashed:k2,LucidePanelLeftInactive:k2,LucidePanelLeftOpen:N2,LucidePanelRight:JW,LucidePanelRightClose:XW,LucidePanelRightDashed:C2,LucidePanelRightInactive:C2,LucidePanelRightOpen:QW,LucidePanelTop:rG,LucidePanelTopClose:eG,LucidePanelTopDashed:M2,LucidePanelTopInactive:M2,LucidePanelTopOpen:tG,LucidePanelsLeftBottom:nG,LucidePanelsLeftRight:H_,LucidePanelsRightBottom:sG,LucidePanelsTopBottom:L2,LucidePanelsTopLeft:Yx,LucidePaperclip:iG,LucideParentheses:aG,LucideParkingCircle:A_,LucideParkingCircleOff:T_,LucideParkingMeter:oG,LucideParkingSquare:_b,LucideParkingSquareOff:vb,LucidePartyPopper:$h,LucidePause:zf,LucidePauseCircle:E_,LucidePauseOctagon:v2,LucidePawPrint:lG,LucidePcCase:cG,LucidePen:Xx,LucidePenBox:Jl,LucidePenLine:T2,LucidePenOff:dG,LucidePenSquare:Jl,LucidePenTool:KS,LucidePencil:ma,LucidePencilLine:uG,LucidePencilOff:hG,LucidePencilRuler:fG,LucidePentagon:pG,LucidePercent:ZS,LucidePercentCircle:I_,LucidePercentDiamond:G_,LucidePercentSquare:bb,LucidePersonStanding:mG,LucidePhilippinePeso:gG,LucidePhone:Wa,LucidePhoneCall:yG,LucidePhoneForwarded:xG,LucidePhoneIncoming:vG,LucidePhoneMissed:_G,LucidePhoneOff:bG,LucidePhoneOutgoing:wG,LucidePi:jG,LucidePiSquare:wb,LucidePiano:kG,LucidePickaxe:NG,LucidePictureInPicture:CG,LucidePictureInPicture2:SG,LucidePieChart:h_,LucidePiggyBank:MG,LucidePilcrow:EG,LucidePilcrowLeft:TG,LucidePilcrowRight:AG,LucidePilcrowSquare:jb,LucidePill:PG,LucidePillBottle:IG,LucidePin:X0,LucidePinOff:vT,LucidePipette:LG,LucidePizza:OG,LucidePlane:FG,LucidePlaneLanding:DG,LucidePlaneTakeoff:RG,LucidePlay:wc,LucidePlayCircle:Sf,LucidePlaySquare:kb,LucidePlug:BG,LucidePlug2:zG,LucidePlugZap:A2,LucidePlugZap2:A2,LucidePlus:Sn,LucidePlusCircle:P_,LucidePlusSquare:Nb,LucidePocket:UG,LucidePocketKnife:$G,LucidePodcast:qG,LucidePointer:HG,LucidePointerOff:VG,LucidePopcorn:WG,LucidePopsicle:GG,LucidePoundSterling:KG,LucidePower:YG,LucidePowerCircle:L_,LucidePowerOff:ZG,LucidePowerSquare:Sb,LucidePresentation:XG,LucidePrinter:JG,LucidePrinterCheck:QG,LucideProjector:eK,LucideProportions:tK,LucidePuzzle:rK,LucidePyramid:nK,LucideQrCode:sK,LucideQuote:iK,LucideRabbit:aK,LucideRadar:oK,LucideRadiation:lK,LucideRadical:cK,LucideRadio:Hw,LucideRadioReceiver:dK,LucideRadioTower:uK,LucideRadius:hK,LucideRailSymbol:fK,LucideRainbow:pK,LucideRat:mK,LucideRatio:gK,LucideReceipt:NK,LucideReceiptCent:yK,LucideReceiptEuro:xK,LucideReceiptIndianRupee:vK,LucideReceiptJapaneseYen:_K,LucideReceiptPoundSterling:bK,LucideReceiptRussianRuble:wK,LucideReceiptSwissFranc:jK,LucideReceiptText:kK,LucideRectangleEllipsis:E2,LucideRectangleHorizontal:SK,LucideRectangleVertical:CK,LucideRecycle:MK,LucideRedo:YS,LucideRedo2:TK,LucideRedoDot:AK,LucideRefreshCcw:IK,LucideRefreshCcwDot:EK,LucideRefreshCw:Dl,LucideRefreshCwOff:PK,LucideRefrigerator:LK,LucideRegex:OK,LucideRemoveFormatting:DK,LucideRepeat:zK,LucideRepeat1:RK,LucideRepeat2:FK,LucideReplace:$K,LucideReplaceAll:BK,LucideReply:_T,LucideReplyAll:UK,LucideRewind:qK,LucideRibbon:VK,LucideRocket:cg,LucideRockingChair:HK,LucideRollerCoaster:WK,LucideRotate3D:I2,LucideRotate3d:I2,LucideRotateCcw:XS,LucideRotateCcwSquare:GK,LucideRotateCw:bT,LucideRotateCwSquare:KK,LucideRoute:YK,LucideRouteOff:ZK,LucideRouter:XK,LucideRows:P2,LucideRows2:P2,LucideRows3:L2,LucideRows4:QK,LucideRss:JK,LucideRuler:eZ,LucideRussianRuble:tZ,LucideSailboat:rZ,LucideSalad:nZ,LucideSandwich:sZ,LucideSatellite:aZ,LucideSatelliteDish:iZ,LucideSave:dg,LucideSaveAll:oZ,LucideSaveOff:lZ,LucideScale:cZ,LucideScale3D:O2,LucideScale3d:O2,LucideScaling:dZ,LucideScan:xZ,LucideScanBarcode:uZ,LucideScanEye:hZ,LucideScanFace:fZ,LucideScanLine:pZ,LucideScanQrCode:mZ,LucideScanSearch:gZ,LucideScanText:yZ,LucideScatterChart:f_,LucideSchool:vZ,LucideSchool2:$b,LucideScissors:bZ,LucideScissorsLineDashed:_Z,LucideScissorsSquare:Cb,LucideScissorsSquareDashedBottom:J2,LucideScreenShare:jZ,LucideScreenShareOff:wZ,LucideScroll:NZ,LucideScrollText:kZ,LucideSearch:Ti,LucideSearchCheck:SZ,LucideSearchCode:CZ,LucideSearchSlash:MZ,LucideSearchX:TZ,LucideSection:AZ,LucideSend:To,LucideSendHorizonal:D2,LucideSendHorizontal:D2,LucideSendToBack:EZ,LucideSeparatorHorizontal:IZ,LucideSeparatorVertical:PZ,LucideServer:RZ,LucideServerCog:LZ,LucideServerCrash:OZ,LucideServerOff:DZ,LucideSettings:id,LucideSettings2:FZ,LucideShapes:zZ,LucideShare:wT,LucideShare2:Kd,LucideSheet:BZ,LucideShell:$Z,LucideShield:sm,LucideShieldAlert:UZ,LucideShieldBan:qZ,LucideShieldCheck:jT,LucideShieldClose:R2,LucideShieldEllipsis:VZ,LucideShieldHalf:HZ,LucideShieldMinus:WZ,LucideShieldOff:GZ,LucideShieldPlus:KZ,LucideShieldQuestion:ZZ,LucideShieldX:R2,LucideShip:XZ,LucideShipWheel:YZ,LucideShirt:QZ,LucideShoppingBag:ug,LucideShoppingBasket:JZ,LucideShoppingCart:sh,LucideShovel:eY,LucideShowerHead:tY,LucideShrink:rY,LucideShrub:nY,LucideShuffle:sY,LucideSidebar:S2,LucideSidebarClose:j2,LucideSidebarOpen:N2,LucideSigma:iY,LucideSigmaSquare:Mb,LucideSignal:dY,LucideSignalHigh:aY,LucideSignalLow:oY,LucideSignalMedium:lY,LucideSignalZero:cY,LucideSignature:uY,LucideSignpost:fY,LucideSignpostBig:hY,LucideSiren:pY,LucideSkipBack:mY,LucideSkipForward:gY,LucideSkull:yY,LucideSlack:xY,LucideSlash:vY,LucideSlashSquare:Tb,LucideSlice:_Y,LucideSliders:F2,LucideSlidersHorizontal:kT,LucideSlidersVertical:F2,LucideSmartphone:Q0,LucideSmartphoneCharging:bY,LucideSmartphoneNfc:wY,LucideSmile:kY,LucideSmilePlus:jY,LucideSnail:NY,LucideSnowflake:SY,LucideSofa:CY,LucideSortAsc:Gv,LucideSortDesc:Vv,LucideSoup:MY,LucideSpace:TY,LucideSpade:AY,LucideSparkle:EY,LucideSparkles:Mi,LucideSpeaker:IY,LucideSpeech:PY,LucideSpellCheck:OY,LucideSpellCheck2:LY,LucideSpline:DY,LucideSplit:RY,LucideSplitSquareHorizontal:Ab,LucideSplitSquareVertical:Eb,LucideSprayCan:FY,LucideSprout:zY,LucideSquare:im,LucideSquareActivity:z2,LucideSquareArrowDown:U2,LucideSquareArrowDownLeft:B2,LucideSquareArrowDownRight:$2,LucideSquareArrowLeft:q2,LucideSquareArrowOutDownLeft:V2,LucideSquareArrowOutDownRight:H2,LucideSquareArrowOutUpLeft:W2,LucideSquareArrowOutUpRight:G2,LucideSquareArrowRight:K2,LucideSquareArrowUp:X2,LucideSquareArrowUpLeft:Z2,LucideSquareArrowUpRight:Y2,LucideSquareAsterisk:Q2,LucideSquareBottomDashedScissors:J2,LucideSquareChartGantt:Bm,LucideSquareCheck:eb,LucideSquareCheckBig:Qx,LucideSquareChevronDown:tb,LucideSquareChevronLeft:rb,LucideSquareChevronRight:nb,LucideSquareChevronUp:sb,LucideSquareCode:ib,LucideSquareDashed:lb,LucideSquareDashedBottom:$Y,LucideSquareDashedBottomCode:BY,LucideSquareDashedKanban:ab,LucideSquareDashedMousePointer:ob,LucideSquareDivide:cb,LucideSquareDot:db,LucideSquareEqual:ub,LucideSquareFunction:hb,LucideSquareGanttChart:Bm,LucideSquareKanban:fb,LucideSquareLibrary:pb,LucideSquareM:mb,LucideSquareMenu:gb,LucideSquareMinus:yb,LucideSquareMousePointer:xb,LucideSquareParking:_b,LucideSquareParkingOff:vb,LucideSquarePen:Jl,LucideSquarePercent:bb,LucideSquarePi:wb,LucideSquarePilcrow:jb,LucideSquarePlay:kb,LucideSquarePlus:Nb,LucideSquarePower:Sb,LucideSquareRadical:UY,LucideSquareScissors:Cb,LucideSquareSigma:Mb,LucideSquareSlash:Tb,LucideSquareSplitHorizontal:Ab,LucideSquareSplitVertical:Eb,LucideSquareSquare:qY,LucideSquareStack:VY,LucideSquareTerminal:Ib,LucideSquareUser:Lb,LucideSquareUserRound:Pb,LucideSquareX:Ob,LucideSquircle:HY,LucideSquirrel:WY,LucideStamp:GY,LucideStar:Ca,LucideStarHalf:KY,LucideStarOff:ZY,LucideStars:Mi,LucideStepBack:YY,LucideStepForward:XY,LucideStethoscope:QY,LucideSticker:JY,LucideStickyNote:eX,LucideStopCircle:D_,LucideStore:tX,LucideStretchHorizontal:rX,LucideStretchVertical:nX,LucideStrikethrough:sX,LucideSubscript:iX,LucideSubtitles:t_,LucideSun:Ww,LucideSunDim:aX,LucideSunMedium:oX,LucideSunMoon:lX,LucideSunSnow:cX,LucideSunrise:dX,LucideSunset:uX,LucideSuperscript:hX,LucideSwatchBook:fX,LucideSwissFranc:pX,LucideSwitchCamera:mX,LucideSword:gX,LucideSwords:yX,LucideSyringe:xX,LucideTable:NX,LucideTable2:NT,LucideTableCellsMerge:vX,LucideTableCellsSplit:_X,LucideTableColumnsSplit:bX,LucideTableOfContents:wX,LucideTableProperties:jX,LucideTableRowsSplit:kX,LucideTablet:CX,LucideTabletSmartphone:SX,LucideTablets:MX,LucideTag:Gw,LucideTags:TX,LucideTally1:AX,LucideTally2:EX,LucideTally3:IX,LucideTally4:PX,LucideTally5:LX,LucideTangent:OX,LucideTarget:Ey,LucideTelescope:DX,LucideTent:FX,LucideTentTree:RX,LucideTerminal:zX,LucideTerminalSquare:Ib,LucideTestTube:BX,LucideTestTube2:Db,LucideTestTubeDiagonal:Db,LucideTestTubes:$X,LucideText:WX,LucideTextCursor:qX,LucideTextCursorInput:UX,LucideTextQuote:VX,LucideTextSearch:HX,LucideTextSelect:Rb,LucideTextSelection:Rb,LucideTheater:GX,LucideThermometer:YX,LucideThermometerSnowflake:KX,LucideThermometerSun:ZX,LucideThumbsDown:ST,LucideThumbsUp:Zd,LucideTicket:CT,LucideTicketCheck:XX,LucideTicketMinus:QX,LucideTicketPercent:JX,LucideTicketPlus:eQ,LucideTicketSlash:tQ,LucideTicketX:rQ,LucideTickets:sQ,LucideTicketsPlane:nQ,LucideTimer:oQ,LucideTimerOff:iQ,LucideTimerReset:aQ,LucideToggleLeft:lQ,LucideToggleRight:cQ,LucideToilet:dQ,LucideTornado:uQ,LucideTorus:hQ,LucideTouchpad:pQ,LucideTouchpadOff:fQ,LucideTowerControl:mQ,LucideToyBrick:gQ,LucideTractor:yQ,LucideTrafficCone:xQ,LucideTrain:Fb,LucideTrainFront:_Q,LucideTrainFrontTunnel:vQ,LucideTrainTrack:bQ,LucideTramFront:Fb,LucideTrash:wQ,LucideTrash2:Xn,LucideTreeDeciduous:jQ,LucideTreePalm:zb,LucideTreePine:kQ,LucideTrees:NQ,LucideTrello:SQ,LucideTrendingDown:Kw,LucideTrendingUp:Bf,LucideTrendingUpDown:CQ,LucideTriangle:TQ,LucideTriangleAlert:Ph,LucideTriangleRight:MQ,LucideTrophy:qa,LucideTruck:MT,LucideTurtle:AQ,LucideTv:IQ,LucideTv2:Bb,LucideTvMinimal:Bb,LucideTvMinimalPlay:EQ,LucideTwitch:PQ,LucideTwitter:LQ,LucideType:DQ,LucideTypeOutline:OQ,LucideUmbrella:FQ,LucideUmbrellaOff:RQ,LucideUnderline:zQ,LucideUndo:QS,LucideUndo2:BQ,LucideUndoDot:$Q,LucideUnfoldHorizontal:UQ,LucideUnfoldVertical:qQ,LucideUngroup:VQ,LucideUniversity:$b,LucideUnlink:TT,LucideUnlink2:HQ,LucideUnlock:m2,LucideUnlockKeyhole:p2,LucideUnplug:WQ,LucideUpload:Ao,LucideUploadCloud:U_,LucideUsb:GQ,LucideUser:jc,LucideUser2:Gb,LucideUserCheck:Zw,LucideUserCheck2:Ub,LucideUserCircle:F_,LucideUserCircle2:R_,LucideUserCog:AT,LucideUserCog2:qb,LucideUserMinus:KQ,LucideUserMinus2:Vb,LucideUserPen:ZQ,LucideUserPlus:J0,LucideUserPlus2:Hb,LucideUserRound:Gb,LucideUserRoundCheck:Ub,LucideUserRoundCog:qb,LucideUserRoundMinus:Vb,LucideUserRoundPen:YQ,LucideUserRoundPlus:Hb,LucideUserRoundSearch:XQ,LucideUserRoundX:Wb,LucideUserSearch:QQ,LucideUserSquare:Lb,LucideUserSquare2:Pb,LucideUserX:JQ,LucideUserX2:Wb,LucideUsers:hs,LucideUsers2:Kb,LucideUsersRound:Kb,LucideUtensils:Yb,LucideUtensilsCrossed:Zb,LucideUtilityPole:eJ,LucideVariable:ET,LucideVault:tJ,LucideVegan:rJ,LucideVenetianMask:nJ,LucideVerified:Yv,LucideVibrate:iJ,LucideVibrateOff:sJ,LucideVideo:Gi,LucideVideoOff:aJ,LucideVideotape:oJ,LucideView:lJ,LucideVoicemail:cJ,LucideVolleyball:dJ,LucideVolume:mJ,LucideVolume1:uJ,LucideVolume2:hJ,LucideVolumeOff:fJ,LucideVolumeX:pJ,LucideVote:gJ,LucideWallet:xJ,LucideWallet2:Xb,LucideWalletCards:yJ,LucideWalletMinimal:Xb,LucideWallpaper:vJ,LucideWand:_J,LucideWand2:Qb,LucideWandSparkles:Qb,LucideWarehouse:bJ,LucideWashingMachine:wJ,LucideWatch:jJ,LucideWaves:kJ,LucideWaypoints:NJ,LucideWebcam:SJ,LucideWebhook:MJ,LucideWebhookOff:CJ,LucideWeight:TJ,LucideWheat:EJ,LucideWheatOff:AJ,LucideWholeWord:IJ,LucideWifi:RJ,LucideWifiHigh:PJ,LucideWifiLow:LJ,LucideWifiOff:OJ,LucideWifiZero:DJ,LucideWind:zJ,LucideWindArrowDown:FJ,LucideWine:$J,LucideWineOff:BJ,LucideWorkflow:UJ,LucideWorm:qJ,LucideWrapText:VJ,LucideWrench:Iy,LucideX:Ms,LucideXCircle:Lc,LucideXOctagon:_2,LucideXSquare:Ob,LucideYoutube:HJ,LucideZap:e1,LucideZapOff:WJ,LucideZoomIn:JS,LucideZoomOut:e4,Luggage:NV,LuggageIcon:NV,MSquare:mb,MSquareIcon:mb,Magnet:SV,MagnetIcon:SV,Mail:di,MailCheck:CV,MailCheckIcon:CV,MailIcon:di,MailMinus:MV,MailMinusIcon:MV,MailOpen:TV,MailOpenIcon:TV,MailPlus:AV,MailPlusIcon:AV,MailQuestion:EV,MailQuestionIcon:EV,MailSearch:IV,MailSearchIcon:IV,MailWarning:PV,MailWarningIcon:PV,MailX:pT,MailXIcon:pT,Mailbox:LV,MailboxIcon:LV,Mails:OV,MailsIcon:OV,Map:GV,MapIcon:GV,MapPin:yl,MapPinCheck:RV,MapPinCheckIcon:RV,MapPinCheckInside:DV,MapPinCheckInsideIcon:DV,MapPinHouse:FV,MapPinHouseIcon:FV,MapPinIcon:yl,MapPinMinus:BV,MapPinMinusIcon:BV,MapPinMinusInside:zV,MapPinMinusInsideIcon:zV,MapPinOff:$V,MapPinOffIcon:$V,MapPinPlus:qV,MapPinPlusIcon:qV,MapPinPlusInside:UV,MapPinPlusInsideIcon:UV,MapPinX:HV,MapPinXIcon:HV,MapPinXInside:VV,MapPinXInsideIcon:VV,MapPinned:WV,MapPinnedIcon:WV,Martini:KV,MartiniIcon:KV,Maximize:Z0,Maximize2:ZV,Maximize2Icon:ZV,MaximizeIcon:Z0,Medal:Ty,MedalIcon:Ty,Megaphone:nm,MegaphoneIcon:nm,MegaphoneOff:YV,MegaphoneOffIcon:YV,Meh:XV,MehIcon:XV,MemoryStick:QV,MemoryStickIcon:QV,Menu:mT,MenuIcon:mT,MenuSquare:gb,MenuSquareIcon:gb,Merge:JV,MergeIcon:JV,MessageCircle:Hl,MessageCircleCode:eH,MessageCircleCodeIcon:eH,MessageCircleDashed:tH,MessageCircleDashedIcon:tH,MessageCircleHeart:rH,MessageCircleHeartIcon:rH,MessageCircleIcon:Hl,MessageCircleMore:nH,MessageCircleMoreIcon:nH,MessageCircleOff:sH,MessageCircleOffIcon:sH,MessageCirclePlus:iH,MessageCirclePlusIcon:iH,MessageCircleQuestion:gT,MessageCircleQuestionIcon:gT,MessageCircleReply:aH,MessageCircleReplyIcon:aH,MessageCircleWarning:oH,MessageCircleWarningIcon:oH,MessageCircleX:lH,MessageCircleXIcon:lH,MessageSquare:Wl,MessageSquareCode:cH,MessageSquareCodeIcon:cH,MessageSquareDashed:dH,MessageSquareDashedIcon:dH,MessageSquareDiff:uH,MessageSquareDiffIcon:uH,MessageSquareDot:hH,MessageSquareDotIcon:hH,MessageSquareHeart:fH,MessageSquareHeartIcon:fH,MessageSquareIcon:Wl,MessageSquareLock:pH,MessageSquareLockIcon:pH,MessageSquareMore:mH,MessageSquareMoreIcon:mH,MessageSquareOff:gH,MessageSquareOffIcon:gH,MessageSquarePlus:yH,MessageSquarePlusIcon:yH,MessageSquareQuote:xH,MessageSquareQuoteIcon:xH,MessageSquareReply:vH,MessageSquareReplyIcon:vH,MessageSquareShare:_H,MessageSquareShareIcon:_H,MessageSquareText:bH,MessageSquareTextIcon:bH,MessageSquareWarning:wH,MessageSquareWarningIcon:wH,MessageSquareX:jH,MessageSquareXIcon:jH,MessagesSquare:kH,MessagesSquareIcon:kH,Mic:yT,Mic2:g2,Mic2Icon:g2,MicIcon:yT,MicOff:NH,MicOffIcon:NH,MicVocal:g2,MicVocalIcon:g2,Microchip:SH,MicrochipIcon:SH,Microscope:CH,MicroscopeIcon:CH,Microwave:MH,MicrowaveIcon:MH,Milestone:TH,MilestoneIcon:TH,Milk:EH,MilkIcon:EH,MilkOff:AH,MilkOffIcon:AH,Minimize:PH,Minimize2:IH,Minimize2Icon:IH,MinimizeIcon:PH,Minus:Y0,MinusCircle:M_,MinusCircleIcon:M_,MinusIcon:Y0,MinusSquare:yb,MinusSquareIcon:yb,Monitor:GS,MonitorCheck:LH,MonitorCheckIcon:LH,MonitorCog:OH,MonitorCogIcon:OH,MonitorDot:DH,MonitorDotIcon:DH,MonitorDown:RH,MonitorDownIcon:RH,MonitorIcon:GS,MonitorOff:FH,MonitorOffIcon:FH,MonitorPause:zH,MonitorPauseIcon:zH,MonitorPlay:BH,MonitorPlayIcon:BH,MonitorSmartphone:$H,MonitorSmartphoneIcon:$H,MonitorSpeaker:UH,MonitorSpeakerIcon:UH,MonitorStop:qH,MonitorStopIcon:qH,MonitorUp:VH,MonitorUpIcon:VH,MonitorX:HH,MonitorXIcon:HH,Moon:GH,MoonIcon:GH,MoonStar:WH,MoonStarIcon:WH,MoreHorizontal:Zm,MoreHorizontalIcon:Zm,MoreVertical:gy,MoreVerticalIcon:gy,Mountain:ZH,MountainIcon:ZH,MountainSnow:KH,MountainSnowIcon:KH,Mouse:tW,MouseIcon:tW,MouseOff:YH,MouseOffIcon:YH,MousePointer:eW,MousePointer2:XH,MousePointer2Icon:XH,MousePointerBan:QH,MousePointerBanIcon:QH,MousePointerClick:JH,MousePointerClickIcon:JH,MousePointerIcon:eW,MousePointerSquareDashed:ob,MousePointerSquareDashedIcon:ob,Move:pW,Move3D:y2,Move3DIcon:y2,Move3d:y2,Move3dIcon:y2,MoveDiagonal:nW,MoveDiagonal2:rW,MoveDiagonal2Icon:rW,MoveDiagonalIcon:nW,MoveDown:aW,MoveDownIcon:aW,MoveDownLeft:sW,MoveDownLeftIcon:sW,MoveDownRight:iW,MoveDownRightIcon:iW,MoveHorizontal:oW,MoveHorizontalIcon:oW,MoveIcon:pW,MoveLeft:lW,MoveLeftIcon:lW,MoveRight:cW,MoveRightIcon:cW,MoveUp:hW,MoveUpIcon:hW,MoveUpLeft:dW,MoveUpLeftIcon:dW,MoveUpRight:uW,MoveUpRightIcon:uW,MoveVertical:fW,MoveVerticalIcon:fW,Music:xW,Music2:mW,Music2Icon:mW,Music3:gW,Music3Icon:gW,Music4:yW,Music4Icon:yW,MusicIcon:xW,Navigation:xT,Navigation2:_W,Navigation2Icon:_W,Navigation2Off:vW,Navigation2OffIcon:vW,NavigationIcon:xT,NavigationOff:bW,NavigationOffIcon:bW,Network:wW,NetworkIcon:wW,Newspaper:Ay,NewspaperIcon:Ay,Nfc:jW,NfcIcon:jW,Notebook:CW,NotebookIcon:CW,NotebookPen:kW,NotebookPenIcon:kW,NotebookTabs:NW,NotebookTabsIcon:NW,NotebookText:SW,NotebookTextIcon:SW,NotepadText:TW,NotepadTextDashed:MW,NotepadTextDashedIcon:MW,NotepadTextIcon:TW,Nut:EW,NutIcon:EW,NutOff:AW,NutOffIcon:AW,Octagon:PW,OctagonAlert:x2,OctagonAlertIcon:x2,OctagonIcon:PW,OctagonMinus:IW,OctagonMinusIcon:IW,OctagonPause:v2,OctagonPauseIcon:v2,OctagonX:_2,OctagonXIcon:_2,Omega:LW,OmegaIcon:LW,Option:OW,OptionIcon:OW,Orbit:DW,OrbitIcon:DW,Origami:RW,OrigamiIcon:RW,Outdent:u2,OutdentIcon:u2,Package:Tl,Package2:FW,Package2Icon:FW,PackageCheck:zW,PackageCheckIcon:zW,PackageIcon:Tl,PackageMinus:BW,PackageMinusIcon:BW,PackageOpen:$W,PackageOpenIcon:$W,PackagePlus:UW,PackagePlusIcon:UW,PackageSearch:qW,PackageSearchIcon:qW,PackageX:VW,PackageXIcon:VW,PaintBucket:HW,PaintBucketIcon:HW,PaintRoller:WW,PaintRollerIcon:WW,Paintbrush:GW,Paintbrush2:b2,Paintbrush2Icon:b2,PaintbrushIcon:GW,PaintbrushVertical:b2,PaintbrushVerticalIcon:b2,Palette:Gd,PaletteIcon:Gd,Palmtree:zb,PalmtreeIcon:zb,PanelBottom:YW,PanelBottomClose:KW,PanelBottomCloseIcon:KW,PanelBottomDashed:w2,PanelBottomDashedIcon:w2,PanelBottomIcon:YW,PanelBottomInactive:w2,PanelBottomInactiveIcon:w2,PanelBottomOpen:ZW,PanelBottomOpenIcon:ZW,PanelLeft:S2,PanelLeftClose:j2,PanelLeftCloseIcon:j2,PanelLeftDashed:k2,PanelLeftDashedIcon:k2,PanelLeftIcon:S2,PanelLeftInactive:k2,PanelLeftInactiveIcon:k2,PanelLeftOpen:N2,PanelLeftOpenIcon:N2,PanelRight:JW,PanelRightClose:XW,PanelRightCloseIcon:XW,PanelRightDashed:C2,PanelRightDashedIcon:C2,PanelRightIcon:JW,PanelRightInactive:C2,PanelRightInactiveIcon:C2,PanelRightOpen:QW,PanelRightOpenIcon:QW,PanelTop:rG,PanelTopClose:eG,PanelTopCloseIcon:eG,PanelTopDashed:M2,PanelTopDashedIcon:M2,PanelTopIcon:rG,PanelTopInactive:M2,PanelTopInactiveIcon:M2,PanelTopOpen:tG,PanelTopOpenIcon:tG,PanelsLeftBottom:nG,PanelsLeftBottomIcon:nG,PanelsLeftRight:H_,PanelsLeftRightIcon:H_,PanelsRightBottom:sG,PanelsRightBottomIcon:sG,PanelsTopBottom:L2,PanelsTopBottomIcon:L2,PanelsTopLeft:Yx,PanelsTopLeftIcon:Yx,Paperclip:iG,PaperclipIcon:iG,Parentheses:aG,ParenthesesIcon:aG,ParkingCircle:A_,ParkingCircleIcon:A_,ParkingCircleOff:T_,ParkingCircleOffIcon:T_,ParkingMeter:oG,ParkingMeterIcon:oG,ParkingSquare:_b,ParkingSquareIcon:_b,ParkingSquareOff:vb,ParkingSquareOffIcon:vb,PartyPopper:$h,PartyPopperIcon:$h,Pause:zf,PauseCircle:E_,PauseCircleIcon:E_,PauseIcon:zf,PauseOctagon:v2,PauseOctagonIcon:v2,PawPrint:lG,PawPrintIcon:lG,PcCase:cG,PcCaseIcon:cG,Pen:Xx,PenBox:Jl,PenBoxIcon:Jl,PenIcon:Xx,PenLine:T2,PenLineIcon:T2,PenOff:dG,PenOffIcon:dG,PenSquare:Jl,PenSquareIcon:Jl,PenTool:KS,PenToolIcon:KS,Pencil:ma,PencilIcon:ma,PencilLine:uG,PencilLineIcon:uG,PencilOff:hG,PencilOffIcon:hG,PencilRuler:fG,PencilRulerIcon:fG,Pentagon:pG,PentagonIcon:pG,Percent:ZS,PercentCircle:I_,PercentCircleIcon:I_,PercentDiamond:G_,PercentDiamondIcon:G_,PercentIcon:ZS,PercentSquare:bb,PercentSquareIcon:bb,PersonStanding:mG,PersonStandingIcon:mG,PhilippinePeso:gG,PhilippinePesoIcon:gG,Phone:Wa,PhoneCall:yG,PhoneCallIcon:yG,PhoneForwarded:xG,PhoneForwardedIcon:xG,PhoneIcon:Wa,PhoneIncoming:vG,PhoneIncomingIcon:vG,PhoneMissed:_G,PhoneMissedIcon:_G,PhoneOff:bG,PhoneOffIcon:bG,PhoneOutgoing:wG,PhoneOutgoingIcon:wG,Pi:jG,PiIcon:jG,PiSquare:wb,PiSquareIcon:wb,Piano:kG,PianoIcon:kG,Pickaxe:NG,PickaxeIcon:NG,PictureInPicture:CG,PictureInPicture2:SG,PictureInPicture2Icon:SG,PictureInPictureIcon:CG,PieChart:h_,PieChartIcon:h_,PiggyBank:MG,PiggyBankIcon:MG,Pilcrow:EG,PilcrowIcon:EG,PilcrowLeft:TG,PilcrowLeftIcon:TG,PilcrowRight:AG,PilcrowRightIcon:AG,PilcrowSquare:jb,PilcrowSquareIcon:jb,Pill:PG,PillBottle:IG,PillBottleIcon:IG,PillIcon:PG,Pin:X0,PinIcon:X0,PinOff:vT,PinOffIcon:vT,Pipette:LG,PipetteIcon:LG,Pizza:OG,PizzaIcon:OG,Plane:FG,PlaneIcon:FG,PlaneLanding:DG,PlaneLandingIcon:DG,PlaneTakeoff:RG,PlaneTakeoffIcon:RG,Play:wc,PlayCircle:Sf,PlayCircleIcon:Sf,PlayIcon:wc,PlaySquare:kb,PlaySquareIcon:kb,Plug:BG,Plug2:zG,Plug2Icon:zG,PlugIcon:BG,PlugZap:A2,PlugZap2:A2,PlugZap2Icon:A2,PlugZapIcon:A2,Plus:Sn,PlusCircle:P_,PlusCircleIcon:P_,PlusIcon:Sn,PlusSquare:Nb,PlusSquareIcon:Nb,Pocket:UG,PocketIcon:UG,PocketKnife:$G,PocketKnifeIcon:$G,Podcast:qG,PodcastIcon:qG,Pointer:HG,PointerIcon:HG,PointerOff:VG,PointerOffIcon:VG,Popcorn:WG,PopcornIcon:WG,Popsicle:GG,PopsicleIcon:GG,PoundSterling:KG,PoundSterlingIcon:KG,Power:YG,PowerCircle:L_,PowerCircleIcon:L_,PowerIcon:YG,PowerOff:ZG,PowerOffIcon:ZG,PowerSquare:Sb,PowerSquareIcon:Sb,Presentation:XG,PresentationIcon:XG,Printer:JG,PrinterCheck:QG,PrinterCheckIcon:QG,PrinterIcon:JG,Projector:eK,ProjectorIcon:eK,Proportions:tK,ProportionsIcon:tK,Puzzle:rK,PuzzleIcon:rK,Pyramid:nK,PyramidIcon:nK,QrCode:sK,QrCodeIcon:sK,Quote:iK,QuoteIcon:iK,Rabbit:aK,RabbitIcon:aK,Radar:oK,RadarIcon:oK,Radiation:lK,RadiationIcon:lK,Radical:cK,RadicalIcon:cK,Radio:Hw,RadioIcon:Hw,RadioReceiver:dK,RadioReceiverIcon:dK,RadioTower:uK,RadioTowerIcon:uK,Radius:hK,RadiusIcon:hK,RailSymbol:fK,RailSymbolIcon:fK,Rainbow:pK,RainbowIcon:pK,Rat:mK,RatIcon:mK,Ratio:gK,RatioIcon:gK,Receipt:NK,ReceiptCent:yK,ReceiptCentIcon:yK,ReceiptEuro:xK,ReceiptEuroIcon:xK,ReceiptIcon:NK,ReceiptIndianRupee:vK,ReceiptIndianRupeeIcon:vK,ReceiptJapaneseYen:_K,ReceiptJapaneseYenIcon:_K,ReceiptPoundSterling:bK,ReceiptPoundSterlingIcon:bK,ReceiptRussianRuble:wK,ReceiptRussianRubleIcon:wK,ReceiptSwissFranc:jK,ReceiptSwissFrancIcon:jK,ReceiptText:kK,ReceiptTextIcon:kK,RectangleEllipsis:E2,RectangleEllipsisIcon:E2,RectangleHorizontal:SK,RectangleHorizontalIcon:SK,RectangleVertical:CK,RectangleVerticalIcon:CK,Recycle:MK,RecycleIcon:MK,Redo:YS,Redo2:TK,Redo2Icon:TK,RedoDot:AK,RedoDotIcon:AK,RedoIcon:YS,RefreshCcw:IK,RefreshCcwDot:EK,RefreshCcwDotIcon:EK,RefreshCcwIcon:IK,RefreshCw:Dl,RefreshCwIcon:Dl,RefreshCwOff:PK,RefreshCwOffIcon:PK,Refrigerator:LK,RefrigeratorIcon:LK,Regex:OK,RegexIcon:OK,RemoveFormatting:DK,RemoveFormattingIcon:DK,Repeat:zK,Repeat1:RK,Repeat1Icon:RK,Repeat2:FK,Repeat2Icon:FK,RepeatIcon:zK,Replace:$K,ReplaceAll:BK,ReplaceAllIcon:BK,ReplaceIcon:$K,Reply:_T,ReplyAll:UK,ReplyAllIcon:UK,ReplyIcon:_T,Rewind:qK,RewindIcon:qK,Ribbon:VK,RibbonIcon:VK,Rocket:cg,RocketIcon:cg,RockingChair:HK,RockingChairIcon:HK,RollerCoaster:WK,RollerCoasterIcon:WK,Rotate3D:I2,Rotate3DIcon:I2,Rotate3d:I2,Rotate3dIcon:I2,RotateCcw:XS,RotateCcwIcon:XS,RotateCcwSquare:GK,RotateCcwSquareIcon:GK,RotateCw:bT,RotateCwIcon:bT,RotateCwSquare:KK,RotateCwSquareIcon:KK,Route:YK,RouteIcon:YK,RouteOff:ZK,RouteOffIcon:ZK,Router:XK,RouterIcon:XK,Rows:P2,Rows2:P2,Rows2Icon:P2,Rows3:L2,Rows3Icon:L2,Rows4:QK,Rows4Icon:QK,RowsIcon:P2,Rss:JK,RssIcon:JK,Ruler:eZ,RulerIcon:eZ,RussianRuble:tZ,RussianRubleIcon:tZ,Sailboat:rZ,SailboatIcon:rZ,Salad:nZ,SaladIcon:nZ,Sandwich:sZ,SandwichIcon:sZ,Satellite:aZ,SatelliteDish:iZ,SatelliteDishIcon:iZ,SatelliteIcon:aZ,Save:dg,SaveAll:oZ,SaveAllIcon:oZ,SaveIcon:dg,SaveOff:lZ,SaveOffIcon:lZ,Scale:cZ,Scale3D:O2,Scale3DIcon:O2,Scale3d:O2,Scale3dIcon:O2,ScaleIcon:cZ,Scaling:dZ,ScalingIcon:dZ,Scan:xZ,ScanBarcode:uZ,ScanBarcodeIcon:uZ,ScanEye:hZ,ScanEyeIcon:hZ,ScanFace:fZ,ScanFaceIcon:fZ,ScanIcon:xZ,ScanLine:pZ,ScanLineIcon:pZ,ScanQrCode:mZ,ScanQrCodeIcon:mZ,ScanSearch:gZ,ScanSearchIcon:gZ,ScanText:yZ,ScanTextIcon:yZ,ScatterChart:f_,ScatterChartIcon:f_,School:vZ,School2:$b,School2Icon:$b,SchoolIcon:vZ,Scissors:bZ,ScissorsIcon:bZ,ScissorsLineDashed:_Z,ScissorsLineDashedIcon:_Z,ScissorsSquare:Cb,ScissorsSquareDashedBottom:J2,ScissorsSquareDashedBottomIcon:J2,ScissorsSquareIcon:Cb,ScreenShare:jZ,ScreenShareIcon:jZ,ScreenShareOff:wZ,ScreenShareOffIcon:wZ,Scroll:NZ,ScrollIcon:NZ,ScrollText:kZ,ScrollTextIcon:kZ,Search:Ti,SearchCheck:SZ,SearchCheckIcon:SZ,SearchCode:CZ,SearchCodeIcon:CZ,SearchIcon:Ti,SearchSlash:MZ,SearchSlashIcon:MZ,SearchX:TZ,SearchXIcon:TZ,Section:AZ,SectionIcon:AZ,Send:To,SendHorizonal:D2,SendHorizonalIcon:D2,SendHorizontal:D2,SendHorizontalIcon:D2,SendIcon:To,SendToBack:EZ,SendToBackIcon:EZ,SeparatorHorizontal:IZ,SeparatorHorizontalIcon:IZ,SeparatorVertical:PZ,SeparatorVerticalIcon:PZ,Server:RZ,ServerCog:LZ,ServerCogIcon:LZ,ServerCrash:OZ,ServerCrashIcon:OZ,ServerIcon:RZ,ServerOff:DZ,ServerOffIcon:DZ,Settings:id,Settings2:FZ,Settings2Icon:FZ,SettingsIcon:id,Shapes:zZ,ShapesIcon:zZ,Share:wT,Share2:Kd,Share2Icon:Kd,ShareIcon:wT,Sheet:BZ,SheetIcon:BZ,Shell:$Z,ShellIcon:$Z,Shield:sm,ShieldAlert:UZ,ShieldAlertIcon:UZ,ShieldBan:qZ,ShieldBanIcon:qZ,ShieldCheck:jT,ShieldCheckIcon:jT,ShieldClose:R2,ShieldCloseIcon:R2,ShieldEllipsis:VZ,ShieldEllipsisIcon:VZ,ShieldHalf:HZ,ShieldHalfIcon:HZ,ShieldIcon:sm,ShieldMinus:WZ,ShieldMinusIcon:WZ,ShieldOff:GZ,ShieldOffIcon:GZ,ShieldPlus:KZ,ShieldPlusIcon:KZ,ShieldQuestion:ZZ,ShieldQuestionIcon:ZZ,ShieldX:R2,ShieldXIcon:R2,Ship:XZ,ShipIcon:XZ,ShipWheel:YZ,ShipWheelIcon:YZ,Shirt:QZ,ShirtIcon:QZ,ShoppingBag:ug,ShoppingBagIcon:ug,ShoppingBasket:JZ,ShoppingBasketIcon:JZ,ShoppingCart:sh,ShoppingCartIcon:sh,Shovel:eY,ShovelIcon:eY,ShowerHead:tY,ShowerHeadIcon:tY,Shrink:rY,ShrinkIcon:rY,Shrub:nY,ShrubIcon:nY,Shuffle:sY,ShuffleIcon:sY,Sidebar:S2,SidebarClose:j2,SidebarCloseIcon:j2,SidebarIcon:S2,SidebarOpen:N2,SidebarOpenIcon:N2,Sigma:iY,SigmaIcon:iY,SigmaSquare:Mb,SigmaSquareIcon:Mb,Signal:dY,SignalHigh:aY,SignalHighIcon:aY,SignalIcon:dY,SignalLow:oY,SignalLowIcon:oY,SignalMedium:lY,SignalMediumIcon:lY,SignalZero:cY,SignalZeroIcon:cY,Signature:uY,SignatureIcon:uY,Signpost:fY,SignpostBig:hY,SignpostBigIcon:hY,SignpostIcon:fY,Siren:pY,SirenIcon:pY,SkipBack:mY,SkipBackIcon:mY,SkipForward:gY,SkipForwardIcon:gY,Skull:yY,SkullIcon:yY,Slack:xY,SlackIcon:xY,Slash:vY,SlashIcon:vY,SlashSquare:Tb,SlashSquareIcon:Tb,Slice:_Y,SliceIcon:_Y,Sliders:F2,SlidersHorizontal:kT,SlidersHorizontalIcon:kT,SlidersIcon:F2,SlidersVertical:F2,SlidersVerticalIcon:F2,Smartphone:Q0,SmartphoneCharging:bY,SmartphoneChargingIcon:bY,SmartphoneIcon:Q0,SmartphoneNfc:wY,SmartphoneNfcIcon:wY,Smile:kY,SmileIcon:kY,SmilePlus:jY,SmilePlusIcon:jY,Snail:NY,SnailIcon:NY,Snowflake:SY,SnowflakeIcon:SY,Sofa:CY,SofaIcon:CY,SortAsc:Gv,SortAscIcon:Gv,SortDesc:Vv,SortDescIcon:Vv,Soup:MY,SoupIcon:MY,Space:TY,SpaceIcon:TY,Spade:AY,SpadeIcon:AY,Sparkle:EY,SparkleIcon:EY,Sparkles:Mi,SparklesIcon:Mi,Speaker:IY,SpeakerIcon:IY,Speech:PY,SpeechIcon:PY,SpellCheck:OY,SpellCheck2:LY,SpellCheck2Icon:LY,SpellCheckIcon:OY,Spline:DY,SplineIcon:DY,Split:RY,SplitIcon:RY,SplitSquareHorizontal:Ab,SplitSquareHorizontalIcon:Ab,SplitSquareVertical:Eb,SplitSquareVerticalIcon:Eb,SprayCan:FY,SprayCanIcon:FY,Sprout:zY,SproutIcon:zY,Square:im,SquareActivity:z2,SquareActivityIcon:z2,SquareArrowDown:U2,SquareArrowDownIcon:U2,SquareArrowDownLeft:B2,SquareArrowDownLeftIcon:B2,SquareArrowDownRight:$2,SquareArrowDownRightIcon:$2,SquareArrowLeft:q2,SquareArrowLeftIcon:q2,SquareArrowOutDownLeft:V2,SquareArrowOutDownLeftIcon:V2,SquareArrowOutDownRight:H2,SquareArrowOutDownRightIcon:H2,SquareArrowOutUpLeft:W2,SquareArrowOutUpLeftIcon:W2,SquareArrowOutUpRight:G2,SquareArrowOutUpRightIcon:G2,SquareArrowRight:K2,SquareArrowRightIcon:K2,SquareArrowUp:X2,SquareArrowUpIcon:X2,SquareArrowUpLeft:Z2,SquareArrowUpLeftIcon:Z2,SquareArrowUpRight:Y2,SquareArrowUpRightIcon:Y2,SquareAsterisk:Q2,SquareAsteriskIcon:Q2,SquareBottomDashedScissors:J2,SquareBottomDashedScissorsIcon:J2,SquareChartGantt:Bm,SquareChartGanttIcon:Bm,SquareCheck:eb,SquareCheckBig:Qx,SquareCheckBigIcon:Qx,SquareCheckIcon:eb,SquareChevronDown:tb,SquareChevronDownIcon:tb,SquareChevronLeft:rb,SquareChevronLeftIcon:rb,SquareChevronRight:nb,SquareChevronRightIcon:nb,SquareChevronUp:sb,SquareChevronUpIcon:sb,SquareCode:ib,SquareCodeIcon:ib,SquareDashed:lb,SquareDashedBottom:$Y,SquareDashedBottomCode:BY,SquareDashedBottomCodeIcon:BY,SquareDashedBottomIcon:$Y,SquareDashedIcon:lb,SquareDashedKanban:ab,SquareDashedKanbanIcon:ab,SquareDashedMousePointer:ob,SquareDashedMousePointerIcon:ob,SquareDivide:cb,SquareDivideIcon:cb,SquareDot:db,SquareDotIcon:db,SquareEqual:ub,SquareEqualIcon:ub,SquareFunction:hb,SquareFunctionIcon:hb,SquareGanttChart:Bm,SquareGanttChartIcon:Bm,SquareIcon:im,SquareKanban:fb,SquareKanbanIcon:fb,SquareLibrary:pb,SquareLibraryIcon:pb,SquareM:mb,SquareMIcon:mb,SquareMenu:gb,SquareMenuIcon:gb,SquareMinus:yb,SquareMinusIcon:yb,SquareMousePointer:xb,SquareMousePointerIcon:xb,SquareParking:_b,SquareParkingIcon:_b,SquareParkingOff:vb,SquareParkingOffIcon:vb,SquarePen:Jl,SquarePenIcon:Jl,SquarePercent:bb,SquarePercentIcon:bb,SquarePi:wb,SquarePiIcon:wb,SquarePilcrow:jb,SquarePilcrowIcon:jb,SquarePlay:kb,SquarePlayIcon:kb,SquarePlus:Nb,SquarePlusIcon:Nb,SquarePower:Sb,SquarePowerIcon:Sb,SquareRadical:UY,SquareRadicalIcon:UY,SquareScissors:Cb,SquareScissorsIcon:Cb,SquareSigma:Mb,SquareSigmaIcon:Mb,SquareSlash:Tb,SquareSlashIcon:Tb,SquareSplitHorizontal:Ab,SquareSplitHorizontalIcon:Ab,SquareSplitVertical:Eb,SquareSplitVerticalIcon:Eb,SquareSquare:qY,SquareSquareIcon:qY,SquareStack:VY,SquareStackIcon:VY,SquareTerminal:Ib,SquareTerminalIcon:Ib,SquareUser:Lb,SquareUserIcon:Lb,SquareUserRound:Pb,SquareUserRoundIcon:Pb,SquareX:Ob,SquareXIcon:Ob,Squircle:HY,SquircleIcon:HY,Squirrel:WY,SquirrelIcon:WY,Stamp:GY,StampIcon:GY,Star:Ca,StarHalf:KY,StarHalfIcon:KY,StarIcon:Ca,StarOff:ZY,StarOffIcon:ZY,Stars:Mi,StarsIcon:Mi,StepBack:YY,StepBackIcon:YY,StepForward:XY,StepForwardIcon:XY,Stethoscope:QY,StethoscopeIcon:QY,Sticker:JY,StickerIcon:JY,StickyNote:eX,StickyNoteIcon:eX,StopCircle:D_,StopCircleIcon:D_,Store:tX,StoreIcon:tX,StretchHorizontal:rX,StretchHorizontalIcon:rX,StretchVertical:nX,StretchVerticalIcon:nX,Strikethrough:sX,StrikethroughIcon:sX,Subscript:iX,SubscriptIcon:iX,Subtitles:t_,SubtitlesIcon:t_,Sun:Ww,SunDim:aX,SunDimIcon:aX,SunIcon:Ww,SunMedium:oX,SunMediumIcon:oX,SunMoon:lX,SunMoonIcon:lX,SunSnow:cX,SunSnowIcon:cX,Sunrise:dX,SunriseIcon:dX,Sunset:uX,SunsetIcon:uX,Superscript:hX,SuperscriptIcon:hX,SwatchBook:fX,SwatchBookIcon:fX,SwissFranc:pX,SwissFrancIcon:pX,SwitchCamera:mX,SwitchCameraIcon:mX,Sword:gX,SwordIcon:gX,Swords:yX,SwordsIcon:yX,Syringe:xX,SyringeIcon:xX,Table:NX,Table2:NT,Table2Icon:NT,TableCellsMerge:vX,TableCellsMergeIcon:vX,TableCellsSplit:_X,TableCellsSplitIcon:_X,TableColumnsSplit:bX,TableColumnsSplitIcon:bX,TableIcon:NX,TableOfContents:wX,TableOfContentsIcon:wX,TableProperties:jX,TablePropertiesIcon:jX,TableRowsSplit:kX,TableRowsSplitIcon:kX,Tablet:CX,TabletIcon:CX,TabletSmartphone:SX,TabletSmartphoneIcon:SX,Tablets:MX,TabletsIcon:MX,Tag:Gw,TagIcon:Gw,Tags:TX,TagsIcon:TX,Tally1:AX,Tally1Icon:AX,Tally2:EX,Tally2Icon:EX,Tally3:IX,Tally3Icon:IX,Tally4:PX,Tally4Icon:PX,Tally5:LX,Tally5Icon:LX,Tangent:OX,TangentIcon:OX,Target:Ey,TargetIcon:Ey,Telescope:DX,TelescopeIcon:DX,Tent:FX,TentIcon:FX,TentTree:RX,TentTreeIcon:RX,Terminal:zX,TerminalIcon:zX,TerminalSquare:Ib,TerminalSquareIcon:Ib,TestTube:BX,TestTube2:Db,TestTube2Icon:Db,TestTubeDiagonal:Db,TestTubeDiagonalIcon:Db,TestTubeIcon:BX,TestTubes:$X,TestTubesIcon:$X,Text:WX,TextCursor:qX,TextCursorIcon:qX,TextCursorInput:UX,TextCursorInputIcon:UX,TextIcon:WX,TextQuote:VX,TextQuoteIcon:VX,TextSearch:HX,TextSearchIcon:HX,TextSelect:Rb,TextSelectIcon:Rb,TextSelection:Rb,TextSelectionIcon:Rb,Theater:GX,TheaterIcon:GX,Thermometer:YX,ThermometerIcon:YX,ThermometerSnowflake:KX,ThermometerSnowflakeIcon:KX,ThermometerSun:ZX,ThermometerSunIcon:ZX,ThumbsDown:ST,ThumbsDownIcon:ST,ThumbsUp:Zd,ThumbsUpIcon:Zd,Ticket:CT,TicketCheck:XX,TicketCheckIcon:XX,TicketIcon:CT,TicketMinus:QX,TicketMinusIcon:QX,TicketPercent:JX,TicketPercentIcon:JX,TicketPlus:eQ,TicketPlusIcon:eQ,TicketSlash:tQ,TicketSlashIcon:tQ,TicketX:rQ,TicketXIcon:rQ,Tickets:sQ,TicketsIcon:sQ,TicketsPlane:nQ,TicketsPlaneIcon:nQ,Timer:oQ,TimerIcon:oQ,TimerOff:iQ,TimerOffIcon:iQ,TimerReset:aQ,TimerResetIcon:aQ,ToggleLeft:lQ,ToggleLeftIcon:lQ,ToggleRight:cQ,ToggleRightIcon:cQ,Toilet:dQ,ToiletIcon:dQ,Tornado:uQ,TornadoIcon:uQ,Torus:hQ,TorusIcon:hQ,Touchpad:pQ,TouchpadIcon:pQ,TouchpadOff:fQ,TouchpadOffIcon:fQ,TowerControl:mQ,TowerControlIcon:mQ,ToyBrick:gQ,ToyBrickIcon:gQ,Tractor:yQ,TractorIcon:yQ,TrafficCone:xQ,TrafficConeIcon:xQ,Train:Fb,TrainFront:_Q,TrainFrontIcon:_Q,TrainFrontTunnel:vQ,TrainFrontTunnelIcon:vQ,TrainIcon:Fb,TrainTrack:bQ,TrainTrackIcon:bQ,TramFront:Fb,TramFrontIcon:Fb,Trash:wQ,Trash2:Xn,Trash2Icon:Xn,TrashIcon:wQ,TreeDeciduous:jQ,TreeDeciduousIcon:jQ,TreePalm:zb,TreePalmIcon:zb,TreePine:kQ,TreePineIcon:kQ,Trees:NQ,TreesIcon:NQ,Trello:SQ,TrelloIcon:SQ,TrendingDown:Kw,TrendingDownIcon:Kw,TrendingUp:Bf,TrendingUpDown:CQ,TrendingUpDownIcon:CQ,TrendingUpIcon:Bf,Triangle:TQ,TriangleAlert:Ph,TriangleAlertIcon:Ph,TriangleIcon:TQ,TriangleRight:MQ,TriangleRightIcon:MQ,Trophy:qa,TrophyIcon:qa,Truck:MT,TruckIcon:MT,Turtle:AQ,TurtleIcon:AQ,Tv:IQ,Tv2:Bb,Tv2Icon:Bb,TvIcon:IQ,TvMinimal:Bb,TvMinimalIcon:Bb,TvMinimalPlay:EQ,TvMinimalPlayIcon:EQ,Twitch:PQ,TwitchIcon:PQ,Twitter:LQ,TwitterIcon:LQ,Type:DQ,TypeIcon:DQ,TypeOutline:OQ,TypeOutlineIcon:OQ,Umbrella:FQ,UmbrellaIcon:FQ,UmbrellaOff:RQ,UmbrellaOffIcon:RQ,Underline:zQ,UnderlineIcon:zQ,Undo:QS,Undo2:BQ,Undo2Icon:BQ,UndoDot:$Q,UndoDotIcon:$Q,UndoIcon:QS,UnfoldHorizontal:UQ,UnfoldHorizontalIcon:UQ,UnfoldVertical:qQ,UnfoldVerticalIcon:qQ,Ungroup:VQ,UngroupIcon:VQ,University:$b,UniversityIcon:$b,Unlink:TT,Unlink2:HQ,Unlink2Icon:HQ,UnlinkIcon:TT,Unlock:m2,UnlockIcon:m2,UnlockKeyhole:p2,UnlockKeyholeIcon:p2,Unplug:WQ,UnplugIcon:WQ,Upload:Ao,UploadCloud:U_,UploadCloudIcon:U_,UploadIcon:Ao,Usb:GQ,UsbIcon:GQ,User:jc,User2:Gb,User2Icon:Gb,UserCheck:Zw,UserCheck2:Ub,UserCheck2Icon:Ub,UserCheckIcon:Zw,UserCircle:F_,UserCircle2:R_,UserCircle2Icon:R_,UserCircleIcon:F_,UserCog:AT,UserCog2:qb,UserCog2Icon:qb,UserCogIcon:AT,UserIcon:jc,UserMinus:KQ,UserMinus2:Vb,UserMinus2Icon:Vb,UserMinusIcon:KQ,UserPen:ZQ,UserPenIcon:ZQ,UserPlus:J0,UserPlus2:Hb,UserPlus2Icon:Hb,UserPlusIcon:J0,UserRound:Gb,UserRoundCheck:Ub,UserRoundCheckIcon:Ub,UserRoundCog:qb,UserRoundCogIcon:qb,UserRoundIcon:Gb,UserRoundMinus:Vb,UserRoundMinusIcon:Vb,UserRoundPen:YQ,UserRoundPenIcon:YQ,UserRoundPlus:Hb,UserRoundPlusIcon:Hb,UserRoundSearch:XQ,UserRoundSearchIcon:XQ,UserRoundX:Wb,UserRoundXIcon:Wb,UserSearch:QQ,UserSearchIcon:QQ,UserSquare:Lb,UserSquare2:Pb,UserSquare2Icon:Pb,UserSquareIcon:Lb,UserX:JQ,UserX2:Wb,UserX2Icon:Wb,UserXIcon:JQ,Users:hs,Users2:Kb,Users2Icon:Kb,UsersIcon:hs,UsersRound:Kb,UsersRoundIcon:Kb,Utensils:Yb,UtensilsCrossed:Zb,UtensilsCrossedIcon:Zb,UtensilsIcon:Yb,UtilityPole:eJ,UtilityPoleIcon:eJ,Variable:ET,VariableIcon:ET,Vault:tJ,VaultIcon:tJ,Vegan:rJ,VeganIcon:rJ,VenetianMask:nJ,VenetianMaskIcon:nJ,Verified:Yv,VerifiedIcon:Yv,Vibrate:iJ,VibrateIcon:iJ,VibrateOff:sJ,VibrateOffIcon:sJ,Video:Gi,VideoIcon:Gi,VideoOff:aJ,VideoOffIcon:aJ,Videotape:oJ,VideotapeIcon:oJ,View:lJ,ViewIcon:lJ,Voicemail:cJ,VoicemailIcon:cJ,Volleyball:dJ,VolleyballIcon:dJ,Volume:mJ,Volume1:uJ,Volume1Icon:uJ,Volume2:hJ,Volume2Icon:hJ,VolumeIcon:mJ,VolumeOff:fJ,VolumeOffIcon:fJ,VolumeX:pJ,VolumeXIcon:pJ,Vote:gJ,VoteIcon:gJ,Wallet:xJ,Wallet2:Xb,Wallet2Icon:Xb,WalletCards:yJ,WalletCardsIcon:yJ,WalletIcon:xJ,WalletMinimal:Xb,WalletMinimalIcon:Xb,Wallpaper:vJ,WallpaperIcon:vJ,Wand:_J,Wand2:Qb,Wand2Icon:Qb,WandIcon:_J,WandSparkles:Qb,WandSparklesIcon:Qb,Warehouse:bJ,WarehouseIcon:bJ,WashingMachine:wJ,WashingMachineIcon:wJ,Watch:jJ,WatchIcon:jJ,Waves:kJ,WavesIcon:kJ,Waypoints:NJ,WaypointsIcon:NJ,Webcam:SJ,WebcamIcon:SJ,Webhook:MJ,WebhookIcon:MJ,WebhookOff:CJ,WebhookOffIcon:CJ,Weight:TJ,WeightIcon:TJ,Wheat:EJ,WheatIcon:EJ,WheatOff:AJ,WheatOffIcon:AJ,WholeWord:IJ,WholeWordIcon:IJ,Wifi:RJ,WifiHigh:PJ,WifiHighIcon:PJ,WifiIcon:RJ,WifiLow:LJ,WifiLowIcon:LJ,WifiOff:OJ,WifiOffIcon:OJ,WifiZero:DJ,WifiZeroIcon:DJ,Wind:zJ,WindArrowDown:FJ,WindArrowDownIcon:FJ,WindIcon:zJ,Wine:$J,WineIcon:$J,WineOff:BJ,WineOffIcon:BJ,Workflow:UJ,WorkflowIcon:UJ,Worm:qJ,WormIcon:qJ,WrapText:VJ,WrapTextIcon:VJ,Wrench:Iy,WrenchIcon:Iy,X:Ms,XCircle:Lc,XCircleIcon:Lc,XIcon:Ms,XOctagon:_2,XOctagonIcon:_2,XSquare:Ob,XSquareIcon:Ob,Youtube:HJ,YoutubeIcon:HJ,Zap:e1,ZapIcon:e1,ZapOff:WJ,ZapOffIcon:WJ,ZoomIn:JS,ZoomInIcon:JS,ZoomOut:e4,ZoomOutIcon:e4,createLucideIcon:U,icons:FKe},Symbol.toStringTag,{value:"Module"})),Eme="-",zKe=t=>{const e=$Ke(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=t;return{getClassGroupId:c=>{const a=c.split(Eme);return a[0]===""&&a.length!==1&&a.shift(),lAe(a,e)||BKe(c)},getConflictingClassGroupIds:(c,a)=>{const f=n[c]||[];return a&&s[c]?[...f,...s[c]]:f}}},lAe=(t,e)=>{var c;if(t.length===0)return e.classGroupId;const n=t[0],s=e.nextPart.get(n),i=s?lAe(t.slice(1),s):void 0;if(i)return i;if(e.validators.length===0)return;const o=t.join(Eme);return(c=e.validators.find(({validator:a})=>a(o)))==null?void 0:c.classGroupId},Pbe=/^\[(.+)\]$/,BKe=t=>{if(Pbe.test(t)){const e=Pbe.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},$Ke=t=>{const{theme:e,prefix:n}=t,s={nextPart:new Map,validators:[]};return qKe(Object.entries(t.classGroups),n).forEach(([o,c])=>{tue(c,s,o,e)}),s},tue=(t,e,n,s)=>{t.forEach(i=>{if(typeof i=="string"){const o=i===""?e:Lbe(e,i);o.classGroupId=n;return}if(typeof i=="function"){if(UKe(i)){tue(i(s),e,n,s);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([o,c])=>{tue(c,Lbe(e,o),n,s)})})},Lbe=(t,e)=>{let n=t;return e.split(Eme).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},UKe=t=>t.isThemeGetter,qKe=(t,e)=>e?t.map(([n,s])=>{const i=s.map(o=>typeof o=="string"?e+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([c,a])=>[e+c,a])):o);return[n,i]}):t,VKe=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,s=new Map;const i=(o,c)=>{n.set(o,c),e++,e>t&&(e=0,s=n,n=new Map)};return{get(o){let c=n.get(o);if(c!==void 0)return c;if((c=s.get(o))!==void 0)return i(o,c),c},set(o,c){n.has(o)?n.set(o,c):i(o,c)}}},cAe="!",HKe=t=>{const{separator:e,experimentalParseClassName:n}=t,s=e.length===1,i=e[0],o=e.length,c=a=>{const f=[];let m=0,y=0,v;for(let T=0;Ty?v-y:void 0;return{modifiers:f,hasImportantModifier:k,baseClassName:C,maybePostfixModifierPosition:S}};return n?a=>n({className:a,parseClassName:c}):c},WKe=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(s=>{s[0]==="["?(e.push(...n.sort(),s),n=[]):n.push(s)}),e.push(...n.sort()),e},GKe=t=>({cache:VKe(t.cacheSize),parseClassName:HKe(t),...zKe(t)}),KKe=/\s+/,ZKe=(t,e)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:i}=e,o=[],c=t.trim().split(KKe);let a="";for(let f=c.length-1;f>=0;f-=1){const m=c[f],{modifiers:y,hasImportantModifier:v,baseClassName:w,maybePostfixModifierPosition:k}=n(m);let C=!!k,S=s(C?w.substring(0,k):w);if(!S){if(!C){a=m+(a.length>0?" "+a:a);continue}if(S=s(w),!S){a=m+(a.length>0?" "+a:a);continue}C=!1}const T=WKe(y).join(":"),I=v?T+cAe:T,A=I+S;if(o.includes(A))continue;o.push(A);const D=i(S,C);for(let $=0;$0?" "+a:a)}return a};function YKe(){let t=0,e,n,s="";for(;t{if(typeof t=="string")return t;let e,n="";for(let s=0;sv(y),t());return n=GKe(m),s=n.cache.get,i=n.cache.set,o=a,a(f)}function a(f){const m=s(f);if(m)return m;const y=ZKe(f,n);return i(f,y),y}return function(){return o(YKe.apply(null,arguments))}}const rl=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},uAe=/^\[(?:([a-z-]+):)?(.+)\]$/i,QKe=/^\d+\/\d+$/,JKe=new Set(["px","full","screen"]),eZe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,tZe=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,rZe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,nZe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,sZe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ty=t=>t4(t)||JKe.has(t)||QKe.test(t),zx=t=>TC(t,"length",hZe),t4=t=>!!t&&!Number.isNaN(Number(t)),lle=t=>TC(t,"number",t4),l5=t=>!!t&&Number.isInteger(Number(t)),iZe=t=>t.endsWith("%")&&t4(t.slice(0,-1)),ea=t=>uAe.test(t),Bx=t=>eZe.test(t),aZe=new Set(["length","size","percentage"]),oZe=t=>TC(t,aZe,hAe),lZe=t=>TC(t,"position",hAe),cZe=new Set(["image","url"]),dZe=t=>TC(t,cZe,pZe),uZe=t=>TC(t,"",fZe),c5=()=>!0,TC=(t,e,n)=>{const s=uAe.exec(t);return s?s[1]?typeof e=="string"?s[1]===e:e.has(s[1]):n(s[2]):!1},hZe=t=>tZe.test(t)&&!rZe.test(t),hAe=()=>!1,fZe=t=>nZe.test(t),pZe=t=>sZe.test(t),mZe=()=>{const t=rl("colors"),e=rl("spacing"),n=rl("blur"),s=rl("brightness"),i=rl("borderColor"),o=rl("borderRadius"),c=rl("borderSpacing"),a=rl("borderWidth"),f=rl("contrast"),m=rl("grayscale"),y=rl("hueRotate"),v=rl("invert"),w=rl("gap"),k=rl("gradientColorStops"),C=rl("gradientColorStopPositions"),S=rl("inset"),T=rl("margin"),I=rl("opacity"),A=rl("padding"),D=rl("saturate"),$=rl("scale"),F=rl("sepia"),q=rl("skew"),W=rl("space"),K=rl("translate"),Z=()=>["auto","contain","none"],re=()=>["auto","hidden","clip","visible","scroll"],he=()=>["auto",ea,e],ue=()=>[ea,e],Ne=()=>["",ty,zx],se=()=>["auto",t4,ea],xe=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],ie=()=>["solid","dashed","dotted","double","none"],me=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],fe=()=>["start","end","center","between","around","evenly","stretch"],ve=()=>["","0",ea],Ie=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Se=()=>[t4,ea];return{cacheSize:500,separator:":",theme:{colors:[c5],spacing:[ty,zx],blur:["none","",Bx,ea],brightness:Se(),borderColor:[t],borderRadius:["none","","full",Bx,ea],borderSpacing:ue(),borderWidth:Ne(),contrast:Se(),grayscale:ve(),hueRotate:Se(),invert:ve(),gap:ue(),gradientColorStops:[t],gradientColorStopPositions:[iZe,zx],inset:he(),margin:he(),opacity:Se(),padding:ue(),saturate:Se(),scale:Se(),sepia:ve(),skew:Se(),space:ue(),translate:ue()},classGroups:{aspect:[{aspect:["auto","square","video",ea]}],container:["container"],columns:[{columns:[Bx]}],"break-after":[{"break-after":Ie()}],"break-before":[{"break-before":Ie()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...xe(),ea]}],overflow:[{overflow:re()}],"overflow-x":[{"overflow-x":re()}],"overflow-y":[{"overflow-y":re()}],overscroll:[{overscroll:Z()}],"overscroll-x":[{"overscroll-x":Z()}],"overscroll-y":[{"overscroll-y":Z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[S]}],"inset-x":[{"inset-x":[S]}],"inset-y":[{"inset-y":[S]}],start:[{start:[S]}],end:[{end:[S]}],top:[{top:[S]}],right:[{right:[S]}],bottom:[{bottom:[S]}],left:[{left:[S]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",l5,ea]}],basis:[{basis:he()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ea]}],grow:[{grow:ve()}],shrink:[{shrink:ve()}],order:[{order:["first","last","none",l5,ea]}],"grid-cols":[{"grid-cols":[c5]}],"col-start-end":[{col:["auto",{span:["full",l5,ea]},ea]}],"col-start":[{"col-start":se()}],"col-end":[{"col-end":se()}],"grid-rows":[{"grid-rows":[c5]}],"row-start-end":[{row:["auto",{span:[l5,ea]},ea]}],"row-start":[{"row-start":se()}],"row-end":[{"row-end":se()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ea]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ea]}],gap:[{gap:[w]}],"gap-x":[{"gap-x":[w]}],"gap-y":[{"gap-y":[w]}],"justify-content":[{justify:["normal",...fe()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...fe(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...fe(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[A]}],px:[{px:[A]}],py:[{py:[A]}],ps:[{ps:[A]}],pe:[{pe:[A]}],pt:[{pt:[A]}],pr:[{pr:[A]}],pb:[{pb:[A]}],pl:[{pl:[A]}],m:[{m:[T]}],mx:[{mx:[T]}],my:[{my:[T]}],ms:[{ms:[T]}],me:[{me:[T]}],mt:[{mt:[T]}],mr:[{mr:[T]}],mb:[{mb:[T]}],ml:[{ml:[T]}],"space-x":[{"space-x":[W]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[W]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ea,e]}],"min-w":[{"min-w":[ea,e,"min","max","fit"]}],"max-w":[{"max-w":[ea,e,"none","full","min","max","fit","prose",{screen:[Bx]},Bx]}],h:[{h:[ea,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ea,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ea,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ea,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Bx,zx]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",lle]}],"font-family":[{font:[c5]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",ea]}],"line-clamp":[{"line-clamp":["none",t4,lle]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ty,ea]}],"list-image":[{"list-image":["none",ea]}],"list-style-type":[{list:["none","disc","decimal",ea]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[I]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[I]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ie(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",ty,zx]}],"underline-offset":[{"underline-offset":["auto",ty,ea]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:ue()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ea]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ea]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[I]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...xe(),lZe]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",oZe]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},dZe]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[C]}],"gradient-via-pos":[{via:[C]}],"gradient-to-pos":[{to:[C]}],"gradient-from":[{from:[k]}],"gradient-via":[{via:[k]}],"gradient-to":[{to:[k]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[I]}],"border-style":[{border:[...ie(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[I]}],"divide-style":[{divide:ie()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...ie()]}],"outline-offset":[{"outline-offset":[ty,ea]}],"outline-w":[{outline:[ty,zx]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:Ne()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[I]}],"ring-offset-w":[{"ring-offset":[ty,zx]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Bx,uZe]}],"shadow-color":[{shadow:[c5]}],opacity:[{opacity:[I]}],"mix-blend":[{"mix-blend":[...me(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":me()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[s]}],contrast:[{contrast:[f]}],"drop-shadow":[{"drop-shadow":["","none",Bx,ea]}],grayscale:[{grayscale:[m]}],"hue-rotate":[{"hue-rotate":[y]}],invert:[{invert:[v]}],saturate:[{saturate:[D]}],sepia:[{sepia:[F]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[s]}],"backdrop-contrast":[{"backdrop-contrast":[f]}],"backdrop-grayscale":[{"backdrop-grayscale":[m]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[y]}],"backdrop-invert":[{"backdrop-invert":[v]}],"backdrop-opacity":[{"backdrop-opacity":[I]}],"backdrop-saturate":[{"backdrop-saturate":[D]}],"backdrop-sepia":[{"backdrop-sepia":[F]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[c]}],"border-spacing-x":[{"border-spacing-x":[c]}],"border-spacing-y":[{"border-spacing-y":[c]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",ea]}],duration:[{duration:Se()}],ease:[{ease:["linear","in","out","in-out",ea]}],delay:[{delay:Se()}],animate:[{animate:["none","spin","ping","pulse","bounce",ea]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[$]}],"scale-x":[{"scale-x":[$]}],"scale-y":[{"scale-y":[$]}],rotate:[{rotate:[l5,ea]}],"translate-x":[{"translate-x":[K]}],"translate-y":[{"translate-y":[K]}],"skew-x":[{"skew-x":[q]}],"skew-y":[{"skew-y":[q]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ea]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ea]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":ue()}],"scroll-mx":[{"scroll-mx":ue()}],"scroll-my":[{"scroll-my":ue()}],"scroll-ms":[{"scroll-ms":ue()}],"scroll-me":[{"scroll-me":ue()}],"scroll-mt":[{"scroll-mt":ue()}],"scroll-mr":[{"scroll-mr":ue()}],"scroll-mb":[{"scroll-mb":ue()}],"scroll-ml":[{"scroll-ml":ue()}],"scroll-p":[{"scroll-p":ue()}],"scroll-px":[{"scroll-px":ue()}],"scroll-py":[{"scroll-py":ue()}],"scroll-ps":[{"scroll-ps":ue()}],"scroll-pe":[{"scroll-pe":ue()}],"scroll-pt":[{"scroll-pt":ue()}],"scroll-pr":[{"scroll-pr":ue()}],"scroll-pb":[{"scroll-pb":ue()}],"scroll-pl":[{"scroll-pl":ue()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ea]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[ty,zx,lle]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},gZe=XKe(mZe);function zt(...t){return gZe(ta(t))}function jd(t,e=!1){return e&&t>=1e6?`$${(t/1e6).toFixed(1)}M`:e&&t>=1e3?`$${(t/1e3).toFixed(0)}K`:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(t)}function Obe(t){const e=new Date(t);return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(e)}function jne(t){return t?t.replace(/<[^>]*>/g,""):""}const yZe=OKe,fAe=P.forwardRef(({className:t,...e},n)=>r.jsx(QTe,{ref:n,className:zt("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",t),...e}));fAe.displayName=QTe.displayName;const xZe=MC("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),pAe=P.forwardRef(({className:t,variant:e,...n},s)=>r.jsx(JTe,{ref:s,className:zt(xZe({variant:e}),t),...n}));pAe.displayName=JTe.displayName;const vZe=P.forwardRef(({className:t,...e},n)=>r.jsx(rAe,{ref:n,className:zt("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors group-[.destructive]:border-muted/40 hover:bg-secondary group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 group-[.destructive]:focus:ring-destructive disabled:pointer-events-none disabled:opacity-50",t),...e}));vZe.displayName=rAe.displayName;const mAe=P.forwardRef(({className:t,...e},n)=>r.jsx(nAe,{ref:n,className:zt("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 hover:text-foreground group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:outline-none focus:ring-2 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...e,children:r.jsx(Ms,{className:"h-4 w-4"})}));mAe.displayName=nAe.displayName;const gAe=P.forwardRef(({className:t,...e},n)=>r.jsx(eAe,{ref:n,className:zt("text-sm font-semibold",t),...e}));gAe.displayName=eAe.displayName;const yAe=P.forwardRef(({className:t,...e},n)=>r.jsx(tAe,{ref:n,className:zt("text-sm opacity-90",t),...e}));yAe.displayName=tAe.displayName;function _Ze(){const{toasts:t}=la();return r.jsxs(yZe,{children:[t.map(function({id:e,title:n,description:s,action:i,...o}){return r.jsxs(pAe,{...o,children:[r.jsxs("div",{className:"grid gap-1",children:[n&&r.jsx(gAe,{children:n}),s&&r.jsx(yAe,{children:s})]}),i,r.jsx(mAe,{})]},e)}),r.jsx(fAe,{})]})}var Dbe=["light","dark"],bZe="(prefers-color-scheme: dark)",wZe=P.createContext(void 0),jZe={setTheme:t=>{},themes:[]},kZe=()=>{var t;return(t=P.useContext(wZe))!=null?t:jZe};P.memo(({forcedTheme:t,storageKey:e,attribute:n,enableSystem:s,enableColorScheme:i,defaultTheme:o,value:c,attrs:a,nonce:f})=>{let m=o==="system",y=n==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${a.map(C=>`'${C}'`).join(",")})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,v=i?Dbe.includes(o)&&o?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${o}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",w=(C,S=!1,T=!0)=>{let I=c?c[C]:C,A=S?C+"|| ''":`'${I}'`,D="";return i&&T&&!S&&Dbe.includes(C)&&(D+=`d.style.colorScheme = '${C}';`),n==="class"?S||I?D+=`c.add(${A})`:D+="null":I&&(D+=`d[s](n,${A})`),D},k=t?`!function(){${y}${w(t)}}()`:s?`!function(){try{${y}var e=localStorage.getItem('${e}');if('system'===e||(!e&&${m})){var t='${bZe}',m=window.matchMedia(t);if(m.media!==t||m.matches){${w("dark")}}else{${w("light")}}}else if(e){${c?`var x=${JSON.stringify(c)};`:""}${w(c?"x[e]":"e",!0)}}${m?"":"else{"+w(o,!1,!1)+"}"}${v}}catch(e){}}()`:`!function(){try{${y}var e=localStorage.getItem('${e}');if(e){${c?`var x=${JSON.stringify(c)};`:""}${w(c?"x[e]":"e",!0)}}else{${w(o,!1,!1)};}${v}}catch(t){}}();`;return P.createElement("script",{nonce:f,dangerouslySetInnerHTML:{__html:k}})});var NZe=t=>{switch(t){case"success":return MZe;case"info":return AZe;case"warning":return TZe;case"error":return EZe;default:return null}},SZe=Array(12).fill(0),CZe=({visible:t,className:e})=>lt.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},lt.createElement("div",{className:"sonner-spinner"},SZe.map((n,s)=>lt.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),MZe=lt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},lt.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),TZe=lt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},lt.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),AZe=lt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},lt.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),EZe=lt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},lt.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),IZe=lt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},lt.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),lt.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),PZe=()=>{let[t,e]=lt.useState(document.hidden);return lt.useEffect(()=>{let n=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),t},rue=1,LZe=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let e=this.subscribers.indexOf(t);this.subscribers.splice(e,1)}),this.publish=t=>{this.subscribers.forEach(e=>e(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var e;let{message:n,...s}=t,i=typeof(t==null?void 0:t.id)=="number"||((e=t.id)==null?void 0:e.length)>0?t.id:rue++,o=this.toasts.find(a=>a.id===i),c=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(i)&&this.dismissedToasts.delete(i),o?this.toasts=this.toasts.map(a=>a.id===i?(this.publish({...a,...t,id:i,title:n}),{...a,...t,id:i,dismissible:c,title:n}):a):this.addToast({title:n,...s,dismissible:c,id:i}),i},this.dismiss=t=>(this.dismissedToasts.add(t),t||this.toasts.forEach(e=>{this.subscribers.forEach(n=>n({id:e.id,dismiss:!0}))}),this.subscribers.forEach(e=>e({id:t,dismiss:!0})),t),this.message=(t,e)=>this.create({...e,message:t}),this.error=(t,e)=>this.create({...e,message:t,type:"error"}),this.success=(t,e)=>this.create({...e,type:"success",message:t}),this.info=(t,e)=>this.create({...e,type:"info",message:t}),this.warning=(t,e)=>this.create({...e,type:"warning",message:t}),this.loading=(t,e)=>this.create({...e,type:"loading",message:t}),this.promise=(t,e)=>{if(!e)return;let n;e.loading!==void 0&&(n=this.create({...e,promise:t,type:"loading",message:e.loading,description:typeof e.description!="function"?e.description:void 0}));let s=t instanceof Promise?t:t(),i=n!==void 0,o,c=s.then(async f=>{if(o=["resolve",f],lt.isValidElement(f))i=!1,this.create({id:n,type:"default",message:f});else if(DZe(f)&&!f.ok){i=!1;let m=typeof e.error=="function"?await e.error(`HTTP error! status: ${f.status}`):e.error,y=typeof e.description=="function"?await e.description(`HTTP error! status: ${f.status}`):e.description;this.create({id:n,type:"error",message:m,description:y})}else if(e.success!==void 0){i=!1;let m=typeof e.success=="function"?await e.success(f):e.success,y=typeof e.description=="function"?await e.description(f):e.description;this.create({id:n,type:"success",message:m,description:y})}}).catch(async f=>{if(o=["reject",f],e.error!==void 0){i=!1;let m=typeof e.error=="function"?await e.error(f):e.error,y=typeof e.description=="function"?await e.description(f):e.description;this.create({id:n,type:"error",message:m,description:y})}}).finally(()=>{var f;i&&(this.dismiss(n),n=void 0),(f=e.finally)==null||f.call(e)}),a=()=>new Promise((f,m)=>c.then(()=>o[0]==="reject"?m(o[1]):f(o[1])).catch(m));return typeof n!="string"&&typeof n!="number"?{unwrap:a}:Object.assign(n,{unwrap:a})},this.custom=(t,e)=>{let n=(e==null?void 0:e.id)||rue++;return this.create({jsx:t(n),id:n,...e}),n},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Ju=new LZe,OZe=(t,e)=>{let n=(e==null?void 0:e.id)||rue++;return Ju.addToast({title:t,...e,id:n}),n},DZe=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",RZe=OZe,FZe=()=>Ju.toasts,zZe=()=>Ju.getActiveToasts(),Ge=Object.assign(RZe,{success:Ju.success,info:Ju.info,warning:Ju.warning,error:Ju.error,custom:Ju.custom,message:Ju.message,promise:Ju.promise,dismiss:Ju.dismiss,loading:Ju.loading},{getHistory:FZe,getToasts:zZe});function BZe(t,{insertAt:e}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",e==="top"&&n.firstChild?n.insertBefore(s,n.firstChild):n.appendChild(s),s.styleSheet?s.styleSheet.cssText=t:s.appendChild(document.createTextNode(t))}BZe(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)} `);function z6(t){return t.label!==void 0}var $Ze=3,UZe="32px",qZe="16px",Rbe=4e3,VZe=356,HZe=14,WZe=20,GZe=200;function Ap(...t){return t.filter(Boolean).join(" ")}function KZe(t){let[e,n]=t.split("-"),s=[];return e&&s.push(e),n&&s.push(n),s}var ZZe=t=>{var e,n,s,i,o,c,a,f,m,y,v;let{invert:w,toast:k,unstyled:C,interacting:S,setHeights:T,visibleToasts:I,heights:A,index:D,toasts:$,expanded:F,removeToast:q,defaultRichColors:W,closeButton:K,style:Z,cancelButtonStyle:re,actionButtonStyle:he,className:ue="",descriptionClassName:Ne="",duration:se,position:xe,gap:ie,loadingIcon:me,expandByDefault:fe,classNames:ve,icons:Ie,closeButtonAriaLabel:Se="Close toast",pauseWhenPageIsHidden:oe}=t,[ae,je]=lt.useState(null),[Me,Ue]=lt.useState(null),[Re,$e]=lt.useState(!1),[Pe,Ae]=lt.useState(!1),[nt,Te]=lt.useState(!1),[Xe,ge]=lt.useState(!1),[mt,rt]=lt.useState(!1),[We,Ce]=lt.useState(0),[et,Fe]=lt.useState(0),Ke=lt.useRef(k.duration||se||Rbe),Le=lt.useRef(null),ft=lt.useRef(null),Nt=D===0,Mt=D+1<=I,It=k.type,tr=k.dismissible!==!1,Mr=k.className||"",pn=k.descriptionClassName||"",fs=lt.useMemo(()=>A.findIndex(_s=>_s.toastId===k.id)||0,[A,k.id]),Qn=lt.useMemo(()=>{var _s;return(_s=k.closeButton)!=null?_s:K},[k.closeButton,K]),js=lt.useMemo(()=>k.duration||se||Rbe,[k.duration,se]),Qs=lt.useRef(0),si=lt.useRef(0),wr=lt.useRef(0),Ts=lt.useRef(null),[ii,mi]=xe.split("-"),Ta=lt.useMemo(()=>A.reduce((_s,yi,Ni)=>Ni>=fs?_s:_s+yi.height,0),[A,fs]),ga=PZe(),vl=k.invert||w,Yo=It==="loading";si.current=lt.useMemo(()=>fs*ie+Ta,[fs,Ta]),lt.useEffect(()=>{Ke.current=js},[js]),lt.useEffect(()=>{$e(!0)},[]),lt.useEffect(()=>{let _s=ft.current;if(_s){let yi=_s.getBoundingClientRect().height;return Fe(yi),T(Ni=>[{toastId:k.id,height:yi,position:k.position},...Ni]),()=>T(Ni=>Ni.filter(Oo=>Oo.toastId!==k.id))}},[T,k.id]),lt.useLayoutEffect(()=>{if(!Re)return;let _s=ft.current,yi=_s.style.height;_s.style.height="auto";let Ni=_s.getBoundingClientRect().height;_s.style.height=yi,Fe(Ni),T(Oo=>Oo.find(sr=>sr.toastId===k.id)?Oo.map(sr=>sr.toastId===k.id?{...sr,height:Ni}:sr):[{toastId:k.id,height:Ni,position:k.position},...Oo])},[Re,k.title,k.description,T,k.id]);let Ds=lt.useCallback(()=>{Ae(!0),Ce(si.current),T(_s=>_s.filter(yi=>yi.toastId!==k.id)),setTimeout(()=>{q(k)},GZe)},[k,q,T,si]);lt.useEffect(()=>{if(k.promise&&It==="loading"||k.duration===1/0||k.type==="loading")return;let _s;return F||S||oe&&ga?(()=>{if(wr.current{var yi;(yi=k.onAutoClose)==null||yi.call(k,k),Ds()},Ke.current)),()=>clearTimeout(_s)},[F,S,k,It,oe,ga,Ds]),lt.useEffect(()=>{k.delete&&Ds()},[Ds,k.delete]);function Ki(){var _s,yi,Ni;return Ie!=null&&Ie.loading?lt.createElement("div",{className:Ap(ve==null?void 0:ve.loader,(_s=k==null?void 0:k.classNames)==null?void 0:_s.loader,"sonner-loader"),"data-visible":It==="loading"},Ie.loading):me?lt.createElement("div",{className:Ap(ve==null?void 0:ve.loader,(yi=k==null?void 0:k.classNames)==null?void 0:yi.loader,"sonner-loader"),"data-visible":It==="loading"},me):lt.createElement(CZe,{className:Ap(ve==null?void 0:ve.loader,(Ni=k==null?void 0:k.classNames)==null?void 0:Ni.loader),visible:It==="loading"})}return lt.createElement("li",{tabIndex:0,ref:ft,className:Ap(ue,Mr,ve==null?void 0:ve.toast,(e=k==null?void 0:k.classNames)==null?void 0:e.toast,ve==null?void 0:ve.default,ve==null?void 0:ve[It],(n=k==null?void 0:k.classNames)==null?void 0:n[It]),"data-sonner-toast":"","data-rich-colors":(s=k.richColors)!=null?s:W,"data-styled":!(k.jsx||k.unstyled||C),"data-mounted":Re,"data-promise":!!k.promise,"data-swiped":mt,"data-removed":Pe,"data-visible":Mt,"data-y-position":ii,"data-x-position":mi,"data-index":D,"data-front":Nt,"data-swiping":nt,"data-dismissible":tr,"data-type":It,"data-invert":vl,"data-swipe-out":Xe,"data-swipe-direction":Me,"data-expanded":!!(F||fe&&Re),style:{"--index":D,"--toasts-before":D,"--z-index":$.length-D,"--offset":`${Pe?We:si.current}px`,"--initial-height":fe?"auto":`${et}px`,...Z,...k.style},onDragEnd:()=>{Te(!1),je(null),Ts.current=null},onPointerDown:_s=>{Yo||!tr||(Le.current=new Date,Ce(si.current),_s.target.setPointerCapture(_s.pointerId),_s.target.tagName!=="BUTTON"&&(Te(!0),Ts.current={x:_s.clientX,y:_s.clientY}))},onPointerUp:()=>{var _s,yi,Ni,Oo;if(Xe||!tr)return;Ts.current=null;let sr=Number(((_s=ft.current)==null?void 0:_s.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),fo=Number(((yi=ft.current)==null?void 0:yi.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),lc=new Date().getTime()-((Ni=Le.current)==null?void 0:Ni.getTime()),po=ae==="x"?sr:fo,Qr=Math.abs(po)/lc;if(Math.abs(po)>=WZe||Qr>.11){Ce(si.current),(Oo=k.onDismiss)==null||Oo.call(k,k),Ue(ae==="x"?sr>0?"right":"left":fo>0?"down":"up"),Ds(),ge(!0),rt(!1);return}Te(!1),je(null)},onPointerMove:_s=>{var yi,Ni,Oo,sr;if(!Ts.current||!tr||((yi=window.getSelection())==null?void 0:yi.toString().length)>0)return;let fo=_s.clientY-Ts.current.y,lc=_s.clientX-Ts.current.x,po=(Ni=t.swipeDirections)!=null?Ni:KZe(xe);!ae&&(Math.abs(lc)>1||Math.abs(fo)>1)&&je(Math.abs(lc)>Math.abs(fo)?"x":"y");let Qr={x:0,y:0};ae==="y"?(po.includes("top")||po.includes("bottom"))&&(po.includes("top")&&fo<0||po.includes("bottom")&&fo>0)&&(Qr.y=fo):ae==="x"&&(po.includes("left")||po.includes("right"))&&(po.includes("left")&&lc<0||po.includes("right")&&lc>0)&&(Qr.x=lc),(Math.abs(Qr.x)>0||Math.abs(Qr.y)>0)&&rt(!0),(Oo=ft.current)==null||Oo.style.setProperty("--swipe-amount-x",`${Qr.x}px`),(sr=ft.current)==null||sr.style.setProperty("--swipe-amount-y",`${Qr.y}px`)}},Qn&&!k.jsx?lt.createElement("button",{"aria-label":Se,"data-disabled":Yo,"data-close-button":!0,onClick:Yo||!tr?()=>{}:()=>{var _s;Ds(),(_s=k.onDismiss)==null||_s.call(k,k)},className:Ap(ve==null?void 0:ve.closeButton,(i=k==null?void 0:k.classNames)==null?void 0:i.closeButton)},(o=Ie==null?void 0:Ie.close)!=null?o:IZe):null,k.jsx||P.isValidElement(k.title)?k.jsx?k.jsx:typeof k.title=="function"?k.title():k.title:lt.createElement(lt.Fragment,null,It||k.icon||k.promise?lt.createElement("div",{"data-icon":"",className:Ap(ve==null?void 0:ve.icon,(c=k==null?void 0:k.classNames)==null?void 0:c.icon)},k.promise||k.type==="loading"&&!k.icon?k.icon||Ki():null,k.type!=="loading"?k.icon||(Ie==null?void 0:Ie[It])||NZe(It):null):null,lt.createElement("div",{"data-content":"",className:Ap(ve==null?void 0:ve.content,(a=k==null?void 0:k.classNames)==null?void 0:a.content)},lt.createElement("div",{"data-title":"",className:Ap(ve==null?void 0:ve.title,(f=k==null?void 0:k.classNames)==null?void 0:f.title)},typeof k.title=="function"?k.title():k.title),k.description?lt.createElement("div",{"data-description":"",className:Ap(Ne,pn,ve==null?void 0:ve.description,(m=k==null?void 0:k.classNames)==null?void 0:m.description)},typeof k.description=="function"?k.description():k.description):null),P.isValidElement(k.cancel)?k.cancel:k.cancel&&z6(k.cancel)?lt.createElement("button",{"data-button":!0,"data-cancel":!0,style:k.cancelButtonStyle||re,onClick:_s=>{var yi,Ni;z6(k.cancel)&&tr&&((Ni=(yi=k.cancel).onClick)==null||Ni.call(yi,_s),Ds())},className:Ap(ve==null?void 0:ve.cancelButton,(y=k==null?void 0:k.classNames)==null?void 0:y.cancelButton)},k.cancel.label):null,P.isValidElement(k.action)?k.action:k.action&&z6(k.action)?lt.createElement("button",{"data-button":!0,"data-action":!0,style:k.actionButtonStyle||he,onClick:_s=>{var yi,Ni;z6(k.action)&&((Ni=(yi=k.action).onClick)==null||Ni.call(yi,_s),!_s.defaultPrevented&&Ds())},className:Ap(ve==null?void 0:ve.actionButton,(v=k==null?void 0:k.classNames)==null?void 0:v.actionButton)},k.action.label):null))};function Fbe(){if(typeof window>"u"||typeof document>"u")return"ltr";let t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function YZe(t,e){let n={};return[t,e].forEach((s,i)=>{let o=i===1,c=o?"--mobile-offset":"--offset",a=o?qZe:UZe;function f(m){["top","right","bottom","left"].forEach(y=>{n[`${c}-${y}`]=typeof m=="number"?`${m}px`:m})}typeof s=="number"||typeof s=="string"?f(s):typeof s=="object"?["top","right","bottom","left"].forEach(m=>{s[m]===void 0?n[`${c}-${m}`]=a:n[`${c}-${m}`]=typeof s[m]=="number"?`${s[m]}px`:s[m]}):f(a)}),n}var XZe=P.forwardRef(function(t,e){let{invert:n,position:s="bottom-right",hotkey:i=["altKey","KeyT"],expand:o,closeButton:c,className:a,offset:f,mobileOffset:m,theme:y="light",richColors:v,duration:w,style:k,visibleToasts:C=$Ze,toastOptions:S,dir:T=Fbe(),gap:I=HZe,loadingIcon:A,icons:D,containerAriaLabel:$="Notifications",pauseWhenPageIsHidden:F}=t,[q,W]=lt.useState([]),K=lt.useMemo(()=>Array.from(new Set([s].concat(q.filter(oe=>oe.position).map(oe=>oe.position)))),[q,s]),[Z,re]=lt.useState([]),[he,ue]=lt.useState(!1),[Ne,se]=lt.useState(!1),[xe,ie]=lt.useState(y!=="system"?y:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),me=lt.useRef(null),fe=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),ve=lt.useRef(null),Ie=lt.useRef(!1),Se=lt.useCallback(oe=>{W(ae=>{var je;return(je=ae.find(Me=>Me.id===oe.id))!=null&&je.delete||Ju.dismiss(oe.id),ae.filter(({id:Me})=>Me!==oe.id)})},[]);return lt.useEffect(()=>Ju.subscribe(oe=>{if(oe.dismiss){W(ae=>ae.map(je=>je.id===oe.id?{...je,delete:!0}:je));return}setTimeout(()=>{Nme.flushSync(()=>{W(ae=>{let je=ae.findIndex(Me=>Me.id===oe.id);return je!==-1?[...ae.slice(0,je),{...ae[je],...oe},...ae.slice(je+1)]:[oe,...ae]})})})}),[]),lt.useEffect(()=>{if(y!=="system"){ie(y);return}if(y==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?ie("dark"):ie("light")),typeof window>"u")return;let oe=window.matchMedia("(prefers-color-scheme: dark)");try{oe.addEventListener("change",({matches:ae})=>{ie(ae?"dark":"light")})}catch{oe.addListener(({matches:je})=>{try{ie(je?"dark":"light")}catch(Me){console.error(Me)}})}},[y]),lt.useEffect(()=>{q.length<=1&&ue(!1)},[q]),lt.useEffect(()=>{let oe=ae=>{var je,Me;i.every(Ue=>ae[Ue]||ae.code===Ue)&&(ue(!0),(je=me.current)==null||je.focus()),ae.code==="Escape"&&(document.activeElement===me.current||(Me=me.current)!=null&&Me.contains(document.activeElement))&&ue(!1)};return document.addEventListener("keydown",oe),()=>document.removeEventListener("keydown",oe)},[i]),lt.useEffect(()=>{if(me.current)return()=>{ve.current&&(ve.current.focus({preventScroll:!0}),ve.current=null,Ie.current=!1)}},[me.current]),lt.createElement("section",{ref:e,"aria-label":`${$} ${fe}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},K.map((oe,ae)=>{var je;let[Me,Ue]=oe.split("-");return q.length?lt.createElement("ol",{key:oe,dir:T==="auto"?Fbe():T,tabIndex:-1,ref:me,className:a,"data-sonner-toaster":!0,"data-theme":xe,"data-y-position":Me,"data-lifted":he&&q.length>1&&!o,"data-x-position":Ue,style:{"--front-toast-height":`${((je=Z[0])==null?void 0:je.height)||0}px`,"--width":`${VZe}px`,"--gap":`${I}px`,...k,...YZe(f,m)},onBlur:Re=>{Ie.current&&!Re.currentTarget.contains(Re.relatedTarget)&&(Ie.current=!1,ve.current&&(ve.current.focus({preventScroll:!0}),ve.current=null))},onFocus:Re=>{Re.target instanceof HTMLElement&&Re.target.dataset.dismissible==="false"||Ie.current||(Ie.current=!0,ve.current=Re.relatedTarget)},onMouseEnter:()=>ue(!0),onMouseMove:()=>ue(!0),onMouseLeave:()=>{Ne||ue(!1)},onDragEnd:()=>ue(!1),onPointerDown:Re=>{Re.target instanceof HTMLElement&&Re.target.dataset.dismissible==="false"||se(!0)},onPointerUp:()=>se(!1)},q.filter(Re=>!Re.position&&ae===0||Re.position===oe).map((Re,$e)=>{var Pe,Ae;return lt.createElement(ZZe,{key:Re.id,icons:D,index:$e,toast:Re,defaultRichColors:v,duration:(Pe=S==null?void 0:S.duration)!=null?Pe:w,className:S==null?void 0:S.className,descriptionClassName:S==null?void 0:S.descriptionClassName,invert:n,visibleToasts:C,closeButton:(Ae=S==null?void 0:S.closeButton)!=null?Ae:c,interacting:Ne,position:oe,style:S==null?void 0:S.style,unstyled:S==null?void 0:S.unstyled,classNames:S==null?void 0:S.classNames,cancelButtonStyle:S==null?void 0:S.cancelButtonStyle,actionButtonStyle:S==null?void 0:S.actionButtonStyle,removeToast:Se,toasts:q.filter(nt=>nt.position==Re.position),heights:Z.filter(nt=>nt.position==Re.position),setHeights:re,expandByDefault:o,gap:I,loadingIcon:A,expanded:he,pauseWhenPageIsHidden:F,swipeDirections:t.swipeDirections})})):null}))});const QZe=({...t})=>{const{theme:e="system"}=kZe();return r.jsx(XZe,{theme:e,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...t})};var JZe=Lpe[" useId ".trim().toString()]||(()=>{}),eYe=0;function Fc(t){const[e,n]=P.useState(JZe());return Gl(()=>{n(s=>s??String(eYe++))},[t]),e?`radix-${e}`:""}const tYe=["top","right","bottom","left"],m1=Math.min,Lh=Math.max,Oee=Math.round,B6=Math.floor,hg=t=>({x:t,y:t}),rYe={left:"right",right:"left",bottom:"top",top:"bottom"},nYe={start:"end",end:"start"};function nue(t,e,n){return Lh(t,m1(e,n))}function qy(t,e){return typeof t=="function"?t(e):t}function Vy(t){return t.split("-")[0]}function AC(t){return t.split("-")[1]}function Ime(t){return t==="x"?"y":"x"}function Pme(t){return t==="y"?"height":"width"}const sYe=new Set(["top","bottom"]);function Jm(t){return sYe.has(Vy(t))?"y":"x"}function Lme(t){return Ime(Jm(t))}function iYe(t,e,n){n===void 0&&(n=!1);const s=AC(t),i=Lme(t),o=Pme(i);let c=i==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(c=Dee(c)),[c,Dee(c)]}function aYe(t){const e=Dee(t);return[sue(t),e,sue(e)]}function sue(t){return t.replace(/start|end/g,e=>nYe[e])}const zbe=["left","right"],Bbe=["right","left"],oYe=["top","bottom"],lYe=["bottom","top"];function cYe(t,e,n){switch(t){case"top":case"bottom":return n?e?Bbe:zbe:e?zbe:Bbe;case"left":case"right":return e?oYe:lYe;default:return[]}}function dYe(t,e,n,s){const i=AC(t);let o=cYe(Vy(t),n==="start",s);return i&&(o=o.map(c=>c+"-"+i),e&&(o=o.concat(o.map(sue)))),o}function Dee(t){return t.replace(/left|right|bottom|top/g,e=>rYe[e])}function uYe(t){return{top:0,right:0,bottom:0,left:0,...t}}function xAe(t){return typeof t!="number"?uYe(t):{top:t,right:t,bottom:t,left:t}}function Ree(t){const{x:e,y:n,width:s,height:i}=t;return{width:s,height:i,top:n,left:e,right:e+s,bottom:n+i,x:e,y:n}}function $be(t,e,n){let{reference:s,floating:i}=t;const o=Jm(e),c=Lme(e),a=Pme(c),f=Vy(e),m=o==="y",y=s.x+s.width/2-i.width/2,v=s.y+s.height/2-i.height/2,w=s[a]/2-i[a]/2;let k;switch(f){case"top":k={x:y,y:s.y-i.height};break;case"bottom":k={x:y,y:s.y+s.height};break;case"right":k={x:s.x+s.width,y:v};break;case"left":k={x:s.x-i.width,y:v};break;default:k={x:s.x,y:s.y}}switch(AC(e)){case"start":k[c]-=w*(n&&m?-1:1);break;case"end":k[c]+=w*(n&&m?-1:1);break}return k}const hYe=async(t,e,n)=>{const{placement:s="bottom",strategy:i="absolute",middleware:o=[],platform:c}=n,a=o.filter(Boolean),f=await(c.isRTL==null?void 0:c.isRTL(e));let m=await c.getElementRects({reference:t,floating:e,strategy:i}),{x:y,y:v}=$be(m,s,f),w=s,k={},C=0;for(let S=0;S({name:"arrow",options:t,async fn(e){const{x:n,y:s,placement:i,rects:o,platform:c,elements:a,middlewareData:f}=e,{element:m,padding:y=0}=qy(t,e)||{};if(m==null)return{};const v=xAe(y),w={x:n,y:s},k=Lme(i),C=Pme(k),S=await c.getDimensions(m),T=k==="y",I=T?"top":"left",A=T?"bottom":"right",D=T?"clientHeight":"clientWidth",$=o.reference[C]+o.reference[k]-w[k]-o.floating[C],F=w[k]-o.reference[k],q=await(c.getOffsetParent==null?void 0:c.getOffsetParent(m));let W=q?q[D]:0;(!W||!await(c.isElement==null?void 0:c.isElement(q)))&&(W=a.floating[D]||o.floating[C]);const K=$/2-F/2,Z=W/2-S[C]/2-1,re=m1(v[I],Z),he=m1(v[A],Z),ue=re,Ne=W-S[C]-he,se=W/2-S[C]/2+K,xe=nue(ue,se,Ne),ie=!f.arrow&&AC(i)!=null&&se!==xe&&o.reference[C]/2-(sese<=0)){var he,ue;const se=(((he=o.flip)==null?void 0:he.index)||0)+1,xe=W[se];if(xe&&(!(v==="alignment"?A!==Jm(xe):!1)||re.every(fe=>fe.overflows[0]>0&&Jm(fe.placement)===A)))return{data:{index:se,overflows:re},reset:{placement:xe}};let ie=(ue=re.filter(me=>me.overflows[0]<=0).sort((me,fe)=>me.overflows[1]-fe.overflows[1])[0])==null?void 0:ue.placement;if(!ie)switch(k){case"bestFit":{var Ne;const me=(Ne=re.filter(fe=>{if(q){const ve=Jm(fe.placement);return ve===A||ve==="y"}return!0}).map(fe=>[fe.placement,fe.overflows.filter(ve=>ve>0).reduce((ve,Ie)=>ve+Ie,0)]).sort((fe,ve)=>fe[1]-ve[1])[0])==null?void 0:Ne[0];me&&(ie=me);break}case"initialPlacement":ie=a;break}if(i!==ie)return{reset:{placement:ie}}}return{}}}};function Ube(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function qbe(t){return tYe.some(e=>t[e]>=0)}const mYe=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:s="referenceHidden",...i}=qy(t,e);switch(s){case"referenceHidden":{const o=await jA(e,{...i,elementContext:"reference"}),c=Ube(o,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:qbe(c)}}}case"escaped":{const o=await jA(e,{...i,altBoundary:!0}),c=Ube(o,n.floating);return{data:{escapedOffsets:c,escaped:qbe(c)}}}default:return{}}}}},vAe=new Set(["left","top"]);async function gYe(t,e){const{placement:n,platform:s,elements:i}=t,o=await(s.isRTL==null?void 0:s.isRTL(i.floating)),c=Vy(n),a=AC(n),f=Jm(n)==="y",m=vAe.has(c)?-1:1,y=o&&f?-1:1,v=qy(e,t);let{mainAxis:w,crossAxis:k,alignmentAxis:C}=typeof v=="number"?{mainAxis:v,crossAxis:0,alignmentAxis:null}:{mainAxis:v.mainAxis||0,crossAxis:v.crossAxis||0,alignmentAxis:v.alignmentAxis};return a&&typeof C=="number"&&(k=a==="end"?C*-1:C),f?{x:k*y,y:w*m}:{x:w*m,y:k*y}}const yYe=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,s;const{x:i,y:o,placement:c,middlewareData:a}=e,f=await gYe(e,t);return c===((n=a.offset)==null?void 0:n.placement)&&(s=a.arrow)!=null&&s.alignmentOffset?{}:{x:i+f.x,y:o+f.y,data:{...f,placement:c}}}}},xYe=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:s,placement:i}=e,{mainAxis:o=!0,crossAxis:c=!1,limiter:a={fn:T=>{let{x:I,y:A}=T;return{x:I,y:A}}},...f}=qy(t,e),m={x:n,y:s},y=await jA(e,f),v=Jm(Vy(i)),w=Ime(v);let k=m[w],C=m[v];if(o){const T=w==="y"?"top":"left",I=w==="y"?"bottom":"right",A=k+y[T],D=k-y[I];k=nue(A,k,D)}if(c){const T=v==="y"?"top":"left",I=v==="y"?"bottom":"right",A=C+y[T],D=C-y[I];C=nue(A,C,D)}const S=a.fn({...e,[w]:k,[v]:C});return{...S,data:{x:S.x-n,y:S.y-s,enabled:{[w]:o,[v]:c}}}}}},vYe=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:s,placement:i,rects:o,middlewareData:c}=e,{offset:a=0,mainAxis:f=!0,crossAxis:m=!0}=qy(t,e),y={x:n,y:s},v=Jm(i),w=Ime(v);let k=y[w],C=y[v];const S=qy(a,e),T=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:0,crossAxis:0,...S};if(f){const D=w==="y"?"height":"width",$=o.reference[w]-o.floating[D]+T.mainAxis,F=o.reference[w]+o.reference[D]-T.mainAxis;k<$?k=$:k>F&&(k=F)}if(m){var I,A;const D=w==="y"?"width":"height",$=vAe.has(Vy(i)),F=o.reference[v]-o.floating[D]+($&&((I=c.offset)==null?void 0:I[v])||0)+($?0:T.crossAxis),q=o.reference[v]+o.reference[D]+($?0:((A=c.offset)==null?void 0:A[v])||0)-($?T.crossAxis:0);Cq&&(C=q)}return{[w]:k,[v]:C}}}},_Ye=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,s;const{placement:i,rects:o,platform:c,elements:a}=e,{apply:f=()=>{},...m}=qy(t,e),y=await jA(e,m),v=Vy(i),w=AC(i),k=Jm(i)==="y",{width:C,height:S}=o.floating;let T,I;v==="top"||v==="bottom"?(T=v,I=w===(await(c.isRTL==null?void 0:c.isRTL(a.floating))?"start":"end")?"left":"right"):(I=v,T=w==="end"?"top":"bottom");const A=S-y.top-y.bottom,D=C-y.left-y.right,$=m1(S-y[T],A),F=m1(C-y[I],D),q=!e.middlewareData.shift;let W=$,K=F;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(K=D),(s=e.middlewareData.shift)!=null&&s.enabled.y&&(W=A),q&&!w){const re=Lh(y.left,0),he=Lh(y.right,0),ue=Lh(y.top,0),Ne=Lh(y.bottom,0);k?K=C-2*(re!==0||he!==0?re+he:Lh(y.left,y.right)):W=S-2*(ue!==0||Ne!==0?ue+Ne:Lh(y.top,y.bottom))}await f({...e,availableWidth:K,availableHeight:W});const Z=await c.getDimensions(a.floating);return C!==Z.width||S!==Z.height?{reset:{rects:!0}}:{}}}};function kne(){return typeof window<"u"}function EC(t){return _Ae(t)?(t.nodeName||"").toLowerCase():"#document"}function Uh(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function kg(t){var e;return(e=(_Ae(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function _Ae(t){return kne()?t instanceof Node||t instanceof Uh(t).Node:!1}function cm(t){return kne()?t instanceof Element||t instanceof Uh(t).Element:!1}function xg(t){return kne()?t instanceof HTMLElement||t instanceof Uh(t).HTMLElement:!1}function Vbe(t){return!kne()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Uh(t).ShadowRoot}const bYe=new Set(["inline","contents"]);function qE(t){const{overflow:e,overflowX:n,overflowY:s,display:i}=dm(t);return/auto|scroll|overlay|hidden|clip/.test(e+s+n)&&!bYe.has(i)}const wYe=new Set(["table","td","th"]);function jYe(t){return wYe.has(EC(t))}const kYe=[":popover-open",":modal"];function Nne(t){return kYe.some(e=>{try{return t.matches(e)}catch{return!1}})}const NYe=["transform","translate","scale","rotate","perspective"],SYe=["transform","translate","scale","rotate","perspective","filter"],CYe=["paint","layout","strict","content"];function Ome(t){const e=Dme(),n=cm(t)?dm(t):t;return NYe.some(s=>n[s]?n[s]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||SYe.some(s=>(n.willChange||"").includes(s))||CYe.some(s=>(n.contain||"").includes(s))}function MYe(t){let e=g1(t);for(;xg(e)&&!L4(e);){if(Ome(e))return e;if(Nne(e))return null;e=g1(e)}return null}function Dme(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const TYe=new Set(["html","body","#document"]);function L4(t){return TYe.has(EC(t))}function dm(t){return Uh(t).getComputedStyle(t)}function Sne(t){return cm(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function g1(t){if(EC(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Vbe(t)&&t.host||kg(t);return Vbe(e)?e.host:e}function bAe(t){const e=g1(t);return L4(e)?t.ownerDocument?t.ownerDocument.body:t.body:xg(e)&&qE(e)?e:bAe(e)}function kA(t,e,n){var s;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=bAe(t),o=i===((s=t.ownerDocument)==null?void 0:s.body),c=Uh(i);if(o){const a=iue(c);return e.concat(c,c.visualViewport||[],qE(i)?i:[],a&&n?kA(a):[])}return e.concat(i,kA(i,[],n))}function iue(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function wAe(t){const e=dm(t);let n=parseFloat(e.width)||0,s=parseFloat(e.height)||0;const i=xg(t),o=i?t.offsetWidth:n,c=i?t.offsetHeight:s,a=Oee(n)!==o||Oee(s)!==c;return a&&(n=o,s=c),{width:n,height:s,$:a}}function Rme(t){return cm(t)?t:t.contextElement}function r4(t){const e=Rme(t);if(!xg(e))return hg(1);const n=e.getBoundingClientRect(),{width:s,height:i,$:o}=wAe(e);let c=(o?Oee(n.width):n.width)/s,a=(o?Oee(n.height):n.height)/i;return(!c||!Number.isFinite(c))&&(c=1),(!a||!Number.isFinite(a))&&(a=1),{x:c,y:a}}const AYe=hg(0);function jAe(t){const e=Uh(t);return!Dme()||!e.visualViewport?AYe:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function EYe(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Uh(t)?!1:e}function lj(t,e,n,s){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),o=Rme(t);let c=hg(1);e&&(s?cm(s)&&(c=r4(s)):c=r4(t));const a=EYe(o,n,s)?jAe(o):hg(0);let f=(i.left+a.x)/c.x,m=(i.top+a.y)/c.y,y=i.width/c.x,v=i.height/c.y;if(o){const w=Uh(o),k=s&&cm(s)?Uh(s):s;let C=w,S=iue(C);for(;S&&s&&k!==C;){const T=r4(S),I=S.getBoundingClientRect(),A=dm(S),D=I.left+(S.clientLeft+parseFloat(A.paddingLeft))*T.x,$=I.top+(S.clientTop+parseFloat(A.paddingTop))*T.y;f*=T.x,m*=T.y,y*=T.x,v*=T.y,f+=D,m+=$,C=Uh(S),S=iue(C)}}return Ree({width:y,height:v,x:f,y:m})}function Fme(t,e){const n=Sne(t).scrollLeft;return e?e.left+n:lj(kg(t)).left+n}function kAe(t,e,n){n===void 0&&(n=!1);const s=t.getBoundingClientRect(),i=s.left+e.scrollLeft-(n?0:Fme(t,s)),o=s.top+e.scrollTop;return{x:i,y:o}}function IYe(t){let{elements:e,rect:n,offsetParent:s,strategy:i}=t;const o=i==="fixed",c=kg(s),a=e?Nne(e.floating):!1;if(s===c||a&&o)return n;let f={scrollLeft:0,scrollTop:0},m=hg(1);const y=hg(0),v=xg(s);if((v||!v&&!o)&&((EC(s)!=="body"||qE(c))&&(f=Sne(s)),xg(s))){const k=lj(s);m=r4(s),y.x=k.x+s.clientLeft,y.y=k.y+s.clientTop}const w=c&&!v&&!o?kAe(c,f,!0):hg(0);return{width:n.width*m.x,height:n.height*m.y,x:n.x*m.x-f.scrollLeft*m.x+y.x+w.x,y:n.y*m.y-f.scrollTop*m.y+y.y+w.y}}function PYe(t){return Array.from(t.getClientRects())}function LYe(t){const e=kg(t),n=Sne(t),s=t.ownerDocument.body,i=Lh(e.scrollWidth,e.clientWidth,s.scrollWidth,s.clientWidth),o=Lh(e.scrollHeight,e.clientHeight,s.scrollHeight,s.clientHeight);let c=-n.scrollLeft+Fme(t);const a=-n.scrollTop;return dm(s).direction==="rtl"&&(c+=Lh(e.clientWidth,s.clientWidth)-i),{width:i,height:o,x:c,y:a}}function OYe(t,e){const n=Uh(t),s=kg(t),i=n.visualViewport;let o=s.clientWidth,c=s.clientHeight,a=0,f=0;if(i){o=i.width,c=i.height;const m=Dme();(!m||m&&e==="fixed")&&(a=i.offsetLeft,f=i.offsetTop)}return{width:o,height:c,x:a,y:f}}const DYe=new Set(["absolute","fixed"]);function RYe(t,e){const n=lj(t,!0,e==="fixed"),s=n.top+t.clientTop,i=n.left+t.clientLeft,o=xg(t)?r4(t):hg(1),c=t.clientWidth*o.x,a=t.clientHeight*o.y,f=i*o.x,m=s*o.y;return{width:c,height:a,x:f,y:m}}function Hbe(t,e,n){let s;if(e==="viewport")s=OYe(t,n);else if(e==="document")s=LYe(kg(t));else if(cm(e))s=RYe(e,n);else{const i=jAe(t);s={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return Ree(s)}function NAe(t,e){const n=g1(t);return n===e||!cm(n)||L4(n)?!1:dm(n).position==="fixed"||NAe(n,e)}function FYe(t,e){const n=e.get(t);if(n)return n;let s=kA(t,[],!1).filter(a=>cm(a)&&EC(a)!=="body"),i=null;const o=dm(t).position==="fixed";let c=o?g1(t):t;for(;cm(c)&&!L4(c);){const a=dm(c),f=Ome(c);!f&&a.position==="fixed"&&(i=null),(o?!f&&!i:!f&&a.position==="static"&&!!i&&DYe.has(i.position)||qE(c)&&!f&&NAe(t,c))?s=s.filter(y=>y!==c):i=a,c=g1(c)}return e.set(t,s),s}function zYe(t){let{element:e,boundary:n,rootBoundary:s,strategy:i}=t;const c=[...n==="clippingAncestors"?Nne(e)?[]:FYe(e,this._c):[].concat(n),s],a=c[0],f=c.reduce((m,y)=>{const v=Hbe(e,y,i);return m.top=Lh(v.top,m.top),m.right=m1(v.right,m.right),m.bottom=m1(v.bottom,m.bottom),m.left=Lh(v.left,m.left),m},Hbe(e,a,i));return{width:f.right-f.left,height:f.bottom-f.top,x:f.left,y:f.top}}function BYe(t){const{width:e,height:n}=wAe(t);return{width:e,height:n}}function $Ye(t,e,n){const s=xg(e),i=kg(e),o=n==="fixed",c=lj(t,!0,o,e);let a={scrollLeft:0,scrollTop:0};const f=hg(0);function m(){f.x=Fme(i)}if(s||!s&&!o)if((EC(e)!=="body"||qE(i))&&(a=Sne(e)),s){const k=lj(e,!0,o,e);f.x=k.x+e.clientLeft,f.y=k.y+e.clientTop}else i&&m();o&&!s&&i&&m();const y=i&&!s&&!o?kAe(i,a):hg(0),v=c.left+a.scrollLeft-f.x-y.x,w=c.top+a.scrollTop-f.y-y.y;return{x:v,y:w,width:c.width,height:c.height}}function cle(t){return dm(t).position==="static"}function Wbe(t,e){if(!xg(t)||dm(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return kg(t)===n&&(n=n.ownerDocument.body),n}function SAe(t,e){const n=Uh(t);if(Nne(t))return n;if(!xg(t)){let i=g1(t);for(;i&&!L4(i);){if(cm(i)&&!cle(i))return i;i=g1(i)}return n}let s=Wbe(t,e);for(;s&&jYe(s)&&cle(s);)s=Wbe(s,e);return s&&L4(s)&&cle(s)&&!Ome(s)?n:s||MYe(t)||n}const UYe=async function(t){const e=this.getOffsetParent||SAe,n=this.getDimensions,s=await n(t.floating);return{reference:$Ye(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function qYe(t){return dm(t).direction==="rtl"}const VYe={convertOffsetParentRelativeRectToViewportRelativeRect:IYe,getDocumentElement:kg,getClippingRect:zYe,getOffsetParent:SAe,getElementRects:UYe,getClientRects:PYe,getDimensions:BYe,getScale:r4,isElement:cm,isRTL:qYe};function CAe(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function HYe(t,e){let n=null,s;const i=kg(t);function o(){var a;clearTimeout(s),(a=n)==null||a.disconnect(),n=null}function c(a,f){a===void 0&&(a=!1),f===void 0&&(f=1),o();const m=t.getBoundingClientRect(),{left:y,top:v,width:w,height:k}=m;if(a||e(),!w||!k)return;const C=B6(v),S=B6(i.clientWidth-(y+w)),T=B6(i.clientHeight-(v+k)),I=B6(y),D={rootMargin:-C+"px "+-S+"px "+-T+"px "+-I+"px",threshold:Lh(0,m1(1,f))||1};let $=!0;function F(q){const W=q[0].intersectionRatio;if(W!==f){if(!$)return c();W?c(!1,W):s=setTimeout(()=>{c(!1,1e-7)},1e3)}W===1&&!CAe(m,t.getBoundingClientRect())&&c(),$=!1}try{n=new IntersectionObserver(F,{...D,root:i.ownerDocument})}catch{n=new IntersectionObserver(F,D)}n.observe(t)}return c(!0),o}function WYe(t,e,n,s){s===void 0&&(s={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:f=!1}=s,m=Rme(t),y=i||o?[...m?kA(m):[],...kA(e)]:[];y.forEach(I=>{i&&I.addEventListener("scroll",n,{passive:!0}),o&&I.addEventListener("resize",n)});const v=m&&a?HYe(m,n):null;let w=-1,k=null;c&&(k=new ResizeObserver(I=>{let[A]=I;A&&A.target===m&&k&&(k.unobserve(e),cancelAnimationFrame(w),w=requestAnimationFrame(()=>{var D;(D=k)==null||D.observe(e)})),n()}),m&&!f&&k.observe(m),k.observe(e));let C,S=f?lj(t):null;f&&T();function T(){const I=lj(t);S&&!CAe(S,I)&&n(),S=I,C=requestAnimationFrame(T)}return n(),()=>{var I;y.forEach(A=>{i&&A.removeEventListener("scroll",n),o&&A.removeEventListener("resize",n)}),v==null||v(),(I=k)==null||I.disconnect(),k=null,f&&cancelAnimationFrame(C)}}const GYe=yYe,KYe=xYe,ZYe=pYe,YYe=_Ye,XYe=mYe,Gbe=fYe,QYe=vYe,JYe=(t,e,n)=>{const s=new Map,i={platform:VYe,...n},o={...i.platform,_c:s};return hYe(t,e,{...i,platform:o})};var eXe=typeof document<"u",tXe=function(){},GJ=eXe?P.useLayoutEffect:tXe;function Fee(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,s,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(s=n;s--!==0;)if(!Fee(t[s],e[s]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(e,i[s]))return!1;for(s=n;s--!==0;){const o=i[s];if(!(o==="_owner"&&t.$$typeof)&&!Fee(t[o],e[o]))return!1}return!0}return t!==t&&e!==e}function MAe(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Kbe(t,e){const n=MAe(t);return Math.round(e*n)/n}function dle(t){const e=P.useRef(t);return GJ(()=>{e.current=t}),e}function rXe(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:s=[],platform:i,elements:{reference:o,floating:c}={},transform:a=!0,whileElementsMounted:f,open:m}=t,[y,v]=P.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[w,k]=P.useState(s);Fee(w,s)||k(s);const[C,S]=P.useState(null),[T,I]=P.useState(null),A=P.useCallback(fe=>{fe!==q.current&&(q.current=fe,S(fe))},[]),D=P.useCallback(fe=>{fe!==W.current&&(W.current=fe,I(fe))},[]),$=o||C,F=c||T,q=P.useRef(null),W=P.useRef(null),K=P.useRef(y),Z=f!=null,re=dle(f),he=dle(i),ue=dle(m),Ne=P.useCallback(()=>{if(!q.current||!W.current)return;const fe={placement:e,strategy:n,middleware:w};he.current&&(fe.platform=he.current),JYe(q.current,W.current,fe).then(ve=>{const Ie={...ve,isPositioned:ue.current!==!1};se.current&&!Fee(K.current,Ie)&&(K.current=Ie,N1.flushSync(()=>{v(Ie)}))})},[w,e,n,he,ue]);GJ(()=>{m===!1&&K.current.isPositioned&&(K.current.isPositioned=!1,v(fe=>({...fe,isPositioned:!1})))},[m]);const se=P.useRef(!1);GJ(()=>(se.current=!0,()=>{se.current=!1}),[]),GJ(()=>{if($&&(q.current=$),F&&(W.current=F),$&&F){if(re.current)return re.current($,F,Ne);Ne()}},[$,F,Ne,re,Z]);const xe=P.useMemo(()=>({reference:q,floating:W,setReference:A,setFloating:D}),[A,D]),ie=P.useMemo(()=>({reference:$,floating:F}),[$,F]),me=P.useMemo(()=>{const fe={position:n,left:0,top:0};if(!ie.floating)return fe;const ve=Kbe(ie.floating,y.x),Ie=Kbe(ie.floating,y.y);return a?{...fe,transform:"translate("+ve+"px, "+Ie+"px)",...MAe(ie.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ve,top:Ie}},[n,a,ie.floating,y.x,y.y]);return P.useMemo(()=>({...y,update:Ne,refs:xe,elements:ie,floatingStyles:me}),[y,Ne,xe,ie,me])}const nXe=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:s,padding:i}=typeof t=="function"?t(n):t;return s&&e(s)?s.current!=null?Gbe({element:s.current,padding:i}).fn(n):{}:s?Gbe({element:s,padding:i}).fn(n):{}}}},sXe=(t,e)=>({...GYe(t),options:[t,e]}),iXe=(t,e)=>({...KYe(t),options:[t,e]}),aXe=(t,e)=>({...QYe(t),options:[t,e]}),oXe=(t,e)=>({...ZYe(t),options:[t,e]}),lXe=(t,e)=>({...YYe(t),options:[t,e]}),cXe=(t,e)=>({...XYe(t),options:[t,e]}),dXe=(t,e)=>({...nXe(t),options:[t,e]});var uXe="Arrow",TAe=P.forwardRef((t,e)=>{const{children:n,width:s=10,height:i=5,...o}=t;return r.jsx(On.svg,{...o,ref:e,width:s,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:r.jsx("polygon",{points:"0,0 30,0 15,10"})})});TAe.displayName=uXe;var hXe=TAe;function VE(t){const[e,n]=P.useState(void 0);return Gl(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const s=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let c,a;if("borderBoxSize"in o){const f=o.borderBoxSize,m=Array.isArray(f)?f[0]:f;c=m.inlineSize,a=m.blockSize}else c=t.offsetWidth,a=t.offsetHeight;n({width:c,height:a})});return s.observe(t,{box:"border-box"}),()=>s.unobserve(t)}else n(void 0)},[t]),e}var zme="Popper",[AAe,Ng]=Zl(zme),[fXe,EAe]=AAe(zme),IAe=t=>{const{__scopePopper:e,children:n}=t,[s,i]=P.useState(null);return r.jsx(fXe,{scope:e,anchor:s,onAnchorChange:i,children:n})};IAe.displayName=zme;var PAe="PopperAnchor",LAe=P.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:s,...i}=t,o=EAe(PAe,n),c=P.useRef(null),a=Gs(e,c);return P.useEffect(()=>{o.onAnchorChange((s==null?void 0:s.current)||c.current)}),s?null:r.jsx(On.div,{...i,ref:a})});LAe.displayName=PAe;var Bme="PopperContent",[pXe,mXe]=AAe(Bme),OAe=P.forwardRef((t,e)=>{var Re,$e,Pe,Ae,nt,Te;const{__scopePopper:n,side:s="bottom",sideOffset:i=0,align:o="center",alignOffset:c=0,arrowPadding:a=0,avoidCollisions:f=!0,collisionBoundary:m=[],collisionPadding:y=0,sticky:v="partial",hideWhenDetached:w=!1,updatePositionStrategy:k="optimized",onPlaced:C,...S}=t,T=EAe(Bme,n),[I,A]=P.useState(null),D=Gs(e,Xe=>A(Xe)),[$,F]=P.useState(null),q=VE($),W=(q==null?void 0:q.width)??0,K=(q==null?void 0:q.height)??0,Z=s+(o!=="center"?"-"+o:""),re=typeof y=="number"?y:{top:0,right:0,bottom:0,left:0,...y},he=Array.isArray(m)?m:[m],ue=he.length>0,Ne={padding:re,boundary:he.filter(yXe),altBoundary:ue},{refs:se,floatingStyles:xe,placement:ie,isPositioned:me,middlewareData:fe}=rXe({strategy:"fixed",placement:Z,whileElementsMounted:(...Xe)=>WYe(...Xe,{animationFrame:k==="always"}),elements:{reference:T.anchor},middleware:[sXe({mainAxis:i+K,alignmentAxis:c}),f&&iXe({mainAxis:!0,crossAxis:!1,limiter:v==="partial"?aXe():void 0,...Ne}),f&&oXe({...Ne}),lXe({...Ne,apply:({elements:Xe,rects:ge,availableWidth:mt,availableHeight:rt})=>{const{width:We,height:Ce}=ge.reference,et=Xe.floating.style;et.setProperty("--radix-popper-available-width",`${mt}px`),et.setProperty("--radix-popper-available-height",`${rt}px`),et.setProperty("--radix-popper-anchor-width",`${We}px`),et.setProperty("--radix-popper-anchor-height",`${Ce}px`)}}),$&&dXe({element:$,padding:a}),xXe({arrowWidth:W,arrowHeight:K}),w&&cXe({strategy:"referenceHidden",...Ne})]}),[ve,Ie]=FAe(ie),Se=$l(C);Gl(()=>{me&&(Se==null||Se())},[me,Se]);const oe=(Re=fe.arrow)==null?void 0:Re.x,ae=($e=fe.arrow)==null?void 0:$e.y,je=((Pe=fe.arrow)==null?void 0:Pe.centerOffset)!==0,[Me,Ue]=P.useState();return Gl(()=>{I&&Ue(window.getComputedStyle(I).zIndex)},[I]),r.jsx("div",{ref:se.setFloating,"data-radix-popper-content-wrapper":"",style:{...xe,transform:me?xe.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Me,"--radix-popper-transform-origin":[(Ae=fe.transformOrigin)==null?void 0:Ae.x,(nt=fe.transformOrigin)==null?void 0:nt.y].join(" "),...((Te=fe.hide)==null?void 0:Te.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:r.jsx(pXe,{scope:n,placedSide:ve,onArrowChange:F,arrowX:oe,arrowY:ae,shouldHideArrow:je,children:r.jsx(On.div,{"data-side":ve,"data-align":Ie,...S,ref:D,style:{...S.style,animation:me?void 0:"none"}})})})});OAe.displayName=Bme;var DAe="PopperArrow",gXe={top:"bottom",right:"left",bottom:"top",left:"right"},RAe=P.forwardRef(function(e,n){const{__scopePopper:s,...i}=e,o=mXe(DAe,s),c=gXe[o.placedSide];return r.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[c]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:r.jsx(hXe,{...i,ref:n,style:{...i.style,display:"block"}})})});RAe.displayName=DAe;function yXe(t){return t!==null}var xXe=t=>({name:"transformOrigin",options:t,fn(e){var T,I,A;const{placement:n,rects:s,middlewareData:i}=e,c=((T=i.arrow)==null?void 0:T.centerOffset)!==0,a=c?0:t.arrowWidth,f=c?0:t.arrowHeight,[m,y]=FAe(n),v={start:"0%",center:"50%",end:"100%"}[y],w=(((I=i.arrow)==null?void 0:I.x)??0)+a/2,k=(((A=i.arrow)==null?void 0:A.y)??0)+f/2;let C="",S="";return m==="bottom"?(C=c?v:`${w}px`,S=`${-f}px`):m==="top"?(C=c?v:`${w}px`,S=`${s.floating.height+f}px`):m==="right"?(C=`${-f}px`,S=c?v:`${k}px`):m==="left"&&(C=`${s.floating.width+f}px`,S=c?v:`${k}px`),{data:{x:C,y:S}}}});function FAe(t){const[e,n="center"]=t.split("-");return[e,n]}var HE=IAe,IC=LAe,WE=OAe,GE=RAe,[Cne]=Zl("Tooltip",[Ng]),Mne=Ng(),zAe="TooltipProvider",vXe=700,aue="tooltip.open",[_Xe,$me]=Cne(zAe),BAe=t=>{const{__scopeTooltip:e,delayDuration:n=vXe,skipDelayDuration:s=300,disableHoverableContent:i=!1,children:o}=t,c=P.useRef(!0),a=P.useRef(!1),f=P.useRef(0);return P.useEffect(()=>{const m=f.current;return()=>window.clearTimeout(m)},[]),r.jsx(_Xe,{scope:e,isOpenDelayedRef:c,delayDuration:n,onOpen:P.useCallback(()=>{window.clearTimeout(f.current),c.current=!1},[]),onClose:P.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>c.current=!0,s)},[s]),isPointerInTransitRef:a,onPointerInTransitChange:P.useCallback(m=>{a.current=m},[]),disableHoverableContent:i,children:o})};BAe.displayName=zAe;var NA="Tooltip",[bXe,Tne]=Cne(NA),$Ae=t=>{const{__scopeTooltip:e,children:n,open:s,defaultOpen:i,onOpenChange:o,disableHoverableContent:c,delayDuration:a}=t,f=$me(NA,t.__scopeTooltip),m=Mne(e),[y,v]=P.useState(null),w=Fc(),k=P.useRef(0),C=c??f.disableHoverableContent,S=a??f.delayDuration,T=P.useRef(!1),[I,A]=Tu({prop:s,defaultProp:i??!1,onChange:W=>{W?(f.onOpen(),document.dispatchEvent(new CustomEvent(aue))):f.onClose(),o==null||o(W)},caller:NA}),D=P.useMemo(()=>I?T.current?"delayed-open":"instant-open":"closed",[I]),$=P.useCallback(()=>{window.clearTimeout(k.current),k.current=0,T.current=!1,A(!0)},[A]),F=P.useCallback(()=>{window.clearTimeout(k.current),k.current=0,A(!1)},[A]),q=P.useCallback(()=>{window.clearTimeout(k.current),k.current=window.setTimeout(()=>{T.current=!0,A(!0),k.current=0},S)},[S,A]);return P.useEffect(()=>()=>{k.current&&(window.clearTimeout(k.current),k.current=0)},[]),r.jsx(HE,{...m,children:r.jsx(bXe,{scope:e,contentId:w,open:I,stateAttribute:D,trigger:y,onTriggerChange:v,onTriggerEnter:P.useCallback(()=>{f.isOpenDelayedRef.current?q():$()},[f.isOpenDelayedRef,q,$]),onTriggerLeave:P.useCallback(()=>{C?F():(window.clearTimeout(k.current),k.current=0)},[F,C]),onOpen:$,onClose:F,disableHoverableContent:C,children:n})})};$Ae.displayName=NA;var oue="TooltipTrigger",UAe=P.forwardRef((t,e)=>{const{__scopeTooltip:n,...s}=t,i=Tne(oue,n),o=$me(oue,n),c=Mne(n),a=P.useRef(null),f=Gs(e,a,i.onTriggerChange),m=P.useRef(!1),y=P.useRef(!1),v=P.useCallback(()=>m.current=!1,[]);return P.useEffect(()=>()=>document.removeEventListener("pointerup",v),[v]),r.jsx(IC,{asChild:!0,...c,children:r.jsx(On.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...s,ref:f,onPointerMove:an(t.onPointerMove,w=>{w.pointerType!=="touch"&&!y.current&&!o.isPointerInTransitRef.current&&(i.onTriggerEnter(),y.current=!0)}),onPointerLeave:an(t.onPointerLeave,()=>{i.onTriggerLeave(),y.current=!1}),onPointerDown:an(t.onPointerDown,()=>{i.open&&i.onClose(),m.current=!0,document.addEventListener("pointerup",v,{once:!0})}),onFocus:an(t.onFocus,()=>{m.current||i.onOpen()}),onBlur:an(t.onBlur,i.onClose),onClick:an(t.onClick,i.onClose)})})});UAe.displayName=oue;var wXe="TooltipPortal",[bGt,jXe]=Cne(wXe,{forceMount:void 0}),O4="TooltipContent",qAe=P.forwardRef((t,e)=>{const n=jXe(O4,t.__scopeTooltip),{forceMount:s=n.forceMount,side:i="top",...o}=t,c=Tne(O4,t.__scopeTooltip);return r.jsx(oc,{present:s||c.open,children:c.disableHoverableContent?r.jsx(VAe,{side:i,...o,ref:e}):r.jsx(kXe,{side:i,...o,ref:e})})}),kXe=P.forwardRef((t,e)=>{const n=Tne(O4,t.__scopeTooltip),s=$me(O4,t.__scopeTooltip),i=P.useRef(null),o=Gs(e,i),[c,a]=P.useState(null),{trigger:f,onClose:m}=n,y=i.current,{onPointerInTransitChange:v}=s,w=P.useCallback(()=>{a(null),v(!1)},[v]),k=P.useCallback((C,S)=>{const T=C.currentTarget,I={x:C.clientX,y:C.clientY},A=TXe(I,T.getBoundingClientRect()),D=AXe(I,A),$=EXe(S.getBoundingClientRect()),F=PXe([...D,...$]);a(F),v(!0)},[v]);return P.useEffect(()=>()=>w(),[w]),P.useEffect(()=>{if(f&&y){const C=T=>k(T,y),S=T=>k(T,f);return f.addEventListener("pointerleave",C),y.addEventListener("pointerleave",S),()=>{f.removeEventListener("pointerleave",C),y.removeEventListener("pointerleave",S)}}},[f,y,k,w]),P.useEffect(()=>{if(c){const C=S=>{const T=S.target,I={x:S.clientX,y:S.clientY},A=(f==null?void 0:f.contains(T))||(y==null?void 0:y.contains(T)),D=!IXe(I,c);A?w():D&&(w(),m())};return document.addEventListener("pointermove",C),()=>document.removeEventListener("pointermove",C)}},[f,y,c,m,w]),r.jsx(VAe,{...t,ref:o})}),[NXe,SXe]=Cne(NA,{isInside:!1}),CXe=LTe("TooltipContent"),VAe=P.forwardRef((t,e)=>{const{__scopeTooltip:n,children:s,"aria-label":i,onEscapeKeyDown:o,onPointerDownOutside:c,...a}=t,f=Tne(O4,n),m=Mne(n),{onClose:y}=f;return P.useEffect(()=>(document.addEventListener(aue,y),()=>document.removeEventListener(aue,y)),[y]),P.useEffect(()=>{if(f.trigger){const v=w=>{const k=w.target;k!=null&&k.contains(f.trigger)&&y()};return window.addEventListener("scroll",v,{capture:!0}),()=>window.removeEventListener("scroll",v,{capture:!0})}},[f.trigger,y]),r.jsx(S1,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:c,onFocusOutside:v=>v.preventDefault(),onDismiss:y,children:r.jsxs(WE,{"data-state":f.stateAttribute,...m,...a,ref:e,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[r.jsx(CXe,{children:s}),r.jsx(NXe,{scope:n,isInside:!0,children:r.jsx(yKe,{id:f.contentId,role:"tooltip",children:i||s})})]})})});qAe.displayName=O4;var HAe="TooltipArrow",MXe=P.forwardRef((t,e)=>{const{__scopeTooltip:n,...s}=t,i=Mne(n);return SXe(HAe,n).isInside?null:r.jsx(GE,{...i,...s,ref:e})});MXe.displayName=HAe;function TXe(t,e){const n=Math.abs(e.top-t.y),s=Math.abs(e.bottom-t.y),i=Math.abs(e.right-t.x),o=Math.abs(e.left-t.x);switch(Math.min(n,s,i,o)){case o:return"left";case i:return"right";case n:return"top";case s:return"bottom";default:throw new Error("unreachable")}}function AXe(t,e,n=5){const s=[];switch(e){case"top":s.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":s.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":s.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":s.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return s}function EXe(t){const{top:e,right:n,bottom:s,left:i}=t;return[{x:i,y:e},{x:n,y:e},{x:n,y:s},{x:i,y:s}]}function IXe(t,e){const{x:n,y:s}=t;let i=!1;for(let o=0,c=e.length-1;os!=w>s&&n<(v-m)*(s-y)/(w-y)+m&&(i=!i)}return i}function PXe(t){const e=t.slice();return e.sort((n,s)=>n.xs.x?1:n.ys.y?1:0),LXe(e)}function LXe(t){if(t.length<=1)return t.slice();const e=[];for(let s=0;s=2;){const o=e[e.length-1],c=e[e.length-2];if((o.x-c.x)*(i.y-c.y)>=(o.y-c.y)*(i.x-c.x))e.pop();else break}e.push(i)}e.pop();const n=[];for(let s=t.length-1;s>=0;s--){const i=t[s];for(;n.length>=2;){const o=n[n.length-1],c=n[n.length-2];if((o.x-c.x)*(i.y-c.y)>=(o.y-c.y)*(i.x-c.x))n.pop();else break}n.push(i)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var OXe=BAe,DXe=$Ae,RXe=UAe,WAe=qAe;const KE=OXe,fg=DXe,pg=RXe,am=P.forwardRef(({className:t,sideOffset:e=4,...n},s)=>r.jsx(WAe,{ref:s,sideOffset:e,className:zt("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n}));am.displayName=WAe.displayName;var PC=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},cj=typeof window>"u"||"Deno"in globalThis;function pu(){}function FXe(t,e){return typeof t=="function"?t(e):t}function lue(t){return typeof t=="number"&&t>=0&&t!==1/0}function GAe(t,e){return Math.max(t+(e||0)-Date.now(),0)}function t1(t,e){return typeof t=="function"?t(e):t}function wf(t,e){return typeof t=="function"?t(e):t}function Zbe(t,e){const{type:n="all",exact:s,fetchStatus:i,predicate:o,queryKey:c,stale:a}=t;if(c){if(s){if(e.queryHash!==Ume(c,e.options))return!1}else if(!SA(e.queryKey,c))return!1}if(n!=="all"){const f=e.isActive();if(n==="active"&&!f||n==="inactive"&&f)return!1}return!(typeof a=="boolean"&&e.isStale()!==a||i&&i!==e.state.fetchStatus||o&&!o(e))}function Ybe(t,e){const{exact:n,status:s,predicate:i,mutationKey:o}=t;if(o){if(!e.options.mutationKey)return!1;if(n){if(dj(e.options.mutationKey)!==dj(o))return!1}else if(!SA(e.options.mutationKey,o))return!1}return!(s&&e.state.status!==s||i&&!i(e))}function Ume(t,e){return((e==null?void 0:e.queryKeyHashFn)||dj)(t)}function dj(t){return JSON.stringify(t,(e,n)=>cue(n)?Object.keys(n).sort().reduce((s,i)=>(s[i]=n[i],s),{}):n)}function SA(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>SA(t[n],e[n])):!1}function KAe(t,e){if(t===e)return t;const n=Xbe(t)&&Xbe(e);if(n||cue(t)&&cue(e)){const s=n?t:Object.keys(t),i=s.length,o=n?e:Object.keys(e),c=o.length,a=n?[]:{},f=new Set(s);let m=0;for(let y=0;y{setTimeout(e,t)})}function due(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?KAe(t,e):e}function BXe(t,e,n=0){const s=[...t,e];return n&&s.length>n?s.slice(1):s}function $Xe(t,e,n=0){const s=[e,...t];return n&&s.length>n?s.slice(0,-1):s}var qme=Symbol();function ZAe(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===qme?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function YAe(t,e){return typeof t=="function"?t(...e):!!t}var jw,f0,m4,cMe,UXe=(cMe=class extends PC{constructor(){super();ri(this,jw);ri(this,f0);ri(this,m4);is(this,m4,e=>{if(!cj&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){Zt(this,f0)||this.setEventListener(Zt(this,m4))}onUnsubscribe(){var e;this.hasListeners()||((e=Zt(this,f0))==null||e.call(this),is(this,f0,void 0))}setEventListener(e){var n;is(this,m4,e),(n=Zt(this,f0))==null||n.call(this),is(this,f0,e(s=>{typeof s=="boolean"?this.setFocused(s):this.onFocus()}))}setFocused(e){Zt(this,jw)!==e&&(is(this,jw,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof Zt(this,jw)=="boolean"?Zt(this,jw):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},jw=new WeakMap,f0=new WeakMap,m4=new WeakMap,cMe),Vme=new UXe,g4,p0,y4,dMe,qXe=(dMe=class extends PC{constructor(){super();ri(this,g4,!0);ri(this,p0);ri(this,y4);is(this,y4,e=>{if(!cj&&window.addEventListener){const n=()=>e(!0),s=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",s)}}})}onSubscribe(){Zt(this,p0)||this.setEventListener(Zt(this,y4))}onUnsubscribe(){var e;this.hasListeners()||((e=Zt(this,p0))==null||e.call(this),is(this,p0,void 0))}setEventListener(e){var n;is(this,y4,e),(n=Zt(this,p0))==null||n.call(this),is(this,p0,e(this.setOnline.bind(this)))}setOnline(e){Zt(this,g4)!==e&&(is(this,g4,e),this.listeners.forEach(s=>{s(e)}))}isOnline(){return Zt(this,g4)}},g4=new WeakMap,p0=new WeakMap,y4=new WeakMap,dMe),Bee=new qXe;function uue(){let t,e;const n=new Promise((i,o)=>{t=i,e=o});n.status="pending",n.catch(()=>{});function s(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{s({status:"fulfilled",value:i}),t(i)},n.reject=i=>{s({status:"rejected",reason:i}),e(i)},n}function VXe(t){return Math.min(1e3*2**t,3e4)}function XAe(t){return(t??"online")==="online"?Bee.isOnline():!0}var QAe=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function ule(t){return t instanceof QAe}function JAe(t){let e=!1,n=0,s=!1,i;const o=uue(),c=S=>{var T;s||(w(new QAe(S)),(T=t.abort)==null||T.call(t))},a=()=>{e=!0},f=()=>{e=!1},m=()=>Vme.isFocused()&&(t.networkMode==="always"||Bee.isOnline())&&t.canRun(),y=()=>XAe(t.networkMode)&&t.canRun(),v=S=>{var T;s||(s=!0,(T=t.onSuccess)==null||T.call(t,S),i==null||i(),o.resolve(S))},w=S=>{var T;s||(s=!0,(T=t.onError)==null||T.call(t,S),i==null||i(),o.reject(S))},k=()=>new Promise(S=>{var T;i=I=>{(s||m())&&S(I)},(T=t.onPause)==null||T.call(t)}).then(()=>{var S;i=void 0,s||(S=t.onContinue)==null||S.call(t)}),C=()=>{if(s)return;let S;const T=n===0?t.initialPromise:void 0;try{S=T??t.fn()}catch(I){S=Promise.reject(I)}Promise.resolve(S).then(v).catch(I=>{var q;if(s)return;const A=t.retry??(cj?0:3),D=t.retryDelay??VXe,$=typeof D=="function"?D(n,I):D,F=A===!0||typeof A=="number"&&nm()?void 0:k()).then(()=>{e?w(I):C()})})};return{promise:o,cancel:c,continue:()=>(i==null||i(),o),cancelRetry:a,continueRetry:f,canStart:y,start:()=>(y()?C():k().then(C),o)}}var HXe=t=>setTimeout(t,0);function WXe(){let t=[],e=0,n=a=>{a()},s=a=>{a()},i=HXe;const o=a=>{e?t.push(a):i(()=>{n(a)})},c=()=>{const a=t;t=[],a.length&&i(()=>{s(()=>{a.forEach(f=>{n(f)})})})};return{batch:a=>{let f;e++;try{f=a()}finally{e--,e||c()}return f},batchCalls:a=>(...f)=>{o(()=>{a(...f)})},schedule:o,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{s=a},setScheduler:a=>{i=a}}}var Oc=WXe(),kw,uMe,eEe=(uMe=class{constructor(){ri(this,kw)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),lue(this.gcTime)&&is(this,kw,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(cj?1/0:5*60*1e3))}clearGcTimeout(){Zt(this,kw)&&(clearTimeout(Zt(this,kw)),is(this,kw,void 0))}},kw=new WeakMap,uMe),x4,Nw,bf,Sw,Fd,IE,Cw,Fp,ly,hMe,GXe=(hMe=class extends eEe{constructor(e){super();ri(this,Fp);ri(this,x4);ri(this,Nw);ri(this,bf);ri(this,Sw);ri(this,Fd);ri(this,IE);ri(this,Cw);is(this,Cw,!1),is(this,IE,e.defaultOptions),this.setOptions(e.options),this.observers=[],is(this,Sw,e.client),is(this,bf,Zt(this,Sw).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,is(this,x4,KXe(this.options)),this.state=e.state??Zt(this,x4),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=Zt(this,Fd))==null?void 0:e.promise}setOptions(e){this.options={...Zt(this,IE),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&Zt(this,bf).remove(this)}setData(e,n){const s=due(this.state.data,e,this.options);return sa(this,Fp,ly).call(this,{data:s,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),s}setState(e,n){sa(this,Fp,ly).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var s,i;const n=(s=Zt(this,Fd))==null?void 0:s.promise;return(i=Zt(this,Fd))==null||i.cancel(e),n?n.then(pu).catch(pu):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(Zt(this,x4))}isActive(){return this.observers.some(e=>wf(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===qme||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>t1(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!GAe(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(s=>s.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=Zt(this,Fd))==null||n.continue()}onOnline(){var n;const e=this.observers.find(s=>s.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=Zt(this,Fd))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),Zt(this,bf).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(Zt(this,Fd)&&(Zt(this,Cw)?Zt(this,Fd).cancel({revert:!0}):Zt(this,Fd).cancelRetry()),this.scheduleGc()),Zt(this,bf).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||sa(this,Fp,ly).call(this,{type:"invalidate"})}fetch(e,n){var m,y,v;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(Zt(this,Fd))return Zt(this,Fd).continueRetry(),Zt(this,Fd).promise}if(e&&this.setOptions(e),!this.options.queryFn){const w=this.observers.find(k=>k.options.queryFn);w&&this.setOptions(w.options)}const s=new AbortController,i=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(is(this,Cw,!0),s.signal)})},o=()=>{const w=ZAe(this.options,n),C=(()=>{const S={client:Zt(this,Sw),queryKey:this.queryKey,meta:this.meta};return i(S),S})();return is(this,Cw,!1),this.options.persister?this.options.persister(w,C,this):w(C)},a=(()=>{const w={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:Zt(this,Sw),state:this.state,fetchFn:o};return i(w),w})();(m=this.options.behavior)==null||m.onFetch(a,this),is(this,Nw,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((y=a.fetchOptions)==null?void 0:y.meta))&&sa(this,Fp,ly).call(this,{type:"fetch",meta:(v=a.fetchOptions)==null?void 0:v.meta});const f=w=>{var k,C,S,T;ule(w)&&w.silent||sa(this,Fp,ly).call(this,{type:"error",error:w}),ule(w)||((C=(k=Zt(this,bf).config).onError)==null||C.call(k,w,this),(T=(S=Zt(this,bf).config).onSettled)==null||T.call(S,this.state.data,w,this)),this.scheduleGc()};return is(this,Fd,JAe({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,abort:s.abort.bind(s),onSuccess:w=>{var k,C,S,T;if(w===void 0){f(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(w)}catch(I){f(I);return}(C=(k=Zt(this,bf).config).onSuccess)==null||C.call(k,w,this),(T=(S=Zt(this,bf).config).onSettled)==null||T.call(S,w,this.state.error,this),this.scheduleGc()},onError:f,onFail:(w,k)=>{sa(this,Fp,ly).call(this,{type:"failed",failureCount:w,error:k})},onPause:()=>{sa(this,Fp,ly).call(this,{type:"pause"})},onContinue:()=>{sa(this,Fp,ly).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0})),Zt(this,Fd).start()}},x4=new WeakMap,Nw=new WeakMap,bf=new WeakMap,Sw=new WeakMap,Fd=new WeakMap,IE=new WeakMap,Cw=new WeakMap,Fp=new WeakSet,ly=function(e){const n=s=>{switch(e.type){case"failed":return{...s,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,...tEe(s.data,this.options),fetchMeta:e.meta??null};case"success":return is(this,Nw,void 0),{...s,data:e.data,dataUpdateCount:s.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const i=e.error;return ule(i)&&i.revert&&Zt(this,Nw)?{...Zt(this,Nw),fetchStatus:"idle"}:{...s,error:i,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...e.state}}};this.state=n(this.state),Oc.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),Zt(this,bf).notify({query:this,type:"updated",action:e})})},hMe);function tEe(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:XAe(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function KXe(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,s=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?s??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Wm,fMe,ZXe=(fMe=class extends PC{constructor(e={}){super();ri(this,Wm);this.config=e,is(this,Wm,new Map)}build(e,n,s){const i=n.queryKey,o=n.queryHash??Ume(i,n);let c=this.get(o);return c||(c=new GXe({client:e,queryKey:i,queryHash:o,options:e.defaultQueryOptions(n),state:s,defaultOptions:e.getQueryDefaults(i)}),this.add(c)),c}add(e){Zt(this,Wm).has(e.queryHash)||(Zt(this,Wm).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=Zt(this,Wm).get(e.queryHash);n&&(e.destroy(),n===e&&Zt(this,Wm).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Oc.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return Zt(this,Wm).get(e)}getAll(){return[...Zt(this,Wm).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(s=>Zbe(n,s))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(s=>Zbe(e,s)):n}notify(e){Oc.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){Oc.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Oc.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Wm=new WeakMap,fMe),Gm,uu,Mw,Km,Vx,pMe,YXe=(pMe=class extends eEe{constructor(e){super();ri(this,Km);ri(this,Gm);ri(this,uu);ri(this,Mw);this.mutationId=e.mutationId,is(this,uu,e.mutationCache),is(this,Gm,[]),this.state=e.state||rEe(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){Zt(this,Gm).includes(e)||(Zt(this,Gm).push(e),this.clearGcTimeout(),Zt(this,uu).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){is(this,Gm,Zt(this,Gm).filter(n=>n!==e)),this.scheduleGc(),Zt(this,uu).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){Zt(this,Gm).length||(this.state.status==="pending"?this.scheduleGc():Zt(this,uu).remove(this))}continue(){var e;return((e=Zt(this,Mw))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var o,c,a,f,m,y,v,w,k,C,S,T,I,A,D,$,F,q,W,K;const n=()=>{sa(this,Km,Vx).call(this,{type:"continue"})};is(this,Mw,JAe({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(Z,re)=>{sa(this,Km,Vx).call(this,{type:"failed",failureCount:Z,error:re})},onPause:()=>{sa(this,Km,Vx).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>Zt(this,uu).canRun(this)}));const s=this.state.status==="pending",i=!Zt(this,Mw).canStart();try{if(s)n();else{sa(this,Km,Vx).call(this,{type:"pending",variables:e,isPaused:i}),await((c=(o=Zt(this,uu).config).onMutate)==null?void 0:c.call(o,e,this));const re=await((f=(a=this.options).onMutate)==null?void 0:f.call(a,e));re!==this.state.context&&sa(this,Km,Vx).call(this,{type:"pending",context:re,variables:e,isPaused:i})}const Z=await Zt(this,Mw).start();return await((y=(m=Zt(this,uu).config).onSuccess)==null?void 0:y.call(m,Z,e,this.state.context,this)),await((w=(v=this.options).onSuccess)==null?void 0:w.call(v,Z,e,this.state.context)),await((C=(k=Zt(this,uu).config).onSettled)==null?void 0:C.call(k,Z,null,this.state.variables,this.state.context,this)),await((T=(S=this.options).onSettled)==null?void 0:T.call(S,Z,null,e,this.state.context)),sa(this,Km,Vx).call(this,{type:"success",data:Z}),Z}catch(Z){try{throw await((A=(I=Zt(this,uu).config).onError)==null?void 0:A.call(I,Z,e,this.state.context,this)),await(($=(D=this.options).onError)==null?void 0:$.call(D,Z,e,this.state.context)),await((q=(F=Zt(this,uu).config).onSettled)==null?void 0:q.call(F,void 0,Z,this.state.variables,this.state.context,this)),await((K=(W=this.options).onSettled)==null?void 0:K.call(W,void 0,Z,e,this.state.context)),Z}finally{sa(this,Km,Vx).call(this,{type:"error",error:Z})}}finally{Zt(this,uu).runNext(this)}}},Gm=new WeakMap,uu=new WeakMap,Mw=new WeakMap,Km=new WeakSet,Vx=function(e){const n=s=>{switch(e.type){case"failed":return{...s,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};case"pending":return{...s,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...s,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:e.error,failureCount:s.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Oc.batch(()=>{Zt(this,Gm).forEach(s=>{s.onMutationUpdate(e)}),Zt(this,uu).notify({mutation:this,type:"updated",action:e})})},pMe);function rEe(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var yy,zp,PE,mMe,XXe=(mMe=class extends PC{constructor(e={}){super();ri(this,yy);ri(this,zp);ri(this,PE);this.config=e,is(this,yy,new Set),is(this,zp,new Map),is(this,PE,0)}build(e,n,s){const i=new YXe({mutationCache:this,mutationId:++v6(this,PE)._,options:e.defaultMutationOptions(n),state:s});return this.add(i),i}add(e){Zt(this,yy).add(e);const n=$6(e);if(typeof n=="string"){const s=Zt(this,zp).get(n);s?s.push(e):Zt(this,zp).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(Zt(this,yy).delete(e)){const n=$6(e);if(typeof n=="string"){const s=Zt(this,zp).get(n);if(s)if(s.length>1){const i=s.indexOf(e);i!==-1&&s.splice(i,1)}else s[0]===e&&Zt(this,zp).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=$6(e);if(typeof n=="string"){const s=Zt(this,zp).get(n),i=s==null?void 0:s.find(o=>o.state.status==="pending");return!i||i===e}else return!0}runNext(e){var s;const n=$6(e);if(typeof n=="string"){const i=(s=Zt(this,zp).get(n))==null?void 0:s.find(o=>o!==e&&o.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Oc.batch(()=>{Zt(this,yy).forEach(e=>{this.notify({type:"removed",mutation:e})}),Zt(this,yy).clear(),Zt(this,zp).clear()})}getAll(){return Array.from(Zt(this,yy))}find(e){const n={exact:!0,...e};return this.getAll().find(s=>Ybe(n,s))}findAll(e={}){return this.getAll().filter(n=>Ybe(e,n))}notify(e){Oc.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return Oc.batch(()=>Promise.all(e.map(n=>n.continue().catch(pu))))}},yy=new WeakMap,zp=new WeakMap,PE=new WeakMap,mMe);function $6(t){var e;return(e=t.options.scope)==null?void 0:e.id}function Jbe(t){return{onFetch:(e,n)=>{var y,v,w,k,C;const s=e.options,i=(w=(v=(y=e.fetchOptions)==null?void 0:y.meta)==null?void 0:v.fetchMore)==null?void 0:w.direction,o=((k=e.state.data)==null?void 0:k.pages)||[],c=((C=e.state.data)==null?void 0:C.pageParams)||[];let a={pages:[],pageParams:[]},f=0;const m=async()=>{let S=!1;const T=D=>{Object.defineProperty(D,"signal",{enumerable:!0,get:()=>(e.signal.aborted?S=!0:e.signal.addEventListener("abort",()=>{S=!0}),e.signal)})},I=ZAe(e.options,e.fetchOptions),A=async(D,$,F)=>{if(S)return Promise.reject();if($==null&&D.pages.length)return Promise.resolve(D);const W=(()=>{const he={client:e.client,queryKey:e.queryKey,pageParam:$,direction:F?"backward":"forward",meta:e.options.meta};return T(he),he})(),K=await I(W),{maxPages:Z}=e.options,re=F?$Xe:BXe;return{pages:re(D.pages,K,Z),pageParams:re(D.pageParams,$,Z)}};if(i&&o.length){const D=i==="backward",$=D?QXe:ewe,F={pages:o,pageParams:c},q=$(s,F);a=await A(F,q,D)}else{const D=t??o.length;do{const $=f===0?c[0]??s.initialPageParam:ewe(s,a);if(f>0&&$==null)break;a=await A(a,$),f++}while(f{var S,T;return(T=(S=e.options).persister)==null?void 0:T.call(S,m,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=m}}}function ewe(t,{pages:e,pageParams:n}){const s=e.length-1;return e.length>0?t.getNextPageParam(e[s],e,n[s],n):void 0}function QXe(t,{pages:e,pageParams:n}){var s;return e.length>0?(s=t.getPreviousPageParam)==null?void 0:s.call(t,e[0],e,n[0],n):void 0}var Ll,m0,g0,v4,_4,y0,b4,w4,gMe,JXe=(gMe=class{constructor(t={}){ri(this,Ll);ri(this,m0);ri(this,g0);ri(this,v4);ri(this,_4);ri(this,y0);ri(this,b4);ri(this,w4);is(this,Ll,t.queryCache||new ZXe),is(this,m0,t.mutationCache||new XXe),is(this,g0,t.defaultOptions||{}),is(this,v4,new Map),is(this,_4,new Map),is(this,y0,0)}mount(){v6(this,y0)._++,Zt(this,y0)===1&&(is(this,b4,Vme.subscribe(async t=>{t&&(await this.resumePausedMutations(),Zt(this,Ll).onFocus())})),is(this,w4,Bee.subscribe(async t=>{t&&(await this.resumePausedMutations(),Zt(this,Ll).onOnline())})))}unmount(){var t,e;v6(this,y0)._--,Zt(this,y0)===0&&((t=Zt(this,b4))==null||t.call(this),is(this,b4,void 0),(e=Zt(this,w4))==null||e.call(this),is(this,w4,void 0))}isFetching(t){return Zt(this,Ll).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return Zt(this,m0).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=Zt(this,Ll).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=Zt(this,Ll).build(this,e),s=n.state.data;return s===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(t1(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(s))}getQueriesData(t){return Zt(this,Ll).findAll(t).map(({queryKey:e,state:n})=>{const s=n.data;return[e,s]})}setQueryData(t,e,n){const s=this.defaultQueryOptions({queryKey:t}),i=Zt(this,Ll).get(s.queryHash),o=i==null?void 0:i.state.data,c=FXe(e,o);if(c!==void 0)return Zt(this,Ll).build(this,s).setData(c,{...n,manual:!0})}setQueriesData(t,e,n){return Oc.batch(()=>Zt(this,Ll).findAll(t).map(({queryKey:s})=>[s,this.setQueryData(s,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=Zt(this,Ll).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=Zt(this,Ll);Oc.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=Zt(this,Ll);return Oc.batch(()=>(n.findAll(t).forEach(s=>{s.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},s=Oc.batch(()=>Zt(this,Ll).findAll(t).map(i=>i.cancel(n)));return Promise.all(s).then(pu).catch(pu)}invalidateQueries(t,e={}){return Oc.batch(()=>(Zt(this,Ll).findAll(t).forEach(n=>{n.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},s=Oc.batch(()=>Zt(this,Ll).findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let o=i.fetch(void 0,n);return n.throwOnError||(o=o.catch(pu)),i.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(s).then(pu)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=Zt(this,Ll).build(this,e);return n.isStaleByTime(t1(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(pu).catch(pu)}fetchInfiniteQuery(t){return t.behavior=Jbe(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(pu).catch(pu)}ensureInfiniteQueryData(t){return t.behavior=Jbe(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Bee.isOnline()?Zt(this,m0).resumePausedMutations():Promise.resolve()}getQueryCache(){return Zt(this,Ll)}getMutationCache(){return Zt(this,m0)}getDefaultOptions(){return Zt(this,g0)}setDefaultOptions(t){is(this,g0,t)}setQueryDefaults(t,e){Zt(this,v4).set(dj(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...Zt(this,v4).values()],n={};return e.forEach(s=>{SA(t,s.queryKey)&&Object.assign(n,s.defaultOptions)}),n}setMutationDefaults(t,e){Zt(this,_4).set(dj(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...Zt(this,_4).values()],n={};return e.forEach(s=>{SA(t,s.mutationKey)&&Object.assign(n,s.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...Zt(this,g0).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Ume(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===qme&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...Zt(this,g0).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){Zt(this,Ll).clear(),Zt(this,m0).clear()}},Ll=new WeakMap,m0=new WeakMap,g0=new WeakMap,v4=new WeakMap,_4=new WeakMap,y0=new WeakMap,b4=new WeakMap,w4=new WeakMap,gMe),Yu,Pa,LE,hu,Tw,j4,x0,v0,OE,k4,N4,Aw,Ew,_0,S4,ho,R5,hue,fue,pue,mue,gue,yue,xue,nEe,yMe,eQe=(yMe=class extends PC{constructor(e,n){super();ri(this,ho);ri(this,Yu);ri(this,Pa);ri(this,LE);ri(this,hu);ri(this,Tw);ri(this,j4);ri(this,x0);ri(this,v0);ri(this,OE);ri(this,k4);ri(this,N4);ri(this,Aw);ri(this,Ew);ri(this,_0);ri(this,S4,new Set);this.options=n,is(this,Yu,e),is(this,v0,null),is(this,x0,uue()),this.options.experimental_prefetchInRender||Zt(this,x0).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(Zt(this,Pa).addObserver(this),twe(Zt(this,Pa),this.options)?sa(this,ho,R5).call(this):this.updateResult(),sa(this,ho,mue).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return vue(Zt(this,Pa),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return vue(Zt(this,Pa),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,sa(this,ho,gue).call(this),sa(this,ho,yue).call(this),Zt(this,Pa).removeObserver(this)}setOptions(e){const n=this.options,s=Zt(this,Pa);if(this.options=Zt(this,Yu).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof wf(this.options.enabled,Zt(this,Pa))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");sa(this,ho,xue).call(this),Zt(this,Pa).setOptions(this.options),n._defaulted&&!zee(this.options,n)&&Zt(this,Yu).getQueryCache().notify({type:"observerOptionsUpdated",query:Zt(this,Pa),observer:this});const i=this.hasListeners();i&&rwe(Zt(this,Pa),s,this.options,n)&&sa(this,ho,R5).call(this),this.updateResult(),i&&(Zt(this,Pa)!==s||wf(this.options.enabled,Zt(this,Pa))!==wf(n.enabled,Zt(this,Pa))||t1(this.options.staleTime,Zt(this,Pa))!==t1(n.staleTime,Zt(this,Pa)))&&sa(this,ho,hue).call(this);const o=sa(this,ho,fue).call(this);i&&(Zt(this,Pa)!==s||wf(this.options.enabled,Zt(this,Pa))!==wf(n.enabled,Zt(this,Pa))||o!==Zt(this,_0))&&sa(this,ho,pue).call(this,o)}getOptimisticResult(e){const n=Zt(this,Yu).getQueryCache().build(Zt(this,Yu),e),s=this.createResult(n,e);return rQe(this,s)&&(is(this,hu,s),is(this,j4,this.options),is(this,Tw,Zt(this,Pa).state)),s}getCurrentResult(){return Zt(this,hu)}trackResult(e,n){return new Proxy(e,{get:(s,i)=>(this.trackProp(i),n==null||n(i),Reflect.get(s,i))})}trackProp(e){Zt(this,S4).add(e)}getCurrentQuery(){return Zt(this,Pa)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=Zt(this,Yu).defaultQueryOptions(e),s=Zt(this,Yu).getQueryCache().build(Zt(this,Yu),n);return s.fetch().then(()=>this.createResult(s,n))}fetch(e){return sa(this,ho,R5).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),Zt(this,hu)))}createResult(e,n){var Z;const s=Zt(this,Pa),i=this.options,o=Zt(this,hu),c=Zt(this,Tw),a=Zt(this,j4),m=e!==s?e.state:Zt(this,LE),{state:y}=e;let v={...y},w=!1,k;if(n._optimisticResults){const re=this.hasListeners(),he=!re&&twe(e,n),ue=re&&rwe(e,s,n,i);(he||ue)&&(v={...v,...tEe(y.data,e.options)}),n._optimisticResults==="isRestoring"&&(v.fetchStatus="idle")}let{error:C,errorUpdatedAt:S,status:T}=v;k=v.data;let I=!1;if(n.placeholderData!==void 0&&k===void 0&&T==="pending"){let re;o!=null&&o.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(re=o.data,I=!0):re=typeof n.placeholderData=="function"?n.placeholderData((Z=Zt(this,N4))==null?void 0:Z.state.data,Zt(this,N4)):n.placeholderData,re!==void 0&&(T="success",k=due(o==null?void 0:o.data,re,n),w=!0)}if(n.select&&k!==void 0&&!I)if(o&&k===(c==null?void 0:c.data)&&n.select===Zt(this,OE))k=Zt(this,k4);else try{is(this,OE,n.select),k=n.select(k),k=due(o==null?void 0:o.data,k,n),is(this,k4,k),is(this,v0,null)}catch(re){is(this,v0,re)}Zt(this,v0)&&(C=Zt(this,v0),k=Zt(this,k4),S=Date.now(),T="error");const A=v.fetchStatus==="fetching",D=T==="pending",$=T==="error",F=D&&A,q=k!==void 0,K={status:T,fetchStatus:v.fetchStatus,isPending:D,isSuccess:T==="success",isError:$,isInitialLoading:F,isLoading:F,data:k,dataUpdatedAt:v.dataUpdatedAt,error:C,errorUpdatedAt:S,failureCount:v.fetchFailureCount,failureReason:v.fetchFailureReason,errorUpdateCount:v.errorUpdateCount,isFetched:v.dataUpdateCount>0||v.errorUpdateCount>0,isFetchedAfterMount:v.dataUpdateCount>m.dataUpdateCount||v.errorUpdateCount>m.errorUpdateCount,isFetching:A,isRefetching:A&&!D,isLoadingError:$&&!q,isPaused:v.fetchStatus==="paused",isPlaceholderData:w,isRefetchError:$&&q,isStale:Hme(e,n),refetch:this.refetch,promise:Zt(this,x0),isEnabled:wf(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const re=Ne=>{K.status==="error"?Ne.reject(K.error):K.data!==void 0&&Ne.resolve(K.data)},he=()=>{const Ne=is(this,x0,K.promise=uue());re(Ne)},ue=Zt(this,x0);switch(ue.status){case"pending":e.queryHash===s.queryHash&&re(ue);break;case"fulfilled":(K.status==="error"||K.data!==ue.value)&&he();break;case"rejected":(K.status!=="error"||K.error!==ue.reason)&&he();break}}return K}updateResult(){const e=Zt(this,hu),n=this.createResult(Zt(this,Pa),this.options);if(is(this,Tw,Zt(this,Pa).state),is(this,j4,this.options),Zt(this,Tw).data!==void 0&&is(this,N4,Zt(this,Pa)),zee(n,e))return;is(this,hu,n);const s=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,o=typeof i=="function"?i():i;if(o==="all"||!o&&!Zt(this,S4).size)return!0;const c=new Set(o??Zt(this,S4));return this.options.throwOnError&&c.add("error"),Object.keys(Zt(this,hu)).some(a=>{const f=a;return Zt(this,hu)[f]!==e[f]&&c.has(f)})};sa(this,ho,nEe).call(this,{listeners:s()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&sa(this,ho,mue).call(this)}},Yu=new WeakMap,Pa=new WeakMap,LE=new WeakMap,hu=new WeakMap,Tw=new WeakMap,j4=new WeakMap,x0=new WeakMap,v0=new WeakMap,OE=new WeakMap,k4=new WeakMap,N4=new WeakMap,Aw=new WeakMap,Ew=new WeakMap,_0=new WeakMap,S4=new WeakMap,ho=new WeakSet,R5=function(e){sa(this,ho,xue).call(this);let n=Zt(this,Pa).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(pu)),n},hue=function(){sa(this,ho,gue).call(this);const e=t1(this.options.staleTime,Zt(this,Pa));if(cj||Zt(this,hu).isStale||!lue(e))return;const s=GAe(Zt(this,hu).dataUpdatedAt,e)+1;is(this,Aw,setTimeout(()=>{Zt(this,hu).isStale||this.updateResult()},s))},fue=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(Zt(this,Pa)):this.options.refetchInterval)??!1},pue=function(e){sa(this,ho,yue).call(this),is(this,_0,e),!(cj||wf(this.options.enabled,Zt(this,Pa))===!1||!lue(Zt(this,_0))||Zt(this,_0)===0)&&is(this,Ew,setInterval(()=>{(this.options.refetchIntervalInBackground||Vme.isFocused())&&sa(this,ho,R5).call(this)},Zt(this,_0)))},mue=function(){sa(this,ho,hue).call(this),sa(this,ho,pue).call(this,sa(this,ho,fue).call(this))},gue=function(){Zt(this,Aw)&&(clearTimeout(Zt(this,Aw)),is(this,Aw,void 0))},yue=function(){Zt(this,Ew)&&(clearInterval(Zt(this,Ew)),is(this,Ew,void 0))},xue=function(){const e=Zt(this,Yu).getQueryCache().build(Zt(this,Yu),this.options);if(e===Zt(this,Pa))return;const n=Zt(this,Pa);is(this,Pa,e),is(this,LE,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},nEe=function(e){Oc.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(Zt(this,hu))}),Zt(this,Yu).getQueryCache().notify({query:Zt(this,Pa),type:"observerResultsUpdated"})})},yMe);function tQe(t,e){return wf(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function twe(t,e){return tQe(t,e)||t.state.data!==void 0&&vue(t,e,e.refetchOnMount)}function vue(t,e,n){if(wf(e.enabled,t)!==!1&&t1(e.staleTime,t)!=="static"){const s=typeof n=="function"?n(t):n;return s==="always"||s!==!1&&Hme(t,e)}return!1}function rwe(t,e,n,s){return(t!==e||wf(s.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&Hme(t,n)}function Hme(t,e){return wf(e.enabled,t)!==!1&&t.isStaleByTime(t1(e.staleTime,t))}function rQe(t,e){return!zee(t.getCurrentResult(),e)}var b0,w0,Xu,xy,Ry,KJ,_ue,xMe,nQe=(xMe=class extends PC{constructor(n,s){super();ri(this,Ry);ri(this,b0);ri(this,w0);ri(this,Xu);ri(this,xy);is(this,b0,n),this.setOptions(s),this.bindMethods(),sa(this,Ry,KJ).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var i;const s=this.options;this.options=Zt(this,b0).defaultMutationOptions(n),zee(this.options,s)||Zt(this,b0).getMutationCache().notify({type:"observerOptionsUpdated",mutation:Zt(this,Xu),observer:this}),s!=null&&s.mutationKey&&this.options.mutationKey&&dj(s.mutationKey)!==dj(this.options.mutationKey)?this.reset():((i=Zt(this,Xu))==null?void 0:i.state.status)==="pending"&&Zt(this,Xu).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=Zt(this,Xu))==null||n.removeObserver(this)}onMutationUpdate(n){sa(this,Ry,KJ).call(this),sa(this,Ry,_ue).call(this,n)}getCurrentResult(){return Zt(this,w0)}reset(){var n;(n=Zt(this,Xu))==null||n.removeObserver(this),is(this,Xu,void 0),sa(this,Ry,KJ).call(this),sa(this,Ry,_ue).call(this)}mutate(n,s){var i;return is(this,xy,s),(i=Zt(this,Xu))==null||i.removeObserver(this),is(this,Xu,Zt(this,b0).getMutationCache().build(Zt(this,b0),this.options)),Zt(this,Xu).addObserver(this),Zt(this,Xu).execute(n)}},b0=new WeakMap,w0=new WeakMap,Xu=new WeakMap,xy=new WeakMap,Ry=new WeakSet,KJ=function(){var s;const n=((s=Zt(this,Xu))==null?void 0:s.state)??rEe();is(this,w0,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},_ue=function(n){Oc.batch(()=>{var s,i,o,c,a,f,m,y;if(Zt(this,xy)&&this.hasListeners()){const v=Zt(this,w0).variables,w=Zt(this,w0).context;(n==null?void 0:n.type)==="success"?((i=(s=Zt(this,xy)).onSuccess)==null||i.call(s,n.data,v,w),(c=(o=Zt(this,xy)).onSettled)==null||c.call(o,n.data,null,v,w)):(n==null?void 0:n.type)==="error"&&((f=(a=Zt(this,xy)).onError)==null||f.call(a,n.error,v,w),(y=(m=Zt(this,xy)).onSettled)==null||y.call(m,void 0,n.error,v,w))}this.listeners.forEach(v=>{v(Zt(this,w0))})})},xMe),sEe=P.createContext(void 0),Xr=t=>{const e=P.useContext(sEe);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},sQe=({client:t,children:e})=>(P.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),r.jsx(sEe.Provider,{value:t,children:e})),iEe=P.createContext(!1),iQe=()=>P.useContext(iEe);iEe.Provider;function aQe(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var oQe=P.createContext(aQe()),lQe=()=>P.useContext(oQe),cQe=(t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&(e.isReset()||(t.retryOnMount=!1))},dQe=t=>{P.useEffect(()=>{t.clearReset()},[t])},uQe=({result:t,errorResetBoundary:e,throwOnError:n,query:s,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&s&&(i&&t.data===void 0||YAe(n,[t.error,s])),hQe=t=>{if(t.suspense){const e=s=>s==="static"?s:Math.max(s??1e3,1e3),n=t.staleTime;t.staleTime=typeof n=="function"?(...s)=>e(n(...s)):e(n),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},fQe=(t,e)=>t.isLoading&&t.isFetching&&!e,pQe=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,nwe=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function mQe(t,e,n){var v,w,k,C,S;const s=iQe(),i=lQe(),o=Xr(),c=o.defaultQueryOptions(t);(w=(v=o.getDefaultOptions().queries)==null?void 0:v._experimental_beforeQuery)==null||w.call(v,c),c._optimisticResults=s?"isRestoring":"optimistic",hQe(c),cQe(c,i),dQe(i);const a=!o.getQueryCache().get(c.queryHash),[f]=P.useState(()=>new e(o,c)),m=f.getOptimisticResult(c),y=!s&&t.subscribed!==!1;if(P.useSyncExternalStore(P.useCallback(T=>{const I=y?f.subscribe(Oc.batchCalls(T)):pu;return f.updateResult(),I},[f,y]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),P.useEffect(()=>{f.setOptions(c)},[c,f]),pQe(c,m))throw nwe(c,f,i);if(uQe({result:m,errorResetBoundary:i,throwOnError:c.throwOnError,query:o.getQueryCache().get(c.queryHash),suspense:c.suspense}))throw m.error;if((C=(k=o.getDefaultOptions().queries)==null?void 0:k._experimental_afterQuery)==null||C.call(k,c,m),c.experimental_prefetchInRender&&!cj&&fQe(m,s)){const T=a?nwe(c,f,i):(S=o.getQueryCache().get(c.queryHash))==null?void 0:S.promise;T==null||T.catch(pu).finally(()=>{f.updateResult()})}return c.notifyOnChangeProps?m:f.trackResult(m)}function rr(t,e){return mQe(t,eQe)}function cr(t,e){const n=Xr(),[s]=P.useState(()=>new nQe(n,t));P.useEffect(()=>{s.setOptions(t)},[s,t]);const i=P.useSyncExternalStore(P.useCallback(c=>s.subscribe(Oc.batchCalls(c)),[s]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),o=P.useCallback((c,a)=>{s.mutate(c,a).catch(pu)},[s]);if(i.error&&YAe(s.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:o,mutateAsync:i.mutate}}/** * @remix-run/router v1.23.0 * * 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 CA(){return CA=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function aEe(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function yQe(){return Math.random().toString(36).substr(2,8)}function iwe(t,e){return{usr:t.state,key:t.key,idx:e}}function bue(t,e,n,s){return n===void 0&&(n=null),CA({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?LC(e):e,{state:n,key:e&&e.key||s||yQe()})}function $ee(t){let{pathname:e="/",search:n="",hash:s=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),s&&s!=="#"&&(e+=s.charAt(0)==="#"?s:"#"+s),e}function LC(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let s=t.indexOf("?");s>=0&&(e.search=t.substr(s),t=t.substr(0,s)),t&&(e.pathname=t)}return e}function xQe(t,e,n,s){s===void 0&&(s={});let{window:i=document.defaultView,v5Compat:o=!1}=s,c=i.history,a=N0.Pop,f=null,m=y();m==null&&(m=0,c.replaceState(CA({},c.state,{idx:m}),""));function y(){return(c.state||{idx:null}).idx}function v(){a=N0.Pop;let T=y(),I=T==null?null:T-m;m=T,f&&f({action:a,location:S.location,delta:I})}function w(T,I){a=N0.Push;let A=bue(S.location,T,I);m=y()+1;let D=iwe(A,m),$=S.createHref(A);try{c.pushState(D,"",$)}catch(F){if(F instanceof DOMException&&F.name==="DataCloneError")throw F;i.location.assign($)}o&&f&&f({action:a,location:S.location,delta:1})}function k(T,I){a=N0.Replace;let A=bue(S.location,T,I);m=y();let D=iwe(A,m),$=S.createHref(A);c.replaceState(D,"",$),o&&f&&f({action:a,location:S.location,delta:0})}function C(T){let I=i.location.origin!=="null"?i.location.origin:i.location.href,A=typeof T=="string"?T:$ee(T);return A=A.replace(/ $/,"%20"),ic(I,"No window.location.(origin|href) available to create URL for href: "+A),new URL(A,I)}let S={get action(){return a},get location(){return t(i,c)},listen(T){if(f)throw new Error("A history only accepts one active listener");return i.addEventListener(swe,v),f=T,()=>{i.removeEventListener(swe,v),f=null}},createHref(T){return e(i,T)},createURL:C,encodeLocation(T){let I=C(T);return{pathname:I.pathname,search:I.search,hash:I.hash}},push:w,replace:k,go(T){return c.go(T)}};return S}var awe;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(awe||(awe={}));function vQe(t,e,n){return n===void 0&&(n="/"),_Qe(t,e,n)}function _Qe(t,e,n,s){let i=typeof e=="string"?LC(e):e,o=Wme(i.pathname||"/",n);if(o==null)return null;let c=oEe(t);bQe(c);let a=null;for(let f=0;a==null&&f{let f={relativePath:a===void 0?o.path||"":a,caseSensitive:o.caseSensitive===!0,childrenIndex:c,route:o};f.relativePath.startsWith("/")&&(ic(f.relativePath.startsWith(s),'Absolute route path "'+f.relativePath+'" nested under path '+('"'+s+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),f.relativePath=f.relativePath.slice(s.length));let m=r1([s,f.relativePath]),y=n.concat(f);o.children&&o.children.length>0&&(ic(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+m+'".')),oEe(o.children,e,y,m)),!(o.path==null&&!o.index)&&e.push({path:m,score:MQe(m,o.index),routesMeta:y})};return t.forEach((o,c)=>{var a;if(o.path===""||!((a=o.path)!=null&&a.includes("?")))i(o,c);else for(let f of lEe(o.path))i(o,c,f)}),e}function lEe(t){let e=t.split("/");if(e.length===0)return[];let[n,...s]=e,i=n.endsWith("?"),o=n.replace(/\?$/,"");if(s.length===0)return i?[o,""]:[o];let c=lEe(s.join("/")),a=[];return a.push(...c.map(f=>f===""?o:[o,f].join("/"))),i&&a.push(...c),a.map(f=>t.startsWith("/")&&f===""?"/":f)}function bQe(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:TQe(e.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}const wQe=/^:[\w-]+$/,jQe=3,kQe=2,NQe=1,SQe=10,CQe=-2,owe=t=>t==="*";function MQe(t,e){let n=t.split("/"),s=n.length;return n.some(owe)&&(s+=CQe),e&&(s+=kQe),n.filter(i=>!owe(i)).reduce((i,o)=>i+(wQe.test(o)?jQe:o===""?NQe:SQe),s)}function TQe(t,e){return t.length===e.length&&t.slice(0,-1).every((s,i)=>s===e[i])?t[t.length-1]-e[e.length-1]:0}function AQe(t,e,n){let{routesMeta:s}=t,i={},o="/",c=[];for(let a=0;a{let{paramName:w,isOptional:k}=y;if(w==="*"){let S=a[v]||"";c=o.slice(0,o.length-S.length).replace(/(.)\/+$/,"$1")}const C=a[v];return k&&!C?m[w]=void 0:m[w]=(C||"").replace(/%2F/g,"/"),m},{}),pathname:o,pathnameBase:c,pattern:t}}function IQe(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),aEe(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let s=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,a,f)=>(s.push({paramName:a,isOptional:f!=null}),f?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(s.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),s]}function PQe(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return aEe(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function Wme(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,s=t.charAt(n);return s&&s!=="/"?null:t.slice(n)||"/"}function LQe(t,e){e===void 0&&(e="/");let{pathname:n,search:s="",hash:i=""}=typeof t=="string"?LC(t):t;return{pathname:n?n.startsWith("/")?n:OQe(n,e):e,search:FQe(s),hash:zQe(i)}}function OQe(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function hle(t,e,n,s){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(s)+"]. 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 DQe(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function Gme(t,e){let n=DQe(t);return e?n.map((s,i)=>i===n.length-1?s.pathname:s.pathnameBase):n.map(s=>s.pathnameBase)}function Kme(t,e,n,s){s===void 0&&(s=!1);let i;typeof t=="string"?i=LC(t):(i=CA({},t),ic(!i.pathname||!i.pathname.includes("?"),hle("?","pathname","search",i)),ic(!i.pathname||!i.pathname.includes("#"),hle("#","pathname","hash",i)),ic(!i.search||!i.search.includes("#"),hle("#","search","hash",i)));let o=t===""||i.pathname==="",c=o?"/":i.pathname,a;if(c==null)a=n;else{let v=e.length-1;if(!s&&c.startsWith("..")){let w=c.split("/");for(;w[0]==="..";)w.shift(),v-=1;i.pathname=w.join("/")}a=v>=0?e[v]:"/"}let f=LQe(i,a),m=c&&c!=="/"&&c.endsWith("/"),y=(o||c===".")&&n.endsWith("/");return!f.pathname.endsWith("/")&&(m||y)&&(f.pathname+="/"),f}const r1=t=>t.join("/").replace(/\/\/+/g,"/"),RQe=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),FQe=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,zQe=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function BQe(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const cEe=["post","put","patch","delete"];new Set(cEe);const $Qe=["get",...cEe];new Set($Qe);/** * React Router v6.30.1 * * 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 MA(){return MA=Object.assign?Object.assign.bind():function(t){for(var e=1;e{a.current=!0}),P.useCallback(function(m,y){if(y===void 0&&(y={}),!a.current)return;if(typeof m=="number"){s.go(m);return}let v=Kme(m,JSON.parse(c),o,y.relative==="path");t==null&&e!=="/"&&(v.pathname=v.pathname==="/"?e:r1([e,v.pathname])),(y.replace?s.replace:s.push)(v,y.state,y)},[e,s,c,o,t])}const HQe=P.createContext(null);function WQe(t){let e=P.useContext(Sg).outlet;return e&&P.createElement(HQe.Provider,{value:t},e)}function dd(){let{matches:t}=P.useContext(Sg),e=t[t.length-1];return e?e.params:{}}function hEe(t,e){let{relative:n}=e===void 0?{}:e,{future:s}=P.useContext(C1),{matches:i}=P.useContext(Sg),{pathname:o}=Cg(),c=JSON.stringify(Gme(i,s.v7_relativeSplatPath));return P.useMemo(()=>Kme(t,JSON.parse(c),o,n==="path"),[t,c,o,n])}function GQe(t,e){return KQe(t,e)}function KQe(t,e,n,s){OC()||ic(!1);let{navigator:i}=P.useContext(C1),{matches:o}=P.useContext(Sg),c=o[o.length-1],a=c?c.params:{};c&&c.pathname;let f=c?c.pathnameBase:"/";c&&c.route;let m=Cg(),y;if(e){var v;let T=typeof e=="string"?LC(e):e;f==="/"||(v=T.pathname)!=null&&v.startsWith(f)||ic(!1),y=T}else y=m;let w=y.pathname||"/",k=w;if(f!=="/"){let T=f.replace(/^\//,"").split("/");k="/"+w.replace(/^\//,"").split("/").slice(T.length).join("/")}let C=vQe(t,{pathname:k}),S=JQe(C&&C.map(T=>Object.assign({},T,{params:Object.assign({},a,T.params),pathname:r1([f,i.encodeLocation?i.encodeLocation(T.pathname).pathname:T.pathname]),pathnameBase:T.pathnameBase==="/"?f:r1([f,i.encodeLocation?i.encodeLocation(T.pathnameBase).pathname:T.pathnameBase])})),o,n,s);return e&&S?P.createElement(Ane.Provider,{value:{location:MA({pathname:"/",search:"",hash:"",state:null,key:"default"},y),navigationType:N0.Pop}},S):S}function ZQe(){let t=nJe(),e=BQe(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.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"}},e),n?P.createElement("pre",{style:i},n):null,null)}const YQe=P.createElement(ZQe,null);class XQe extends P.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?P.createElement(Sg.Provider,{value:this.props.routeContext},P.createElement(dEe.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function QQe(t){let{routeContext:e,match:n,children:s}=t,i=P.useContext(Zme);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),P.createElement(Sg.Provider,{value:e},s)}function JQe(t,e,n,s){var i;if(e===void 0&&(e=[]),n===void 0&&(n=null),s===void 0&&(s=null),t==null){var o;if(!n)return null;if(n.errors)t=n.matches;else if((o=s)!=null&&o.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let c=t,a=(i=n)==null?void 0:i.errors;if(a!=null){let y=c.findIndex(v=>v.route.id&&(a==null?void 0:a[v.route.id])!==void 0);y>=0||ic(!1),c=c.slice(0,Math.min(c.length,y+1))}let f=!1,m=-1;if(n&&s&&s.v7_partialHydration)for(let y=0;y=0?c=c.slice(0,m+1):c=[c[0]];break}}}return c.reduceRight((y,v,w)=>{let k,C=!1,S=null,T=null;n&&(k=a&&v.route.id?a[v.route.id]:void 0,S=v.route.errorElement||YQe,f&&(m<0&&w===0?(iJe("route-fallback"),C=!0,T=null):m===w&&(C=!0,T=v.route.hydrateFallbackElement||null)));let I=e.concat(c.slice(0,w+1)),A=()=>{let D;return k?D=S:C?D=T:v.route.Component?D=P.createElement(v.route.Component,null):v.route.element?D=v.route.element:D=y,P.createElement(QQe,{match:v,routeContext:{outlet:y,matches:I,isDataRoute:n!=null},children:D})};return n&&(v.route.ErrorBoundary||v.route.errorElement||w===0)?P.createElement(XQe,{location:n.location,revalidation:n.revalidation,component:S,error:k,children:A(),routeContext:{outlet:null,matches:I,isDataRoute:!0}}):A()},null)}var fEe=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(fEe||{}),pEe=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(pEe||{});function eJe(t){let e=P.useContext(Zme);return e||ic(!1),e}function tJe(t){let e=P.useContext(UQe);return e||ic(!1),e}function rJe(t){let e=P.useContext(Sg);return e||ic(!1),e}function mEe(t){let e=rJe(),n=e.matches[e.matches.length-1];return n.route.id||ic(!1),n.route.id}function nJe(){var t;let e=P.useContext(dEe),n=tJe(),s=mEe();return e!==void 0?e:(t=n.errors)==null?void 0:t[s]}function sJe(){let{router:t}=eJe(fEe.UseNavigateStable),e=mEe(pEe.UseNavigateStable),n=P.useRef(!1);return uEe(()=>{n.current=!0}),P.useCallback(function(i,o){o===void 0&&(o={}),n.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,MA({fromRouteId:e},o)))},[t,e])}const lwe={};function iJe(t,e,n){lwe[t]||(lwe[t]=!0)}function aJe(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function ZJ(t){let{to:e,replace:n,state:s,relative:i}=t;OC()||ic(!1);let{future:o,static:c}=P.useContext(C1),{matches:a}=P.useContext(Sg),{pathname:f}=Cg(),m=es(),y=Kme(e,Gme(a,o.v7_relativeSplatPath),f,i==="path"),v=JSON.stringify(y);return P.useEffect(()=>m(JSON.parse(v),{replace:n,state:s,relative:i}),[m,v,i,n,s]),null}function oJe(t){return WQe(t.context)}function ln(t){ic(!1)}function lJe(t){let{basename:e="/",children:n=null,location:s,navigationType:i=N0.Pop,navigator:o,static:c=!1,future:a}=t;OC()&&ic(!1);let f=e.replace(/^\/*/,"/"),m=P.useMemo(()=>({basename:f,navigator:o,static:c,future:MA({v7_relativeSplatPath:!1},a)}),[f,a,o,c]);typeof s=="string"&&(s=LC(s));let{pathname:y="/",search:v="",hash:w="",state:k=null,key:C="default"}=s,S=P.useMemo(()=>{let T=Wme(y,f);return T==null?null:{location:{pathname:T,search:v,hash:w,state:k,key:C},navigationType:i}},[f,y,v,w,k,C,i]);return S==null?null:P.createElement(C1.Provider,{value:m},P.createElement(Ane.Provider,{children:n,value:S}))}function cJe(t){let{children:e,location:n}=t;return GQe(wue(e),n)}new Promise(()=>{});function wue(t,e){e===void 0&&(e=[]);let n=[];return P.Children.forEach(t,(s,i)=>{if(!P.isValidElement(s))return;let o=[...e,i];if(s.type===P.Fragment){n.push.apply(n,wue(s.props.children,o));return}s.type!==ln&&ic(!1),!s.props.index||!s.props.children||ic(!1);let c={id:s.props.id||o.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,loader:s.props.loader,action:s.props.action,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(c.children=wue(s.props.children,o)),n.push(c)}),n}/** * React Router DOM v6.30.1 * * 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 jue(){return jue=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[i]=t[i]);return n}function uJe(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function hJe(t,e){return t.button===0&&(!e||e==="_self")&&!uJe(t)}function kue(t){return t===void 0&&(t=""),new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let s=t[n];return e.concat(Array.isArray(s)?s.map(i=>[n,i]):[[n,s]])},[]))}function fJe(t,e){let n=kue(t);return e&&e.forEach((s,i)=>{n.has(i)||e.getAll(i).forEach(o=>{n.append(i,o)})}),n}const pJe=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],mJe="6";try{window.__reactRouterVersion=mJe}catch{}const gJe="startTransition",cwe=Lpe[gJe];function yJe(t){let{basename:e,children:n,future:s,window:i}=t,o=P.useRef();o.current==null&&(o.current=gQe({window:i,v5Compat:!0}));let c=o.current,[a,f]=P.useState({action:c.action,location:c.location}),{v7_startTransition:m}=s||{},y=P.useCallback(v=>{m&&cwe?cwe(()=>f(v)):f(v)},[f,m]);return P.useLayoutEffect(()=>c.listen(y),[c,y]),P.useEffect(()=>aJe(s),[s]),P.createElement(lJe,{basename:e,children:n,location:a.location,navigationType:a.action,navigator:c,future:s})}const xJe=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",vJe=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ao=P.forwardRef(function(e,n){let{onClick:s,relative:i,reloadDocument:o,replace:c,state:a,target:f,to:m,preventScrollReset:y,viewTransition:v}=e,w=dJe(e,pJe),{basename:k}=P.useContext(C1),C,S=!1;if(typeof m=="string"&&vJe.test(m)&&(C=m,xJe))try{let D=new URL(window.location.href),$=m.startsWith("//")?new URL(D.protocol+m):new URL(m),F=Wme($.pathname,k);$.origin===D.origin&&F!=null?m=F+$.search+$.hash:S=!0}catch{}let T=qQe(m,{relative:i}),I=_Je(m,{replace:c,state:a,target:f,preventScrollReset:y,relative:i,viewTransition:v});function A(D){s&&s(D),D.defaultPrevented||I(D)}return P.createElement("a",jue({},w,{href:C||T,onClick:S||o?s:A,ref:n,target:f}))});var dwe;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(dwe||(dwe={}));var uwe;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(uwe||(uwe={}));function _Je(t,e){let{target:n,replace:s,state:i,preventScrollReset:o,relative:c,viewTransition:a}=e===void 0?{}:e,f=es(),m=Cg(),y=hEe(t,{relative:c});return P.useCallback(v=>{if(hJe(v,n)){v.preventDefault();let w=s!==void 0?s:$ee(m)===$ee(y);f(t,{replace:w,state:i,preventScrollReset:o,relative:c,viewTransition:a})}},[m,f,y,s,i,n,t,o,c,a])}function Ed(t){let e=P.useRef(kue(t)),n=P.useRef(!1),s=Cg(),i=P.useMemo(()=>fJe(s.search,n.current?null:e.current),[s.search]),o=es(),c=P.useCallback((a,f)=>{const m=kue(typeof a=="function"?a(i):a);n.current=!0,o("?"+m,f)},[o,i]);return[i,c]}var bJe=typeof Element<"u",wJe=typeof Map=="function",jJe=typeof Set=="function",kJe=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function YJ(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;var n,s,i;if(Array.isArray(t)){if(n=t.length,n!=e.length)return!1;for(s=n;s--!==0;)if(!YJ(t[s],e[s]))return!1;return!0}var o;if(wJe&&t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(o=t.entries();!(s=o.next()).done;)if(!e.has(s.value[0]))return!1;for(o=t.entries();!(s=o.next()).done;)if(!YJ(s.value[1],e.get(s.value[0])))return!1;return!0}if(jJe&&t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(o=t.entries();!(s=o.next()).done;)if(!e.has(s.value[0]))return!1;return!0}if(kJe&&ArrayBuffer.isView(t)&&ArrayBuffer.isView(e)){if(n=t.length,n!=e.length)return!1;for(s=n;s--!==0;)if(t[s]!==e[s])return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf&&typeof t.valueOf=="function"&&typeof e.valueOf=="function")return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString&&typeof t.toString=="function"&&typeof e.toString=="function")return t.toString()===e.toString();if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(e,i[s]))return!1;if(bJe&&t instanceof Element)return!1;for(s=n;s--!==0;)if(!((i[s]==="_owner"||i[s]==="__v"||i[s]==="__o")&&t.$$typeof)&&!YJ(t[i[s]],e[i[s]]))return!1;return!0}return t!==t&&e!==e}var NJe=function(e,n){try{return YJ(e,n)}catch(s){if((s.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw s}};const SJe=Oa(NJe);var CJe=function(t,e,n,s,i,o,c,a){if(!t){var f;if(e===void 0)f=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var m=[n,s,i,o,c,a],y=0;f=new Error(e.replace(/%s/g,function(){return m[y++]})),f.name="Invariant Violation"}throw f.framesToPop=1,f}},MJe=CJe;const hwe=Oa(MJe);var TJe=function(e,n,s,i){var o=s?s.call(i,e,n):void 0;if(o!==void 0)return!!o;if(e===n)return!0;if(typeof e!="object"||!e||typeof n!="object"||!n)return!1;var c=Object.keys(e),a=Object.keys(n);if(c.length!==a.length)return!1;for(var f=Object.prototype.hasOwnProperty.bind(n),m=0;m(t.BASE="base",t.BODY="body",t.HEAD="head",t.HTML="html",t.LINK="link",t.META="meta",t.NOSCRIPT="noscript",t.SCRIPT="script",t.STYLE="style",t.TITLE="title",t.FRAGMENT="Symbol(react.fragment)",t))(gEe||{}),fle={link:{rel:["amphtml","canonical","alternate"]},script:{type:["application/ld+json"]},meta:{charset:"",name:["generator","robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]}},fwe=Object.values(gEe),Yme={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},EJe=Object.entries(Yme).reduce((t,[e,n])=>(t[n]=e,t),{}),Zp="data-rh",n4={DEFAULT_TITLE:"defaultTitle",DEFER:"defer",ENCODE_SPECIAL_CHARACTERS:"encodeSpecialCharacters",ON_CHANGE_CLIENT_STATE:"onChangeClientState",TITLE_TEMPLATE:"titleTemplate",PRIORITIZE_SEO_TAGS:"prioritizeSeoTags"},s4=(t,e)=>{for(let n=t.length-1;n>=0;n-=1){const s=t[n];if(Object.prototype.hasOwnProperty.call(s,e))return s[e]}return null},IJe=t=>{let e=s4(t,"title");const n=s4(t,n4.TITLE_TEMPLATE);if(Array.isArray(e)&&(e=e.join("")),n&&e)return n.replace(/%s/g,()=>e);const s=s4(t,n4.DEFAULT_TITLE);return e||s||void 0},PJe=t=>s4(t,n4.ON_CHANGE_CLIENT_STATE)||(()=>{}),ple=(t,e)=>e.filter(n=>typeof n[t]<"u").map(n=>n[t]).reduce((n,s)=>({...n,...s}),{}),LJe=(t,e)=>e.filter(n=>typeof n.base<"u").map(n=>n.base).reverse().reduce((n,s)=>{if(!n.length){const i=Object.keys(s);for(let o=0;oconsole&&typeof console.warn=="function"&&console.warn(t),d5=(t,e,n)=>{const s={};return n.filter(i=>Array.isArray(i[t])?!0:(typeof i[t]<"u"&&OJe(`Helmet: ${t} should be of type "Array". Instead found type "${typeof i[t]}"`),!1)).map(i=>i[t]).reverse().reduce((i,o)=>{const c={};o.filter(f=>{let m;const y=Object.keys(f);for(let w=0;wi.push(f));const a=Object.keys(c);for(let f=0;f{if(Array.isArray(t)&&t.length){for(let n=0;n({baseTag:LJe(["href"],t),bodyAttributes:ple("bodyAttributes",t),defer:s4(t,n4.DEFER),encode:s4(t,n4.ENCODE_SPECIAL_CHARACTERS),htmlAttributes:ple("htmlAttributes",t),linkTags:d5("link",["rel","href"],t),metaTags:d5("meta",["name","charset","http-equiv","property","itemprop"],t),noscriptTags:d5("noscript",["innerHTML"],t),onChangeClientState:PJe(t),scriptTags:d5("script",["src","innerHTML"],t),styleTags:d5("style",["cssText"],t),title:IJe(t),titleAttributes:ple("titleAttributes",t),prioritizeSeoTags:DJe(t,n4.PRIORITIZE_SEO_TAGS)}),yEe=t=>Array.isArray(t)?t.join(""):t,FJe=(t,e)=>{const n=Object.keys(t);for(let s=0;sArray.isArray(t)?t.reduce((n,s)=>(FJe(s,e)?n.priority.push(s):n.default.push(s),n),{priority:[],default:[]}):{default:t,priority:[]},pwe=(t,e)=>({...t,[e]:void 0}),zJe=["noscript","script","style"],Nue=(t,e=!0)=>e===!1?String(t):String(t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),xEe=t=>Object.keys(t).reduce((e,n)=>{const s=typeof t[n]<"u"?`${n}="${t[n]}"`:`${n}`;return e?`${e} ${s}`:s},""),BJe=(t,e,n,s)=>{const i=xEe(n),o=yEe(e);return i?`<${t} ${Zp}="true" ${i}>${Nue(o,s)}`:`<${t} ${Zp}="true">${Nue(o,s)}`},$Je=(t,e,n=!0)=>e.reduce((s,i)=>{const o=i,c=Object.keys(o).filter(m=>!(m==="innerHTML"||m==="cssText")).reduce((m,y)=>{const v=typeof o[y]>"u"?y:`${y}="${Nue(o[y],n)}"`;return m?`${m} ${v}`:v},""),a=o.innerHTML||o.cssText||"",f=zJe.indexOf(t)===-1;return`${s}<${t} ${Zp}="true" ${c}${f?"/>":`>${a}`}`},""),vEe=(t,e={})=>Object.keys(t).reduce((n,s)=>{const i=Yme[s];return n[i||s]=t[s],n},e),UJe=(t,e,n)=>{const s={key:e,[Zp]:!0},i=vEe(n,s);return[lt.createElement("title",i,e)]},XJ=(t,e)=>e.map((n,s)=>{const i={key:s,[Zp]:!0};return Object.keys(n).forEach(o=>{const a=Yme[o]||o;if(a==="innerHTML"||a==="cssText"){const f=n.innerHTML||n.cssText;i.dangerouslySetInnerHTML={__html:f}}else i[a]=n[o]}),lt.createElement(t,i)}),_f=(t,e,n=!0)=>{switch(t){case"title":return{toComponent:()=>UJe(t,e.title,e.titleAttributes),toString:()=>BJe(t,e.title,e.titleAttributes,n)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>vEe(e),toString:()=>xEe(e)};default:return{toComponent:()=>XJ(t,e),toString:()=>$Je(t,e,n)}}},qJe=({metaTags:t,linkTags:e,scriptTags:n,encode:s})=>{const i=mle(t,fle.meta),o=mle(e,fle.link),c=mle(n,fle.script);return{priorityMethods:{toComponent:()=>[...XJ("meta",i.priority),...XJ("link",o.priority),...XJ("script",c.priority)],toString:()=>`${_f("meta",i.priority,s)} ${_f("link",o.priority,s)} ${_f("script",c.priority,s)}`},metaTags:i.default,linkTags:o.default,scriptTags:c.default}},VJe=t=>{const{baseTag:e,bodyAttributes:n,encode:s=!0,htmlAttributes:i,noscriptTags:o,styleTags:c,title:a="",titleAttributes:f,prioritizeSeoTags:m}=t;let{linkTags:y,metaTags:v,scriptTags:w}=t,k={toComponent:()=>{},toString:()=>""};return m&&({priorityMethods:k,linkTags:y,metaTags:v,scriptTags:w}=qJe(t)),{priority:k,base:_f("base",e,s),bodyAttributes:_f("bodyAttributes",n,s),htmlAttributes:_f("htmlAttributes",i,s),link:_f("link",y,s),meta:_f("meta",v,s),noscript:_f("noscript",o,s),script:_f("script",w,s),style:_f("style",c,s),title:_f("title",{title:a,titleAttributes:f},s)}},Sue=VJe,U6=[],_Ee=!!(typeof window<"u"&&window.document&&window.document.createElement),Cue=class{constructor(t,e){qn(this,"instances",[]);qn(this,"canUseDOM",_Ee);qn(this,"context");qn(this,"value",{setHelmet:t=>{this.context.helmet=t},helmetInstances:{get:()=>this.canUseDOM?U6:this.instances,add:t=>{(this.canUseDOM?U6:this.instances).push(t)},remove:t=>{const e=(this.canUseDOM?U6:this.instances).indexOf(t);(this.canUseDOM?U6:this.instances).splice(e,1)}}});this.context=t,this.canUseDOM=e||!1,e||(t.helmet=Sue({baseTag:[],bodyAttributes:{},htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},HJe={},bEe=lt.createContext(HJe),Iw,wEe=(Iw=class extends P.Component{constructor(n){super(n);qn(this,"helmetData");this.helmetData=new Cue(this.props.context||{},Iw.canUseDOM)}render(){return lt.createElement(bEe.Provider,{value:this.helmetData.value},this.props.children)}},qn(Iw,"canUseDOM",_Ee),Iw),SN=(t,e)=>{const n=document.head||document.querySelector("head"),s=n.querySelectorAll(`${t}[${Zp}]`),i=[].slice.call(s),o=[];let c;return e&&e.length&&e.forEach(a=>{const f=document.createElement(t);for(const m in a)if(Object.prototype.hasOwnProperty.call(a,m))if(m==="innerHTML")f.innerHTML=a.innerHTML;else if(m==="cssText")f.styleSheet?f.styleSheet.cssText=a.cssText:f.appendChild(document.createTextNode(a.cssText));else{const y=m,v=typeof a[y]>"u"?"":a[y];f.setAttribute(m,v)}f.setAttribute(Zp,"true"),i.some((m,y)=>(c=y,f.isEqualNode(m)))?i.splice(c,1):o.push(f)}),i.forEach(a=>{var f;return(f=a.parentNode)==null?void 0:f.removeChild(a)}),o.forEach(a=>n.appendChild(a)),{oldTags:i,newTags:o}},Mue=(t,e)=>{const n=document.getElementsByTagName(t)[0];if(!n)return;const s=n.getAttribute(Zp),i=s?s.split(","):[],o=[...i],c=Object.keys(e);for(const a of c){const f=e[a]||"";n.getAttribute(a)!==f&&n.setAttribute(a,f),i.indexOf(a)===-1&&i.push(a);const m=o.indexOf(a);m!==-1&&o.splice(m,1)}for(let a=o.length-1;a>=0;a-=1)n.removeAttribute(o[a]);i.length===o.length?n.removeAttribute(Zp):n.getAttribute(Zp)!==c.join(",")&&n.setAttribute(Zp,c.join(","))},WJe=(t,e)=>{typeof t<"u"&&document.title!==t&&(document.title=yEe(t)),Mue("title",e)},mwe=(t,e)=>{const{baseTag:n,bodyAttributes:s,htmlAttributes:i,linkTags:o,metaTags:c,noscriptTags:a,onChangeClientState:f,scriptTags:m,styleTags:y,title:v,titleAttributes:w}=t;Mue("body",s),Mue("html",i),WJe(v,w);const k={baseTag:SN("base",n),linkTags:SN("link",o),metaTags:SN("meta",c),noscriptTags:SN("noscript",a),scriptTags:SN("script",m),styleTags:SN("style",y)},C={},S={};Object.keys(k).forEach(T=>{const{newTags:I,oldTags:A}=k[T];I.length&&(C[T]=I),A.length&&(S[T]=k[T].oldTags)}),e&&e(),f(t,C,S)},u5=null,GJe=t=>{u5&&cancelAnimationFrame(u5),t.defer?u5=requestAnimationFrame(()=>{mwe(t,()=>{u5=null})}):(mwe(t),u5=null)},KJe=GJe,gwe=class extends P.Component{constructor(){super(...arguments);qn(this,"rendered",!1)}shouldComponentUpdate(e){return!AJe(e,this.props)}componentDidUpdate(){this.emitChange()}componentWillUnmount(){const{helmetInstances:e}=this.props.context;e.remove(this),this.emitChange()}emitChange(){const{helmetInstances:e,setHelmet:n}=this.props.context;let s=null;const i=RJe(e.get().map(o=>{const c={...o.props};return delete c.context,c}));wEe.canUseDOM?KJe(i):Sue&&(s=Sue(i)),n(s)}init(){if(this.rendered)return;this.rendered=!0;const{helmetInstances:e}=this.props.context;e.add(this),this.emitChange()}render(){return this.init(),null}},sde,Mg=(sde=class extends P.Component{shouldComponentUpdate(t){return!SJe(pwe(this.props,"helmetData"),pwe(t,"helmetData"))}mapNestedChildrenToProps(t,e){if(!e)return null;switch(t.type){case"script":case"noscript":return{innerHTML:e};case"style":return{cssText:e};default:throw new Error(`<${t.type} /> elements are self-closing and can not contain children. Refer to our API for more information.`)}}flattenArrayTypeChildren(t,e,n,s){return{...e,[t.type]:[...e[t.type]||[],{...n,...this.mapNestedChildrenToProps(t,s)}]}}mapObjectTypeChildren(t,e,n,s){switch(t.type){case"title":return{...e,[t.type]:s,titleAttributes:{...n}};case"body":return{...e,bodyAttributes:{...n}};case"html":return{...e,htmlAttributes:{...n}};default:return{...e,[t.type]:{...n}}}}mapArrayTypeChildrenToProps(t,e){let n={...e};return Object.keys(t).forEach(s=>{n={...n,[s]:t[s]}}),n}warnOnInvalidChildren(t,e){return hwe(fwe.some(n=>t.type===n),typeof t.type=="function"?"You may be attempting to nest components within each other, which is not allowed. Refer to our API for more information.":`Only elements types ${fwe.join(", ")} are allowed. Helmet does not support rendering <${t.type}> elements. Refer to our API for more information.`),hwe(!e||typeof e=="string"||Array.isArray(e)&&!e.some(n=>typeof n!="string"),`Helmet expects a string as a child of <${t.type}>. Did you forget to wrap your children in braces? ( <${t.type}>{\`\`} ) Refer to our API for more information.`),!0}mapChildrenToProps(t,e){let n={};return lt.Children.forEach(t,s=>{if(!s||!s.props)return;const{children:i,...o}=s.props,c=Object.keys(o).reduce((f,m)=>(f[EJe[m]||m]=o[m],f),{});let{type:a}=s;switch(typeof a=="symbol"?a=a.toString():this.warnOnInvalidChildren(s,i),a){case"Symbol(react.fragment)":e=this.mapChildrenToProps(i,e);break;case"link":case"meta":case"noscript":case"script":case"style":n=this.flattenArrayTypeChildren(s,n,c,i);break;default:e=this.mapObjectTypeChildren(s,e,c,i);break}}),this.mapArrayTypeChildrenToProps(n,e)}render(){const{children:t,...e}=this.props;let n={...e},{helmetData:s}=e;if(t&&(n=this.mapChildrenToProps(t,n)),s&&!(s instanceof Cue)){const i=s;s=new Cue(i.context,!0),delete n.helmetData}return s?lt.createElement(gwe,{...n,context:s.value}):lt.createElement(bEe.Consumer,null,i=>lt.createElement(gwe,{...n,context:i}))}},qn(sde,"defaultProps",{defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1}),sde),Tue=function(t,e){return Tue=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(n[i]=s[i])},Tue(t,e)};function jEe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Tue(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var Cf=function(){return Cf=Object.assign||function(e){for(var n,s=1,i=arguments.length;s=0;a--)(c=t[a])&&(o=(i<3?c(o):i>3?c(e,n,o):c(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o}function NEe(t,e){return function(n,s){e(n,s,t)}}function SEe(t,e,n,s,i,o){function c(I){if(I!==void 0&&typeof I!="function")throw new TypeError("Function expected");return I}for(var a=s.kind,f=a==="getter"?"get":a==="setter"?"set":"value",m=!e&&t?s.static?t:t.prototype:null,y=e||(m?Object.getOwnPropertyDescriptor(m,s.name):{}),v,w=!1,k=n.length-1;k>=0;k--){var C={};for(var S in s)C[S]=S==="access"?{}:s[S];for(var S in s.access)C.access[S]=s.access[S];C.addInitializer=function(I){if(w)throw new TypeError("Cannot add initializers after decoration has completed");o.push(c(I||null))};var T=(0,n[k])(a==="accessor"?{get:y.get,set:y.set}:y[f],C);if(a==="accessor"){if(T===void 0)continue;if(T===null||typeof T!="object")throw new TypeError("Object expected");(v=c(T.get))&&(y.get=v),(v=c(T.set))&&(y.set=v),(v=c(T.init))&&i.unshift(v)}else(v=c(T))&&(a==="field"?i.unshift(v):y[f]=v)}m&&Object.defineProperty(m,s.name,y),w=!0}function CEe(t,e,n){for(var s=arguments.length>2,i=0;i0&&o[o.length-1])&&(m[0]===6||m[0]===2)){n=0;continue}if(m[0]===3&&(!o||m[1]>o[0]&&m[1]=t.length&&(t=void 0),{value:t&&t[s++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Xme(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var s=n.call(t),i,o=[],c;try{for(;(e===void 0||e-- >0)&&!(i=s.next()).done;)o.push(i.value)}catch(a){c={error:a}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(c)throw c.error}}return o}function PEe(){for(var t=[],e=0;e1||f(k,S)})},C&&(i[k]=C(i[k])))}function f(k,C){try{m(s[k](C))}catch(S){w(o[0][3],S)}}function m(k){k.value instanceof D4?Promise.resolve(k.value.v).then(y,v):w(o[0][2],k)}function y(k){f("next",k)}function v(k){f("throw",k)}function w(k,C){k(C),o.shift(),o.length&&f(o[0][0],o[0][1])}}function DEe(t){var e,n;return e={},s("next"),s("throw",function(i){throw i}),s("return"),e[Symbol.iterator]=function(){return this},e;function s(i,o){e[i]=t[i]?function(c){return(n=!n)?{value:D4(t[i](c)),done:!1}:o?o(c):c}:o}}function REe(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof Uee=="function"?Uee(t):t[Symbol.iterator](),n={},s("next"),s("throw"),s("return"),n[Symbol.asyncIterator]=function(){return this},n);function s(o){n[o]=t[o]&&function(c){return new Promise(function(a,f){c=t[o](c),i(a,f,c.done,c.value)})}}function i(o,c,a,f){Promise.resolve(f).then(function(m){o({value:m,done:a})},c)}}function FEe(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}var ZJe=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e},Aue=function(t){return Aue=Object.getOwnPropertyNames||function(e){var n=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[n.length]=s);return n},Aue(t)};function zEe(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n=Aue(t),s=0;s0){document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),a=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));i=Promise.allSettled(n.map(f=>{if(f=eet(f),f in ywe)return;ywe[f]=!0;const m=f.endsWith(".css"),y=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${y}`))return;const v=document.createElement("link");if(v.rel=m?"stylesheet":JJe,m||(v.as="script"),v.crossOrigin="",v.href=f,a&&v.setAttribute("nonce",a),document.head.appendChild(v),m)return new Promise((w,k)=>{v.addEventListener("load",w),v.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${f}`)))})}))}function o(c){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=c,window.dispatchEvent(a),!a.defaultPrevented)throw c}return i.then(c=>{for(const a of c||[])a.status==="rejected"&&o(a.reason);return e().catch(o)})},tet=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...n)=>DC(async()=>{const{default:s}=await Promise.resolve().then(()=>Dj);return{default:s}},void 0).then(({default:s})=>s(...n)):e=fetch,(...n)=>e(...n)};class Jme extends Error{constructor(e,n="FunctionsError",s){super(e),this.name=n,this.context=s}}class xwe extends Jme{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class vwe extends Jme{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class _we extends Jme{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var Eue;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(Eue||(Eue={}));class ret{constructor(e,{headers:n={},customFetch:s,region:i=Eue.Any}={}){this.url=e,this.headers=n,this.region=i,this.fetch=tet(s)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return Cs(this,arguments,void 0,function*(n,s={}){var i;try{const{headers:o,method:c,body:a,signal:f}=s;let m={},{region:y}=s;y||(y=this.region);const v=new URL(`${this.url}/${n}`);y&&y!=="any"&&(m["x-region"]=y,v.searchParams.set("forceFunctionRegion",y));let w;a&&(o&&!Object.prototype.hasOwnProperty.call(o,"Content-Type")||!o)?typeof Blob<"u"&&a instanceof Blob||a instanceof ArrayBuffer?(m["Content-Type"]="application/octet-stream",w=a):typeof a=="string"?(m["Content-Type"]="text/plain",w=a):typeof FormData<"u"&&a instanceof FormData?w=a:(m["Content-Type"]="application/json",w=JSON.stringify(a)):w=a;const k=yield this.fetch(v.toString(),{method:c||"POST",headers:Object.assign(Object.assign(Object.assign({},m),this.headers),o),body:w,signal:f}).catch(I=>{throw I.name==="AbortError"?I:new xwe(I)}),C=k.headers.get("x-relay-error");if(C&&C==="true")throw new vwe(k);if(!k.ok)throw new _we(k);let S=((i=k.headers.get("Content-Type"))!==null&&i!==void 0?i:"text/plain").split(";")[0].trim(),T;return S==="application/json"?T=yield k.json():S==="application/octet-stream"||S==="application/pdf"?T=yield k.blob():S==="text/event-stream"?T=k:S==="multipart/form-data"?T=yield k.formData():T=yield k.text(),{data:T,error:null,response:k}}catch(o){return o instanceof Error&&o.name==="AbortError"?{data:null,error:new xwe(o)}:{data:null,error:o,response:o instanceof _we||o instanceof vwe?o.context:void 0}}})}}var th={};const RC=vMe(QJe);var q6={},V6={},H6={},W6={},G6={},net=function(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")},R4=net();const set=R4.fetch,GEe=R4.fetch.bind(R4),KEe=R4.Headers,iet=R4.Request,aet=R4.Response,Dj=Object.freeze(Object.defineProperty({__proto__:null,Headers:KEe,Request:iet,Response:aet,default:GEe,fetch:set},Symbol.toStringTag,{value:"Module"})),oet=vMe(Dj);var K6={},bwe;function ZEe(){if(bwe)return K6;bwe=1,Object.defineProperty(K6,"__esModule",{value:!0});class t extends Error{constructor(n){super(n.message),this.name="PostgrestError",this.details=n.details,this.hint=n.hint,this.code=n.code}}return K6.default=t,K6}var wwe;function YEe(){if(wwe)return G6;wwe=1,Object.defineProperty(G6,"__esModule",{value:!0});const t=RC,e=t.__importDefault(oet),n=t.__importDefault(ZEe());class s{constructor(o){var c,a;this.shouldThrowOnError=!1,this.method=o.method,this.url=o.url,this.headers=new Headers(o.headers),this.schema=o.schema,this.body=o.body,this.shouldThrowOnError=(c=o.shouldThrowOnError)!==null&&c!==void 0?c:!1,this.signal=o.signal,this.isMaybeSingle=(a=o.isMaybeSingle)!==null&&a!==void 0?a:!1,o.fetch?this.fetch=o.fetch:typeof fetch>"u"?this.fetch=e.default:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(o,c){return this.headers=new Headers(this.headers),this.headers.set(o,c),this}then(o,c){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");const a=this.fetch;let f=a(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async m=>{var y,v,w,k;let C=null,S=null,T=null,I=m.status,A=m.statusText;if(m.ok){if(this.method!=="HEAD"){const q=await m.text();q===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((y=this.headers.get("Accept"))===null||y===void 0)&&y.includes("application/vnd.pgrst.plan+text"))?S=q:S=JSON.parse(q))}const $=(v=this.headers.get("Prefer"))===null||v===void 0?void 0:v.match(/count=(exact|planned|estimated)/),F=(w=m.headers.get("content-range"))===null||w===void 0?void 0:w.split("/");$&&F&&F.length>1&&(T=parseInt(F[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(S)&&(S.length>1?(C={code:"PGRST116",details:`Results contain ${S.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},S=null,T=null,I=406,A="Not Acceptable"):S.length===1?S=S[0]:S=null)}else{const $=await m.text();try{C=JSON.parse($),Array.isArray(C)&&m.status===404&&(S=[],C=null,I=200,A="OK")}catch{m.status===404&&$===""?(I=204,A="No Content"):C={message:$}}if(C&&this.isMaybeSingle&&(!((k=C==null?void 0:C.details)===null||k===void 0)&&k.includes("0 rows"))&&(C=null,I=200,A="OK"),C&&this.shouldThrowOnError)throw new n.default(C)}return{error:C,data:S,count:T,status:I,statusText:A}});return this.shouldThrowOnError||(f=f.catch(m=>{var y,v,w;return{error:{message:`${(y=m==null?void 0:m.name)!==null&&y!==void 0?y:"FetchError"}: ${m==null?void 0:m.message}`,details:`${(v=m==null?void 0:m.stack)!==null&&v!==void 0?v:""}`,hint:"",code:`${(w=m==null?void 0:m.code)!==null&&w!==void 0?w:""}`},data:null,count:null,status:0,statusText:""}})),f.then(o,c)}returns(){return this}overrideTypes(){return this}}return G6.default=s,G6}var jwe;function XEe(){if(jwe)return W6;jwe=1,Object.defineProperty(W6,"__esModule",{value:!0});const e=RC.__importDefault(YEe());class n extends e.default{select(i){let o=!1;const c=(i??"*").split("").map(a=>/\s/.test(a)&&!o?"":(a==='"'&&(o=!o),a)).join("");return this.url.searchParams.set("select",c),this.headers.append("Prefer","return=representation"),this}order(i,{ascending:o=!0,nullsFirst:c,foreignTable:a,referencedTable:f=a}={}){const m=f?`${f}.order`:"order",y=this.url.searchParams.get(m);return this.url.searchParams.set(m,`${y?`${y},`:""}${i}.${o?"asc":"desc"}${c===void 0?"":c?".nullsfirst":".nullslast"}`),this}limit(i,{foreignTable:o,referencedTable:c=o}={}){const a=typeof c>"u"?"limit":`${c}.limit`;return this.url.searchParams.set(a,`${i}`),this}range(i,o,{foreignTable:c,referencedTable:a=c}={}){const f=typeof a>"u"?"offset":`${a}.offset`,m=typeof a>"u"?"limit":`${a}.limit`;return this.url.searchParams.set(f,`${i}`),this.url.searchParams.set(m,`${o-i+1}`),this}abortSignal(i){return this.signal=i,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:i=!1,verbose:o=!1,settings:c=!1,buffers:a=!1,wal:f=!1,format:m="text"}={}){var y;const v=[i?"analyze":null,o?"verbose":null,c?"settings":null,a?"buffers":null,f?"wal":null].filter(Boolean).join("|"),w=(y=this.headers.get("Accept"))!==null&&y!==void 0?y:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${m}; for="${w}"; options=${v};`),m==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(i){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${i}`),this}}return W6.default=n,W6}var kwe;function ege(){if(kwe)return H6;kwe=1,Object.defineProperty(H6,"__esModule",{value:!0});const e=RC.__importDefault(XEe()),n=new RegExp("[,()]");class s extends e.default{eq(o,c){return this.url.searchParams.append(o,`eq.${c}`),this}neq(o,c){return this.url.searchParams.append(o,`neq.${c}`),this}gt(o,c){return this.url.searchParams.append(o,`gt.${c}`),this}gte(o,c){return this.url.searchParams.append(o,`gte.${c}`),this}lt(o,c){return this.url.searchParams.append(o,`lt.${c}`),this}lte(o,c){return this.url.searchParams.append(o,`lte.${c}`),this}like(o,c){return this.url.searchParams.append(o,`like.${c}`),this}likeAllOf(o,c){return this.url.searchParams.append(o,`like(all).{${c.join(",")}}`),this}likeAnyOf(o,c){return this.url.searchParams.append(o,`like(any).{${c.join(",")}}`),this}ilike(o,c){return this.url.searchParams.append(o,`ilike.${c}`),this}ilikeAllOf(o,c){return this.url.searchParams.append(o,`ilike(all).{${c.join(",")}}`),this}ilikeAnyOf(o,c){return this.url.searchParams.append(o,`ilike(any).{${c.join(",")}}`),this}is(o,c){return this.url.searchParams.append(o,`is.${c}`),this}in(o,c){const a=Array.from(new Set(c)).map(f=>typeof f=="string"&&n.test(f)?`"${f}"`:`${f}`).join(",");return this.url.searchParams.append(o,`in.(${a})`),this}contains(o,c){return typeof c=="string"?this.url.searchParams.append(o,`cs.${c}`):Array.isArray(c)?this.url.searchParams.append(o,`cs.{${c.join(",")}}`):this.url.searchParams.append(o,`cs.${JSON.stringify(c)}`),this}containedBy(o,c){return typeof c=="string"?this.url.searchParams.append(o,`cd.${c}`):Array.isArray(c)?this.url.searchParams.append(o,`cd.{${c.join(",")}}`):this.url.searchParams.append(o,`cd.${JSON.stringify(c)}`),this}rangeGt(o,c){return this.url.searchParams.append(o,`sr.${c}`),this}rangeGte(o,c){return this.url.searchParams.append(o,`nxl.${c}`),this}rangeLt(o,c){return this.url.searchParams.append(o,`sl.${c}`),this}rangeLte(o,c){return this.url.searchParams.append(o,`nxr.${c}`),this}rangeAdjacent(o,c){return this.url.searchParams.append(o,`adj.${c}`),this}overlaps(o,c){return typeof c=="string"?this.url.searchParams.append(o,`ov.${c}`):this.url.searchParams.append(o,`ov.{${c.join(",")}}`),this}textSearch(o,c,{config:a,type:f}={}){let m="";f==="plain"?m="pl":f==="phrase"?m="ph":f==="websearch"&&(m="w");const y=a===void 0?"":`(${a})`;return this.url.searchParams.append(o,`${m}fts${y}.${c}`),this}match(o){return Object.entries(o).forEach(([c,a])=>{this.url.searchParams.append(c,`eq.${a}`)}),this}not(o,c,a){return this.url.searchParams.append(o,`not.${c}.${a}`),this}or(o,{foreignTable:c,referencedTable:a=c}={}){const f=a?`${a}.or`:"or";return this.url.searchParams.append(f,`(${o})`),this}filter(o,c,a){return this.url.searchParams.append(o,`${c}.${a}`),this}}return H6.default=s,H6}var Nwe;function QEe(){if(Nwe)return V6;Nwe=1,Object.defineProperty(V6,"__esModule",{value:!0});const e=RC.__importDefault(ege());class n{constructor(i,{headers:o={},schema:c,fetch:a}){this.url=i,this.headers=new Headers(o),this.schema=c,this.fetch=a}select(i,o){const{head:c=!1,count:a}=o??{},f=c?"HEAD":"GET";let m=!1;const y=(i??"*").split("").map(v=>/\s/.test(v)&&!m?"":(v==='"'&&(m=!m),v)).join("");return this.url.searchParams.set("select",y),a&&this.headers.append("Prefer",`count=${a}`),new e.default({method:f,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(i,{count:o,defaultToNull:c=!0}={}){var a;const f="POST";if(o&&this.headers.append("Prefer",`count=${o}`),c||this.headers.append("Prefer","missing=default"),Array.isArray(i)){const m=i.reduce((y,v)=>y.concat(Object.keys(v)),[]);if(m.length>0){const y=[...new Set(m)].map(v=>`"${v}"`);this.url.searchParams.set("columns",y.join(","))}}return new e.default({method:f,url:this.url,headers:this.headers,schema:this.schema,body:i,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}upsert(i,{onConflict:o,ignoreDuplicates:c=!1,count:a,defaultToNull:f=!0}={}){var m;const y="POST";if(this.headers.append("Prefer",`resolution=${c?"ignore":"merge"}-duplicates`),o!==void 0&&this.url.searchParams.set("on_conflict",o),a&&this.headers.append("Prefer",`count=${a}`),f||this.headers.append("Prefer","missing=default"),Array.isArray(i)){const v=i.reduce((w,k)=>w.concat(Object.keys(k)),[]);if(v.length>0){const w=[...new Set(v)].map(k=>`"${k}"`);this.url.searchParams.set("columns",w.join(","))}}return new e.default({method:y,url:this.url,headers:this.headers,schema:this.schema,body:i,fetch:(m=this.fetch)!==null&&m!==void 0?m:fetch})}update(i,{count:o}={}){var c;const a="PATCH";return o&&this.headers.append("Prefer",`count=${o}`),new e.default({method:a,url:this.url,headers:this.headers,schema:this.schema,body:i,fetch:(c=this.fetch)!==null&&c!==void 0?c:fetch})}delete({count:i}={}){var o;const c="DELETE";return i&&this.headers.append("Prefer",`count=${i}`),new e.default({method:c,url:this.url,headers:this.headers,schema:this.schema,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}}return V6.default=n,V6}var Swe;function cet(){if(Swe)return q6;Swe=1,Object.defineProperty(q6,"__esModule",{value:!0});const t=RC,e=t.__importDefault(QEe()),n=t.__importDefault(ege());class s{constructor(o,{headers:c={},schema:a,fetch:f}={}){this.url=o,this.headers=new Headers(c),this.schemaName=a,this.fetch=f}from(o){const c=new URL(`${this.url}/${o}`);return new e.default(c,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(o){return new s(this.url,{headers:this.headers,schema:o,fetch:this.fetch})}rpc(o,c={},{head:a=!1,get:f=!1,count:m}={}){var y;let v;const w=new URL(`${this.url}/rpc/${o}`);let k;a||f?(v=a?"HEAD":"GET",Object.entries(c).filter(([S,T])=>T!==void 0).map(([S,T])=>[S,Array.isArray(T)?`{${T.join(",")}}`:`${T}`]).forEach(([S,T])=>{w.searchParams.append(S,T)})):(v="POST",k=c);const C=new Headers(this.headers);return m&&C.set("Prefer",`count=${m}`),new n.default({method:v,url:w,headers:C,schema:this.schemaName,body:k,fetch:(y=this.fetch)!==null&&y!==void 0?y:fetch})}}return q6.default=s,q6}Object.defineProperty(th,"__esModule",{value:!0});var JEe=th.PostgrestError=cIe=th.PostgrestBuilder=oIe=th.PostgrestTransformBuilder=iIe=th.PostgrestFilterBuilder=nIe=th.PostgrestQueryBuilder=tIe=th.PostgrestClient=void 0;const FC=RC,eIe=FC.__importDefault(cet());var tIe=th.PostgrestClient=eIe.default;const rIe=FC.__importDefault(QEe());var nIe=th.PostgrestQueryBuilder=rIe.default;const sIe=FC.__importDefault(ege());var iIe=th.PostgrestFilterBuilder=sIe.default;const aIe=FC.__importDefault(XEe());var oIe=th.PostgrestTransformBuilder=aIe.default;const lIe=FC.__importDefault(YEe());var cIe=th.PostgrestBuilder=lIe.default;const dIe=FC.__importDefault(ZEe());JEe=th.PostgrestError=dIe.default;var uIe=th.default={PostgrestClient:eIe.default,PostgrestQueryBuilder:rIe.default,PostgrestFilterBuilder:sIe.default,PostgrestTransformBuilder:aIe.default,PostgrestBuilder:lIe.default,PostgrestError:dIe.default};const det=Object.freeze(Object.defineProperty({__proto__:null,get PostgrestBuilder(){return cIe},get PostgrestClient(){return tIe},get PostgrestError(){return JEe},get PostgrestFilterBuilder(){return iIe},get PostgrestQueryBuilder(){return nIe},get PostgrestTransformBuilder(){return oIe},default:uIe},Symbol.toStringTag,{value:"Module"})),{PostgrestClient:uet,PostgrestQueryBuilder:jGt,PostgrestFilterBuilder:kGt,PostgrestTransformBuilder:NGt,PostgrestBuilder:SGt,PostgrestError:CGt}=uIe||det;class het{static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};if(typeof process<"u"){const n=process.versions;if(n&&n.node){const s=n.node,i=parseInt(s.replace(/^v/,"").split(".")[0]);return i>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${i} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${i} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option: import ws from "ws" new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const e=this.detectEnvironment();if(e.constructor)return e.constructor;let n=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(n+=` Suggested solution: ${e.workaround}`),new Error(n)}static createWebSocket(e,n){const s=this.getWebSocketConstructor();return new s(e,n)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const fet="2.78.0",pet=`realtime-js/${fet}`,met="1.0.0",Iue=1e4,get=1e3,yet=100;var IT;(function(t){t[t.connecting=0]="connecting",t[t.open=1]="open",t[t.closing=2]="closing",t[t.closed=3]="closed"})(IT||(IT={}));var Ac;(function(t){t.closed="closed",t.errored="errored",t.joined="joined",t.joining="joining",t.leaving="leaving"})(Ac||(Ac={}));var $p;(function(t){t.close="phx_close",t.error="phx_error",t.join="phx_join",t.reply="phx_reply",t.leave="phx_leave",t.access_token="access_token"})($p||($p={}));var Pue;(function(t){t.websocket="websocket"})(Pue||(Pue={}));var sw;(function(t){t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed"})(sw||(sw={}));class xet{constructor(){this.HEADER_LENGTH=1}decode(e,n){return e.constructor===ArrayBuffer?n(this._binaryDecode(e)):n(typeof e=="string"?JSON.parse(e):{})}_binaryDecode(e){const n=new DataView(e),s=new TextDecoder;return this._decodeBroadcast(e,n,s)}_decodeBroadcast(e,n,s){const i=n.getUint8(1),o=n.getUint8(2);let c=this.HEADER_LENGTH+2;const a=s.decode(e.slice(c,c+i));c=c+i;const f=s.decode(e.slice(c,c+o));c=c+o;const m=JSON.parse(s.decode(e.slice(c,e.byteLength)));return{ref:null,topic:a,event:f,payload:m}}}class hIe{constructor(e,n){this.callback=e,this.timerCalc=n,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=n}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}var Uo;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(Uo||(Uo={}));const Cwe=(t,e,n={})=>{var s;const i=(s=n.skipTypes)!==null&&s!==void 0?s:[];return e?Object.keys(e).reduce((o,c)=>(o[c]=vet(c,t,e,i),o),{}):{}},vet=(t,e,n,s)=>{const i=e.find(a=>a.name===t),o=i==null?void 0:i.type,c=n[t];return o&&!s.includes(o)?fIe(o,c):Lue(c)},fIe=(t,e)=>{if(t.charAt(0)==="_"){const n=t.slice(1,t.length);return jet(e,n)}switch(t){case Uo.bool:return _et(e);case Uo.float4:case Uo.float8:case Uo.int2:case Uo.int4:case Uo.int8:case Uo.numeric:case Uo.oid:return bet(e);case Uo.json:case Uo.jsonb:return wet(e);case Uo.timestamp:return ket(e);case Uo.abstime:case Uo.date:case Uo.daterange:case Uo.int4range:case Uo.int8range:case Uo.money:case Uo.reltime:case Uo.text:case Uo.time:case Uo.timestamptz:case Uo.timetz:case Uo.tsrange:case Uo.tstzrange:return Lue(e);default:return Lue(e)}},Lue=t=>t,_et=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},bet=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},wet=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch(e){return console.log(`JSON parse error: ${e}`),t}return t},jet=(t,e)=>{if(typeof t!="string")return t;const n=t.length-1,s=t[n];if(t[0]==="{"&&s==="}"){let o;const c=t.slice(1,n);try{o=JSON.parse("["+c+"]")}catch{o=c?c.split(","):[]}return o.map(a=>fIe(e,a))}return t},ket=t=>typeof t=="string"?t.replace(" ","T"):t,pIe=t=>{const e=new URL(t);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};class gle{constructor(e,n,s={},i=Iue){this.channel=e,this.event=n,this.payload=s,this.timeout=i,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,n){var s;return this._hasReceived(e)&&n((s=this.receivedResp)===null||s===void 0?void 0:s.response),this.recHooks.push({status:e,callback:n}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const e=n=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=n,this._matchReceive(n)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,n){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:n})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:n}){this.recHooks.filter(s=>s.status===e).forEach(s=>s.callback(n))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}var Mwe;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(Mwe||(Mwe={}));class PT{constructor(e,n){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const s=(n==null?void 0:n.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(s.state,{},i=>{const{onJoin:o,onLeave:c,onSync:a}=this.caller;this.joinRef=this.channel._joinRef(),this.state=PT.syncState(this.state,i,o,c),this.pendingDiffs.forEach(f=>{this.state=PT.syncDiff(this.state,f,o,c)}),this.pendingDiffs=[],a()}),this.channel._on(s.diff,{},i=>{const{onJoin:o,onLeave:c,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(i):(this.state=PT.syncDiff(this.state,i,o,c),a())}),this.onJoin((i,o,c)=>{this.channel._trigger("presence",{event:"join",key:i,currentPresences:o,newPresences:c})}),this.onLeave((i,o,c)=>{this.channel._trigger("presence",{event:"leave",key:i,currentPresences:o,leftPresences:c})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,n,s,i){const o=this.cloneDeep(e),c=this.transformState(n),a={},f={};return this.map(o,(m,y)=>{c[m]||(f[m]=y)}),this.map(c,(m,y)=>{const v=o[m];if(v){const w=y.map(T=>T.presence_ref),k=v.map(T=>T.presence_ref),C=y.filter(T=>k.indexOf(T.presence_ref)<0),S=v.filter(T=>w.indexOf(T.presence_ref)<0);C.length>0&&(a[m]=C),S.length>0&&(f[m]=S)}else a[m]=y}),this.syncDiff(o,{joins:a,leaves:f},s,i)}static syncDiff(e,n,s,i){const{joins:o,leaves:c}={joins:this.transformState(n.joins),leaves:this.transformState(n.leaves)};return s||(s=()=>{}),i||(i=()=>{}),this.map(o,(a,f)=>{var m;const y=(m=e[a])!==null&&m!==void 0?m:[];if(e[a]=this.cloneDeep(f),y.length>0){const v=e[a].map(k=>k.presence_ref),w=y.filter(k=>v.indexOf(k.presence_ref)<0);e[a].unshift(...w)}s(a,y,f)}),this.map(c,(a,f)=>{let m=e[a];if(!m)return;const y=f.map(v=>v.presence_ref);m=m.filter(v=>y.indexOf(v.presence_ref)<0),e[a]=m,i(a,m,f),m.length===0&&delete e[a]}),e}static map(e,n){return Object.getOwnPropertyNames(e).map(s=>n(s,e[s]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((n,s)=>{const i=e[s];return"metas"in i?n[s]=i.metas.map(o=>(o.presence_ref=o.phx_ref,delete o.phx_ref,delete o.phx_ref_prev,o)):n[s]=i,n},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var Twe;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(Twe||(Twe={}));var LT;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(LT||(LT={}));var uy;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(uy||(uy={}));class tge{constructor(e,n={config:{}},s){var i,o;if(this.topic=e,this.params=n,this.socket=s,this.bindings={},this.state=Ac.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},n.config),this.timeout=this.socket.timeout,this.joinPush=new gle(this,$p.join,this.params,this.timeout),this.rejoinTimer=new hIe(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=Ac.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(c=>c.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=Ac.closed,this.socket._remove(this)}),this._onError(c=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,c),this.state=Ac.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=Ac.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",c=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,c),this.state=Ac.errored,this.rejoinTimer.scheduleTimeout())}),this._on($p.reply,{},(c,a)=>{this._trigger(this._replyEventName(a),c)}),this.presence=new PT(this),this.broadcastEndpointURL=pIe(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((o=(i=this.params.config)===null||i===void 0?void 0:i.broadcast)===null||o===void 0)&&o.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(e,n=this.timeout){var s,i,o;if(this.socket.isConnected()||this.socket.connect(),this.state==Ac.closed){const{config:{broadcast:c,presence:a,private:f}}=this.params,m=(i=(s=this.bindings.postgres_changes)===null||s===void 0?void 0:s.map(k=>k.filter))!==null&&i!==void 0?i:[],y=!!this.bindings[LT.PRESENCE]&&this.bindings[LT.PRESENCE].length>0||((o=this.params.config.presence)===null||o===void 0?void 0:o.enabled)===!0,v={},w={broadcast:c,presence:Object.assign(Object.assign({},a),{enabled:y}),postgres_changes:m,private:f};this.socket.accessTokenValue&&(v.access_token=this.socket.accessTokenValue),this._onError(k=>e==null?void 0:e(uy.CHANNEL_ERROR,k)),this._onClose(()=>e==null?void 0:e(uy.CLOSED)),this.updateJoinPayload(Object.assign({config:w},v)),this.joinedOnce=!0,this._rejoin(n),this.joinPush.receive("ok",async({postgres_changes:k})=>{var C;if(this.socket.setAuth(),k===void 0){e==null||e(uy.SUBSCRIBED);return}else{const S=this.bindings.postgres_changes,T=(C=S==null?void 0:S.length)!==null&&C!==void 0?C:0,I=[];for(let A=0;A{this.state=Ac.errored,e==null||e(uy.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(k).join(", ")||"error")))}).receive("timeout",()=>{e==null||e(uy.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,n={}){return await this.send({type:"presence",event:"track",payload:e},n.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,n,s){return this.state===Ac.joined&&e===LT.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(()=>this.subscribe())),this._on(e,n,s)}async httpSend(e,n,s={}){var i;const o=this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"";if(n==null)return Promise.reject("Payload is required for httpSend()");const c={method:"POST",headers:{Authorization:o,apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:n,private:this.private}]})},a=await this._fetchWithTimeout(this.broadcastEndpointURL,c,(i=s.timeout)!==null&&i!==void 0?i:this.timeout);if(a.status===202)return{success:!0};let f=a.statusText;try{const m=await a.json();f=m.error||m.message||f}catch{}return Promise.reject(new Error(f))}async send(e,n={}){var s,i;if(!this._canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:o,payload:c}=e,f={method:"POST",headers:{Authorization:this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"",apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:o,payload:c,private:this.private}]})};try{const m=await this._fetchWithTimeout(this.broadcastEndpointURL,f,(s=n.timeout)!==null&&s!==void 0?s:this.timeout);return await((i=m.body)===null||i===void 0?void 0:i.cancel()),m.ok?"ok":"error"}catch(m){return m.name==="AbortError"?"timed out":"error"}}else return new Promise(o=>{var c,a,f;const m=this._push(e.type,e,n.timeout||this.timeout);e.type==="broadcast"&&!(!((f=(a=(c=this.params)===null||c===void 0?void 0:c.config)===null||a===void 0?void 0:a.broadcast)===null||f===void 0)&&f.ack)&&o("ok"),m.receive("ok",()=>o("ok")),m.receive("error",()=>o("error")),m.receive("timeout",()=>o("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=Ac.leaving;const n=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger($p.close,"leave",this._joinRef())};this.joinPush.destroy();let s=null;return new Promise(i=>{s=new gle(this,$p.leave,{},e),s.receive("ok",()=>{n(),i("ok")}).receive("timeout",()=>{n(),i("timed out")}).receive("error",()=>{i("error")}),s.send(),this._canPush()||s.trigger("ok",{})}).finally(()=>{s==null||s.destroy()})}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=Ac.closed,this.bindings={}}async _fetchWithTimeout(e,n,s){const i=new AbortController,o=setTimeout(()=>i.abort(),s),c=await this.socket.fetch(e,Object.assign(Object.assign({},n),{signal:i.signal}));return clearTimeout(o),c}_push(e,n,s=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let i=new gle(this,e,n,s);return this._canPush()?i.send():this._addToPushBuffer(i),i}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>yet){const n=this.pushBuffer.shift();n&&(n.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${n.event}`,n.payload))}}_onMessage(e,n,s){return n}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,n,s){var i,o;const c=e.toLocaleLowerCase(),{close:a,error:f,leave:m,join:y}=$p;if(s&&[a,f,m,y].indexOf(c)>=0&&s!==this._joinRef())return;let w=this._onMessage(c,n,s);if(n&&!w)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(c)?(i=this.bindings.postgres_changes)===null||i===void 0||i.filter(k=>{var C,S,T;return((C=k.filter)===null||C===void 0?void 0:C.event)==="*"||((T=(S=k.filter)===null||S===void 0?void 0:S.event)===null||T===void 0?void 0:T.toLocaleLowerCase())===c}).map(k=>k.callback(w,s)):(o=this.bindings[c])===null||o===void 0||o.filter(k=>{var C,S,T,I,A,D;if(["broadcast","presence","postgres_changes"].includes(c))if("id"in k){const $=k.id,F=(C=k.filter)===null||C===void 0?void 0:C.event;return $&&((S=n.ids)===null||S===void 0?void 0:S.includes($))&&(F==="*"||(F==null?void 0:F.toLocaleLowerCase())===((T=n.data)===null||T===void 0?void 0:T.type.toLocaleLowerCase()))}else{const $=(A=(I=k==null?void 0:k.filter)===null||I===void 0?void 0:I.event)===null||A===void 0?void 0:A.toLocaleLowerCase();return $==="*"||$===((D=n==null?void 0:n.event)===null||D===void 0?void 0:D.toLocaleLowerCase())}else return k.type.toLocaleLowerCase()===c}).map(k=>{if(typeof w=="object"&&"ids"in w){const C=w.data,{schema:S,table:T,commit_timestamp:I,type:A,errors:D}=C;w=Object.assign(Object.assign({},{schema:S,table:T,commit_timestamp:I,eventType:A,new:{},old:{},errors:D}),this._getPayloadRecords(C))}k.callback(w,s)})}_isClosed(){return this.state===Ac.closed}_isJoined(){return this.state===Ac.joined}_isJoining(){return this.state===Ac.joining}_isLeaving(){return this.state===Ac.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,n,s){const i=e.toLocaleLowerCase(),o={type:i,filter:n,callback:s};return this.bindings[i]?this.bindings[i].push(o):this.bindings[i]=[o],this}_off(e,n){const s=e.toLocaleLowerCase();return this.bindings[s]&&(this.bindings[s]=this.bindings[s].filter(i=>{var o;return!(((o=i.type)===null||o===void 0?void 0:o.toLocaleLowerCase())===s&&tge.isEqual(i.filter,n))})),this}static isEqual(e,n){if(Object.keys(e).length!==Object.keys(n).length)return!1;for(const s in e)if(e[s]!==n[s])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on($p.close,{},e)}_onError(e){this._on($p.error,{},n=>e(n))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=Ac.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const n={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(n.new=Cwe(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(n.old=Cwe(e.columns,e.old_record)),n}}const yle=()=>{},Z6={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},Net=[1e3,2e3,5e3,1e4],Cet=1e4,Met=` addEventListener("message", (e) => { if (e.data.event === "start") { setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval); } });`;class Tet{constructor(e,n){var s;if(this.accessTokenValue=null,this.apiKey=null,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=Iue,this.transport=null,this.heartbeatIntervalMs=Z6.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=yle,this.ref=0,this.reconnectTimer=null,this.logger=yle,this.conn=null,this.sendBuffer=[],this.serializer=new xet,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._resolveFetch=i=>{let o;return i?o=i:typeof fetch>"u"?o=(...c)=>DC(async()=>{const{default:a}=await Promise.resolve().then(()=>Dj);return{default:a}},void 0).then(({default:a})=>a(...c)).catch(a=>{throw new Error(`Failed to load @supabase/node-fetch: ${a.message}. This is required for HTTP requests in Node.js environments without native fetch.`)}):o=fetch,(...c)=>o(...c)},!(!((s=n==null?void 0:n.params)===null||s===void 0)&&s.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=n.params.apikey,this.endPoint=`${e}/${Pue.websocket}`,this.httpEndpoint=pIe(e),this._initializeOptions(n),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(n==null?void 0:n.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=het.createWebSocket(this.endpointURL())}catch(e){this._setConnectionState("disconnected");const n=e.message;throw n.includes("Node.js")?new Error(`${n} To use Realtime in Node.js, you need to provide a WebSocket implementation: Option 1: Use Node.js 22+ which has native WebSocket support Option 2: Install and provide the "ws" package: npm install ws import ws from "ws" const client = new RealtimeClient(url, { ...options, transport: ws })`):new Error(`WebSocket not available: ${n}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:met}))}disconnect(e,n){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const s=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(s),this._setConnectionState("disconnected")},e?this.conn.close(e,n??""):this.conn.close(),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){const n=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),n}async removeAllChannels(){const e=await Promise.all(this.channels.map(n=>n.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,n,s){this.logger(e,n,s)}connectionState(){switch(this.conn&&this.conn.readyState){case IT.connecting:return sw.Connecting;case IT.open:return sw.Open;case IT.closing:return sw.Closing;default:return sw.Closed}}isConnected(){return this.connectionState()===sw.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(e,n={config:{}}){const s=`realtime:${e}`,i=this.getChannels().find(o=>o.topic===s);if(i)return i;{const o=new tge(`realtime:${e}`,n,this);return this.channels.push(o),o}}push(e){const{topic:n,event:s,payload:i,ref:o}=e,c=()=>{this.encode(e,a=>{var f;(f=this.conn)===null||f===void 0||f.send(a)})};this.log("push",`${n} ${s} (${o})`,i),this.isConnected()?c():this.sendBuffer.push(c)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}async sendHeartbeat(){var e;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(n){this.log("error","error in heartbeat callback",n)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(n){this.log("error","error in heartbeat callback",n)}this._wasManualDisconnect=!1,(e=this.conn)===null||e===void 0||e.close(get,"heartbeat timeout"),setTimeout(()=>{var n;this.isConnected()||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout()},Z6.HEARTBEAT_TIMEOUT_FALLBACK);return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(n){this.log("error","error in heartbeat callback",n)}this._setAuthSafely("heartbeat")}onHeartbeat(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let n=this.channels.find(s=>s.topic===e&&(s._isJoined()||s._isJoining()));n&&(this.log("transport",`leaving duplicate topic "${e}"`),n.unsubscribe())}_remove(e){this.channels=this.channels.filter(n=>n.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,n=>{if(n.topic==="phoenix"&&n.event==="phx_reply")try{this.heartbeatCallback(n.payload.status==="ok"?"ok":"error")}catch(m){this.log("error","error in heartbeat callback",m)}n.ref&&n.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);const{topic:s,event:i,payload:o,ref:c}=n,a=c?`(${c})`:"",f=o.status||"";this.log("receive",`${f} ${s} ${i} ${a}`.trim(),o),this.channels.filter(m=>m._isMember(s)).forEach(m=>m._trigger(i,o,c)),this._triggerStateCallbacks("message",n)})}_clearTimer(e){var n;e==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):e==="reconnect"&&((n=this.reconnectTimer)===null||n===void 0||n.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e))}_teardownConnection(){this.conn&&(this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null),this._clearAllTimers(),this.channels.forEach(e=>e.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),this.flushSendBuffer(),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=n=>{this.log("worker","worker error",n.message),this.workerRef.terminate()},this.workerRef.onmessage=n=>{n.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_onConnClose(e){var n;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e)}_triggerChanError(){this.channels.forEach(e=>e._trigger($p.error))}_appendParams(e,n){if(Object.keys(n).length===0)return e;const s=e.match(/\?/)?"&":"?",i=new URLSearchParams(n);return`${e}${s}${i}`}_workerObjectUrl(e){let n;if(e)n=e;else{const s=new Blob([Met],{type:"application/javascript"});n=URL.createObjectURL(s)}return n}_setConnectionState(e,n=!1){this._connectionState=e,e==="connecting"?this._wasManualDisconnect=!1:e==="disconnecting"&&(this._wasManualDisconnect=n)}async _performAuth(e=null){let n;e?n=e:this.accessToken?n=await this.accessToken():n=this.accessTokenValue,this.accessTokenValue!=n&&(this.accessTokenValue=n,this.channels.forEach(s=>{const i={access_token:n,version:pet};n&&s.updateJoinPayload(i),s.joinedOnce&&s._isJoined()&&s._push($p.access_token,{access_token:n})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this.setAuth().catch(n=>{this.log("error",`error setting auth in ${e}`,n)})}_triggerStateCallbacks(e,n){try{this.stateChangeCallbacks[e].forEach(s=>{try{s(n)}catch(i){this.log("error",`error in ${e} callback`,i)}})}catch(s){this.log("error",`error triggering ${e} callbacks`,s)}}_setupReconnectionTimer(){this.reconnectTimer=new hIe(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},Z6.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var n,s,i,o,c,a,f,m,y;if(this.transport=(n=e==null?void 0:e.transport)!==null&&n!==void 0?n:null,this.timeout=(s=e==null?void 0:e.timeout)!==null&&s!==void 0?s:Iue,this.heartbeatIntervalMs=(i=e==null?void 0:e.heartbeatIntervalMs)!==null&&i!==void 0?i:Z6.HEARTBEAT_INTERVAL,this.worker=(o=e==null?void 0:e.worker)!==null&&o!==void 0?o:!1,this.accessToken=(c=e==null?void 0:e.accessToken)!==null&&c!==void 0?c:null,this.heartbeatCallback=(a=e==null?void 0:e.heartbeatCallback)!==null&&a!==void 0?a:yle,e!=null&&e.params&&(this.params=e.params),e!=null&&e.logger&&(this.logger=e.logger),(e!=null&&e.logLevel||e!=null&&e.log_level)&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(f=e==null?void 0:e.reconnectAfterMs)!==null&&f!==void 0?f:v=>Net[v-1]||Cet,this.encode=(m=e==null?void 0:e.encode)!==null&&m!==void 0?m:(v,w)=>w(JSON.stringify(v)),this.decode=(y=e==null?void 0:e.decode)!==null&&y!==void 0?y:this.serializer.decode.bind(this.serializer),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e==null?void 0:e.workerUrl}}}class rge extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}}function kl(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}class Aet extends rge{constructor(e,n,s){super(e),this.name="StorageApiError",this.status=n,this.statusCode=s}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}class Oue extends rge{constructor(e,n){super(e),this.name="StorageUnknownError",this.originalError=n}}const nge=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...n)=>DC(async()=>{const{default:s}=await Promise.resolve().then(()=>Dj);return{default:s}},void 0).then(({default:s})=>s(...n)):e=fetch,(...n)=>e(...n)},Eet=()=>Cs(void 0,void 0,void 0,function*(){return typeof Response>"u"?(yield DC(()=>Promise.resolve().then(()=>Dj),void 0)).Response:Response}),Due=t=>{if(Array.isArray(t))return t.map(n=>Due(n));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([n,s])=>{const i=n.replace(/([-_][a-z])/gi,o=>o.toUpperCase().replace(/[-_]/g,""));e[i]=Due(s)}),e},Iet=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},xle=t=>{var e;return t.msg||t.message||t.error_description||(typeof t.error=="string"?t.error:(e=t.error)===null||e===void 0?void 0:e.message)||JSON.stringify(t)},Pet=(t,e,n)=>Cs(void 0,void 0,void 0,function*(){const s=yield Eet();t instanceof s&&!(n!=null&&n.noResolveJson)?t.json().then(i=>{const o=t.status||500,c=(i==null?void 0:i.statusCode)||o+"";e(new Aet(xle(i),o,c))}).catch(i=>{e(new Oue(xle(i),i))}):e(new Oue(xle(t),t))}),Let=(t,e,n,s)=>{const i={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"||!s?i:(Iet(s)?(i.headers=Object.assign({"Content-Type":"application/json"},e==null?void 0:e.headers),i.body=JSON.stringify(s)):i.body=s,e!=null&&e.duplex&&(i.duplex=e.duplex),Object.assign(Object.assign({},i),n))};function ZE(t,e,n,s,i,o){return Cs(this,void 0,void 0,function*(){return new Promise((c,a)=>{t(n,Let(e,s,i,o)).then(f=>{if(!f.ok)throw f;return s!=null&&s.noResolveJson?f:f.json()}).then(f=>c(f)).catch(f=>Pet(f,a,s))})})}function TA(t,e,n,s){return Cs(this,void 0,void 0,function*(){return ZE(t,"GET",e,n,s)})}function Rp(t,e,n,s,i){return Cs(this,void 0,void 0,function*(){return ZE(t,"POST",e,s,i,n)})}function Rue(t,e,n,s,i){return Cs(this,void 0,void 0,function*(){return ZE(t,"PUT",e,s,i,n)})}function Oet(t,e,n,s){return Cs(this,void 0,void 0,function*(){return ZE(t,"HEAD",e,Object.assign(Object.assign({},n),{noResolveJson:!0}),s)})}function sge(t,e,n,s,i){return Cs(this,void 0,void 0,function*(){return ZE(t,"DELETE",e,s,i,n)})}class Det{constructor(e,n){this.downloadFn=e,this.shouldThrowOnError=n}then(e,n){return this.execute().then(e,n)}execute(){return Cs(this,void 0,void 0,function*(){try{return{data:(yield this.downloadFn()).body,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(kl(e))return{data:null,error:e};throw e}})}}var mIe;class Ret{constructor(e,n){this.downloadFn=e,this.shouldThrowOnError=n,this[mIe]="BlobDownloadBuilder",this.promise=null}asStream(){return new Det(this.downloadFn,this.shouldThrowOnError)}then(e,n){return this.getPromise().then(e,n)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}execute(){return Cs(this,void 0,void 0,function*(){try{return{data:yield(yield this.downloadFn()).blob(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(kl(e))return{data:null,error:e};throw e}})}}mIe=Symbol.toStringTag;const Fet={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Awe={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class zet{constructor(e,n={},s,i){this.shouldThrowOnError=!1,this.url=e,this.headers=n,this.bucketId=s,this.fetch=nge(i)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(e,n,s,i){return Cs(this,void 0,void 0,function*(){try{let o;const c=Object.assign(Object.assign({},Awe),i);let a=Object.assign(Object.assign({},this.headers),e==="POST"&&{"x-upsert":String(c.upsert)});const f=c.metadata;typeof Blob<"u"&&s instanceof Blob?(o=new FormData,o.append("cacheControl",c.cacheControl),f&&o.append("metadata",this.encodeMetadata(f)),o.append("",s)):typeof FormData<"u"&&s instanceof FormData?(o=s,o.append("cacheControl",c.cacheControl),f&&o.append("metadata",this.encodeMetadata(f))):(o=s,a["cache-control"]=`max-age=${c.cacheControl}`,a["content-type"]=c.contentType,f&&(a["x-metadata"]=this.toBase64(this.encodeMetadata(f)))),i!=null&&i.headers&&(a=Object.assign(Object.assign({},a),i.headers));const m=this._removeEmptyFolders(n),y=this._getFinalPath(m),v=yield(e=="PUT"?Rue:Rp)(this.fetch,`${this.url}/object/${y}`,o,Object.assign({headers:a},c!=null&&c.duplex?{duplex:c.duplex}:{}));return{data:{path:m,id:v.Id,fullPath:v.Key},error:null}}catch(o){if(this.shouldThrowOnError)throw o;if(kl(o))return{data:null,error:o};throw o}})}upload(e,n,s){return Cs(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,n,s)})}uploadToSignedUrl(e,n,s,i){return Cs(this,void 0,void 0,function*(){const o=this._removeEmptyFolders(e),c=this._getFinalPath(o),a=new URL(this.url+`/object/upload/sign/${c}`);a.searchParams.set("token",n);try{let f;const m=Object.assign({upsert:Awe.upsert},i),y=Object.assign(Object.assign({},this.headers),{"x-upsert":String(m.upsert)});typeof Blob<"u"&&s instanceof Blob?(f=new FormData,f.append("cacheControl",m.cacheControl),f.append("",s)):typeof FormData<"u"&&s instanceof FormData?(f=s,f.append("cacheControl",m.cacheControl)):(f=s,y["cache-control"]=`max-age=${m.cacheControl}`,y["content-type"]=m.contentType);const v=yield Rue(this.fetch,a.toString(),f,{headers:y});return{data:{path:o,fullPath:v.Key},error:null}}catch(f){if(this.shouldThrowOnError)throw f;if(kl(f))return{data:null,error:f};throw f}})}createSignedUploadUrl(e,n){return Cs(this,void 0,void 0,function*(){try{let s=this._getFinalPath(e);const i=Object.assign({},this.headers);n!=null&&n.upsert&&(i["x-upsert"]="true");const o=yield Rp(this.fetch,`${this.url}/object/upload/sign/${s}`,{},{headers:i}),c=new URL(this.url+o.url),a=c.searchParams.get("token");if(!a)throw new rge("No token returned by API");return{data:{signedUrl:c.toString(),path:e,token:a},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(kl(s))return{data:null,error:s};throw s}})}update(e,n,s){return Cs(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,n,s)})}move(e,n,s){return Cs(this,void 0,void 0,function*(){try{return{data:yield Rp(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:n,destinationBucket:s==null?void 0:s.destinationBucket},{headers:this.headers}),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(kl(i))return{data:null,error:i};throw i}})}copy(e,n,s){return Cs(this,void 0,void 0,function*(){try{return{data:{path:(yield Rp(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:n,destinationBucket:s==null?void 0:s.destinationBucket},{headers:this.headers})).Key},error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(kl(i))return{data:null,error:i};throw i}})}createSignedUrl(e,n,s){return Cs(this,void 0,void 0,function*(){try{let i=this._getFinalPath(e),o=yield Rp(this.fetch,`${this.url}/object/sign/${i}`,Object.assign({expiresIn:n},s!=null&&s.transform?{transform:s.transform}:{}),{headers:this.headers});const c=s!=null&&s.download?`&download=${s.download===!0?"":s.download}`:"";return o={signedUrl:encodeURI(`${this.url}${o.signedURL}${c}`)},{data:o,error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(kl(i))return{data:null,error:i};throw i}})}createSignedUrls(e,n,s){return Cs(this,void 0,void 0,function*(){try{const i=yield Rp(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:n,paths:e},{headers:this.headers}),o=s!=null&&s.download?`&download=${s.download===!0?"":s.download}`:"";return{data:i.map(c=>Object.assign(Object.assign({},c),{signedUrl:c.signedURL?encodeURI(`${this.url}${c.signedURL}${o}`):null})),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(kl(i))return{data:null,error:i};throw i}})}download(e,n){const i=typeof(n==null?void 0:n.transform)<"u"?"render/image/authenticated":"object",o=this.transformOptsToQueryString((n==null?void 0:n.transform)||{}),c=o?`?${o}`:"",a=this._getFinalPath(e),f=()=>TA(this.fetch,`${this.url}/${i}/${a}${c}`,{headers:this.headers,noResolveJson:!0});return new Ret(f,this.shouldThrowOnError)}info(e){return Cs(this,void 0,void 0,function*(){const n=this._getFinalPath(e);try{const s=yield TA(this.fetch,`${this.url}/object/info/${n}`,{headers:this.headers});return{data:Due(s),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(kl(s))return{data:null,error:s};throw s}})}exists(e){return Cs(this,void 0,void 0,function*(){const n=this._getFinalPath(e);try{return yield Oet(this.fetch,`${this.url}/object/${n}`,{headers:this.headers}),{data:!0,error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(kl(s)&&s instanceof Oue){const i=s.originalError;if([400,404].includes(i==null?void 0:i.status))return{data:!1,error:s}}throw s}})}getPublicUrl(e,n){const s=this._getFinalPath(e),i=[],o=n!=null&&n.download?`download=${n.download===!0?"":n.download}`:"";o!==""&&i.push(o);const a=typeof(n==null?void 0:n.transform)<"u"?"render/image":"object",f=this.transformOptsToQueryString((n==null?void 0:n.transform)||{});f!==""&&i.push(f);let m=i.join("&");return m!==""&&(m=`?${m}`),{data:{publicUrl:encodeURI(`${this.url}/${a}/public/${s}${m}`)}}}remove(e){return Cs(this,void 0,void 0,function*(){try{return{data:yield sge(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(kl(n))return{data:null,error:n};throw n}})}list(e,n,s){return Cs(this,void 0,void 0,function*(){try{const i=Object.assign(Object.assign(Object.assign({},Fet),n),{prefix:e||""});return{data:yield Rp(this.fetch,`${this.url}/object/list/${this.bucketId}`,i,{headers:this.headers},s),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(kl(i))return{data:null,error:i};throw i}})}listV2(e,n){return Cs(this,void 0,void 0,function*(){try{const s=Object.assign({},e);return{data:yield Rp(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,s,{headers:this.headers},n),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(kl(s))return{data:null,error:s};throw s}})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<"u"?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){const n=[];return e.width&&n.push(`width=${e.width}`),e.height&&n.push(`height=${e.height}`),e.resize&&n.push(`resize=${e.resize}`),e.format&&n.push(`format=${e.format}`),e.quality&&n.push(`quality=${e.quality}`),n.join("&")}}const gIe="2.78.0",yIe={"X-Client-Info":`storage-js/${gIe}`};class Bet{constructor(e,n={},s,i){this.shouldThrowOnError=!1;const o=new URL(e);i!=null&&i.useNewHostname&&/supabase\.(co|in|red)$/.test(o.hostname)&&!o.hostname.includes("storage.supabase.")&&(o.hostname=o.hostname.replace("supabase.","storage.supabase.")),this.url=o.href.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},yIe),n),this.fetch=nge(s)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(e){return Cs(this,void 0,void 0,function*(){try{const n=this.listBucketOptionsToQueryString(e);return{data:yield TA(this.fetch,`${this.url}/bucket${n}`,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(kl(n))return{data:null,error:n};throw n}})}getBucket(e){return Cs(this,void 0,void 0,function*(){try{return{data:yield TA(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(kl(n))return{data:null,error:n};throw n}})}createBucket(e){return Cs(this,arguments,void 0,function*(n,s={public:!1}){try{return{data:yield Rp(this.fetch,`${this.url}/bucket`,{id:n,name:n,type:s.type,public:s.public,file_size_limit:s.fileSizeLimit,allowed_mime_types:s.allowedMimeTypes},{headers:this.headers}),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(kl(i))return{data:null,error:i};throw i}})}updateBucket(e,n){return Cs(this,void 0,void 0,function*(){try{return{data:yield Rue(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:n.public,file_size_limit:n.fileSizeLimit,allowed_mime_types:n.allowedMimeTypes},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(kl(s))return{data:null,error:s};throw s}})}emptyBucket(e){return Cs(this,void 0,void 0,function*(){try{return{data:yield Rp(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(kl(n))return{data:null,error:n};throw n}})}deleteBucket(e){return Cs(this,void 0,void 0,function*(){try{return{data:yield sge(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(kl(n))return{data:null,error:n};throw n}})}listBucketOptionsToQueryString(e){const n={};return e&&("limit"in e&&(n.limit=String(e.limit)),"offset"in e&&(n.offset=String(e.offset)),e.search&&(n.search=e.search),e.sortColumn&&(n.sortColumn=e.sortColumn),e.sortOrder&&(n.sortOrder=e.sortOrder)),Object.keys(n).length>0?"?"+new URLSearchParams(n).toString():""}}class $et{constructor(e,n={},s){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},yIe),n),this.fetch=nge(s)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return Cs(this,void 0,void 0,function*(){try{return{data:yield Rp(this.fetch,`${this.url}/bucket`,{name:e},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(kl(n))return{data:null,error:n};throw n}})}listBuckets(e){return Cs(this,void 0,void 0,function*(){try{const n=new URLSearchParams;(e==null?void 0:e.limit)!==void 0&&n.set("limit",e.limit.toString()),(e==null?void 0:e.offset)!==void 0&&n.set("offset",e.offset.toString()),e!=null&&e.sortColumn&&n.set("sortColumn",e.sortColumn),e!=null&&e.sortOrder&&n.set("sortOrder",e.sortOrder),e!=null&&e.search&&n.set("search",e.search);const s=n.toString(),i=s?`${this.url}/bucket?${s}`:`${this.url}/bucket`;return{data:yield TA(this.fetch,i,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(kl(n))return{data:null,error:n};throw n}})}deleteBucket(e){return Cs(this,void 0,void 0,function*(){try{return{data:yield sge(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(kl(n))return{data:null,error:n};throw n}})}}const ige={"X-Client-Info":`storage-js/${gIe}`,"Content-Type":"application/json"};class xIe extends Error{constructor(e){super(e),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}}function Oh(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}class vle extends xIe{constructor(e,n,s){super(e),this.name="StorageVectorsApiError",this.status=n,this.statusCode=s}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}class Uet extends xIe{constructor(e,n){super(e),this.name="StorageVectorsUnknownError",this.originalError=n}}var Ewe;(function(t){t.InternalError="InternalError",t.S3VectorConflictException="S3VectorConflictException",t.S3VectorNotFoundException="S3VectorNotFoundException",t.S3VectorBucketNotEmpty="S3VectorBucketNotEmpty",t.S3VectorMaxBucketsExceeded="S3VectorMaxBucketsExceeded",t.S3VectorMaxIndexesExceeded="S3VectorMaxIndexesExceeded"})(Ewe||(Ewe={}));const age=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...n)=>DC(async()=>{const{default:s}=await Promise.resolve().then(()=>Dj);return{default:s}},void 0).then(({default:s})=>s(...n)):e=fetch,(...n)=>e(...n)},qet=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},Iwe=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),Vet=(t,e,n)=>Cs(void 0,void 0,void 0,function*(){if(t&&typeof t=="object"&&"status"in t&&"ok"in t&&typeof t.status=="number"&&!(n!=null&&n.noResolveJson)){const i=t.status||500,o=t;if(typeof o.json=="function")o.json().then(c=>{const a=(c==null?void 0:c.statusCode)||(c==null?void 0:c.code)||i+"";e(new vle(Iwe(c),i,a))}).catch(()=>{const c=i+"",a=o.statusText||`HTTP ${i} error`;e(new vle(a,i,c))});else{const c=i+"",a=o.statusText||`HTTP ${i} error`;e(new vle(a,i,c))}}else e(new Uet(Iwe(t),t))}),Het=(t,e,n,s)=>{const i={method:t,headers:(e==null?void 0:e.headers)||{}};return s?(qet(s)?(i.headers=Object.assign({"Content-Type":"application/json"},e==null?void 0:e.headers),i.body=JSON.stringify(s)):i.body=s,Object.assign(Object.assign({},i),n)):i};function Wet(t,e,n,s,i,o){return Cs(this,void 0,void 0,function*(){return new Promise((c,a)=>{t(n,Het(e,s,i,o)).then(f=>{if(!f.ok)throw f;if(s!=null&&s.noResolveJson)return f;const m=f.headers.get("content-type");return!m||!m.includes("application/json")?{}:f.json()}).then(f=>c(f)).catch(f=>Vet(f,a,s))})})}function Dh(t,e,n,s,i){return Cs(this,void 0,void 0,function*(){return Wet(t,"POST",e,s,i,n)})}class Get{constructor(e,n={},s){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},ige),n),this.fetch=age(s)}throwOnError(){return this.shouldThrowOnError=!0,this}createIndex(e){return Cs(this,void 0,void 0,function*(){try{return{data:(yield Dh(this.fetch,`${this.url}/CreateIndex`,e,{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Oh(n))return{data:null,error:n};throw n}})}getIndex(e,n){return Cs(this,void 0,void 0,function*(){try{return{data:yield Dh(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:e,indexName:n},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Oh(s))return{data:null,error:s};throw s}})}listIndexes(e){return Cs(this,void 0,void 0,function*(){try{return{data:yield Dh(this.fetch,`${this.url}/ListIndexes`,e,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Oh(n))return{data:null,error:n};throw n}})}deleteIndex(e,n){return Cs(this,void 0,void 0,function*(){try{return{data:(yield Dh(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:e,indexName:n},{headers:this.headers}))||{},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Oh(s))return{data:null,error:s};throw s}})}}class Ket{constructor(e,n={},s){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},ige),n),this.fetch=age(s)}throwOnError(){return this.shouldThrowOnError=!0,this}putVectors(e){return Cs(this,void 0,void 0,function*(){try{if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:(yield Dh(this.fetch,`${this.url}/PutVectors`,e,{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Oh(n))return{data:null,error:n};throw n}})}getVectors(e){return Cs(this,void 0,void 0,function*(){try{return{data:yield Dh(this.fetch,`${this.url}/GetVectors`,e,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Oh(n))return{data:null,error:n};throw n}})}listVectors(e){return Cs(this,void 0,void 0,function*(){try{if(e.segmentCount!==void 0){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(e.segmentIndex!==void 0&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error(`segmentIndex must be between 0 and ${e.segmentCount-1}`)}return{data:yield Dh(this.fetch,`${this.url}/ListVectors`,e,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Oh(n))return{data:null,error:n};throw n}})}queryVectors(e){return Cs(this,void 0,void 0,function*(){try{return{data:yield Dh(this.fetch,`${this.url}/QueryVectors`,e,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Oh(n))return{data:null,error:n};throw n}})}deleteVectors(e){return Cs(this,void 0,void 0,function*(){try{if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:(yield Dh(this.fetch,`${this.url}/DeleteVectors`,e,{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Oh(n))return{data:null,error:n};throw n}})}}class Zet{constructor(e,n={},s){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},ige),n),this.fetch=age(s)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return Cs(this,void 0,void 0,function*(){try{return{data:(yield Dh(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Oh(n))return{data:null,error:n};throw n}})}getBucket(e){return Cs(this,void 0,void 0,function*(){try{return{data:yield Dh(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:e},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Oh(n))return{data:null,error:n};throw n}})}listBuckets(){return Cs(this,arguments,void 0,function*(e={}){try{return{data:yield Dh(this.fetch,`${this.url}/ListVectorBuckets`,e,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Oh(n))return{data:null,error:n};throw n}})}deleteBucket(e){return Cs(this,void 0,void 0,function*(){try{return{data:(yield Dh(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Oh(n))return{data:null,error:n};throw n}})}}class Yet extends Zet{constructor(e,n={}){super(e,n.headers||{},n.fetch)}from(e){return new Xet(this.url,this.headers,e,this.fetch)}}class Xet extends Get{constructor(e,n,s,i){super(e,n,i),this.vectorBucketName=s}createIndex(e){const n=Object.create(null,{createIndex:{get:()=>super.createIndex}});return Cs(this,void 0,void 0,function*(){return n.createIndex.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName}))})}listIndexes(){const e=Object.create(null,{listIndexes:{get:()=>super.listIndexes}});return Cs(this,arguments,void 0,function*(n={}){return e.listIndexes.call(this,Object.assign(Object.assign({},n),{vectorBucketName:this.vectorBucketName}))})}getIndex(e){const n=Object.create(null,{getIndex:{get:()=>super.getIndex}});return Cs(this,void 0,void 0,function*(){return n.getIndex.call(this,this.vectorBucketName,e)})}deleteIndex(e){const n=Object.create(null,{deleteIndex:{get:()=>super.deleteIndex}});return Cs(this,void 0,void 0,function*(){return n.deleteIndex.call(this,this.vectorBucketName,e)})}index(e){return new Qet(this.url,this.headers,this.vectorBucketName,e,this.fetch)}}class Qet extends Ket{constructor(e,n,s,i,o){super(e,n,o),this.vectorBucketName=s,this.indexName=i}putVectors(e){const n=Object.create(null,{putVectors:{get:()=>super.putVectors}});return Cs(this,void 0,void 0,function*(){return n.putVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}getVectors(e){const n=Object.create(null,{getVectors:{get:()=>super.getVectors}});return Cs(this,void 0,void 0,function*(){return n.getVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}listVectors(){const e=Object.create(null,{listVectors:{get:()=>super.listVectors}});return Cs(this,arguments,void 0,function*(n={}){return e.listVectors.call(this,Object.assign(Object.assign({},n),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}queryVectors(e){const n=Object.create(null,{queryVectors:{get:()=>super.queryVectors}});return Cs(this,void 0,void 0,function*(){return n.queryVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}deleteVectors(e){const n=Object.create(null,{deleteVectors:{get:()=>super.deleteVectors}});return Cs(this,void 0,void 0,function*(){return n.deleteVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}}class Jet extends Bet{constructor(e,n={},s,i){super(e,n,s,i)}from(e){return new zet(this.url,this.headers,e,this.fetch)}get vectors(){return new Yet(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new $et(this.url+"/iceberg",this.headers,this.fetch)}}const ett="2.78.0";let F5="";typeof Deno<"u"?F5="deno":typeof document<"u"?F5="web":typeof navigator<"u"&&navigator.product==="ReactNative"?F5="react-native":F5="node";const ttt={"X-Client-Info":`supabase-js-${F5}/${ett}`},rtt={headers:ttt},ntt={schema:"public"},stt={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},itt={},att=t=>{let e;return t?e=t:typeof fetch>"u"?e=GEe:e=fetch,(...n)=>e(...n)},ott=()=>typeof Headers>"u"?KEe:Headers,ltt=(t,e,n)=>{const s=att(n),i=ott();return async(o,c)=>{var a;const f=(a=await e())!==null&&a!==void 0?a:t;let m=new i(c==null?void 0:c.headers);return m.has("apikey")||m.set("apikey",t),m.has("Authorization")||m.set("Authorization",`Bearer ${f}`),s(o,Object.assign(Object.assign({},c),{headers:m}))}};function ctt(t){return t.endsWith("/")?t:t+"/"}function dtt(t,e){var n,s;const{db:i,auth:o,realtime:c,global:a}=t,{db:f,auth:m,realtime:y,global:v}=e,w={db:Object.assign(Object.assign({},f),i),auth:Object.assign(Object.assign({},m),o),realtime:Object.assign(Object.assign({},y),c),storage:{},global:Object.assign(Object.assign(Object.assign({},v),a),{headers:Object.assign(Object.assign({},(n=v==null?void 0:v.headers)!==null&&n!==void 0?n:{}),(s=a==null?void 0:a.headers)!==null&&s!==void 0?s:{})}),accessToken:async()=>""};return t.accessToken?w.accessToken=t.accessToken:delete w.accessToken,w}function utt(t){const e=t==null?void 0:t.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(ctt(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}const vIe="2.78.0",ZN=30*1e3,Fue=3,_le=Fue*ZN,htt="http://localhost:9999",ftt="supabase.auth.token",ptt={"X-Client-Info":`gotrue-js/${vIe}`},zue="X-Supabase-Api-Version",_Ie={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},mtt=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,gtt=10*60*1e3;class AA extends Error{constructor(e,n,s){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=s}}function Ws(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class ytt extends AA{constructor(e,n,s){super(e,n,s),this.name="AuthApiError",this.status=n,this.code=s}}function xtt(t){return Ws(t)&&t.name==="AuthApiError"}class iw extends AA{constructor(e,n){super(e),this.name="AuthUnknownError",this.originalError=n}}class T1 extends AA{constructor(e,n,s,i){super(e,s,i),this.name=n,this.status=s}}class Ip extends T1{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function vtt(t){return Ws(t)&&t.name==="AuthSessionMissingError"}class CN extends T1{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class Y6 extends T1{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class X6 extends T1{constructor(e,n=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function _tt(t){return Ws(t)&&t.name==="AuthImplicitGrantRedirectError"}class Pwe extends T1{constructor(e,n=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class Bue extends T1{constructor(e,n){super(e,"AuthRetryableFetchError",n,void 0)}}function ble(t){return Ws(t)&&t.name==="AuthRetryableFetchError"}class Lwe extends T1{constructor(e,n,s){super(e,"AuthWeakPasswordError",n,"weak_password"),this.reasons=s}}class $ue extends T1{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const qee="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Owe=` \r=`.split(""),btt=(()=>{const t=new Array(128);for(let e=0;e=6;){const s=e.queue>>e.queuedBits-6&63;n(qee[s]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const s=e.queue>>e.queuedBits-6&63;n(qee[s]),e.queuedBits-=6}}function bIe(t,e,n){const s=btt[t];if(s>-1)for(e.queue=e.queue<<6|s,e.queuedBits+=6;e.queuedBits>=8;)n(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(s===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function Rwe(t){const e=[],n=c=>{e.push(String.fromCodePoint(c))},s={utf8seq:0,codepoint:0},i={queue:0,queuedBits:0},o=c=>{ktt(c,s,n)};for(let c=0;c>6),e(128|t&63);return}else if(t<=65535){e(224|t>>12),e(128|t>>6&63),e(128|t&63);return}else if(t<=1114111){e(240|t>>18),e(128|t>>12&63),e(128|t>>6&63),e(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function jtt(t,e){for(let n=0;n55295&&s<=56319){const i=(s-55296)*1024&65535;s=(t.charCodeAt(n+1)-56320&65535|i)+65536,n+=1}wtt(s,e)}}function ktt(t,e,n){if(e.utf8seq===0){if(t<=127){n(t);return}for(let s=1;s<6;s+=1)if(!(t>>7-s&1)){e.utf8seq=s;break}if(e.utf8seq===2)e.codepoint=t&31;else if(e.utf8seq===3)e.codepoint=t&15;else if(e.utf8seq===4)e.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|t&63,e.utf8seq-=1,e.utf8seq===0&&n(e.codepoint)}}function i4(t){const e=[],n={queue:0,queuedBits:0},s=i=>{e.push(i)};for(let i=0;ie.push(n)),new Uint8Array(e)}function hw(t){const e=[],n={queue:0,queuedBits:0},s=i=>{e.push(i)};return t.forEach(i=>Dwe(i,n,s)),Dwe(null,n,s),e.join("")}function Stt(t){return Math.round(Date.now()/1e3)+t}function Ctt(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t=="x"?e:e&3|8).toString(16)})}const du=()=>typeof window<"u"&&typeof document<"u",Ev={tested:!1,writable:!1},wIe=()=>{if(!du())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Ev.tested)return Ev.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),Ev.tested=!0,Ev.writable=!0}catch{Ev.tested=!0,Ev.writable=!1}return Ev.writable};function Mtt(t){const e={},n=new URL(t);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((i,o)=>{e[o]=i})}catch{}return n.searchParams.forEach((s,i)=>{e[i]=s}),e}const jIe=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...n)=>DC(async()=>{const{default:s}=await Promise.resolve().then(()=>Dj);return{default:s}},void 0).then(({default:s})=>s(...n)):e=fetch,(...n)=>e(...n)},Ttt=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",YN=async(t,e,n)=>{await t.setItem(e,JSON.stringify(n))},Iv=async(t,e)=>{const n=await t.getItem(e);if(!n)return null;try{return JSON.parse(n)}catch{return n}},$x=async(t,e)=>{await t.removeItem(e)};class Ine{constructor(){this.promise=new Ine.promiseConstructor((e,n)=>{this.resolve=e,this.reject=n})}}Ine.promiseConstructor=Promise;function wle(t){const e=t.split(".");if(e.length!==3)throw new $ue("Invalid JWT structure");for(let s=0;s{setTimeout(()=>e(null),t)})}function Ett(t,e){return new Promise((s,i)=>{(async()=>{for(let o=0;o<1/0;o++)try{const c=await t(o);if(!e(o,null,c)){s(c);return}}catch(c){if(!e(o,c)){i(c);return}}})()})}function Itt(t){return("0"+t.toString(16)).substr(-2)}function Ptt(){const e=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",s=n.length;let i="";for(let o=0;o<56;o++)i+=n.charAt(Math.floor(Math.random()*s));return i}return crypto.getRandomValues(e),Array.from(e,Itt).join("")}async function Ltt(t){const n=new TextEncoder().encode(t),s=await crypto.subtle.digest("SHA-256",n),i=new Uint8Array(s);return Array.from(i).map(o=>String.fromCharCode(o)).join("")}async function Ott(t){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),t;const n=await Ltt(t);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function MN(t,e,n=!1){const s=Ptt();let i=s;n&&(i+="/PASSWORD_RECOVERY"),await YN(t,`${e}-code-verifier`,i);const o=await Ott(s);return[o,s===o?"plain":"s256"]}const Dtt=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function Rtt(t){const e=t.headers.get(zue);if(!e||!e.match(Dtt))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function Ftt(t){if(!t)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(t<=e)throw new Error("JWT has expired")}function ztt(t){switch(t){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const Btt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function TN(t){if(!Btt.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function jle(){const t={};return new Proxy(t,{get:(e,n)=>{if(n==="__isUserNotAvailableProxy")return!0;if(typeof n=="symbol"){const s=n.toString();if(s==="Symbol(Symbol.toPrimitive)"||s==="Symbol(Symbol.toStringTag)"||s==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${n}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function $tt(t,e){return new Proxy(t,{get:(n,s,i)=>{if(s==="__isInsecureUserWarningProxy")return!0;if(typeof s=="symbol"){const o=s.toString();if(o==="Symbol(Symbol.toPrimitive)"||o==="Symbol(Symbol.toStringTag)"||o==="Symbol(util.inspect.custom)"||o==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(n,s,i)}return!e.value&&typeof s=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),e.value=!0),Reflect.get(n,s,i)}})}function Fwe(t){return JSON.parse(JSON.stringify(t))}const Jb=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),Utt=[502,503,504];async function zwe(t){var e;if(!Ttt(t))throw new Bue(Jb(t),0);if(Utt.includes(t.status))throw new Bue(Jb(t),t.status);let n;try{n=await t.json()}catch(o){throw new iw(Jb(o),o)}let s;const i=Rtt(t);if(i&&i.getTime()>=_Ie["2024-01-01"].timestamp&&typeof n=="object"&&n&&typeof n.code=="string"?s=n.code:typeof n=="object"&&n&&typeof n.error_code=="string"&&(s=n.error_code),s){if(s==="weak_password")throw new Lwe(Jb(n),t.status,((e=n.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(s==="session_not_found")throw new Ip}else if(typeof n=="object"&&n&&typeof n.weak_password=="object"&&n.weak_password&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.reasons.reduce((o,c)=>o&&typeof c=="string",!0))throw new Lwe(Jb(n),t.status,n.weak_password.reasons);throw new ytt(Jb(n),t.status||500,s)}const qtt=(t,e,n,s)=>{const i={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"?i:(i.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),i.body=JSON.stringify(s),Object.assign(Object.assign({},i),n))};async function wi(t,e,n,s){var i;const o=Object.assign({},s==null?void 0:s.headers);o[zue]||(o[zue]=_Ie["2024-01-01"].name),s!=null&&s.jwt&&(o.Authorization=`Bearer ${s.jwt}`);const c=(i=s==null?void 0:s.query)!==null&&i!==void 0?i:{};s!=null&&s.redirectTo&&(c.redirect_to=s.redirectTo);const a=Object.keys(c).length?"?"+new URLSearchParams(c).toString():"",f=await Vtt(t,e,n+a,{headers:o,noResolveJson:s==null?void 0:s.noResolveJson},{},s==null?void 0:s.body);return s!=null&&s.xform?s==null?void 0:s.xform(f):{data:Object.assign({},f),error:null}}async function Vtt(t,e,n,s,i,o){const c=qtt(e,s,i,o);let a;try{a=await t(n,Object.assign({},c))}catch(f){throw console.error(f),new Bue(Jb(f),0)}if(a.ok||await zwe(a),s!=null&&s.noResolveJson)return a;try{return await a.json()}catch(f){await zwe(f)}}function Pp(t){var e;let n=null;Gtt(t)&&(n=Object.assign({},t),t.expires_at||(n.expires_at=Stt(t.expires_in)));const s=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:n,user:s},error:null}}function Bwe(t){const e=Pp(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((n,s)=>n&&typeof s=="string",!0)&&(e.data.weak_password=t.weak_password),e}function c0(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function Htt(t){return{data:t,error:null}}function Wtt(t){const{action_link:e,email_otp:n,hashed_token:s,redirect_to:i,verification_type:o}=t,c=M1(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),a={action_link:e,email_otp:n,hashed_token:s,redirect_to:i,verification_type:o},f=Object.assign({},c);return{data:{properties:a,user:f},error:null}}function $we(t){return t}function Gtt(t){return t.access_token&&t.refresh_token&&t.expires_in}const kle=["global","local","others"];class Ktt{constructor({url:e="",headers:n={},fetch:s}){this.url=e,this.headers=n,this.fetch=jIe(s),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}async signOut(e,n=kle[0]){if(kle.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${kle.join(", ")}`);try{return await wi(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(s){if(Ws(s))return{data:null,error:s};throw s}}async inviteUserByEmail(e,n={}){try{return await wi(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:c0})}catch(s){if(Ws(s))return{data:{user:null},error:s};throw s}}async generateLink(e){try{const{options:n}=e,s=M1(e,["options"]),i=Object.assign(Object.assign({},s),n);return"newEmail"in s&&(i.new_email=s==null?void 0:s.newEmail,delete i.newEmail),await wi(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:i,headers:this.headers,xform:Wtt,redirectTo:n==null?void 0:n.redirectTo})}catch(n){if(Ws(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(e){try{return await wi(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:c0})}catch(n){if(Ws(n))return{data:{user:null},error:n};throw n}}async listUsers(e){var n,s,i,o,c,a,f;try{const m={nextPage:null,lastPage:0,total:0},y=await wi(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(s=(n=e==null?void 0:e.page)===null||n===void 0?void 0:n.toString())!==null&&s!==void 0?s:"",per_page:(o=(i=e==null?void 0:e.perPage)===null||i===void 0?void 0:i.toString())!==null&&o!==void 0?o:""},xform:$we});if(y.error)throw y.error;const v=await y.json(),w=(c=y.headers.get("x-total-count"))!==null&&c!==void 0?c:0,k=(f=(a=y.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&f!==void 0?f:[];return k.length>0&&(k.forEach(C=>{const S=parseInt(C.split(";")[0].split("=")[1].substring(0,1)),T=JSON.parse(C.split(";")[1].split("=")[1]);m[`${T}Page`]=S}),m.total=parseInt(w)),{data:Object.assign(Object.assign({},v),m),error:null}}catch(m){if(Ws(m))return{data:{users:[]},error:m};throw m}}async getUserById(e){TN(e);try{return await wi(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:c0})}catch(n){if(Ws(n))return{data:{user:null},error:n};throw n}}async updateUserById(e,n){TN(e);try{return await wi(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:n,headers:this.headers,xform:c0})}catch(s){if(Ws(s))return{data:{user:null},error:s};throw s}}async deleteUser(e,n=!1){TN(e);try{return await wi(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:n},xform:c0})}catch(s){if(Ws(s))return{data:{user:null},error:s};throw s}}async _listFactors(e){TN(e.userId);try{const{data:n,error:s}=await wi(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:i=>({data:{factors:i},error:null})});return{data:n,error:s}}catch(n){if(Ws(n))return{data:null,error:n};throw n}}async _deleteFactor(e){TN(e.userId),TN(e.id);try{return{data:await wi(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(n){if(Ws(n))return{data:null,error:n};throw n}}async _listOAuthClients(e){var n,s,i,o,c,a,f;try{const m={nextPage:null,lastPage:0,total:0},y=await wi(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(s=(n=e==null?void 0:e.page)===null||n===void 0?void 0:n.toString())!==null&&s!==void 0?s:"",per_page:(o=(i=e==null?void 0:e.perPage)===null||i===void 0?void 0:i.toString())!==null&&o!==void 0?o:""},xform:$we});if(y.error)throw y.error;const v=await y.json(),w=(c=y.headers.get("x-total-count"))!==null&&c!==void 0?c:0,k=(f=(a=y.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&f!==void 0?f:[];return k.length>0&&(k.forEach(C=>{const S=parseInt(C.split(";")[0].split("=")[1].substring(0,1)),T=JSON.parse(C.split(";")[1].split("=")[1]);m[`${T}Page`]=S}),m.total=parseInt(w)),{data:Object.assign(Object.assign({},v),m),error:null}}catch(m){if(Ws(m))return{data:{clients:[]},error:m};throw m}}async _createOAuthClient(e){try{return await wi(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Ws(n))return{data:null,error:n};throw n}}async _getOAuthClient(e){try{return await wi(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Ws(n))return{data:null,error:n};throw n}}async _updateOAuthClient(e,n){try{return await wi(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:n,headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(Ws(s))return{data:null,error:s};throw s}}async _deleteOAuthClient(e){try{return await wi(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(Ws(n))return{data:null,error:n};throw n}}async _regenerateOAuthClientSecret(e){try{return await wi(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Ws(n))return{data:null,error:n};throw n}}}function Uwe(t={}){return{getItem:e=>t[e]||null,setItem:(e,n)=>{t[e]=n},removeItem:e=>{delete t[e]}}}const AN={debug:!!(globalThis&&wIe()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class kIe extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class Ztt extends kIe{}async function Ytt(t,e,n){AN.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const s=new globalThis.AbortController;return e>0&&setTimeout(()=>{s.abort(),AN.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",t)},e),await Promise.resolve().then(()=>globalThis.navigator.locks.request(t,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:s.signal},async i=>{if(i){AN.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,i.name);try{return await n()}finally{AN.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,i.name)}}else{if(e===0)throw AN.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new Ztt(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(AN.debug)try{const o=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(o,null," "))}catch(o){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",o)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await n()}}))}function Xtt(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}function NIe(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function Qtt(t){return parseInt(t,16)}function Jtt(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,s=>s.toString(16).padStart(2,"0")).join("")}function ert(t){var e;const{chainId:n,domain:s,expirationTime:i,issuedAt:o=new Date,nonce:c,notBefore:a,requestId:f,resources:m,scheme:y,uri:v,version:w}=t;{if(!Number.isInteger(n))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${n}`);if(!s)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(c&&c.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${c}`);if(!v)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(w!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${w}`);if(!((e=t.statement)===null||e===void 0)&&e.includes(` `))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}const k=NIe(t.address),C=y?`${y}://${s}`:s,S=t.statement?`${t.statement} `:"",T=`${C} wants you to sign in with your Ethereum account: ${k} ${S}`;let I=`URI: ${v} Version: ${w} Chain ID: ${n}${c?` Nonce: ${c}`:""} Issued At: ${o.toISOString()}`;if(i&&(I+=` Expiration Time: ${i.toISOString()}`),a&&(I+=` Not Before: ${a.toISOString()}`),f&&(I+=` Request ID: ${f}`),m){let A=` Resources:`;for(const D of m){if(!D||typeof D!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${D}`);A+=` - ${D}`}I+=A}return`${T} ${I}`}class gc extends Error{constructor({message:e,code:n,cause:s,name:i}){var o;super(e,{cause:s}),this.__isWebAuthnError=!0,this.name=(o=i??(s instanceof Error?s.name:void 0))!==null&&o!==void 0?o:"Unknown Error",this.code=n}}class Vee extends gc{constructor(e,n){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n,message:e}),this.name="WebAuthnUnknownError",this.originalError=n}}function trt({error:t,options:e}){var n,s,i;const{publicKey:o}=e;if(!o)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new gc({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((n=o.authenticatorSelection)===null||n===void 0?void 0:n.requireResidentKey)===!0)return new gc({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((s=o.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new gc({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((i=o.authenticatorSelection)===null||i===void 0?void 0:i.userVerification)==="required")return new gc({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new gc({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new gc({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return o.pubKeyCredParams.filter(a=>a.type==="public-key").length===0?new gc({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new gc({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){const c=window.location.hostname;if(SIe(c)){if(o.rp.id!==c)return new gc({message:`The RP ID "${o.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new gc({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(o.user.id.byteLength<1||o.user.id.byteLength>64)return new gc({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new gc({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new gc({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function rrt({error:t,options:e}){const{publicKey:n}=e;if(!n)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new gc({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new gc({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const s=window.location.hostname;if(SIe(s)){if(n.rpId!==s)return new gc({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new gc({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new gc({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new gc({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class nrt{createNewAbortSignal(){if(this.controller){const n=new Error("Cancelling existing WebAuthn API call for new one");n.name="AbortError",this.controller.abort(n)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}const srt=new nrt;function irt(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);const{challenge:e,user:n,excludeCredentials:s}=t,i=M1(t,["challenge","user","excludeCredentials"]),o=i4(e).buffer,c=Object.assign(Object.assign({},n),{id:i4(n.id).buffer}),a=Object.assign(Object.assign({},i),{challenge:o,user:c});if(s&&s.length>0){a.excludeCredentials=new Array(s.length);for(let f=0;f0){o.allowCredentials=new Array(n.length);for(let c=0;ci!==null&&typeof i=="object"&&!Array.isArray(i),n=i=>i instanceof ArrayBuffer||ArrayBuffer.isView(i),s={};for(const i of t)if(i)for(const o in i){const c=i[o];if(c!==void 0)if(Array.isArray(c))s[o]=c;else if(n(c))s[o]=c;else if(e(c)){const a=s[o];e(a)?s[o]=Hee(a,c):s[o]=Hee(c)}else s[o]=c}return s}function frt(t,e){return Hee(urt,t,e||{})}function prt(t,e){return Hee(hrt,t,e||{})}class mrt{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:n,friendlyName:s,signal:i},o){try{const{data:c,error:a}=await this.client.mfa.challenge({factorId:e,webauthn:n});if(!c)return{data:null,error:a};const f=i??srt.createNewAbortSignal();if(c.webauthn.type==="create"){const{user:m}=c.webauthn.credential_options.publicKey;m.name||(m.name=`${m.id}:${s}`),m.displayName||(m.displayName=m.name)}switch(c.webauthn.type){case"create":{const m=frt(c.webauthn.credential_options.publicKey,o==null?void 0:o.create),{data:y,error:v}=await crt({publicKey:m,signal:f});return y?{data:{factorId:e,challengeId:c.id,webauthn:{type:c.webauthn.type,credential_response:y}},error:null}:{data:null,error:v}}case"request":{const m=prt(c.webauthn.credential_options.publicKey,o==null?void 0:o.request),{data:y,error:v}=await drt(Object.assign(Object.assign({},c.webauthn.credential_options),{publicKey:m,signal:f}));return y?{data:{factorId:e,challengeId:c.id,webauthn:{type:c.webauthn.type,credential_response:y}},error:null}:{data:null,error:v}}}}catch(c){return Ws(c)?{data:null,error:c}:{data:null,error:new iw("Unexpected error in challenge",c)}}}async _verify({challengeId:e,factorId:n,webauthn:s}){return this.client.mfa.verify({factorId:n,challengeId:e,webauthn:s})}async _authenticate({factorId:e,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:s=typeof window<"u"?[window.location.origin]:void 0,signal:i}},o){if(!n)return{data:null,error:new AA("rpId is required for WebAuthn authentication")};try{if(!qwe())return{data:null,error:new iw("Browser does not support WebAuthn",null)};const{data:c,error:a}=await this.challenge({factorId:e,webauthn:{rpId:n,rpOrigins:s},signal:i},{request:o});if(!c)return{data:null,error:a};const{webauthn:f}=c;return this._verify({factorId:e,challengeId:c.challengeId,webauthn:{type:f.type,rpId:n,rpOrigins:s,credential_response:f.credential_response}})}catch(c){return Ws(c)?{data:null,error:c}:{data:null,error:new iw("Unexpected error in authenticate",c)}}}async _register({friendlyName:e,rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:s=typeof window<"u"?[window.location.origin]:void 0,signal:i},o){if(!n)return{data:null,error:new AA("rpId is required for WebAuthn registration")};try{if(!qwe())return{data:null,error:new iw("Browser does not support WebAuthn",null)};const{data:c,error:a}=await this._enroll({friendlyName:e});if(!c)return await this.client.mfa.listFactors().then(y=>{var v;return(v=y.data)===null||v===void 0?void 0:v.all.find(w=>w.factor_type==="webauthn"&&w.friendly_name===e&&w.status!=="unverified")}).then(y=>y?this.client.mfa.unenroll({factorId:y==null?void 0:y.id}):void 0),{data:null,error:a};const{data:f,error:m}=await this._challenge({factorId:c.id,friendlyName:c.friendly_name,webauthn:{rpId:n,rpOrigins:s},signal:i},{create:o});return f?this._verify({factorId:c.id,challengeId:f.challengeId,webauthn:{rpId:n,rpOrigins:s,type:f.webauthn.type,credential_response:f.webauthn.credential_response}}):{data:null,error:m}}catch(c){return Ws(c)?{data:null,error:c}:{data:null,error:new iw("Unexpected error in register",c)}}}}Xtt();const grt={url:htt,storageKey:ftt,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:ptt,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1};async function Vwe(t,e,n){return await n()}const EN={};class EA{get jwks(){var e,n;return(n=(e=EN[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(e){EN[this.storageKey]=Object.assign(Object.assign({},EN[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,n;return(n=(e=EN[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){EN[this.storageKey]=Object.assign(Object.assign({},EN[this.storageKey]),{cachedAt:e})}constructor(e){var n,s;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log,this.instanceID=EA.nextInstanceID,EA.nextInstanceID+=1,this.instanceID>0&&du()&&console.warn("Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.");const i=Object.assign(Object.assign({},grt),e);if(this.logDebugMessages=!!i.debug,typeof i.debug=="function"&&(this.logger=i.debug),this.persistSession=i.persistSession,this.storageKey=i.storageKey,this.autoRefreshToken=i.autoRefreshToken,this.admin=new Ktt({url:i.url,headers:i.headers,fetch:i.fetch}),this.url=i.url,this.headers=i.headers,this.fetch=jIe(i.fetch),this.lock=i.lock||Vwe,this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,i.lock?this.lock=i.lock:du()&&(!((n=globalThis==null?void 0:globalThis.navigator)===null||n===void 0)&&n.locks)?this.lock=Ytt:this.lock=Vwe,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new mrt(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this)},this.persistSession?(i.storage?this.storage=i.storage:wIe()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=Uwe(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=Uwe(this.memoryStorage)),du()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(o){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",o)}(s=this.broadcastChannel)===null||s===void 0||s.addEventListener("message",async o=>{this._debug("received broadcast notification from other tab or client",o),await this._notifyAllSubscribers(o.data.event,o.data.session,!1)})}this.initialize()}_debug(...e){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${vIe}) ${new Date().toISOString()}`,...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{const n=Mtt(window.location.href);let s="none";if(this._isImplicitGrantCallback(n)?s="implicit":await this._isPKCECallback(n)&&(s="pkce"),du()&&this.detectSessionInUrl&&s!=="none"){const{data:i,error:o}=await this._getSessionFromURL(n,s);if(o){if(this._debug("#_initialize()","error detecting session from URL",o),_tt(o)){const f=(e=o.details)===null||e===void 0?void 0:e.code;if(f==="identity_already_exists"||f==="identity_not_found"||f==="single_identity_not_deletable")return{error:o}}return await this._removeSession(),{error:o}}const{session:c,redirectType:a}=i;return this._debug("#_initialize()","detected session in URL",c,"redirect type",a),await this._saveSession(c),setTimeout(async()=>{a==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",c):await this._notifyAllSubscribers("SIGNED_IN",c)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(n){return Ws(n)?{error:n}:{error:new iw("Unexpected error during initialization",n)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var n,s,i;try{const o=await wi(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(s=(n=e==null?void 0:e.options)===null||n===void 0?void 0:n.data)!==null&&s!==void 0?s:{},gotrue_meta_security:{captcha_token:(i=e==null?void 0:e.options)===null||i===void 0?void 0:i.captchaToken}},xform:Pp}),{data:c,error:a}=o;if(a||!c)return{data:{user:null,session:null},error:a};const f=c.session,m=c.user;return c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("SIGNED_IN",f)),{data:{user:m,session:f},error:null}}catch(o){if(Ws(o))return{data:{user:null,session:null},error:o};throw o}}async signUp(e){var n,s,i;try{let o;if("email"in e){const{email:y,password:v,options:w}=e;let k=null,C=null;this.flowType==="pkce"&&([k,C]=await MN(this.storage,this.storageKey)),o=await wi(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:w==null?void 0:w.emailRedirectTo,body:{email:y,password:v,data:(n=w==null?void 0:w.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:w==null?void 0:w.captchaToken},code_challenge:k,code_challenge_method:C},xform:Pp})}else if("phone"in e){const{phone:y,password:v,options:w}=e;o=await wi(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:y,password:v,data:(s=w==null?void 0:w.data)!==null&&s!==void 0?s:{},channel:(i=w==null?void 0:w.channel)!==null&&i!==void 0?i:"sms",gotrue_meta_security:{captcha_token:w==null?void 0:w.captchaToken}},xform:Pp})}else throw new Y6("You must provide either an email or phone number and a password");const{data:c,error:a}=o;if(a||!c)return{data:{user:null,session:null},error:a};const f=c.session,m=c.user;return c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("SIGNED_IN",f)),{data:{user:m,session:f},error:null}}catch(o){if(Ws(o))return{data:{user:null,session:null},error:o};throw o}}async signInWithPassword(e){try{let n;if("email"in e){const{email:o,password:c,options:a}=e;n=await wi(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:o,password:c,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:Bwe})}else if("phone"in e){const{phone:o,password:c,options:a}=e;n=await wi(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:o,password:c,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:Bwe})}else throw new Y6("You must provide either an email or phone number and a password");const{data:s,error:i}=n;return i?{data:{user:null,session:null},error:i}:!s||!s.session||!s.user?{data:{user:null,session:null},error:new CN}:(s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),{data:Object.assign({user:s.user,session:s.session},s.weak_password?{weakPassword:s.weak_password}:null),error:i})}catch(n){if(Ws(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithOAuth(e){var n,s,i,o;return await this._handleProviderSignIn(e.provider,{redirectTo:(n=e.options)===null||n===void 0?void 0:n.redirectTo,scopes:(s=e.options)===null||s===void 0?void 0:s.scopes,queryParams:(i=e.options)===null||i===void 0?void 0:i.queryParams,skipBrowserRedirect:(o=e.options)===null||o===void 0?void 0:o.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:n}=e;switch(n){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${n}"`)}}async signInWithEthereum(e){var n,s,i,o,c,a,f,m,y,v,w;let k,C;if("message"in e)k=e.message,C=e.signature;else{const{chain:S,wallet:T,statement:I,options:A}=e;let D;if(du())if(typeof T=="object")D=T;else{const Z=window;if("ethereum"in Z&&typeof Z.ethereum=="object"&&"request"in Z.ethereum&&typeof Z.ethereum.request=="function")D=Z.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof T!="object"||!(A!=null&&A.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");D=T}const $=new URL((n=A==null?void 0:A.url)!==null&&n!==void 0?n:window.location.href),F=await D.request({method:"eth_requestAccounts"}).then(Z=>Z).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!F||F.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const q=NIe(F[0]);let W=(s=A==null?void 0:A.signInWithEthereum)===null||s===void 0?void 0:s.chainId;if(!W){const Z=await D.request({method:"eth_chainId"});W=Qtt(Z)}const K={domain:$.host,address:q,statement:I,uri:$.href,version:"1",chainId:W,nonce:(i=A==null?void 0:A.signInWithEthereum)===null||i===void 0?void 0:i.nonce,issuedAt:(c=(o=A==null?void 0:A.signInWithEthereum)===null||o===void 0?void 0:o.issuedAt)!==null&&c!==void 0?c:new Date,expirationTime:(a=A==null?void 0:A.signInWithEthereum)===null||a===void 0?void 0:a.expirationTime,notBefore:(f=A==null?void 0:A.signInWithEthereum)===null||f===void 0?void 0:f.notBefore,requestId:(m=A==null?void 0:A.signInWithEthereum)===null||m===void 0?void 0:m.requestId,resources:(y=A==null?void 0:A.signInWithEthereum)===null||y===void 0?void 0:y.resources};k=ert(K),C=await D.request({method:"personal_sign",params:[Jtt(k),q]})}try{const{data:S,error:T}=await wi(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:k,signature:C},!((v=e.options)===null||v===void 0)&&v.captchaToken?{gotrue_meta_security:{captcha_token:(w=e.options)===null||w===void 0?void 0:w.captchaToken}}:null),xform:Pp});if(T)throw T;return!S||!S.session||!S.user?{data:{user:null,session:null},error:new CN}:(S.session&&(await this._saveSession(S.session),await this._notifyAllSubscribers("SIGNED_IN",S.session)),{data:Object.assign({},S),error:T})}catch(S){if(Ws(S))return{data:{user:null,session:null},error:S};throw S}}async signInWithSolana(e){var n,s,i,o,c,a,f,m,y,v,w,k;let C,S;if("message"in e)C=e.message,S=e.signature;else{const{chain:T,wallet:I,statement:A,options:D}=e;let $;if(du())if(typeof I=="object")$=I;else{const q=window;if("solana"in q&&typeof q.solana=="object"&&("signIn"in q.solana&&typeof q.solana.signIn=="function"||"signMessage"in q.solana&&typeof q.solana.signMessage=="function"))$=q.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof I!="object"||!(D!=null&&D.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");$=I}const F=new URL((n=D==null?void 0:D.url)!==null&&n!==void 0?n:window.location.href);if("signIn"in $&&$.signIn){const q=await $.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},D==null?void 0:D.signInWithSolana),{version:"1",domain:F.host,uri:F.href}),A?{statement:A}:null));let W;if(Array.isArray(q)&&q[0]&&typeof q[0]=="object")W=q[0];else if(q&&typeof q=="object"&&"signedMessage"in q&&"signature"in q)W=q;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in W&&"signature"in W&&(typeof W.signedMessage=="string"||W.signedMessage instanceof Uint8Array)&&W.signature instanceof Uint8Array)C=typeof W.signedMessage=="string"?W.signedMessage:new TextDecoder().decode(W.signedMessage),S=W.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in $)||typeof $.signMessage!="function"||!("publicKey"in $)||typeof $!="object"||!$.publicKey||!("toBase58"in $.publicKey)||typeof $.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");C=[`${F.host} wants you to sign in with your Solana account:`,$.publicKey.toBase58(),...A?["",A,""]:[""],"Version: 1",`URI: ${F.href}`,`Issued At: ${(i=(s=D==null?void 0:D.signInWithSolana)===null||s===void 0?void 0:s.issuedAt)!==null&&i!==void 0?i:new Date().toISOString()}`,...!((o=D==null?void 0:D.signInWithSolana)===null||o===void 0)&&o.notBefore?[`Not Before: ${D.signInWithSolana.notBefore}`]:[],...!((c=D==null?void 0:D.signInWithSolana)===null||c===void 0)&&c.expirationTime?[`Expiration Time: ${D.signInWithSolana.expirationTime}`]:[],...!((a=D==null?void 0:D.signInWithSolana)===null||a===void 0)&&a.chainId?[`Chain ID: ${D.signInWithSolana.chainId}`]:[],...!((f=D==null?void 0:D.signInWithSolana)===null||f===void 0)&&f.nonce?[`Nonce: ${D.signInWithSolana.nonce}`]:[],...!((m=D==null?void 0:D.signInWithSolana)===null||m===void 0)&&m.requestId?[`Request ID: ${D.signInWithSolana.requestId}`]:[],...!((v=(y=D==null?void 0:D.signInWithSolana)===null||y===void 0?void 0:y.resources)===null||v===void 0)&&v.length?["Resources",...D.signInWithSolana.resources.map(W=>`- ${W}`)]:[]].join(` `);const q=await $.signMessage(new TextEncoder().encode(C),"utf8");if(!q||!(q instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");S=q}}try{const{data:T,error:I}=await wi(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:C,signature:hw(S)},!((w=e.options)===null||w===void 0)&&w.captchaToken?{gotrue_meta_security:{captcha_token:(k=e.options)===null||k===void 0?void 0:k.captchaToken}}:null),xform:Pp});if(I)throw I;return!T||!T.session||!T.user?{data:{user:null,session:null},error:new CN}:(T.session&&(await this._saveSession(T.session),await this._notifyAllSubscribers("SIGNED_IN",T.session)),{data:Object.assign({},T),error:I})}catch(T){if(Ws(T))return{data:{user:null,session:null},error:T};throw T}}async _exchangeCodeForSession(e){const n=await Iv(this.storage,`${this.storageKey}-code-verifier`),[s,i]=(n??"").split("/");try{const{data:o,error:c}=await wi(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:s},xform:Pp});if(await $x(this.storage,`${this.storageKey}-code-verifier`),c)throw c;return!o||!o.session||!o.user?{data:{user:null,session:null,redirectType:null},error:new CN}:(o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",o.session)),{data:Object.assign(Object.assign({},o),{redirectType:i??null}),error:c})}catch(o){if(Ws(o))return{data:{user:null,session:null,redirectType:null},error:o};throw o}}async signInWithIdToken(e){try{const{options:n,provider:s,token:i,access_token:o,nonce:c}=e,a=await wi(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:s,id_token:i,access_token:o,nonce:c,gotrue_meta_security:{captcha_token:n==null?void 0:n.captchaToken}},xform:Pp}),{data:f,error:m}=a;return m?{data:{user:null,session:null},error:m}:!f||!f.session||!f.user?{data:{user:null,session:null},error:new CN}:(f.session&&(await this._saveSession(f.session),await this._notifyAllSubscribers("SIGNED_IN",f.session)),{data:f,error:m})}catch(n){if(Ws(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithOtp(e){var n,s,i,o,c;try{if("email"in e){const{email:a,options:f}=e;let m=null,y=null;this.flowType==="pkce"&&([m,y]=await MN(this.storage,this.storageKey));const{error:v}=await wi(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:a,data:(n=f==null?void 0:f.data)!==null&&n!==void 0?n:{},create_user:(s=f==null?void 0:f.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken},code_challenge:m,code_challenge_method:y},redirectTo:f==null?void 0:f.emailRedirectTo});return{data:{user:null,session:null},error:v}}if("phone"in e){const{phone:a,options:f}=e,{data:m,error:y}=await wi(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:a,data:(i=f==null?void 0:f.data)!==null&&i!==void 0?i:{},create_user:(o=f==null?void 0:f.shouldCreateUser)!==null&&o!==void 0?o:!0,gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken},channel:(c=f==null?void 0:f.channel)!==null&&c!==void 0?c:"sms"}});return{data:{user:null,session:null,messageId:m==null?void 0:m.message_id},error:y}}throw new Y6("You must provide either an email or phone number.")}catch(a){if(Ws(a))return{data:{user:null,session:null},error:a};throw a}}async verifyOtp(e){var n,s;try{let i,o;"options"in e&&(i=(n=e.options)===null||n===void 0?void 0:n.redirectTo,o=(s=e.options)===null||s===void 0?void 0:s.captchaToken);const{data:c,error:a}=await wi(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:o}}),redirectTo:i,xform:Pp});if(a)throw a;if(!c)throw new Error("An error occurred on token verification.");const f=c.session,m=c.user;return f!=null&&f.access_token&&(await this._saveSession(f),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",f)),{data:{user:m,session:f},error:null}}catch(i){if(Ws(i))return{data:{user:null,session:null},error:i};throw i}}async signInWithSSO(e){var n,s,i;try{let o=null,c=null;return this.flowType==="pkce"&&([o,c]=await MN(this.storage,this.storageKey)),await wi(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(s=(n=e.options)===null||n===void 0?void 0:n.redirectTo)!==null&&s!==void 0?s:void 0}),!((i=e==null?void 0:e.options)===null||i===void 0)&&i.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:o,code_challenge_method:c}),headers:this.headers,xform:Htt})}catch(o){if(Ws(o))return{data:null,error:o};throw o}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:n},error:s}=e;if(s)throw s;if(!n)throw new Ip;const{error:i}=await wi(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return{data:{user:null,session:null},error:i}})}catch(e){if(Ws(e))return{data:{user:null,session:null},error:e};throw e}}async resend(e){try{const n=`${this.url}/resend`;if("email"in e){const{email:s,type:i,options:o}=e,{error:c}=await wi(this.fetch,"POST",n,{headers:this.headers,body:{email:s,type:i,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},redirectTo:o==null?void 0:o.emailRedirectTo});return{data:{user:null,session:null},error:c}}else if("phone"in e){const{phone:s,type:i,options:o}=e,{data:c,error:a}=await wi(this.fetch,"POST",n,{headers:this.headers,body:{phone:s,type:i,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}}});return{data:{user:null,session:null,messageId:c==null?void 0:c.message_id},error:a}}throw new Y6("You must provide either an email or phone number and a type")}catch(n){if(Ws(n))return{data:{user:null,session:null},error:n};throw n}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async n=>n))}async _acquireLock(e,n){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const s=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),i=(async()=>(await s,await n()))();return this.pendingInLock.push((async()=>{try{await i}catch{}})()),i}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const s=n();for(this.pendingInLock.push((async()=>{try{await s}catch{}})()),await s;this.pendingInLock.length;){const i=[...this.pendingInLock];await Promise.all(i),this.pendingInLock.splice(0,i.length)}return await s}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const n=await this.__loadSession();return await e(n)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const n=await Iv(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",n),n!==null&&(this._isValidSession(n)?e=n:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const s=e.expires_at?e.expires_at*1e3-Date.now()<_le:!1;if(this._debug("#__loadSession()",`session has${s?"":" not"} expired`,"expires_at",e.expires_at),!s){if(this.userStorage){const c=await Iv(this.userStorage,this.storageKey+"-user");c!=null&&c.user?e.user=c.user:e.user=jle()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const c={value:this.suppressGetSessionWarning};e.user=$tt(e.user,c),c.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:i,error:o}=await this._callRefreshToken(e.refresh_token);return o?{data:{session:null},error:o}:{data:{session:i},error:null}}finally{this._debug("#__loadSession()","end")}}async getUser(e){return e?await this._getUser(e):(await this.initializePromise,await this._acquireLock(-1,async()=>await this._getUser()))}async _getUser(e){try{return e?await wi(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:c0}):await this._useSession(async n=>{var s,i,o;const{data:c,error:a}=n;if(a)throw a;return!(!((s=c.session)===null||s===void 0)&&s.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Ip}:await wi(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(o=(i=c.session)===null||i===void 0?void 0:i.access_token)!==null&&o!==void 0?o:void 0,xform:c0})})}catch(n){if(Ws(n))return vtt(n)&&(await this._removeSession(),await $x(this.storage,`${this.storageKey}-code-verifier`)),{data:{user:null},error:n};throw n}}async updateUser(e,n={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,n))}async _updateUser(e,n={}){try{return await this._useSession(async s=>{const{data:i,error:o}=s;if(o)throw o;if(!i.session)throw new Ip;const c=i.session;let a=null,f=null;this.flowType==="pkce"&&e.email!=null&&([a,f]=await MN(this.storage,this.storageKey));const{data:m,error:y}=await wi(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n==null?void 0:n.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:f}),jwt:c.access_token,xform:c0});if(y)throw y;return c.user=m.user,await this._saveSession(c),await this._notifyAllSubscribers("USER_UPDATED",c),{data:{user:c.user},error:null}})}catch(s){if(Ws(s))return{data:{user:null},error:s};throw s}}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new Ip;const n=Date.now()/1e3;let s=n,i=!0,o=null;const{payload:c}=wle(e.access_token);if(c.exp&&(s=c.exp,i=s<=n),i){const{data:a,error:f}=await this._callRefreshToken(e.refresh_token);if(f)return{data:{user:null,session:null},error:f};if(!a)return{data:{user:null,session:null},error:null};o=a}else{const{data:a,error:f}=await this._getUser(e.access_token);if(f)throw f;o={access_token:e.access_token,refresh_token:e.refresh_token,user:a.user,token_type:"bearer",expires_in:s-n,expires_at:s},await this._saveSession(o),await this._notifyAllSubscribers("SIGNED_IN",o)}return{data:{user:o.user,session:o},error:null}}catch(n){if(Ws(n))return{data:{session:null,user:null},error:n};throw n}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async n=>{var s;if(!e){const{data:c,error:a}=n;if(a)throw a;e=(s=c.session)!==null&&s!==void 0?s:void 0}if(!(e!=null&&e.refresh_token))throw new Ip;const{data:i,error:o}=await this._callRefreshToken(e.refresh_token);return o?{data:{user:null,session:null},error:o}:i?{data:{user:i.user,session:i},error:null}:{data:{user:null,session:null},error:null}})}catch(n){if(Ws(n))return{data:{user:null,session:null},error:n};throw n}}async _getSessionFromURL(e,n){try{if(!du())throw new X6("No browser detected.");if(e.error||e.error_description||e.error_code)throw new X6(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(n){case"implicit":if(this.flowType==="pkce")throw new Pwe("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new X6("Not a valid implicit grant flow url.");break;default:}if(n==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new Pwe("No code detected.");const{data:A,error:D}=await this._exchangeCodeForSession(e.code);if(D)throw D;const $=new URL(window.location.href);return $.searchParams.delete("code"),window.history.replaceState(window.history.state,"",$.toString()),{data:{session:A.session,redirectType:null},error:null}}const{provider_token:s,provider_refresh_token:i,access_token:o,refresh_token:c,expires_in:a,expires_at:f,token_type:m}=e;if(!o||!a||!c||!m)throw new X6("No session defined in URL");const y=Math.round(Date.now()/1e3),v=parseInt(a);let w=y+v;f&&(w=parseInt(f));const k=w-y;k*1e3<=ZN&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${k}s, should have been closer to ${v}s`);const C=w-v;y-C>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",C,w,y):y-C<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",C,w,y);const{data:S,error:T}=await this._getUser(o);if(T)throw T;const I={provider_token:s,provider_refresh_token:i,access_token:o,expires_in:v,expires_at:w,refresh_token:c,token_type:m,user:S.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:I,redirectType:e.type},error:null}}catch(s){if(Ws(s))return{data:{session:null,redirectType:null},error:s};throw s}}_isImplicitGrantCallback(e){return!!(e.access_token||e.error_description)}async _isPKCECallback(e){const n=await Iv(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&n)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async n=>{var s;const{data:i,error:o}=n;if(o)return{error:o};const c=(s=i.session)===null||s===void 0?void 0:s.access_token;if(c){const{error:a}=await this.admin.signOut(c,e);if(a&&!(xtt(a)&&(a.status===404||a.status===401||a.status===403)))return{error:a}}return e!=="others"&&(await this._removeSession(),await $x(this.storage,`${this.storageKey}-code-verifier`)),{error:null}})}onAuthStateChange(e){const n=Ctt(),s={id:n,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",n),this.stateChangeEmitters.delete(n)}};return this._debug("#onAuthStateChange()","registered callback with id",n),this.stateChangeEmitters.set(n,s),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(n)})))(),{data:{subscription:s}}}async _emitInitialSession(e){return await this._useSession(async n=>{var s,i;try{const{data:{session:o},error:c}=n;if(c)throw c;await((s=this.stateChangeEmitters.get(e))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",o)),this._debug("INITIAL_SESSION","callback id",e,"session",o)}catch(o){await((i=this.stateChangeEmitters.get(e))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",o),console.error(o)}})}async resetPasswordForEmail(e,n={}){let s=null,i=null;this.flowType==="pkce"&&([s,i]=await MN(this.storage,this.storageKey,!0));try{return await wi(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:s,code_challenge_method:i,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(o){if(Ws(o))return{data:null,error:o};throw o}}async getUserIdentities(){var e;try{const{data:n,error:s}=await this.getUser();if(s)throw s;return{data:{identities:(e=n.user.identities)!==null&&e!==void 0?e:[]},error:null}}catch(n){if(Ws(n))return{data:null,error:n};throw n}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var n;try{const{data:s,error:i}=await this._useSession(async o=>{var c,a,f,m,y;const{data:v,error:w}=o;if(w)throw w;const k=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(c=e.options)===null||c===void 0?void 0:c.redirectTo,scopes:(a=e.options)===null||a===void 0?void 0:a.scopes,queryParams:(f=e.options)===null||f===void 0?void 0:f.queryParams,skipBrowserRedirect:!0});return await wi(this.fetch,"GET",k,{headers:this.headers,jwt:(y=(m=v.session)===null||m===void 0?void 0:m.access_token)!==null&&y!==void 0?y:void 0})});if(i)throw i;return du()&&!(!((n=e.options)===null||n===void 0)&&n.skipBrowserRedirect)&&window.location.assign(s==null?void 0:s.url),{data:{provider:e.provider,url:s==null?void 0:s.url},error:null}}catch(s){if(Ws(s))return{data:{provider:e.provider,url:null},error:s};throw s}}async linkIdentityIdToken(e){return await this._useSession(async n=>{var s;try{const{error:i,data:{session:o}}=n;if(i)throw i;const{options:c,provider:a,token:f,access_token:m,nonce:y}=e,v=await wi(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(s=o==null?void 0:o.access_token)!==null&&s!==void 0?s:void 0,body:{provider:a,id_token:f,access_token:m,nonce:y,link_identity:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken}},xform:Pp}),{data:w,error:k}=v;return k?{data:{user:null,session:null},error:k}:!w||!w.session||!w.user?{data:{user:null,session:null},error:new CN}:(w.session&&(await this._saveSession(w.session),await this._notifyAllSubscribers("USER_UPDATED",w.session)),{data:w,error:k})}catch(i){if(Ws(i))return{data:{user:null,session:null},error:i};throw i}})}async unlinkIdentity(e){try{return await this._useSession(async n=>{var s,i;const{data:o,error:c}=n;if(c)throw c;return await wi(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(i=(s=o.session)===null||s===void 0?void 0:s.access_token)!==null&&i!==void 0?i:void 0})})}catch(n){if(Ws(n))return{data:null,error:n};throw n}}async _refreshAccessToken(e){const n=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(n,"begin");try{const s=Date.now();return await Ett(async i=>(i>0&&await Att(200*Math.pow(2,i-1)),this._debug(n,"refreshing attempt",i),await wi(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:Pp})),(i,o)=>{const c=200*Math.pow(2,i);return o&&ble(o)&&Date.now()+c-s{try{await a.callback(e,n)}catch(f){o.push(f)}});if(await Promise.all(c),o.length>0){for(let a=0;athis._autoRefreshTokenTick(),ZN);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async n=>{const{data:{session:s}}=n;if(!s||!s.refresh_token||!s.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const i=Math.floor((s.expires_at*1e3-e)/ZN);this._debug("#_autoRefreshTokenTick()",`access token expires in ${i} ticks, a tick lasts ${ZN}ms, refresh threshold is ${Fue} ticks`),i<=Fue&&await this._callRefreshToken(s.refresh_token)})}catch(n){console.error("Auto refresh tick failed with error. This is likely a transient error.",n)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof kIe)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!du()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const n=`#_onVisibilityChanged(${e})`;this._debug(n,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(-1,async()=>{if(document.visibilityState!=="visible"){this._debug(n,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,n,s){const i=[`provider=${encodeURIComponent(n)}`];if(s!=null&&s.redirectTo&&i.push(`redirect_to=${encodeURIComponent(s.redirectTo)}`),s!=null&&s.scopes&&i.push(`scopes=${encodeURIComponent(s.scopes)}`),this.flowType==="pkce"){const[o,c]=await MN(this.storage,this.storageKey),a=new URLSearchParams({code_challenge:`${encodeURIComponent(o)}`,code_challenge_method:`${encodeURIComponent(c)}`});i.push(a.toString())}if(s!=null&&s.queryParams){const o=new URLSearchParams(s.queryParams);i.push(o.toString())}return s!=null&&s.skipBrowserRedirect&&i.push(`skip_http_redirect=${s.skipBrowserRedirect}`),`${e}?${i.join("&")}`}async _unenroll(e){try{return await this._useSession(async n=>{var s;const{data:i,error:o}=n;return o?{data:null,error:o}:await wi(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(s=i==null?void 0:i.session)===null||s===void 0?void 0:s.access_token})})}catch(n){if(Ws(n))return{data:null,error:n};throw n}}async _enroll(e){try{return await this._useSession(async n=>{var s,i;const{data:o,error:c}=n;if(c)return{data:null,error:c};const a=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:f,error:m}=await wi(this.fetch,"POST",`${this.url}/factors`,{body:a,headers:this.headers,jwt:(s=o==null?void 0:o.session)===null||s===void 0?void 0:s.access_token});return m?{data:null,error:m}:(e.factorType==="totp"&&f.type==="totp"&&(!((i=f==null?void 0:f.totp)===null||i===void 0)&&i.qr_code)&&(f.totp.qr_code=`data:image/svg+xml;utf-8,${f.totp.qr_code}`),{data:f,error:null})})}catch(n){if(Ws(n))return{data:null,error:n};throw n}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async n=>{var s;const{data:i,error:o}=n;if(o)return{data:null,error:o};const c=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?ort(e.webauthn.credential_response):lrt(e.webauthn.credential_response)})}:{code:e.code}),{data:a,error:f}=await wi(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:c,headers:this.headers,jwt:(s=i==null?void 0:i.session)===null||s===void 0?void 0:s.access_token});return f?{data:null,error:f}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",a),{data:a,error:f})})}catch(n){if(Ws(n))return{data:null,error:n};throw n}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async n=>{var s;const{data:i,error:o}=n;if(o)return{data:null,error:o};const c=await wi(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(s=i==null?void 0:i.session)===null||s===void 0?void 0:s.access_token});if(c.error)return c;const{data:a}=c;if(a.type!=="webauthn")return{data:a,error:null};switch(a.webauthn.type){case"create":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:irt(a.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:art(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(Ws(n))return{data:null,error:n};throw n}})}async _challengeAndVerify(e){const{data:n,error:s}=await this._challenge({factorId:e.factorId});return s?{data:null,error:s}:await this._verify({factorId:e.factorId,challengeId:n.id,code:e.code})}async _listFactors(){var e;const{data:{user:n},error:s}=await this.getUser();if(s)return{data:null,error:s};const i={all:[],phone:[],totp:[],webauthn:[]};for(const o of(e=n==null?void 0:n.factors)!==null&&e!==void 0?e:[])i.all.push(o),o.status==="verified"&&i[o.factor_type].push(o);return{data:i,error:null}}async _getAuthenticatorAssuranceLevel(){var e,n;const{data:{session:s},error:i}=await this.getSession();if(i)return{data:null,error:i};if(!s)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:o}=wle(s.access_token);let c=null;o.aal&&(c=o.aal);let a=c;((n=(e=s.user.factors)===null||e===void 0?void 0:e.filter(y=>y.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(a="aal2");const m=o.amr||[];return{data:{currentLevel:c,nextLevel:a,currentAuthenticationMethods:m},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async n=>{const{data:{session:s},error:i}=n;return i?{data:null,error:i}:s?await wi(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:s.access_token,xform:o=>({data:o,error:null})}):{data:null,error:new Ip}})}catch(n){if(Ws(n))return{data:null,error:n};throw n}}async _approveAuthorization(e,n){try{return await this._useSession(async s=>{const{data:{session:i},error:o}=s;if(o)return{data:null,error:o};if(!i)return{data:null,error:new Ip};const c=await wi(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"approve"},xform:a=>({data:a,error:null})});return c.data&&c.data.redirect_url&&du()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(c.data.redirect_url),c})}catch(s){if(Ws(s))return{data:null,error:s};throw s}}async _denyAuthorization(e,n){try{return await this._useSession(async s=>{const{data:{session:i},error:o}=s;if(o)return{data:null,error:o};if(!i)return{data:null,error:new Ip};const c=await wi(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"deny"},xform:a=>({data:a,error:null})});return c.data&&c.data.redirect_url&&du()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(c.data.redirect_url),c})}catch(s){if(Ws(s))return{data:null,error:s};throw s}}async fetchJwk(e,n={keys:[]}){let s=n.keys.find(a=>a.kid===e);if(s)return s;const i=Date.now();if(s=this.jwks.keys.find(a=>a.kid===e),s&&this.jwks_cached_at+gtt>i)return s;const{data:o,error:c}=await wi(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(c)throw c;return!o.keys||o.keys.length===0||(this.jwks=o,this.jwks_cached_at=i,s=o.keys.find(a=>a.kid===e),!s)?null:s}async getClaims(e,n={}){try{let s=e;if(!s){const{data:k,error:C}=await this.getSession();if(C||!k.session)return{data:null,error:C};s=k.session.access_token}const{header:i,payload:o,signature:c,raw:{header:a,payload:f}}=wle(s);n!=null&&n.allowExpired||Ftt(o.exp);const m=!i.alg||i.alg.startsWith("HS")||!i.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(i.kid,n!=null&&n.keys?{keys:n.keys}:n==null?void 0:n.jwks);if(!m){const{error:k}=await this.getUser(s);if(k)throw k;return{data:{claims:o,header:i,signature:c},error:null}}const y=ztt(i.alg),v=await crypto.subtle.importKey("jwk",m,y,!0,["verify"]);if(!await crypto.subtle.verify(y,v,c,Ntt(`${a}.${f}`)))throw new $ue("Invalid JWT signature");return{data:{claims:o,header:i,signature:c},error:null}}catch(s){if(Ws(s))return{data:null,error:s};throw s}}}EA.nextInstanceID=0;const yrt=EA;class xrt extends yrt{constructor(e){super(e)}}class vrt{constructor(e,n,s){var i,o,c;this.supabaseUrl=e,this.supabaseKey=n;const a=utt(e);if(!n)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",a),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",a),this.storageUrl=new URL("storage/v1",a),this.functionsUrl=new URL("functions/v1",a);const f=`sb-${a.hostname.split(".")[0]}-auth-token`,m={db:ntt,realtime:itt,auth:Object.assign(Object.assign({},stt),{storageKey:f}),global:rtt},y=dtt(s??{},m);this.storageKey=(i=y.auth.storageKey)!==null&&i!==void 0?i:"",this.headers=(o=y.global.headers)!==null&&o!==void 0?o:{},y.accessToken?(this.accessToken=y.accessToken,this.auth=new Proxy({},{get:(v,w)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(w)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((c=y.auth)!==null&&c!==void 0?c:{},this.headers,y.global.fetch),this.fetch=ltt(n,this._getAccessToken.bind(this),y.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},y.realtime)),this.rest=new uet(new URL("rest/v1",a).href,{headers:this.headers,schema:y.db.schema,fetch:this.fetch}),this.storage=new Jet(this.storageUrl.href,this.headers,this.fetch,s==null?void 0:s.storage),y.accessToken||this._listenForAuthEvents()}get functions(){return new ret(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,n={},s={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,n,s)}channel(e,n={config:{}}){return this.realtime.channel(e,n)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e,n;if(this.accessToken)return await this.accessToken();const{data:s}=await this.auth.getSession();return(n=(e=s.session)===null||e===void 0?void 0:e.access_token)!==null&&n!==void 0?n:this.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:n,detectSessionInUrl:s,storage:i,userStorage:o,storageKey:c,flowType:a,lock:f,debug:m},y,v){const w={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new xrt({url:this.authUrl.href,headers:Object.assign(Object.assign({},w),y),storageKey:c,autoRefreshToken:e,persistSession:n,detectSessionInUrl:s,storage:i,userStorage:o,flowType:a,lock:f,debug:m,fetch:v,hasCustomAuthorizationHeader:Object.keys(this.headers).some(k=>k.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new Tet(this.realtimeUrl.href,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},e==null?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((n,s)=>{this._handleTokenChanged(n,"CLIENT",s==null?void 0:s.access_token)})}_handleTokenChanged(e,n,s){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==s?(this.changedAccessToken=s,this.realtime.setAuth(s)):e==="SIGNED_OUT"&&(this.realtime.setAuth(),n=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}}const _rt=(t,e,n)=>new vrt(t,e,n);function brt(){if(typeof window<"u"||typeof process>"u")return!1;const t=process.version;if(t==null)return!1;const e=t.match(/^v(\d+)\./);return e?parseInt(e[1],10)<=18:!1}brt()&&console.warn("⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");const wrt="https://relzejiswnotikjgvjhz.supabase.co",jrt="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJlbHplamlzd25vdGlramd2amh6Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjE5NTAzNDQsImV4cCI6MjA3NzUyNjM0NH0.dzIkIr_oFSbFE3oWS0ktIr83iKHHkZxt40Gc7SpC_mM",ee=_rt(wrt,jrt,{auth:{storage:localStorage,persistSession:!0,autoRefreshToken:!0}}),CIe=P.createContext(void 0),krt=({children:t})=>{const[e,n]=P.useState(null),[s,i]=P.useState(null),[o,c]=P.useState(!0),[a,f]=P.useState(!1),[m,y]=P.useState(!1),[v,w]=P.useState(null),[k,C]=P.useState([]),[S,T]=P.useState(null),I=es(),A=async q=>{try{console.log("Checking roles via RPC for user:",q);const[{data:W,error:K},{data:Z,error:re}]=await Promise.all([ee.rpc("has_role",{_user_id:q,_role:"admin"}),ee.rpc("has_role",{_user_id:q,_role:"brokerage_manager"})]);if(K||re)console.error("Role RPC errors:",{isAdminError:K,isBrokerError:re}),f(!1),y(!1);else{const Ne=!!W,se=!!Z;console.log("RPC roles result:",{adminValue:Ne,brokerValue:se}),f(Ne),y(se)}const{data:he,error:ue}=await ee.from("profiles").select("brokerage_id").eq("id",q).single();if(w(!ue&&he?he.brokerage_id:null),Z){console.log("Fetching managed brokerages for user:",q);const{data:Ne,error:se}=await ee.from("brokerage_manager_assignments").select("brokerage_id").eq("user_id",q);if(console.log("Managed brokerage assignments result:",{assignments:Ne,assignmentsError:se}),se||!Ne){console.error("Error fetching managed brokerage assignments:",se),C([]);return}const xe=Array.from(new Set(Ne.map(ve=>ve.brokerage_id).filter(Boolean)));if(xe.length===0){C([]);return}const{data:ie,error:me}=await ee.from("brokerages").select("id, name").in("id",xe);if(console.log("Managed brokerages details result:",{brokeragesData:ie,brokeragesError:me}),me||!ie){console.error("Error fetching managed brokerages details:",me),C([]);return}const fe=ie.map(ve=>({id:ve.id,name:ve.name})).sort((ve,Ie)=>xe.indexOf(ve.id)-xe.indexOf(Ie.id));console.log("Parsed managed brokerages:",fe),C(fe),fe.length>0&&!S&&T(fe[0].id)}else console.log("User is not a brokerage manager, skipping managed brokerages fetch"),C([])}catch(W){console.error("Unexpected error in checkRoles:",W),f(!1),y(!1),w(null),C([])}};P.useEffect(()=>{const{data:{subscription:q}}=ee.auth.onAuthStateChange((W,K)=>{console.log("Auth event:",W),i(K),n((K==null?void 0:K.user)??null),W==="PASSWORD_RECOVERY"&&(console.log("Password recovery detected, redirecting to profile"),setTimeout(()=>{I("/profile?reset=true")},100)),K!=null&&K.user?setTimeout(()=>{A(K.user.id)},0):(f(!1),y(!1),w(null),C([]),T(null))});return ee.auth.getSession().then(({data:{session:W}})=>{i(W),n((W==null?void 0:W.user)??null),W!=null&&W.user?A(W.user.id).finally(()=>{c(!1)}):c(!1)}),()=>q.unsubscribe()},[]);const D=async(q,W)=>{const{error:K}=await ee.auth.signInWithPassword({email:q,password:W});if(K)throw Ge.error(K.message),K;Ge.success("Welcome back!"),I("/dashboard")},$=async(q,W,K)=>{const Z=`${window.location.origin}/dashboard`,{error:re}=await ee.auth.signUp({email:q,password:W,options:{emailRedirectTo:Z,data:{name:K}}});if(re)throw Ge.error(re.message),re;Ge.success("Account created! Welcome to LevelUp."),I("/dashboard")},F=async()=>{try{const{data:{session:q}}=await ee.auth.getSession();if(q){const{error:W}=await ee.auth.signOut();W?W.message==="Auth session missing!"?console.warn("Sign out warning (ignored):",W.message):(console.error("Sign out error:",W),Ge.error(W.message)):Ge.success("Signed out successfully")}else console.log("No active session found, redirecting to auth");n(null),i(null),f(!1),y(!1),w(null),C([]),T(null),I("/auth")}catch(q){console.error("Unexpected sign out error:",q),I("/auth")}};return r.jsx(CIe.Provider,{value:{user:e,session:s,loading:o,signIn:D,signUp:$,signOut:F,isAdmin:a,isBrokerageManager:m,brokerageId:v,managedBrokerages:k,selectedBrokerageId:S,setSelectedBrokerageId:T},children:t})},Fr=()=>{const t=P.useContext(CIe);if(t===void 0)throw new Error("useAuth must be used within an AuthProvider");return t},MIe=P.createContext(void 0),IN="levelup_admin_session",Pv="levelup_impersonation",Nrt=({children:t})=>{const[e,n]=P.useState(!1),[s,i]=P.useState(null),[o,c]=P.useState(!1);P.useEffect(()=>{const m=sessionStorage.getItem(Pv);if(m)try{const y=JSON.parse(m);n(!0),i(y)}catch{sessionStorage.removeItem(Pv)}},[]);const a=async m=>{c(!0);try{const{data:{session:y}}=await ee.auth.getSession();if(!y)return Ge.error("No active session found"),!1;const v={access_token:y.access_token,refresh_token:y.refresh_token};sessionStorage.setItem(IN,JSON.stringify(v));const w=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/impersonate-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${y.access_token}`},body:JSON.stringify({targetUserId:m})}),k=await w.json();if(!w.ok)throw new Error(k.error||"Failed to impersonate user");const C={id:k.targetUser.id,name:k.targetUser.name,email:k.targetUser.email};sessionStorage.setItem(Pv,JSON.stringify(C));const{error:S}=await ee.auth.verifyOtp({token_hash:k.token_hash,type:"magiclink"});if(S)throw console.error("Verify OTP error:",S),sessionStorage.removeItem(IN),sessionStorage.removeItem(Pv),new Error("Failed to establish impersonation session");return n(!0),i(C),Ge.success(`Now viewing as ${C.name}`),window.location.href="/dashboard",!0}catch(y){return console.error("Impersonation error:",y),Ge.error(y.message||"Failed to impersonate user"),sessionStorage.removeItem(IN),sessionStorage.removeItem(Pv),!1}finally{c(!1)}},f=async()=>{c(!0);try{const m=sessionStorage.getItem(IN);if(!m){await ee.auth.signOut(),window.location.href="/auth";return}const y=JSON.parse(m);await ee.auth.signOut();const{error:v}=await ee.auth.setSession({access_token:y.access_token,refresh_token:y.refresh_token});if(sessionStorage.removeItem(IN),sessionStorage.removeItem(Pv),v){console.error("Failed to restore admin session:",v),Ge.error("Admin session expired, please sign in again"),window.location.href="/auth";return}n(!1),i(null),Ge.success("Returned to admin account"),window.location.href="/admin/members"}catch(m){console.error("Stop impersonation error:",m),Ge.error("Failed to restore admin session"),sessionStorage.removeItem(IN),sessionStorage.removeItem(Pv),window.location.href="/auth"}finally{c(!1)}};return r.jsx(MIe.Provider,{value:{isImpersonating:e,impersonatedUser:s,startImpersonation:a,stopImpersonation:f,isLoading:o},children:t})},TIe=()=>{const t=P.useContext(MIe);if(t===void 0)throw new Error("useImpersonation must be used within an ImpersonationProvider");return t},IA=MC("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-full text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-full px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),te=P.forwardRef(({className:t,variant:e,size:n,asChild:s=!1,...i},o)=>{const c=s?Sme:"button";return r.jsx(c,{className:zt(IA({variant:e,size:n,className:t})),ref:o,...i})});te.displayName="Button";const Srt=()=>{const{isImpersonating:t,impersonatedUser:e,stopImpersonation:n,isLoading:s}=TIe();return!t||!e?null:r.jsx("div",{className:"fixed top-0 left-0 right-0 z-[100] bg-amber-500 text-amber-950 px-4 py-2 shadow-lg",children:r.jsxs("div",{className:"container mx-auto flex items-center justify-between gap-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Ph,{className:"h-5 w-5 flex-shrink-0"}),r.jsxs("span",{className:"font-medium text-sm md:text-base",children:[r.jsx("span",{className:"hidden sm:inline",children:"You are viewing as "}),r.jsx("strong",{children:e.name}),r.jsxs("span",{className:"hidden md:inline text-amber-800",children:[" (",e.email,")"]})]})]}),r.jsx(te,{size:"sm",variant:"secondary",onClick:n,disabled:s,className:"bg-amber-100 hover:bg-amber-200 text-amber-950 border-0",children:s?r.jsx(sn,{className:"h-4 w-4 animate-spin"}):r.jsxs(r.Fragment,{children:[r.jsx(Ms,{className:"h-4 w-4 mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"Exit Impersonation"}),r.jsx("span",{className:"sm:hidden",children:"Exit"})]})})]})})},Nn=({children:t,requireAdmin:e=!1,requireBrokerageManager:n=!1})=>{const{user:s,loading:i,isAdmin:o,isBrokerageManager:c}=Fr();return i?r.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"Loading..."})]})}):s?e&&!o?r.jsx(ZJ,{to:"/dashboard",replace:!0}):n&&!c&&!o?r.jsx(ZJ,{to:"/dashboard",replace:!0}):r.jsx(r.Fragment,{children:t}):r.jsx(ZJ,{to:"/auth",replace:!0})};var oge={};(function t(e,n,s,i){var o=!!(e.Worker&&e.Blob&&e.Promise&&e.OffscreenCanvas&&e.OffscreenCanvasRenderingContext2D&&e.HTMLCanvasElement&&e.HTMLCanvasElement.prototype.transferControlToOffscreen&&e.URL&&e.URL.createObjectURL),c=typeof Path2D=="function"&&typeof DOMMatrix=="function",a=function(){if(!e.OffscreenCanvas)return!1;try{var Ie=new OffscreenCanvas(1,1),Se=Ie.getContext("2d");Se.fillRect(0,0,1,1);var oe=Ie.transferToImageBitmap();Se.createPattern(oe,"no-repeat")}catch{return!1}return!0}();function f(){}function m(Ie){var Se=n.exports.Promise,oe=Se!==void 0?Se:e.Promise;return typeof oe=="function"?new oe(Ie):(Ie(f,f),null)}var y=function(Ie,Se){return{transform:function(oe){if(Ie)return oe;if(Se.has(oe))return Se.get(oe);var ae=new OffscreenCanvas(oe.width,oe.height),je=ae.getContext("2d");return je.drawImage(oe,0,0),Se.set(oe,ae),ae},clear:function(){Se.clear()}}}(a,new Map),v=function(){var Ie=Math.floor(16.666666666666668),Se,oe,ae={},je=0;return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?(Se=function(Me){var Ue=Math.random();return ae[Ue]=requestAnimationFrame(function Re($e){je===$e||je+Ie-1<$e?(je=$e,delete ae[Ue],Me()):ae[Ue]=requestAnimationFrame(Re)}),Ue},oe=function(Me){ae[Me]&&cancelAnimationFrame(ae[Me])}):(Se=function(Me){return setTimeout(Me,Ie)},oe=function(Me){return clearTimeout(Me)}),{frame:Se,cancel:oe}}(),w=function(){var Ie,Se,oe={};function ae(je){function Me(Ue,Re){je.postMessage({options:Ue||{},callback:Re})}je.init=function(Re){var $e=Re.transferControlToOffscreen();je.postMessage({canvas:$e},[$e])},je.fire=function(Re,$e,Pe){if(Se)return Me(Re,null),Se;var Ae=Math.random().toString(36).slice(2);return Se=m(function(nt){function Te(Xe){Xe.data.callback===Ae&&(delete oe[Ae],je.removeEventListener("message",Te),Se=null,y.clear(),Pe(),nt())}je.addEventListener("message",Te),Me(Re,Ae),oe[Ae]=Te.bind(null,{data:{callback:Ae}})}),Se},je.reset=function(){je.postMessage({reset:!0});for(var Re in oe)oe[Re](),delete oe[Re]}}return function(){if(Ie)return Ie;if(!s&&o){var je=["var CONFETTI, SIZE = {}, module = {};","("+t.toString()+")(this, module, true, SIZE);","onmessage = function(msg) {"," if (msg.data.options) {"," CONFETTI(msg.data.options).then(function () {"," if (msg.data.callback) {"," postMessage({ callback: msg.data.callback });"," }"," });"," } else if (msg.data.reset) {"," CONFETTI && CONFETTI.reset();"," } else if (msg.data.resize) {"," SIZE.width = msg.data.resize.width;"," SIZE.height = msg.data.resize.height;"," } else if (msg.data.canvas) {"," SIZE.width = msg.data.canvas.width;"," SIZE.height = msg.data.canvas.height;"," CONFETTI = module.exports.create(msg.data.canvas);"," }","}"].join(` `);try{Ie=new Worker(URL.createObjectURL(new Blob([je])))}catch(Me){return typeof console<"u"&&typeof console.warn=="function"&&console.warn("🎊 Could not load worker",Me),null}ae(Ie)}return Ie}}(),k={particleCount:50,angle:90,spread:45,startVelocity:45,decay:.9,gravity:1,drift:0,ticks:200,x:.5,y:.5,shapes:["square","circle"],zIndex:100,colors:["#26ccff","#a25afd","#ff5e7e","#88ff5a","#fcff42","#ffa62d","#ff36ff"],disableForReducedMotion:!1,scalar:1};function C(Ie,Se){return Se?Se(Ie):Ie}function S(Ie){return Ie!=null}function T(Ie,Se,oe){return C(Ie&&S(Ie[Se])?Ie[Se]:k[Se],oe)}function I(Ie){return Ie<0?0:Math.floor(Ie)}function A(Ie,Se){return Math.floor(Math.random()*(Se-Ie))+Ie}function D(Ie){return parseInt(Ie,16)}function $(Ie){return Ie.map(F)}function F(Ie){var Se=String(Ie).replace(/[^0-9a-f]/gi,"");return Se.length<6&&(Se=Se[0]+Se[0]+Se[1]+Se[1]+Se[2]+Se[2]),{r:D(Se.substring(0,2)),g:D(Se.substring(2,4)),b:D(Se.substring(4,6))}}function q(Ie){var Se=T(Ie,"origin",Object);return Se.x=T(Se,"x",Number),Se.y=T(Se,"y",Number),Se}function W(Ie){Ie.width=document.documentElement.clientWidth,Ie.height=document.documentElement.clientHeight}function K(Ie){var Se=Ie.getBoundingClientRect();Ie.width=Se.width,Ie.height=Se.height}function Z(Ie){var Se=document.createElement("canvas");return Se.style.position="fixed",Se.style.top="0px",Se.style.left="0px",Se.style.pointerEvents="none",Se.style.zIndex=Ie,Se}function re(Ie,Se,oe,ae,je,Me,Ue,Re,$e){Ie.save(),Ie.translate(Se,oe),Ie.rotate(Me),Ie.scale(ae,je),Ie.arc(0,0,1,Ue,Re,$e),Ie.restore()}function he(Ie){var Se=Ie.angle*(Math.PI/180),oe=Ie.spread*(Math.PI/180);return{x:Ie.x,y:Ie.y,wobble:Math.random()*10,wobbleSpeed:Math.min(.11,Math.random()*.1+.05),velocity:Ie.startVelocity*.5+Math.random()*Ie.startVelocity,angle2D:-Se+(.5*oe-Math.random()*oe),tiltAngle:(Math.random()*(.75-.25)+.25)*Math.PI,color:Ie.color,shape:Ie.shape,tick:0,totalTicks:Ie.ticks,decay:Ie.decay,drift:Ie.drift,random:Math.random()+2,tiltSin:0,tiltCos:0,wobbleX:0,wobbleY:0,gravity:Ie.gravity*3,ovalScalar:.6,scalar:Ie.scalar,flat:Ie.flat}}function ue(Ie,Se){Se.x+=Math.cos(Se.angle2D)*Se.velocity+Se.drift,Se.y+=Math.sin(Se.angle2D)*Se.velocity+Se.gravity,Se.velocity*=Se.decay,Se.flat?(Se.wobble=0,Se.wobbleX=Se.x+10*Se.scalar,Se.wobbleY=Se.y+10*Se.scalar,Se.tiltSin=0,Se.tiltCos=0,Se.random=1):(Se.wobble+=Se.wobbleSpeed,Se.wobbleX=Se.x+10*Se.scalar*Math.cos(Se.wobble),Se.wobbleY=Se.y+10*Se.scalar*Math.sin(Se.wobble),Se.tiltAngle+=.1,Se.tiltSin=Math.sin(Se.tiltAngle),Se.tiltCos=Math.cos(Se.tiltAngle),Se.random=Math.random()+2);var oe=Se.tick++/Se.totalTicks,ae=Se.x+Se.random*Se.tiltCos,je=Se.y+Se.random*Se.tiltSin,Me=Se.wobbleX+Se.random*Se.tiltCos,Ue=Se.wobbleY+Se.random*Se.tiltSin;if(Ie.fillStyle="rgba("+Se.color.r+", "+Se.color.g+", "+Se.color.b+", "+(1-oe)+")",Ie.beginPath(),c&&Se.shape.type==="path"&&typeof Se.shape.path=="string"&&Array.isArray(Se.shape.matrix))Ie.fill(me(Se.shape.path,Se.shape.matrix,Se.x,Se.y,Math.abs(Me-ae)*.1,Math.abs(Ue-je)*.1,Math.PI/10*Se.wobble));else if(Se.shape.type==="bitmap"){var Re=Math.PI/10*Se.wobble,$e=Math.abs(Me-ae)*.1,Pe=Math.abs(Ue-je)*.1,Ae=Se.shape.bitmap.width*Se.scalar,nt=Se.shape.bitmap.height*Se.scalar,Te=new DOMMatrix([Math.cos(Re)*$e,Math.sin(Re)*$e,-Math.sin(Re)*Pe,Math.cos(Re)*Pe,Se.x,Se.y]);Te.multiplySelf(new DOMMatrix(Se.shape.matrix));var Xe=Ie.createPattern(y.transform(Se.shape.bitmap),"no-repeat");Xe.setTransform(Te),Ie.globalAlpha=1-oe,Ie.fillStyle=Xe,Ie.fillRect(Se.x-Ae/2,Se.y-nt/2,Ae,nt),Ie.globalAlpha=1}else if(Se.shape==="circle")Ie.ellipse?Ie.ellipse(Se.x,Se.y,Math.abs(Me-ae)*Se.ovalScalar,Math.abs(Ue-je)*Se.ovalScalar,Math.PI/10*Se.wobble,0,2*Math.PI):re(Ie,Se.x,Se.y,Math.abs(Me-ae)*Se.ovalScalar,Math.abs(Ue-je)*Se.ovalScalar,Math.PI/10*Se.wobble,0,2*Math.PI);else if(Se.shape==="star")for(var ge=Math.PI/2*3,mt=4*Se.scalar,rt=8*Se.scalar,We=Se.x,Ce=Se.y,et=5,Fe=Math.PI/et;et--;)We=Se.x+Math.cos(ge)*rt,Ce=Se.y+Math.sin(ge)*rt,Ie.lineTo(We,Ce),ge+=Fe,We=Se.x+Math.cos(ge)*mt,Ce=Se.y+Math.sin(ge)*mt,Ie.lineTo(We,Ce),ge+=Fe;else Ie.moveTo(Math.floor(Se.x),Math.floor(Se.y)),Ie.lineTo(Math.floor(Se.wobbleX),Math.floor(je)),Ie.lineTo(Math.floor(Me),Math.floor(Ue)),Ie.lineTo(Math.floor(ae),Math.floor(Se.wobbleY));return Ie.closePath(),Ie.fill(),Se.tick{const{data:e,error:n}=await ee.from("celebration_queue").select("*").eq("user_id",t.id).is("seen_at",null).order("created_at",{ascending:!0});if(n)throw n;return e},enabled:!!(t!=null&&t.id),refetchOnWindowFocus:!0,staleTime:0})}function Mrt(){const t=Xr();return cr({mutationFn:async e=>{const{error:n}=await ee.from("celebration_queue").update({seen_at:new Date().toISOString()}).eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["celebrations"]})}})}function Trt(){const t=Xr(),{user:e}=Fr();return cr({mutationFn:async n=>{const{error:s}=await ee.from("celebration_queue").insert({user_id:n.user_id,celebration_type:n.celebration_type,title:n.title,message:n.message||null,points_amount:n.points_amount||null,created_by:e==null?void 0:e.id});if(s)throw s},onSuccess:()=>{t.invalidateQueries({queryKey:["celebrations"]})}})}var Nle="focusScope.autoFocusOnMount",Sle="focusScope.autoFocusOnUnmount",Wwe={bubbles:!1,cancelable:!0},Art="FocusScope",YE=P.forwardRef((t,e)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...c}=t,[a,f]=P.useState(null),m=$l(i),y=$l(o),v=P.useRef(null),w=Gs(e,S=>f(S)),k=P.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;P.useEffect(()=>{if(s){let S=function(D){if(k.paused||!a)return;const $=D.target;a.contains($)?v.current=$:Hx(v.current,{select:!0})},T=function(D){if(k.paused||!a)return;const $=D.relatedTarget;$!==null&&(a.contains($)||Hx(v.current,{select:!0}))},I=function(D){if(document.activeElement===document.body)for(const F of D)F.removedNodes.length>0&&Hx(a)};document.addEventListener("focusin",S),document.addEventListener("focusout",T);const A=new MutationObserver(I);return a&&A.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",T),A.disconnect()}}},[s,a,k.paused]),P.useEffect(()=>{if(a){Kwe.add(k);const S=document.activeElement;if(!a.contains(S)){const I=new CustomEvent(Nle,Wwe);a.addEventListener(Nle,m),a.dispatchEvent(I),I.defaultPrevented||(Ert(Drt(AIe(a)),{select:!0}),document.activeElement===S&&Hx(a))}return()=>{a.removeEventListener(Nle,m),setTimeout(()=>{const I=new CustomEvent(Sle,Wwe);a.addEventListener(Sle,y),a.dispatchEvent(I),I.defaultPrevented||Hx(S??document.body,{select:!0}),a.removeEventListener(Sle,y),Kwe.remove(k)},0)}}},[a,m,y,k]);const C=P.useCallback(S=>{if(!n&&!s||k.paused)return;const T=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,I=document.activeElement;if(T&&I){const A=S.currentTarget,[D,$]=Irt(A);D&&$?!S.shiftKey&&I===$?(S.preventDefault(),n&&Hx(D,{select:!0})):S.shiftKey&&I===D&&(S.preventDefault(),n&&Hx($,{select:!0})):I===A&&S.preventDefault()}},[n,s,k.paused]);return r.jsx(On.div,{tabIndex:-1,...c,ref:w,onKeyDown:C})});YE.displayName=Art;function Ert(t,{select:e=!1}={}){const n=document.activeElement;for(const s of t)if(Hx(s,{select:e}),document.activeElement!==n)return}function Irt(t){const e=AIe(t),n=Gwe(e,t),s=Gwe(e.reverse(),t);return[n,s]}function AIe(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const i=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||i?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function Gwe(t,e){for(const n of t)if(!Prt(n,{upTo:e}))return n}function Prt(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function Lrt(t){return t instanceof HTMLInputElement&&"select"in t}function Hx(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&Lrt(t)&&e&&t.select()}}var Kwe=Ort();function Ort(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=Zwe(t,e),t.unshift(e)},remove(e){var n;t=Zwe(t,e),(n=t[0])==null||n.resume()}}}function Zwe(t,e){const n=[...t],s=n.indexOf(e);return s!==-1&&n.splice(s,1),n}function Drt(t){return t.filter(e=>e.tagName!=="A")}var Cle=0;function Pne(){P.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??Ywe()),document.body.insertAdjacentElement("beforeend",t[1]??Ywe()),Cle++,()=>{Cle===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Cle--}},[])}function Ywe(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var QJ="right-scroll-bar-position",JJ="width-before-scroll-bar",Rrt="with-scroll-bars-hidden",Frt="--removed-body-scroll-bar-size";function Mle(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function zrt(t,e){var n=P.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(s){var i=n.value;i!==s&&(n.value=s,n.callback(s,i))}}}})[0];return n.callback=e,n.facade}var Brt=typeof window<"u"?P.useLayoutEffect:P.useEffect,Xwe=new WeakMap;function $rt(t,e){var n=zrt(null,function(s){return t.forEach(function(i){return Mle(i,s)})});return Brt(function(){var s=Xwe.get(n);if(s){var i=new Set(s),o=new Set(t),c=n.current;i.forEach(function(a){o.has(a)||Mle(a,null)}),o.forEach(function(a){i.has(a)||Mle(a,c)})}Xwe.set(n,t)},[t]),n}function Urt(t){return t}function qrt(t,e){e===void 0&&(e=Urt);var n=[],s=!1,i={read:function(){if(s)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(o){var c=e(o,s);return n.push(c),function(){n=n.filter(function(a){return a!==c})}},assignSyncMedium:function(o){for(s=!0;n.length;){var c=n;n=[],c.forEach(o)}n={push:function(a){return o(a)},filter:function(){return n}}},assignMedium:function(o){s=!0;var c=[];if(n.length){var a=n;n=[],a.forEach(o),c=n}var f=function(){var y=c;c=[],y.forEach(o)},m=function(){return Promise.resolve().then(f)};m(),n={push:function(y){c.push(y),m()},filter:function(y){return c=c.filter(y),n}}}};return i}function Vrt(t){t===void 0&&(t={});var e=qrt(null);return e.options=Cf({async:!0,ssr:!1},t),e}var EIe=function(t){var e=t.sideCar,n=M1(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=e.read();if(!s)throw new Error("Sidecar medium not found");return P.createElement(s,Cf({},n))};EIe.isSideCarExport=!0;function Hrt(t,e){return t.useMedium(e),EIe}var IIe=Vrt(),Tle=function(){},Lne=P.forwardRef(function(t,e){var n=P.useRef(null),s=P.useState({onScrollCapture:Tle,onWheelCapture:Tle,onTouchMoveCapture:Tle}),i=s[0],o=s[1],c=t.forwardProps,a=t.children,f=t.className,m=t.removeScrollBar,y=t.enabled,v=t.shards,w=t.sideCar,k=t.noRelative,C=t.noIsolation,S=t.inert,T=t.allowPinchZoom,I=t.as,A=I===void 0?"div":I,D=t.gapMode,$=M1(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),F=w,q=$rt([n,e]),W=Cf(Cf({},$),i);return P.createElement(P.Fragment,null,y&&P.createElement(F,{sideCar:IIe,removeScrollBar:m,shards:v,noRelative:k,noIsolation:C,inert:S,setCallbacks:o,allowPinchZoom:!!T,lockRef:n,gapMode:D}),c?P.cloneElement(P.Children.only(a),Cf(Cf({},W),{ref:q})):P.createElement(A,Cf({},W,{className:f,ref:q}),a))});Lne.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Lne.classNames={fullWidth:JJ,zeroRight:QJ};var Wrt=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Grt(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=Wrt();return e&&t.setAttribute("nonce",e),t}function Krt(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function Zrt(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var Yrt=function(){var t=0,e=null;return{add:function(n){t==0&&(e=Grt())&&(Krt(e,n),Zrt(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},Xrt=function(){var t=Yrt();return function(e,n){P.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},PIe=function(){var t=Xrt(),e=function(n){var s=n.styles,i=n.dynamic;return t(s,i),null};return e},Qrt={left:0,top:0,right:0,gap:0},Ale=function(t){return parseInt(t||"",10)||0},Jrt=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],s=e[t==="padding"?"paddingTop":"marginTop"],i=e[t==="padding"?"paddingRight":"marginRight"];return[Ale(n),Ale(s),Ale(i)]},ent=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return Qrt;var e=Jrt(t),n=document.documentElement.clientWidth,s=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,s-n+e[2]-e[0])}},tnt=PIe(),a4="data-scroll-locked",rnt=function(t,e,n,s){var i=t.left,o=t.top,c=t.right,a=t.gap;return n===void 0&&(n="margin"),` .`.concat(Rrt,` { overflow: hidden `).concat(s,`; padding-right: `).concat(a,"px ").concat(s,`; } body[`).concat(a4,`] { overflow: hidden `).concat(s,`; overscroll-behavior: contain; `).concat([e&&"position: relative ".concat(s,";"),n==="margin"&&` padding-left: `.concat(i,`px; padding-top: `).concat(o,`px; padding-right: `).concat(c,`px; margin-left:0; margin-top:0; margin-right: `).concat(a,"px ").concat(s,`; `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(s,";")].filter(Boolean).join(""),` } .`).concat(QJ,` { right: `).concat(a,"px ").concat(s,`; } .`).concat(JJ,` { margin-right: `).concat(a,"px ").concat(s,`; } .`).concat(QJ," .").concat(QJ,` { right: 0 `).concat(s,`; } .`).concat(JJ," .").concat(JJ,` { margin-right: 0 `).concat(s,`; } body[`).concat(a4,`] { `).concat(Frt,": ").concat(a,`px; } `)},Qwe=function(){var t=parseInt(document.body.getAttribute(a4)||"0",10);return isFinite(t)?t:0},nnt=function(){P.useEffect(function(){return document.body.setAttribute(a4,(Qwe()+1).toString()),function(){var t=Qwe()-1;t<=0?document.body.removeAttribute(a4):document.body.setAttribute(a4,t.toString())}},[])},snt=function(t){var e=t.noRelative,n=t.noImportant,s=t.gapMode,i=s===void 0?"margin":s;nnt();var o=P.useMemo(function(){return ent(i)},[i]);return P.createElement(tnt,{styles:rnt(o,!e,i,n?"":"!important")})},Uue=!1;if(typeof window<"u")try{var Q6=Object.defineProperty({},"passive",{get:function(){return Uue=!0,!0}});window.addEventListener("test",Q6,Q6),window.removeEventListener("test",Q6,Q6)}catch{Uue=!1}var PN=Uue?{passive:!1}:!1,int=function(t){return t.tagName==="TEXTAREA"},LIe=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!int(t)&&n[e]==="visible")},ant=function(t){return LIe(t,"overflowY")},ont=function(t){return LIe(t,"overflowX")},Jwe=function(t,e){var n=e.ownerDocument,s=e;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var i=OIe(t,s);if(i){var o=DIe(t,s),c=o[1],a=o[2];if(c>a)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},lnt=function(t){var e=t.scrollTop,n=t.scrollHeight,s=t.clientHeight;return[e,n,s]},cnt=function(t){var e=t.scrollLeft,n=t.scrollWidth,s=t.clientWidth;return[e,n,s]},OIe=function(t,e){return t==="v"?ant(e):ont(e)},DIe=function(t,e){return t==="v"?lnt(e):cnt(e)},dnt=function(t,e){return t==="h"&&e==="rtl"?-1:1},unt=function(t,e,n,s,i){var o=dnt(t,window.getComputedStyle(e).direction),c=o*s,a=n.target,f=e.contains(a),m=!1,y=c>0,v=0,w=0;do{if(!a)break;var k=DIe(t,a),C=k[0],S=k[1],T=k[2],I=S-T-o*C;(C||I)&&OIe(t,a)&&(v+=I,w+=C);var A=a.parentNode;a=A&&A.nodeType===Node.DOCUMENT_FRAGMENT_NODE?A.host:A}while(!f&&a!==document.body||f&&(e.contains(a)||e===a));return(y&&Math.abs(v)<1||!y&&Math.abs(w)<1)&&(m=!0),m},J6=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},eje=function(t){return[t.deltaX,t.deltaY]},tje=function(t){return t&&"current"in t?t.current:t},hnt=function(t,e){return t[0]===e[0]&&t[1]===e[1]},fnt=function(t){return` .block-interactivity-`.concat(t,` {pointer-events: none;} .allow-interactivity-`).concat(t,` {pointer-events: all;} `)},pnt=0,LN=[];function mnt(t){var e=P.useRef([]),n=P.useRef([0,0]),s=P.useRef(),i=P.useState(pnt++)[0],o=P.useState(PIe)[0],c=P.useRef(t);P.useEffect(function(){c.current=t},[t]),P.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var S=Qme([t.lockRef.current],(t.shards||[]).map(tje),!0).filter(Boolean);return S.forEach(function(T){return T.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),S.forEach(function(T){return T.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var a=P.useCallback(function(S,T){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!c.current.allowPinchZoom;var I=J6(S),A=n.current,D="deltaX"in S?S.deltaX:A[0]-I[0],$="deltaY"in S?S.deltaY:A[1]-I[1],F,q=S.target,W=Math.abs(D)>Math.abs($)?"h":"v";if("touches"in S&&W==="h"&&q.type==="range")return!1;var K=Jwe(W,q);if(!K)return!0;if(K?F=W:(F=W==="v"?"h":"v",K=Jwe(W,q)),!K)return!1;if(!s.current&&"changedTouches"in S&&(D||$)&&(s.current=F),!F)return!0;var Z=s.current||F;return unt(Z,T,S,Z==="h"?D:$)},[]),f=P.useCallback(function(S){var T=S;if(!(!LN.length||LN[LN.length-1]!==o)){var I="deltaY"in T?eje(T):J6(T),A=e.current.filter(function(F){return F.name===T.type&&(F.target===T.target||T.target===F.shadowParent)&&hnt(F.delta,I)})[0];if(A&&A.should){T.cancelable&&T.preventDefault();return}if(!A){var D=(c.current.shards||[]).map(tje).filter(Boolean).filter(function(F){return F.contains(T.target)}),$=D.length>0?a(T,D[0]):!c.current.noIsolation;$&&T.cancelable&&T.preventDefault()}}},[]),m=P.useCallback(function(S,T,I,A){var D={name:S,delta:T,target:I,should:A,shadowParent:gnt(I)};e.current.push(D),setTimeout(function(){e.current=e.current.filter(function($){return $!==D})},1)},[]),y=P.useCallback(function(S){n.current=J6(S),s.current=void 0},[]),v=P.useCallback(function(S){m(S.type,eje(S),S.target,a(S,t.lockRef.current))},[]),w=P.useCallback(function(S){m(S.type,J6(S),S.target,a(S,t.lockRef.current))},[]);P.useEffect(function(){return LN.push(o),t.setCallbacks({onScrollCapture:v,onWheelCapture:v,onTouchMoveCapture:w}),document.addEventListener("wheel",f,PN),document.addEventListener("touchmove",f,PN),document.addEventListener("touchstart",y,PN),function(){LN=LN.filter(function(S){return S!==o}),document.removeEventListener("wheel",f,PN),document.removeEventListener("touchmove",f,PN),document.removeEventListener("touchstart",y,PN)}},[]);var k=t.removeScrollBar,C=t.inert;return P.createElement(P.Fragment,null,C?P.createElement(o,{styles:fnt(i)}):null,k?P.createElement(snt,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function gnt(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const ynt=Hrt(IIe,mnt);var XE=P.forwardRef(function(t,e){return P.createElement(Lne,Cf({},t,{ref:e,sideCar:ynt}))});XE.classNames=Lne.classNames;var xnt=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},ON=new WeakMap,eL=new WeakMap,tL={},Ele=0,RIe=function(t){return t&&(t.host||RIe(t.parentNode))},vnt=function(t,e){return e.map(function(n){if(t.contains(n))return n;var s=RIe(n);return s&&t.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},_nt=function(t,e,n,s){var i=vnt(e,Array.isArray(t)?t:[t]);tL[n]||(tL[n]=new WeakMap);var o=tL[n],c=[],a=new Set,f=new Set(i),m=function(v){!v||a.has(v)||(a.add(v),m(v.parentNode))};i.forEach(m);var y=function(v){!v||f.has(v)||Array.prototype.forEach.call(v.children,function(w){if(a.has(w))y(w);else try{var k=w.getAttribute(s),C=k!==null&&k!=="false",S=(ON.get(w)||0)+1,T=(o.get(w)||0)+1;ON.set(w,S),o.set(w,T),c.push(w),S===1&&C&&eL.set(w,!0),T===1&&w.setAttribute(n,"true"),C||w.setAttribute(s,"true")}catch(I){console.error("aria-hidden: cannot operate on ",w,I)}})};return y(e),a.clear(),Ele++,function(){c.forEach(function(v){var w=ON.get(v)-1,k=o.get(v)-1;ON.set(v,w),o.set(v,k),w||(eL.has(v)||v.removeAttribute(s),eL.delete(v)),k||v.removeAttribute(n)}),Ele--,Ele||(ON=new WeakMap,ON=new WeakMap,eL=new WeakMap,tL={})}},One=function(t,e,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(t)?t:[t]),i=xnt(t);return i?(s.push.apply(s,Array.from(i.querySelectorAll("[aria-live]"))),_nt(s,i,n,"aria-hidden")):function(){return null}},Dne="Dialog",[FIe,zIe]=Zl(Dne),[bnt,hm]=FIe(Dne),BIe=t=>{const{__scopeDialog:e,children:n,open:s,defaultOpen:i,onOpenChange:o,modal:c=!0}=t,a=P.useRef(null),f=P.useRef(null),[m,y]=Tu({prop:s,defaultProp:i??!1,onChange:o,caller:Dne});return r.jsx(bnt,{scope:e,triggerRef:a,contentRef:f,contentId:Fc(),titleId:Fc(),descriptionId:Fc(),open:m,onOpenChange:y,onOpenToggle:P.useCallback(()=>y(v=>!v),[y]),modal:c,children:n})};BIe.displayName=Dne;var $Ie="DialogTrigger",UIe=P.forwardRef((t,e)=>{const{__scopeDialog:n,...s}=t,i=hm($Ie,n),o=Gs(e,i.triggerRef);return r.jsx(On.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":dge(i.open),...s,ref:o,onClick:an(t.onClick,i.onOpenToggle)})});UIe.displayName=$Ie;var lge="DialogPortal",[wnt,qIe]=FIe(lge,{forceMount:void 0}),VIe=t=>{const{__scopeDialog:e,forceMount:n,children:s,container:i}=t,o=hm(lge,e);return r.jsx(wnt,{scope:e,forceMount:n,children:P.Children.map(s,c=>r.jsx(oc,{present:n||o.open,children:r.jsx(CC,{asChild:!0,container:i,children:c})}))})};VIe.displayName=lge;var Wee="DialogOverlay",HIe=P.forwardRef((t,e)=>{const n=qIe(Wee,t.__scopeDialog),{forceMount:s=n.forceMount,...i}=t,o=hm(Wee,t.__scopeDialog);return o.modal?r.jsx(oc,{present:s||o.open,children:r.jsx(knt,{...i,ref:e})}):null});HIe.displayName=Wee;var jnt=p1("DialogOverlay.RemoveScroll"),knt=P.forwardRef((t,e)=>{const{__scopeDialog:n,...s}=t,i=hm(Wee,n);return r.jsx(XE,{as:jnt,allowPinchZoom:!0,shards:[i.contentRef],children:r.jsx(On.div,{"data-state":dge(i.open),...s,ref:e,style:{pointerEvents:"auto",...s.style}})})}),uj="DialogContent",WIe=P.forwardRef((t,e)=>{const n=qIe(uj,t.__scopeDialog),{forceMount:s=n.forceMount,...i}=t,o=hm(uj,t.__scopeDialog);return r.jsx(oc,{present:s||o.open,children:o.modal?r.jsx(Nnt,{...i,ref:e}):r.jsx(Snt,{...i,ref:e})})});WIe.displayName=uj;var Nnt=P.forwardRef((t,e)=>{const n=hm(uj,t.__scopeDialog),s=P.useRef(null),i=Gs(e,n.contentRef,s);return P.useEffect(()=>{const o=s.current;if(o)return One(o)},[]),r.jsx(GIe,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:an(t.onCloseAutoFocus,o=>{var c;o.preventDefault(),(c=n.triggerRef.current)==null||c.focus()}),onPointerDownOutside:an(t.onPointerDownOutside,o=>{const c=o.detail.originalEvent,a=c.button===0&&c.ctrlKey===!0;(c.button===2||a)&&o.preventDefault()}),onFocusOutside:an(t.onFocusOutside,o=>o.preventDefault())})}),Snt=P.forwardRef((t,e)=>{const n=hm(uj,t.__scopeDialog),s=P.useRef(!1),i=P.useRef(!1);return r.jsx(GIe,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var c,a;(c=t.onCloseAutoFocus)==null||c.call(t,o),o.defaultPrevented||(s.current||(a=n.triggerRef.current)==null||a.focus(),o.preventDefault()),s.current=!1,i.current=!1},onInteractOutside:o=>{var f,m;(f=t.onInteractOutside)==null||f.call(t,o),o.defaultPrevented||(s.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const c=o.target;((m=n.triggerRef.current)==null?void 0:m.contains(c))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),GIe=P.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:o,...c}=t,a=hm(uj,n),f=P.useRef(null),m=Gs(e,f);return Pne(),r.jsxs(r.Fragment,{children:[r.jsx(YE,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:i,onUnmountAutoFocus:o,children:r.jsx(S1,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":dge(a.open),...c,ref:m,onDismiss:()=>a.onOpenChange(!1)})}),r.jsxs(r.Fragment,{children:[r.jsx(Mnt,{titleId:a.titleId}),r.jsx(Ant,{contentRef:f,descriptionId:a.descriptionId})]})]})}),cge="DialogTitle",KIe=P.forwardRef((t,e)=>{const{__scopeDialog:n,...s}=t,i=hm(cge,n);return r.jsx(On.h2,{id:i.titleId,...s,ref:e})});KIe.displayName=cge;var ZIe="DialogDescription",YIe=P.forwardRef((t,e)=>{const{__scopeDialog:n,...s}=t,i=hm(ZIe,n);return r.jsx(On.p,{id:i.descriptionId,...s,ref:e})});YIe.displayName=ZIe;var XIe="DialogClose",QIe=P.forwardRef((t,e)=>{const{__scopeDialog:n,...s}=t,i=hm(XIe,n);return r.jsx(On.button,{type:"button",...s,ref:e,onClick:an(t.onClick,()=>i.onOpenChange(!1))})});QIe.displayName=XIe;function dge(t){return t?"open":"closed"}var JIe="DialogTitleWarning",[Cnt,ePe]=GGe(JIe,{contentName:uj,titleName:cge,docsSlug:"dialog"}),Mnt=({titleId:t})=>{const e=ePe(JIe),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users. If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component. For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return P.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},Tnt="DialogDescriptionWarning",Ant=({contentRef:t,descriptionId:e})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ePe(Tnt).contentName}}.`;return P.useEffect(()=>{var o;const i=(o=t.current)==null?void 0:o.getAttribute("aria-describedby");e&&i&&(document.getElementById(e)||console.warn(s))},[s,t,e]),null},Rne=BIe,uge=UIe,Fne=VIe,zC=HIe,BC=WIe,QE=KIe,JE=YIe,zne=QIe;const $r=Rne,Lo=uge,Ent=Fne,tPe=P.forwardRef(({className:t,...e},n)=>r.jsx(zC,{ref:n,className:zt("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));tPe.displayName=zC.displayName;const zr=P.forwardRef(({className:t,children:e,...n},s)=>r.jsxs(Ent,{children:[r.jsx(tPe,{}),r.jsxs(BC,{ref:s,className:zt("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...n,children:[e,r.jsxs(zne,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-accent data-[state=open]:text-muted-foreground hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[r.jsx(Ms,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));zr.displayName=BC.displayName;const Zr=({className:t,...e})=>r.jsx("div",{className:zt("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});Zr.displayName="DialogHeader";const ni=({className:t,...e})=>r.jsx("div",{className:zt("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});ni.displayName="DialogFooter";const Kr=P.forwardRef(({className:t,...e},n)=>r.jsx(QE,{ref:n,className:zt("text-lg font-semibold leading-none tracking-tight",t),...e}));Kr.displayName=QE.displayName;const ls=P.forwardRef(({className:t,...e},n)=>r.jsx(JE,{ref:n,className:zt("text-sm text-muted-foreground",t),...e}));ls.displayName=JE.displayName;const Int={points_earned:qa,listing_created:Hi,deal_closed:Cd,custom:Ca},rje={points_earned:"from-amber-500 to-orange-500",listing_created:"from-emerald-500 to-teal-500",deal_closed:"from-green-500 to-emerald-500",custom:"from-purple-500 to-pink-500"};function Pnt(){const{user:t}=Fr(),e=Xr(),{data:n}=Crt(),s=Mrt(),[i,o]=P.useState(null),[c,a]=P.useState(!1),f=P.useCallback(()=>{const k=Date.now()+3e3,C={startVelocity:30,spread:360,ticks:60,zIndex:9999},S=(I,A)=>Math.random()*(A-I)+I,T=setInterval(()=>{const I=k-Date.now();if(I<=0){clearInterval(T);return}const A=50*(I/3e3);Hwe({...C,particleCount:A,origin:{x:S(.1,.3),y:Math.random()-.2},colors:["#ff6b6b","#feca57","#48dbfb","#ff9ff3","#54a0ff","#5f27cd"]}),Hwe({...C,particleCount:A,origin:{x:S(.7,.9),y:Math.random()-.2},colors:["#ff6b6b","#feca57","#48dbfb","#ff9ff3","#54a0ff","#5f27cd"]})},250)},[]);P.useEffect(()=>{n&&n.length>0&&!i&&(o(n[0]),a(!0),setTimeout(f,100))},[n,i,f]);const m=async()=>{if(i){const w=i.id;a(!1),o(null),e.setQueryData(["celebrations","pending",t==null?void 0:t.id],k=>(k==null?void 0:k.filter(C=>C.id!==w))??[]),await s.mutateAsync(w)}};if(!i)return null;const y=Int[i.celebration_type]||Ca,v=rje[i.celebration_type]||rje.custom;return r.jsx($r,{open:c,onOpenChange:w=>!w&&m(),children:r.jsxs(zr,{className:"sm:max-w-md text-center border-0 overflow-hidden",children:[r.jsx("div",{className:`absolute inset-0 bg-gradient-to-br ${v} opacity-10`}),r.jsxs("div",{className:"relative z-10 py-6",children:[r.jsx("div",{className:"flex justify-center mb-4",children:r.jsx("div",{className:`w-20 h-20 rounded-full bg-gradient-to-br ${v} flex items-center justify-center animate-bounce`,children:r.jsx(y,{className:"w-10 h-10 text-white"})})}),r.jsxs("div",{className:"flex justify-center gap-1 mb-4",children:[r.jsx(Mi,{className:"w-5 h-5 text-yellow-500 animate-pulse"}),r.jsx(Mi,{className:"w-5 h-5 text-yellow-500 animate-pulse delay-75"}),r.jsx(Mi,{className:"w-5 h-5 text-yellow-500 animate-pulse delay-150"})]}),r.jsxs("h2",{className:"text-2xl font-bold mb-2 bg-gradient-to-r from-primary to-secondary bg-clip-text text-transparent",children:["🎉 ",i.title]}),i.points_amount&&i.points_amount>0&&r.jsxs("div",{className:"text-4xl font-bold text-primary mb-2",children:["+",i.points_amount," points!"]}),i.message&&r.jsx("p",{className:"text-muted-foreground mb-6",children:i.message}),r.jsx(te,{onClick:m,className:"w-full",size:"lg",children:"Awesome! 🙌"}),n&&n.length>1&&r.jsxs("p",{className:"text-sm text-muted-foreground mt-3",children:["+",n.length-1," more celebration",n.length>2?"s":""," waiting"]})]})]})})}const PA="/assets/levelup-logo-color-D3mY9gCJ.png",hge="/assets/levelup-logo-white-C2RAgAoG.png",Lnt="/assets/listings-hero-BI9Ki9Dq.jpg",yt=P.forwardRef(({className:t,type:e,...n},s)=>r.jsx("input",{type:e,className:zt("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:s,...n}));yt.displayName="Input";const Ont=MC("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Rt({className:t,variant:e,...n}){return r.jsx("div",{className:zt(Ont({variant:e}),t),...n})}function Gr({className:t,...e}){return r.jsx("div",{className:zt("animate-pulse rounded-md bg-muted",t),...e})}function LA(t,[e,n]){return Math.min(n,Math.max(e,t))}var Dnt=P.createContext(void 0);function Rj(t){const e=P.useContext(Dnt);return t||e||"ltr"}function eI(t){const e=P.useRef({value:t,previous:t});return P.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var Rnt=[" ","Enter","ArrowUp","ArrowDown"],Fnt=[" ","Enter"],hj="Select",[Bne,$ne,znt]=$E(hj),[$C]=Zl(hj,[znt,Ng]),Une=Ng(),[Bnt,A1]=$C(hj),[$nt,Unt]=$C(hj),rPe=t=>{const{__scopeSelect:e,children:n,open:s,defaultOpen:i,onOpenChange:o,value:c,defaultValue:a,onValueChange:f,dir:m,name:y,autoComplete:v,disabled:w,required:k,form:C}=t,S=Une(e),[T,I]=P.useState(null),[A,D]=P.useState(null),[$,F]=P.useState(!1),q=Rj(m),[W,K]=Tu({prop:s,defaultProp:i??!1,onChange:o,caller:hj}),[Z,re]=Tu({prop:c,defaultProp:a,onChange:f,caller:hj}),he=P.useRef(null),ue=T?C||!!T.closest("form"):!0,[Ne,se]=P.useState(new Set),xe=Array.from(Ne).map(ie=>ie.props.value).join(";");return r.jsx(HE,{...S,children:r.jsxs(Bnt,{required:k,scope:e,trigger:T,onTriggerChange:I,valueNode:A,onValueNodeChange:D,valueNodeHasChildren:$,onValueNodeHasChildrenChange:F,contentId:Fc(),value:Z,onValueChange:re,open:W,onOpenChange:K,dir:q,triggerPointerDownPosRef:he,disabled:w,children:[r.jsx(Bne.Provider,{scope:e,children:r.jsx($nt,{scope:t.__scopeSelect,onNativeOptionAdd:P.useCallback(ie=>{se(me=>new Set(me).add(ie))},[]),onNativeOptionRemove:P.useCallback(ie=>{se(me=>{const fe=new Set(me);return fe.delete(ie),fe})},[]),children:n})}),ue?r.jsxs(SPe,{"aria-hidden":!0,required:k,tabIndex:-1,name:y,autoComplete:v,value:Z,onChange:ie=>re(ie.target.value),disabled:w,form:C,children:[Z===void 0?r.jsx("option",{value:""}):null,Array.from(Ne)]},xe):null]})})};rPe.displayName=hj;var nPe="SelectTrigger",sPe=P.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:s=!1,...i}=t,o=Une(n),c=A1(nPe,n),a=c.disabled||s,f=Gs(e,c.onTriggerChange),m=$ne(n),y=P.useRef("touch"),[v,w,k]=MPe(S=>{const T=m().filter(D=>!D.disabled),I=T.find(D=>D.value===c.value),A=TPe(T,S,I);A!==void 0&&c.onValueChange(A.value)}),C=S=>{a||(c.onOpenChange(!0),k()),S&&(c.triggerPointerDownPosRef.current={x:Math.round(S.pageX),y:Math.round(S.pageY)})};return r.jsx(IC,{asChild:!0,...o,children:r.jsx(On.button,{type:"button",role:"combobox","aria-controls":c.contentId,"aria-expanded":c.open,"aria-required":c.required,"aria-autocomplete":"none",dir:c.dir,"data-state":c.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":CPe(c.value)?"":void 0,...i,ref:f,onClick:an(i.onClick,S=>{S.currentTarget.focus(),y.current!=="mouse"&&C(S)}),onPointerDown:an(i.onPointerDown,S=>{y.current=S.pointerType;const T=S.target;T.hasPointerCapture(S.pointerId)&&T.releasePointerCapture(S.pointerId),S.button===0&&S.ctrlKey===!1&&S.pointerType==="mouse"&&(C(S),S.preventDefault())}),onKeyDown:an(i.onKeyDown,S=>{const T=v.current!=="";!(S.ctrlKey||S.altKey||S.metaKey)&&S.key.length===1&&w(S.key),!(T&&S.key===" ")&&Rnt.includes(S.key)&&(C(),S.preventDefault())})})})});sPe.displayName=nPe;var iPe="SelectValue",aPe=P.forwardRef((t,e)=>{const{__scopeSelect:n,className:s,style:i,children:o,placeholder:c="",...a}=t,f=A1(iPe,n),{onValueNodeHasChildrenChange:m}=f,y=o!==void 0,v=Gs(e,f.onValueNodeChange);return Gl(()=>{m(y)},[m,y]),r.jsx(On.span,{...a,ref:v,style:{pointerEvents:"none"},children:CPe(f.value)?r.jsx(r.Fragment,{children:c}):o})});aPe.displayName=iPe;var qnt="SelectIcon",oPe=P.forwardRef((t,e)=>{const{__scopeSelect:n,children:s,...i}=t;return r.jsx(On.span,{"aria-hidden":!0,...i,ref:e,children:s||"▼"})});oPe.displayName=qnt;var Vnt="SelectPortal",lPe=t=>r.jsx(CC,{asChild:!0,...t});lPe.displayName=Vnt;var fj="SelectContent",cPe=P.forwardRef((t,e)=>{const n=A1(fj,t.__scopeSelect),[s,i]=P.useState();if(Gl(()=>{i(new DocumentFragment)},[]),!n.open){const o=s;return o?N1.createPortal(r.jsx(dPe,{scope:t.__scopeSelect,children:r.jsx(Bne.Slot,{scope:t.__scopeSelect,children:r.jsx("div",{children:t.children})})}),o):null}return r.jsx(uPe,{...t,ref:e})});cPe.displayName=fj;var Op=10,[dPe,E1]=$C(fj),Hnt="SelectContentImpl",Wnt=p1("SelectContent.RemoveScroll"),uPe=P.forwardRef((t,e)=>{const{__scopeSelect:n,position:s="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:o,onPointerDownOutside:c,side:a,sideOffset:f,align:m,alignOffset:y,arrowPadding:v,collisionBoundary:w,collisionPadding:k,sticky:C,hideWhenDetached:S,avoidCollisions:T,...I}=t,A=A1(fj,n),[D,$]=P.useState(null),[F,q]=P.useState(null),W=Gs(e,Re=>$(Re)),[K,Z]=P.useState(null),[re,he]=P.useState(null),ue=$ne(n),[Ne,se]=P.useState(!1),xe=P.useRef(!1);P.useEffect(()=>{if(D)return One(D)},[D]),Pne();const ie=P.useCallback(Re=>{const[$e,...Pe]=ue().map(Te=>Te.ref.current),[Ae]=Pe.slice(-1),nt=document.activeElement;for(const Te of Re)if(Te===nt||(Te==null||Te.scrollIntoView({block:"nearest"}),Te===$e&&F&&(F.scrollTop=0),Te===Ae&&F&&(F.scrollTop=F.scrollHeight),Te==null||Te.focus(),document.activeElement!==nt))return},[ue,F]),me=P.useCallback(()=>ie([K,D]),[ie,K,D]);P.useEffect(()=>{Ne&&me()},[Ne,me]);const{onOpenChange:fe,triggerPointerDownPosRef:ve}=A;P.useEffect(()=>{if(D){let Re={x:0,y:0};const $e=Ae=>{var nt,Te;Re={x:Math.abs(Math.round(Ae.pageX)-(((nt=ve.current)==null?void 0:nt.x)??0)),y:Math.abs(Math.round(Ae.pageY)-(((Te=ve.current)==null?void 0:Te.y)??0))}},Pe=Ae=>{Re.x<=10&&Re.y<=10?Ae.preventDefault():D.contains(Ae.target)||fe(!1),document.removeEventListener("pointermove",$e),ve.current=null};return ve.current!==null&&(document.addEventListener("pointermove",$e),document.addEventListener("pointerup",Pe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",$e),document.removeEventListener("pointerup",Pe,{capture:!0})}}},[D,fe,ve]),P.useEffect(()=>{const Re=()=>fe(!1);return window.addEventListener("blur",Re),window.addEventListener("resize",Re),()=>{window.removeEventListener("blur",Re),window.removeEventListener("resize",Re)}},[fe]);const[Ie,Se]=MPe(Re=>{const $e=ue().filter(nt=>!nt.disabled),Pe=$e.find(nt=>nt.ref.current===document.activeElement),Ae=TPe($e,Re,Pe);Ae&&setTimeout(()=>Ae.ref.current.focus())}),oe=P.useCallback((Re,$e,Pe)=>{const Ae=!xe.current&&!Pe;(A.value!==void 0&&A.value===$e||Ae)&&(Z(Re),Ae&&(xe.current=!0))},[A.value]),ae=P.useCallback(()=>D==null?void 0:D.focus(),[D]),je=P.useCallback((Re,$e,Pe)=>{const Ae=!xe.current&&!Pe;(A.value!==void 0&&A.value===$e||Ae)&&he(Re)},[A.value]),Me=s==="popper"?que:hPe,Ue=Me===que?{side:a,sideOffset:f,align:m,alignOffset:y,arrowPadding:v,collisionBoundary:w,collisionPadding:k,sticky:C,hideWhenDetached:S,avoidCollisions:T}:{};return r.jsx(dPe,{scope:n,content:D,viewport:F,onViewportChange:q,itemRefCallback:oe,selectedItem:K,onItemLeave:ae,itemTextRefCallback:je,focusSelectedItem:me,selectedItemText:re,position:s,isPositioned:Ne,searchRef:Ie,children:r.jsx(XE,{as:Wnt,allowPinchZoom:!0,children:r.jsx(YE,{asChild:!0,trapped:A.open,onMountAutoFocus:Re=>{Re.preventDefault()},onUnmountAutoFocus:an(i,Re=>{var $e;($e=A.trigger)==null||$e.focus({preventScroll:!0}),Re.preventDefault()}),children:r.jsx(S1,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:c,onFocusOutside:Re=>Re.preventDefault(),onDismiss:()=>A.onOpenChange(!1),children:r.jsx(Me,{role:"listbox",id:A.contentId,"data-state":A.open?"open":"closed",dir:A.dir,onContextMenu:Re=>Re.preventDefault(),...I,...Ue,onPlaced:()=>se(!0),ref:W,style:{display:"flex",flexDirection:"column",outline:"none",...I.style},onKeyDown:an(I.onKeyDown,Re=>{const $e=Re.ctrlKey||Re.altKey||Re.metaKey;if(Re.key==="Tab"&&Re.preventDefault(),!$e&&Re.key.length===1&&Se(Re.key),["ArrowUp","ArrowDown","Home","End"].includes(Re.key)){let Ae=ue().filter(nt=>!nt.disabled).map(nt=>nt.ref.current);if(["ArrowUp","End"].includes(Re.key)&&(Ae=Ae.slice().reverse()),["ArrowUp","ArrowDown"].includes(Re.key)){const nt=Re.target,Te=Ae.indexOf(nt);Ae=Ae.slice(Te+1)}setTimeout(()=>ie(Ae)),Re.preventDefault()}})})})})})})});uPe.displayName=Hnt;var Gnt="SelectItemAlignedPosition",hPe=P.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:s,...i}=t,o=A1(fj,n),c=E1(fj,n),[a,f]=P.useState(null),[m,y]=P.useState(null),v=Gs(e,W=>y(W)),w=$ne(n),k=P.useRef(!1),C=P.useRef(!0),{viewport:S,selectedItem:T,selectedItemText:I,focusSelectedItem:A}=c,D=P.useCallback(()=>{if(o.trigger&&o.valueNode&&a&&m&&S&&T&&I){const W=o.trigger.getBoundingClientRect(),K=m.getBoundingClientRect(),Z=o.valueNode.getBoundingClientRect(),re=I.getBoundingClientRect();if(o.dir!=="rtl"){const nt=re.left-K.left,Te=Z.left-nt,Xe=W.left-Te,ge=W.width+Xe,mt=Math.max(ge,K.width),rt=window.innerWidth-Op,We=LA(Te,[Op,Math.max(Op,rt-mt)]);a.style.minWidth=ge+"px",a.style.left=We+"px"}else{const nt=K.right-re.right,Te=window.innerWidth-Z.right-nt,Xe=window.innerWidth-W.right-Te,ge=W.width+Xe,mt=Math.max(ge,K.width),rt=window.innerWidth-Op,We=LA(Te,[Op,Math.max(Op,rt-mt)]);a.style.minWidth=ge+"px",a.style.right=We+"px"}const he=w(),ue=window.innerHeight-Op*2,Ne=S.scrollHeight,se=window.getComputedStyle(m),xe=parseInt(se.borderTopWidth,10),ie=parseInt(se.paddingTop,10),me=parseInt(se.borderBottomWidth,10),fe=parseInt(se.paddingBottom,10),ve=xe+ie+Ne+fe+me,Ie=Math.min(T.offsetHeight*5,ve),Se=window.getComputedStyle(S),oe=parseInt(Se.paddingTop,10),ae=parseInt(Se.paddingBottom,10),je=W.top+W.height/2-Op,Me=ue-je,Ue=T.offsetHeight/2,Re=T.offsetTop+Ue,$e=xe+ie+Re,Pe=ve-$e;if($e<=je){const nt=he.length>0&&T===he[he.length-1].ref.current;a.style.bottom="0px";const Te=m.clientHeight-S.offsetTop-S.offsetHeight,Xe=Math.max(Me,Ue+(nt?ae:0)+Te+me),ge=$e+Xe;a.style.height=ge+"px"}else{const nt=he.length>0&&T===he[0].ref.current;a.style.top="0px";const Xe=Math.max(je,xe+S.offsetTop+(nt?oe:0)+Ue)+Pe;a.style.height=Xe+"px",S.scrollTop=$e-je+S.offsetTop}a.style.margin=`${Op}px 0`,a.style.minHeight=Ie+"px",a.style.maxHeight=ue+"px",s==null||s(),requestAnimationFrame(()=>k.current=!0)}},[w,o.trigger,o.valueNode,a,m,S,T,I,o.dir,s]);Gl(()=>D(),[D]);const[$,F]=P.useState();Gl(()=>{m&&F(window.getComputedStyle(m).zIndex)},[m]);const q=P.useCallback(W=>{W&&C.current===!0&&(D(),A==null||A(),C.current=!1)},[D,A]);return r.jsx(Znt,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:k,onScrollButtonChange:q,children:r.jsx("div",{ref:f,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:$},children:r.jsx(On.div,{...i,ref:v,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});hPe.displayName=Gnt;var Knt="SelectPopperPosition",que=P.forwardRef((t,e)=>{const{__scopeSelect:n,align:s="start",collisionPadding:i=Op,...o}=t,c=Une(n);return r.jsx(WE,{...c,...o,ref:e,align:s,collisionPadding:i,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});que.displayName=Knt;var[Znt,fge]=$C(fj,{}),Vue="SelectViewport",fPe=P.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:s,...i}=t,o=E1(Vue,n),c=fge(Vue,n),a=Gs(e,o.onViewportChange),f=P.useRef(0);return r.jsxs(r.Fragment,{children:[r.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),r.jsx(Bne.Slot,{scope:n,children:r.jsx(On.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:an(i.onScroll,m=>{const y=m.currentTarget,{contentWrapper:v,shouldExpandOnScrollRef:w}=c;if(w!=null&&w.current&&v){const k=Math.abs(f.current-y.scrollTop);if(k>0){const C=window.innerHeight-Op*2,S=parseFloat(v.style.minHeight),T=parseFloat(v.style.height),I=Math.max(S,T);if(I0?$:0,v.style.justifyContent="flex-end")}}}f.current=y.scrollTop})})})]})});fPe.displayName=Vue;var pPe="SelectGroup",[Ynt,Xnt]=$C(pPe),Qnt=P.forwardRef((t,e)=>{const{__scopeSelect:n,...s}=t,i=Fc();return r.jsx(Ynt,{scope:n,id:i,children:r.jsx(On.div,{role:"group","aria-labelledby":i,...s,ref:e})})});Qnt.displayName=pPe;var mPe="SelectLabel",gPe=P.forwardRef((t,e)=>{const{__scopeSelect:n,...s}=t,i=Xnt(mPe,n);return r.jsx(On.div,{id:i.id,...s,ref:e})});gPe.displayName=mPe;var Gee="SelectItem",[Jnt,yPe]=$C(Gee),xPe=P.forwardRef((t,e)=>{const{__scopeSelect:n,value:s,disabled:i=!1,textValue:o,...c}=t,a=A1(Gee,n),f=E1(Gee,n),m=a.value===s,[y,v]=P.useState(o??""),[w,k]=P.useState(!1),C=Gs(e,A=>{var D;return(D=f.itemRefCallback)==null?void 0:D.call(f,A,s,i)}),S=Fc(),T=P.useRef("touch"),I=()=>{i||(a.onValueChange(s),a.onOpenChange(!1))};if(s==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return r.jsx(Jnt,{scope:n,value:s,disabled:i,textId:S,isSelected:m,onItemTextChange:P.useCallback(A=>{v(D=>D||((A==null?void 0:A.textContent)??"").trim())},[]),children:r.jsx(Bne.ItemSlot,{scope:n,value:s,disabled:i,textValue:y,children:r.jsx(On.div,{role:"option","aria-labelledby":S,"data-highlighted":w?"":void 0,"aria-selected":m&&w,"data-state":m?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...c,ref:C,onFocus:an(c.onFocus,()=>k(!0)),onBlur:an(c.onBlur,()=>k(!1)),onClick:an(c.onClick,()=>{T.current!=="mouse"&&I()}),onPointerUp:an(c.onPointerUp,()=>{T.current==="mouse"&&I()}),onPointerDown:an(c.onPointerDown,A=>{T.current=A.pointerType}),onPointerMove:an(c.onPointerMove,A=>{var D;T.current=A.pointerType,i?(D=f.onItemLeave)==null||D.call(f):T.current==="mouse"&&A.currentTarget.focus({preventScroll:!0})}),onPointerLeave:an(c.onPointerLeave,A=>{var D;A.currentTarget===document.activeElement&&((D=f.onItemLeave)==null||D.call(f))}),onKeyDown:an(c.onKeyDown,A=>{var $;(($=f.searchRef)==null?void 0:$.current)!==""&&A.key===" "||(Fnt.includes(A.key)&&I(),A.key===" "&&A.preventDefault())})})})})});xPe.displayName=Gee;var z5="SelectItemText",vPe=P.forwardRef((t,e)=>{const{__scopeSelect:n,className:s,style:i,...o}=t,c=A1(z5,n),a=E1(z5,n),f=yPe(z5,n),m=Unt(z5,n),[y,v]=P.useState(null),w=Gs(e,I=>v(I),f.onItemTextChange,I=>{var A;return(A=a.itemTextRefCallback)==null?void 0:A.call(a,I,f.value,f.disabled)}),k=y==null?void 0:y.textContent,C=P.useMemo(()=>r.jsx("option",{value:f.value,disabled:f.disabled,children:k},f.value),[f.disabled,f.value,k]),{onNativeOptionAdd:S,onNativeOptionRemove:T}=m;return Gl(()=>(S(C),()=>T(C)),[S,T,C]),r.jsxs(r.Fragment,{children:[r.jsx(On.span,{id:f.textId,...o,ref:w}),f.isSelected&&c.valueNode&&!c.valueNodeHasChildren?N1.createPortal(o.children,c.valueNode):null]})});vPe.displayName=z5;var _Pe="SelectItemIndicator",bPe=P.forwardRef((t,e)=>{const{__scopeSelect:n,...s}=t;return yPe(_Pe,n).isSelected?r.jsx(On.span,{"aria-hidden":!0,...s,ref:e}):null});bPe.displayName=_Pe;var Hue="SelectScrollUpButton",wPe=P.forwardRef((t,e)=>{const n=E1(Hue,t.__scopeSelect),s=fge(Hue,t.__scopeSelect),[i,o]=P.useState(!1),c=Gs(e,s.onScrollButtonChange);return Gl(()=>{if(n.viewport&&n.isPositioned){let a=function(){const m=f.scrollTop>0;o(m)};const f=n.viewport;return a(),f.addEventListener("scroll",a),()=>f.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),i?r.jsx(kPe,{...t,ref:c,onAutoScroll:()=>{const{viewport:a,selectedItem:f}=n;a&&f&&(a.scrollTop=a.scrollTop-f.offsetHeight)}}):null});wPe.displayName=Hue;var Wue="SelectScrollDownButton",jPe=P.forwardRef((t,e)=>{const n=E1(Wue,t.__scopeSelect),s=fge(Wue,t.__scopeSelect),[i,o]=P.useState(!1),c=Gs(e,s.onScrollButtonChange);return Gl(()=>{if(n.viewport&&n.isPositioned){let a=function(){const m=f.scrollHeight-f.clientHeight,y=Math.ceil(f.scrollTop)f.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),i?r.jsx(kPe,{...t,ref:c,onAutoScroll:()=>{const{viewport:a,selectedItem:f}=n;a&&f&&(a.scrollTop=a.scrollTop+f.offsetHeight)}}):null});jPe.displayName=Wue;var kPe=P.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:s,...i}=t,o=E1("SelectScrollButton",n),c=P.useRef(null),a=$ne(n),f=P.useCallback(()=>{c.current!==null&&(window.clearInterval(c.current),c.current=null)},[]);return P.useEffect(()=>()=>f(),[f]),Gl(()=>{var y;const m=a().find(v=>v.ref.current===document.activeElement);(y=m==null?void 0:m.ref.current)==null||y.scrollIntoView({block:"nearest"})},[a]),r.jsx(On.div,{"aria-hidden":!0,...i,ref:e,style:{flexShrink:0,...i.style},onPointerDown:an(i.onPointerDown,()=>{c.current===null&&(c.current=window.setInterval(s,50))}),onPointerMove:an(i.onPointerMove,()=>{var m;(m=o.onItemLeave)==null||m.call(o),c.current===null&&(c.current=window.setInterval(s,50))}),onPointerLeave:an(i.onPointerLeave,()=>{f()})})}),est="SelectSeparator",NPe=P.forwardRef((t,e)=>{const{__scopeSelect:n,...s}=t;return r.jsx(On.div,{"aria-hidden":!0,...s,ref:e})});NPe.displayName=est;var Gue="SelectArrow",tst=P.forwardRef((t,e)=>{const{__scopeSelect:n,...s}=t,i=Une(n),o=A1(Gue,n),c=E1(Gue,n);return o.open&&c.position==="popper"?r.jsx(GE,{...i,...s,ref:e}):null});tst.displayName=Gue;var rst="SelectBubbleInput",SPe=P.forwardRef(({__scopeSelect:t,value:e,...n},s)=>{const i=P.useRef(null),o=Gs(s,i),c=eI(e);return P.useEffect(()=>{const a=i.current;if(!a)return;const f=window.HTMLSelectElement.prototype,y=Object.getOwnPropertyDescriptor(f,"value").set;if(c!==e&&y){const v=new Event("change",{bubbles:!0});y.call(a,e),a.dispatchEvent(v)}},[c,e]),r.jsx(On.select,{...n,style:{...FTe,...n.style},ref:o,defaultValue:e})});SPe.displayName=rst;function CPe(t){return t===""||t===void 0}function MPe(t){const e=$l(t),n=P.useRef(""),s=P.useRef(0),i=P.useCallback(c=>{const a=n.current+c;e(a),function f(m){n.current=m,window.clearTimeout(s.current),m!==""&&(s.current=window.setTimeout(()=>f(""),1e3))}(a)},[e]),o=P.useCallback(()=>{n.current="",window.clearTimeout(s.current)},[]);return P.useEffect(()=>()=>window.clearTimeout(s.current),[]),[n,i,o]}function TPe(t,e,n){const i=e.length>1&&Array.from(e).every(m=>m===e[0])?e[0]:e,o=n?t.indexOf(n):-1;let c=nst(t,Math.max(o,0));i.length===1&&(c=c.filter(m=>m!==n));const f=c.find(m=>m.textValue.toLowerCase().startsWith(i.toLowerCase()));return f!==n?f:void 0}function nst(t,e){return t.map((n,s)=>t[(e+s)%t.length])}var sst=rPe,APe=sPe,ist=aPe,ast=oPe,ost=lPe,EPe=cPe,lst=fPe,IPe=gPe,PPe=xPe,cst=vPe,dst=bPe,LPe=wPe,OPe=jPe,DPe=NPe;const _n=sst,bn=ist,xn=P.forwardRef(({className:t,children:e,...n},s)=>r.jsxs(APe,{ref:s,className:zt("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,r.jsx(ast,{asChild:!0,children:r.jsx(uh,{className:"h-4 w-4 opacity-50"})})]}));xn.displayName=APe.displayName;const RPe=P.forwardRef(({className:t,...e},n)=>r.jsx(LPe,{ref:n,className:zt("flex cursor-default items-center justify-center py-1",t),...e,children:r.jsx(U0,{className:"h-4 w-4"})}));RPe.displayName=LPe.displayName;const FPe=P.forwardRef(({className:t,...e},n)=>r.jsx(OPe,{ref:n,className:zt("flex cursor-default items-center justify-center py-1",t),...e,children:r.jsx(uh,{className:"h-4 w-4"})}));FPe.displayName=OPe.displayName;const vn=P.forwardRef(({className:t,children:e,position:n="popper",...s},i)=>r.jsx(ost,{children:r.jsxs(EPe,{ref:i,className:zt("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...s,children:[r.jsx(RPe,{}),r.jsx(lst,{className:zt("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),r.jsx(FPe,{})]})}));vn.displayName=EPe.displayName;const ust=P.forwardRef(({className:t,...e},n)=>r.jsx(IPe,{ref:n,className:zt("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...e}));ust.displayName=IPe.displayName;const er=P.forwardRef(({className:t,children:e,...n},s)=>r.jsxs(PPe,{ref:s,className:zt("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",t),...n,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(dst,{children:r.jsx(Ba,{className:"h-4 w-4"})})}),r.jsx(cst,{children:e})]}));er.displayName=PPe.displayName;const hst=P.forwardRef(({className:t,...e},n)=>r.jsx(DPe,{ref:n,className:zt("-mx-1 my-1 h-px bg-muted",t),...e}));hst.displayName=DPe.displayName;const fst=t=>rr({queryKey:["public-listings",t],queryFn:async()=>{let e=ee.from("listings").select(` id, slug, agent_id, property_address, city, state, neighborhood, price, property_type, status, bedrooms, bathrooms, square_footage, lot_size, year_built, has_hoa, description, created_at, updated_at, photos:listing_photos(id, photo_url, is_primary), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage:brokerages(name)) `).eq("is_approved",!0).eq("is_public",!0).order("created_at",{ascending:!1});t!=null&&t.status&&(e=e.eq("status",t.status)),t!=null&&t.propertyType&&(e=e.eq("property_type",t.propertyType)),t!=null&&t.city&&(e=e.ilike("city",`%${t.city}%`)),t!=null&&t.minPrice&&(e=e.gte("price",t.minPrice)),t!=null&&t.maxPrice&&(e=e.lte("price",t.maxPrice));const{data:n,error:s}=await e;if(s)throw s;return n}}),zPe=t=>rr({queryKey:["public-listing",t],queryFn:async()=>{const e=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t);let n=ee.from("listings").select(` id, slug, agent_id, property_address, city, state, neighborhood, price, property_type, status, bedrooms, bathrooms, square_footage, lot_size, year_built, has_hoa, description, agent_notes, agent_notes_public, mls_link, video_link, video_id, created_at, updated_at, photos:listing_photos(id, photo_url, is_primary, sort_order), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage:brokerages(name)), video:agent_videos!listings_video_id_fkey(id, playback_url, thumbnail_url, title, duration_seconds, bunny_video_id) `).eq("is_approved",!0).eq("is_public",!0);e?n=n.eq("id",t):n=n.eq("slug",t);const{data:s,error:i}=await n.single();if(i)throw i;return s},enabled:!!t}),BPe=()=>cr({mutationFn:async({listingId:t,agentId:e,firstName:n,lastName:s,email:i,phone:o,shareToken:c})=>{let a=null,f=null;if(c){const{data:w}=await ee.from("listing_shares").select("id, sharing_agent_id").eq("share_token",c).eq("listing_id",t).maybeSingle();w&&(a=w.id,f=w.sharing_agent_id)}const{data:m,error:y}=await ee.from("listing_leads").insert({listing_id:t,agent_id:f||e,first_name:n,last_name:s,email:i,phone:o,share_id:a,referred_by_agent_id:f}).select().single();if(y)throw y;const{error:v}=await ee.functions.invoke("process-listing-lead",{body:{leadId:m.id}});return v&&console.error("Error processing lead:",v),m}}),pst=()=>cr({mutationFn:async t=>{const{error:e}=await ee.rpc("increment_listing_share_click",{p_share_token:t});if(e)throw e}}),mst={active:"bg-emerald-500",coming_soon:"bg-blue-600",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},nje={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},gst={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function $Pe(){const[t,e]=P.useState(""),[n,s]=P.useState(!1),[i,o]=P.useState({status:"",propertyType:"",minPrice:"",maxPrice:""}),{data:c,isLoading:a}=fst({city:t||void 0,status:i.status||void 0,propertyType:i.propertyType||void 0,minPrice:i.minPrice?Number(i.minPrice):void 0,maxPrice:i.maxPrice?Number(i.maxPrice):void 0}),f=v=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(v),m=()=>{o({status:"",propertyType:"",minPrice:"",maxPrice:""}),e("")},y=t||i.status||i.propertyType||i.minPrice||i.maxPrice;return r.jsxs(r.Fragment,{children:[r.jsxs(Mg,{children:[r.jsx("title",{children:"LevelUp Listings - Find Your Dream Home | Real Estate for Sale"}),r.jsx("meta",{name:"description",content:"Browse exclusive property listings from LevelUp real estate agents. Find homes for sale, condos, townhouses, and luxury properties. View photos, prices, and connect with agents."}),r.jsx("link",{rel:"canonical",href:"https://listings.relevelup.com"}),r.jsx("meta",{property:"og:title",content:"LevelUp Listings - Find Your Dream Home"}),r.jsx("meta",{property:"og:description",content:"Browse exclusive property listings from LevelUp real estate agents. Find homes for sale, view photos, and connect with agents."}),r.jsx("meta",{property:"og:type",content:"website"}),r.jsx("meta",{property:"og:url",content:"https://listings.relevelup.com"}),r.jsx("meta",{property:"og:site_name",content:"LevelUp Listings"}),r.jsx("meta",{property:"og:locale",content:"en_US"}),r.jsx("meta",{name:"twitter:card",content:"summary_large_image"}),r.jsx("meta",{name:"twitter:title",content:"LevelUp Listings - Find Your Dream Home"}),r.jsx("meta",{name:"twitter:description",content:"Browse exclusive property listings from LevelUp real estate agents."}),r.jsx("meta",{name:"robots",content:"index, follow"}),r.jsx("meta",{name:"keywords",content:"homes for sale, real estate, property listings, houses, condos, townhouses, luxury homes, LevelUp"}),r.jsx("script",{type:"application/ld+json",children:JSON.stringify({"@context":"https://schema.org","@type":"WebSite",name:"LevelUp Listings",url:"https://listings.relevelup.com",description:"Browse exclusive property listings from LevelUp real estate agents",potentialAction:{"@type":"SearchAction",target:{"@type":"EntryPoint",urlTemplate:"https://listings.relevelup.com?q={search_term_string}"},"query-input":"required name=search_term_string"}})}),r.jsx("script",{type:"application/ld+json",children:JSON.stringify({"@context":"https://schema.org","@type":"RealEstateAgent",name:"LevelUp",url:"https://relevelup.com",logo:"https://listings.relevelup.com/assets/levelup-logo-color.png"})})]}),r.jsxs("div",{className:"min-h-screen bg-gray-50",children:[r.jsx("header",{className:"bg-white border-b border-gray-200 sticky top-0 z-50",children:r.jsx("div",{className:"max-w-7xl mx-auto px-4 py-3",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(ao,{to:"/public/listings",className:"flex items-center",children:r.jsx("img",{src:PA,alt:"LevelUp",className:"h-8"})}),r.jsx("nav",{className:"hidden md:flex items-center gap-6",children:r.jsx("a",{href:"https://relevelup.com",target:"_blank",rel:"noopener noreferrer",className:"text-sm font-medium text-gray-600 hover:text-gray-900 transition-colors",children:"About LevelUp"})})]})})}),r.jsxs("section",{className:"relative bg-cover bg-center py-20 md:py-32",style:{backgroundImage:`url(${Lnt})`},children:[r.jsx("div",{className:"absolute inset-0 bg-black/40"}),r.jsxs("div",{className:"relative max-w-7xl mx-auto px-4",children:[r.jsx("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold text-white mb-3 text-center drop-shadow-lg",children:"Find Your Perfect Home"}),r.jsx("p",{className:"text-white/90 text-center mb-10 text-lg md:text-xl drop-shadow",children:"Exclusive listings from LevelUp agents"}),r.jsxs("div",{className:"max-w-3xl mx-auto",children:[r.jsxs("div",{className:"flex gap-0 shadow-2xl rounded-lg overflow-hidden",children:[r.jsxs("div",{className:"relative flex-1 bg-white",children:[r.jsx(Ti,{className:"absolute left-4 top-1/2 -translate-y-1/2 h-5 w-5 text-gray-400"}),r.jsx(yt,{placeholder:"Enter an address, neighborhood, city, or ZIP code",value:t,onChange:v=>e(v.target.value),className:"pl-12 h-14 md:h-16 text-base md:text-lg border-0 focus-visible:ring-0 rounded-none bg-white"})]}),r.jsx(te,{className:"h-14 md:h-16 px-6 md:px-8 rounded-none bg-blue-600 hover:bg-blue-700",children:r.jsx(Ti,{className:"h-5 w-5 md:h-6 md:w-6"})})]}),r.jsx("div",{className:"flex justify-center mt-6",children:r.jsxs(te,{variant:"secondary",size:"sm",onClick:()=>s(!n),className:"gap-2 bg-white/90 hover:bg-white text-gray-700 shadow-lg",children:[r.jsx(kT,{className:"h-4 w-4"}),n?"Hide Filters":"More Filters"]})}),n&&r.jsxs("div",{className:"mt-4 p-6 bg-white rounded-lg shadow-xl",children:[r.jsxs("div",{className:"grid sm:grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 mb-1.5 block",children:"Status"}),r.jsxs(_n,{value:i.status||"all",onValueChange:v=>o({...i,status:v==="all"?"":v}),children:[r.jsx(xn,{className:"bg-white",children:r.jsx(bn,{placeholder:"Any status"})}),r.jsxs(vn,{children:[r.jsx(er,{value:"all",children:"Any status"}),Object.entries(nje).map(([v,w])=>r.jsx(er,{value:v,children:w},v))]})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 mb-1.5 block",children:"Property Type"}),r.jsxs(_n,{value:i.propertyType||"all",onValueChange:v=>o({...i,propertyType:v==="all"?"":v}),children:[r.jsx(xn,{className:"bg-white",children:r.jsx(bn,{placeholder:"Any type"})}),r.jsxs(vn,{children:[r.jsx(er,{value:"all",children:"Any type"}),Object.entries(gst).map(([v,w])=>r.jsx(er,{value:v,children:w},v))]})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 mb-1.5 block",children:"Min Price"}),r.jsx(yt,{type:"number",placeholder:"No min",value:i.minPrice,onChange:v=>o({...i,minPrice:v.target.value}),className:"bg-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 mb-1.5 block",children:"Max Price"}),r.jsx(yt,{type:"number",placeholder:"No max",value:i.maxPrice,onChange:v=>o({...i,maxPrice:v.target.value}),className:"bg-white"})]})]}),y&&r.jsx("div",{className:"flex justify-end mt-4",children:r.jsxs(te,{variant:"ghost",size:"sm",onClick:m,className:"gap-1 text-gray-500",children:[r.jsx(Ms,{className:"h-4 w-4"}),"Clear all"]})})]})]})]})]}),r.jsx("section",{className:"py-8",children:r.jsx("div",{className:"max-w-7xl mx-auto px-4",children:a?r.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-5",children:[...Array(8)].map((v,w)=>r.jsxs("div",{className:"bg-white rounded-lg overflow-hidden shadow-sm",children:[r.jsx(Gr,{className:"aspect-[4/3]"}),r.jsxs("div",{className:"p-4 space-y-3",children:[r.jsx(Gr,{className:"h-7 w-28"}),r.jsx(Gr,{className:"h-4 w-full"}),r.jsx(Gr,{className:"h-4 w-3/4"})]})]},w))}):c&&c.length>0?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"flex items-center justify-between mb-6",children:r.jsxs("h2",{className:"text-xl font-semibold text-gray-900",children:[c.length," ",c.length===1?"Home":"Homes"," Available"]})}),r.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-5",children:c.map(v=>{var S,T,I;const w=((S=v.photos)==null?void 0:S.find(A=>A.is_primary))||((T=v.photos)==null?void 0:T[0]),C=window.location.hostname==="listings.relevelup.com"||window.location.hostname.startsWith("listings.")?`/${v.slug||v.id}`:`/public/listing/${v.slug||v.id}`;return r.jsx(ao,{to:C,children:r.jsxs("div",{className:"bg-white rounded-lg overflow-hidden shadow-sm hover:shadow-lg transition-shadow cursor-pointer group border border-gray-100",children:[r.jsxs("div",{className:"aspect-[4/3] relative overflow-hidden bg-gray-100",children:[w?r.jsx("img",{src:w.photo_url,alt:v.property_address||v.city,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Hi,{className:"h-12 w-12 text-gray-300"})}),r.jsx(Rt,{className:`absolute top-2 left-2 ${mst[v.status]} text-white border-0 text-xs font-medium px-2 py-0.5`,children:nje[v.status]}),r.jsx("button",{className:"absolute top-2 right-2 p-2 rounded-full bg-white/80 hover:bg-white transition-colors",onClick:A=>A.preventDefault(),children:r.jsx(ql,{className:"h-5 w-5 text-gray-600"})})]}),r.jsxs("div",{className:"p-4",children:[r.jsx("p",{className:"text-xl font-bold text-gray-900 mb-1",children:f(v.price)}),r.jsxs("div",{className:"flex items-center gap-1 text-sm text-gray-700 mb-2",children:[v.bedrooms&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"font-semibold",children:v.bedrooms}),r.jsx("span",{className:"text-gray-500",children:"bds"}),r.jsx("span",{className:"text-gray-300 mx-1",children:"|"})]}),v.bathrooms&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"font-semibold",children:v.bathrooms}),r.jsx("span",{className:"text-gray-500",children:"ba"}),r.jsx("span",{className:"text-gray-300 mx-1",children:"|"})]}),v.square_footage&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"font-semibold",children:v.square_footage.toLocaleString()}),r.jsx("span",{className:"text-gray-500",children:"sqft"})]})]}),v.property_address&&r.jsx("p",{className:"text-sm text-gray-700 truncate",children:v.property_address}),r.jsxs("p",{className:"text-sm text-gray-500 truncate",children:[v.city,", ",v.state]}),v.agent&&r.jsxs("div",{className:"mt-3 pt-3 border-t border-gray-100",children:[r.jsx("p",{className:"text-xs text-gray-500 truncate",children:v.agent.name}),((I=v.agent.brokerage)==null?void 0:I.name)&&r.jsx("p",{className:"text-xs text-gray-400 truncate",children:v.agent.brokerage.name})]})]})]})},v.id)})})]}):r.jsxs("div",{className:"text-center py-16",children:[r.jsx("div",{className:"w-20 h-20 mx-auto mb-4 rounded-full bg-gray-100 flex items-center justify-center",children:r.jsx(Hi,{className:"h-10 w-10 text-gray-400"})}),r.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:"No listings found"}),r.jsx("p",{className:"text-gray-500 mb-6",children:y?"Try adjusting your search or filters":"Check back soon for new listings"}),y&&r.jsx(te,{variant:"outline",onClick:m,children:"Clear filters"})]})})}),r.jsx("footer",{className:"bg-gray-900 text-white py-10 mt-auto",children:r.jsx("div",{className:"max-w-7xl mx-auto px-4",children:r.jsxs("div",{className:"flex flex-col md:flex-row items-center justify-between gap-4",children:[r.jsx("div",{className:"flex items-center gap-2",children:r.jsx("img",{src:hge,alt:"LevelUp",className:"h-6"})}),r.jsxs("p",{className:"text-gray-400 text-sm",children:["© ",new Date().getFullYear()," LevelUp. All rights reserved."]}),r.jsx("a",{href:"https://relevelup.com",target:"_blank",rel:"noopener noreferrer",className:"text-gray-400 hover:text-white text-sm transition-colors",children:"relevelup.com"})]})})})]})]})}const Ye=P.forwardRef(({className:t,...e},n)=>r.jsx("div",{ref:n,className:zt("rounded-lg border bg-card text-card-foreground shadow-sm",t),...e}));Ye.displayName="Card";const Ht=P.forwardRef(({className:t,...e},n)=>r.jsx("div",{ref:n,className:zt("flex flex-col space-y-1.5 p-6",t),...e}));Ht.displayName="CardHeader";const Yt=P.forwardRef(({className:t,...e},n)=>r.jsx("h3",{ref:n,className:zt("text-2xl font-semibold leading-none tracking-tight",t),...e}));Yt.displayName="CardTitle";const An=P.forwardRef(({className:t,...e},n)=>r.jsx("p",{ref:n,className:zt("text-sm text-muted-foreground",t),...e}));An.displayName="CardDescription";const Je=P.forwardRef(({className:t,...e},n)=>r.jsx("div",{ref:n,className:zt("p-6 pt-0",t),...e}));Je.displayName="CardContent";const OT=P.forwardRef(({className:t,...e},n)=>r.jsx("div",{ref:n,className:zt("flex items-center p-6 pt-0",t),...e}));OT.displayName="CardFooter";var yst="Label",UPe=P.forwardRef((t,e)=>r.jsx(On.label,{...t,ref:e,onMouseDown:n=>{var i;n.target.closest("button, input, select, textarea")||((i=t.onMouseDown)==null||i.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));UPe.displayName=yst;var qPe=UPe;const xst=MC("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Qe=P.forwardRef(({className:t,...e},n)=>r.jsx(qPe,{ref:n,className:zt(xst(),t),...e}));Qe.displayName=qPe.displayName;function vst(){const t=Cg(),e=window.location.hostname;if(!(e==="listings.relevelup.com"||e.startsWith("listings.")))return null;const s=t.pathname.slice(1);return!s||s===""?r.jsx($Pe,{}):s.startsWith("public/")?null:r.jsx(_st,{slug:s})}function _st({slug:t}){return r.jsx(jst,{slug:t})}const bst={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},wst={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},sje={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function jst({slug:t}){var Z,re;const{data:e,isLoading:n}=zPe(t),s=BPe(),[i,o]=P.useState(""),[c,a]=P.useState(""),[f,m]=P.useState(""),[y,v]=P.useState(""),[w,k]=P.useState(!1),[C,S]=P.useState(!1),[T,I]=P.useState(null),A=he=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(he),D=async he=>{if(he.preventDefault(),!(!i.trim()||!f.trim()||!e)){k(!0);try{await s.mutateAsync({listingId:e.id,agentId:e.agent_id,firstName:i.trim(),lastName:c.trim(),email:f.trim(),phone:y.trim()}),S(!0),Ge.success("Thanks! The agent will be in touch soon.")}catch(ue){console.error("Lead submission error:",ue),Ge.error(`Failed to submit: ${ue.message||"Please try again"}`)}finally{k(!1)}}},$=(e==null?void 0:e.photos)||[],F=$.find(he=>he.is_primary)||$[0],q=()=>{T!==null&&I(T===0?$.length-1:T-1)},W=()=>{T!==null&&I(T===$.length-1?0:T+1)};if(n)return r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"border-b bg-card",children:r.jsx("div",{className:"container mx-auto px-4 py-4",children:r.jsx(Gr,{className:"h-8 w-32"})})}),r.jsxs("div",{className:"container mx-auto px-4 py-8",children:[r.jsx(Gr,{className:"h-10 w-48 mb-6"}),r.jsx(Gr,{className:"aspect-video mb-6"}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"md:col-span-2 space-y-4",children:[r.jsx(Gr,{className:"h-12 w-48"}),r.jsx(Gr,{className:"h-6 w-full"}),r.jsx(Gr,{className:"h-6 w-3/4"})]}),r.jsx(Gr,{className:"h-64"})]})]})]});if(!e)return r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"border-b bg-card",children:r.jsx("div",{className:"container mx-auto px-4 py-4",children:r.jsx("a",{href:"/",className:"flex items-center gap-2",children:r.jsx("img",{src:PA,alt:"LevelUp",className:"h-8"})})})}),r.jsxs("div",{className:"container mx-auto px-4 py-16 text-center",children:[r.jsx(Hi,{className:"h-16 w-16 mx-auto text-muted-foreground mb-4"}),r.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Listing Not Found"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"This listing may no longer be available."}),r.jsx(te,{asChild:!0,children:r.jsx("a",{href:"/",children:"Browse All Listings"})})]})]});const K=e.property_address?`${e.property_address} - ${e.city}, ${e.state}`:`${e.city}, ${e.state} Home for Sale`;return r.jsxs(r.Fragment,{children:[r.jsxs(Mg,{children:[r.jsxs("title",{children:[K," | LevelUp Listings"]}),r.jsx("meta",{name:"description",content:`${A(e.price)} - ${e.bedrooms||""}BD ${e.bathrooms||""}BA ${e.square_footage?e.square_footage.toLocaleString()+" sqft":""} ${sje[e.property_type]} in ${e.city}, ${e.state}. ${((Z=e.description)==null?void 0:Z.slice(0,150))||""}`}),r.jsx("meta",{property:"og:title",content:K}),r.jsx("meta",{property:"og:description",content:`${A(e.price)} - ${e.bedrooms||""}BD ${e.bathrooms||""}BA in ${e.city}, ${e.state}`}),r.jsx("meta",{property:"og:type",content:"website"}),F&&r.jsx("meta",{property:"og:image",content:F.photo_url})]}),r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"border-b bg-card sticky top-0 z-50",children:r.jsx("div",{className:"container mx-auto px-4 py-4",children:r.jsx("div",{className:"flex items-center justify-between",children:r.jsx("a",{href:"/",className:"flex items-center gap-2",children:r.jsx("img",{src:PA,alt:"LevelUp",className:"h-8"})})})})}),r.jsxs("div",{className:"container mx-auto px-4 py-6",children:[r.jsxs("a",{href:"/",className:"inline-flex items-center text-muted-foreground hover:text-foreground mb-6",children:[r.jsx(Va,{className:"h-4 w-4 mr-2"}),"Back to Listings"]}),$.length>0&&r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-8",children:[r.jsx("div",{className:"md:col-span-2",children:r.jsx("div",{className:"aspect-[16/10] rounded-lg overflow-hidden bg-muted cursor-pointer",onClick:()=>I(0),children:r.jsx("img",{src:F==null?void 0:F.photo_url,alt:"Primary",className:"w-full h-full object-cover hover:scale-105 transition-transform duration-300"})})}),r.jsx("div",{className:"grid grid-cols-2 gap-2",children:$.slice(1,5).map((he,ue)=>r.jsxs("div",{className:"aspect-square rounded-lg overflow-hidden bg-muted cursor-pointer relative",onClick:()=>I(ue+1),children:[r.jsx("img",{src:he.photo_url,alt:`Photo ${ue+2}`,className:"w-full h-full object-cover hover:scale-105 transition-transform duration-300"}),ue===3&&$.length>5&&r.jsxs("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center text-white font-semibold",children:["+",$.length-5," more"]})]},he.id))})]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-8",children:[r.jsxs("div",{className:"md:col-span-2 space-y-6",children:[r.jsxs("div",{children:[r.jsx("div",{className:"flex items-center gap-2 mb-3",children:r.jsx(Rt,{className:`${bst[e.status]} text-white border-0`,children:wst[e.status]})}),r.jsx("h1",{className:"text-4xl font-bold text-primary mb-2",children:A(e.price)}),e.property_address&&r.jsx("p",{className:"text-xl font-medium",children:e.property_address}),r.jsxs("p",{className:"text-muted-foreground flex items-center gap-1",children:[r.jsx(yl,{className:"h-4 w-4"}),e.city,", ",e.state,e.neighborhood&&` • ${e.neighborhood}`]})]}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4 py-4 border-y",children:[e.bedrooms&&r.jsxs("div",{className:"text-center",children:[r.jsx(Of,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:e.bedrooms}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Beds"})]}),e.bathrooms&&r.jsxs("div",{className:"text-center",children:[r.jsx(Lf,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:e.bathrooms}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Baths"})]}),e.square_footage&&r.jsxs("div",{className:"text-center",children:[r.jsx(im,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:e.square_footage.toLocaleString()}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Sq Ft"})]}),e.year_built&&r.jsxs("div",{className:"text-center",children:[r.jsx(li,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:e.year_built}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Built"})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(Rt,{variant:"secondary",children:[r.jsx(ra,{className:"h-3 w-3 mr-1"}),sje[e.property_type]]}),e.lot_size&&r.jsxs(Rt,{variant:"secondary",children:["Lot: ",e.lot_size]}),e.has_hoa&&r.jsx(Rt,{variant:"secondary",children:"HOA"})]}),e.description&&r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold mb-2",children:"About This Property"}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:e.description})]}),e.agent_notes&&e.agent_notes_public&&r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Agent Notes"}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:e.agent_notes})]}),e.mls_link&&r.jsx(te,{variant:"outline",asChild:!0,children:r.jsxs("a",{href:e.mls_link,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(Fs,{className:"h-4 w-4 mr-2"}),"View on MLS"]})})]})]}),r.jsxs("div",{className:"space-y-6",children:[e.agent&&r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsxs(Yt,{className:"text-lg flex items-center gap-2",children:[r.jsx(jc,{className:"h-5 w-5"}),"Listing Agent"]})}),r.jsxs(Je,{children:[r.jsx("p",{className:"font-semibold text-lg",children:e.agent.name}),((re=e.agent.brokerage)==null?void 0:re.name)&&r.jsx("p",{className:"text-sm text-muted-foreground",children:e.agent.brokerage.name})]})]}),r.jsxs(Ye,{className:"border-primary",children:[r.jsx(Ht,{children:r.jsx(Yt,{className:"text-lg",children:"Interested in this property?"})}),r.jsx(Je,{children:C?r.jsxs("div",{className:"text-center py-4",children:[r.jsx("div",{className:"h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center mx-auto mb-3",children:r.jsx(di,{className:"h-6 w-6 text-primary"})}),r.jsx("p",{className:"font-medium",children:"Thanks for your interest!"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"The listing agent will contact you soon."})]}):r.jsxs("form",{onSubmit:D,className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"firstName",children:"First Name *"}),r.jsx(yt,{id:"firstName",type:"text",placeholder:"John",value:i,onChange:he=>o(he.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"lastName",children:"Last Name"}),r.jsx(yt,{id:"lastName",type:"text",placeholder:"Doe",value:c,onChange:he=>a(he.target.value)})]})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"email",children:"Email *"}),r.jsx(yt,{id:"email",type:"email",placeholder:"you@example.com",value:f,onChange:he=>m(he.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"phone",children:"Phone"}),r.jsx(yt,{id:"phone",type:"tel",placeholder:"(555) 123-4567",value:y,onChange:he=>v(he.target.value)})]}),r.jsx(te,{type:"submit",className:"w-full",disabled:w,children:w?"Submitting...":"Get More Info"}),r.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"The listing agent will reach out to you directly."})]})})]})]})]})]}),r.jsx($r,{open:T!==null,onOpenChange:()=>I(null),children:r.jsxs(zr,{className:"max-w-5xl p-0 bg-black/95",children:[r.jsx(Zr,{className:"sr-only",children:r.jsx(Kr,{children:"Photo Gallery"})}),r.jsx("button",{onClick:()=>I(null),className:"absolute right-4 top-4 z-50 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(Ms,{className:"h-5 w-5"})}),T!==null&&$[T]&&r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:$[T].photo_url,alt:`Photo ${T+1}`,className:"w-full max-h-[80vh] object-contain"}),$.length>1&&r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:q,className:"absolute left-4 top-1/2 -translate-y-1/2 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(sd,{className:"h-6 w-6"})}),r.jsx("button",{onClick:W,className:"absolute right-4 top-1/2 -translate-y-1/2 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(Ha,{className:"h-6 w-6"})}),r.jsxs("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 text-white bg-black/50 px-3 py-1 rounded-full text-sm",children:[T+1," / ",$.length]})]})]})]})}),r.jsx("footer",{className:"border-t py-8 mt-16",children:r.jsxs("div",{className:"container mx-auto px-4 text-center text-sm text-muted-foreground",children:[r.jsxs("p",{children:["© ",new Date().getFullYear()," LevelUp. All rights reserved."]}),r.jsx("p",{className:"mt-2",children:r.jsx("a",{href:"https://relevelup.com",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground",children:"relevelup.com"})})]})})]})]})}const Kue="levelup_affiliate_ref",kst=30,Nst=()=>{const[t]=Ed();P.useEffect(()=>{const e=t.get("ref");if(e){const n={code:e.toUpperCase(),timestamp:Date.now()};localStorage.setItem(Kue,JSON.stringify(n)),console.log("[Affiliate] Stored referral code:",e)}},[t])},Sst=()=>{try{const t=localStorage.getItem(Kue);if(!t)return null;const e=JSON.parse(t),n=kst*24*60*60*1e3;return Date.now()-e.timestamp>n?(localStorage.removeItem(Kue),console.log("[Affiliate] Referral code expired"),null):e.code}catch{return null}},Kee="/assets/levelup-logo-header-_ZX7DvlA.png",Cst="/assets/scale-your-team-ku4MPatU.png";function Mst({open:t,onOpenChange:e}){return r.jsx($r,{open:t,onOpenChange:e,children:r.jsxs(zr,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[r.jsx(Zr,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-[#4a6b6d]/10 rounded-lg",children:r.jsx(ra,{className:"h-5 w-5 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx(Kr,{children:"Schedule a Brokerage Interest Meeting"}),r.jsx(ls,{children:"Learn how LevelUp can empower your entire team"})]})]})}),t&&r.jsx("iframe",{src:"https://tidycal.com/jeremycollins/brokerinterestmeeting",className:"w-full border-0 rounded-lg",style:{height:"600px",minHeight:"500px"},title:"Schedule Brokerage Interest Meeting"})]})})}const Xc={individual_agent:{name:"Individual Agent",price:"$39",period:"/month",description:"Perfect for independent agents ready to level up",features:["Full dashboard access","300+ professional templates","Academy training library","Community & networking","Live events & workshops","Social media content","Newsletter resources","Email support"],trial:"7-day free trial"},brokerage_under_25:{name:"Brokerage",subtitle:"Under 25 Agents",price:"$299",period:"/month",description:"Empower your entire team to succeed",features:["Everything in Individual","Brokerage manager dashboard","Invite & manage up to 25 agents","Exclusive brokerage resources","Team performance analytics","Agent onboarding tools","Resource sharing","Priority support"]},brokerage_over_25:{name:"Brokerage",subtitle:"Over 25 Agents",price:"$499",period:"/month",description:"Scale your brokerage without limits",features:["Everything in Brokerage","Unlimited agents","Advanced team analytics","Dedicated account manager","Custom onboarding sessions","White-glove support"]}},Tst=[{icon:Sf,title:"Academy Training",description:"Access a library of on-demand video training covering lead generation, marketing, technology, and more."},{icon:Gd,title:"300+ Templates",description:"Professional Canva templates for social media, flyers, postcards, and marketing materials."},{icon:li,title:"Live Events",description:"Weekly live training sessions, workshops, and Q&A events with industry experts."},{icon:Hl,title:"Agent Community",description:"Connect with fellow agents, share wins, ask questions, and network in our private community."},{icon:Ai,title:"Resource Kits",description:"Downloadable toolkits with scripts, checklists, guides, and everything you need to close more deals."},{icon:Qa,title:"Social Swag",description:"Fresh social media content and designs updated regularly to help you stand out online."}],Ast=[{icon:hs,title:"Contact Management",description:"Organize your sphere into relationship tiers—Top 25, Past Clients, Referral Partners, and more."},{icon:Mi,title:"Smart Touchpoint Plans",description:"Automated action plans that tell you exactly who to contact and how, based on relationship type."},{icon:Wa,title:"One-Tap Actions",description:"Call, text, or email contacts directly with pre-written scripts tailored to each relationship."},{icon:og,title:"Birthday & Anniversary Alerts",description:"Never miss an important date—get reminders for birthdays and home anniversaries."},{icon:yl,title:"Pop-by Map",description:"See all your contacts on a map and plan efficient pop-by routes in your area."},{icon:xc,title:"Momentum Tracking",description:"Track your touch streaks, weekly goals, and relationship health scores."},{icon:ql,title:"Relationship Health",description:"Visual dashboard showing which contacts need attention based on last touch date."},{icon:e1,title:"Daily Action Cards",description:"Wake up to a prioritized list of exactly who to reach out to today."}],Est=[{name:"Sarah M.",role:"Top Producer, RE/MAX",quote:"LevelUp completely transformed how I run my business. The templates alone save me hours every week."},{name:"Mike T.",role:"Brokerage Owner",quote:"Onboarding new agents used to take weeks. Now they're productive from day one with all the training resources."},{name:"Jessica L.",role:"Team Lead",quote:"The community is incredible. I've learned more from other agents here than any conference I've attended."}],Ist=()=>{const{user:t,loading:e}=Fr(),n=es(),[s]=Ed();P.useEffect(()=>{const W=window.location.host==="listings.relevelup.com",K=window.location.pathname==="/";if(W&&K){n("/public/listings",{replace:!0});return}},[n]);const[i,o]=P.useState(null),[c,a]=P.useState(null),[f,m]=P.useState(!1),[y,v]=P.useState(""),[w,k]=P.useState(""),[C,S]=P.useState(""),[T,I]=P.useState(!1),[A,D]=P.useState(!1),$=(W,K=!1)=>{a({tier:W,skipTrial:K}),m(!0)};Nst(),P.useEffect(()=>{const W=window.location.host==="listings.relevelup.com",K=location.pathname.startsWith("/public/");!e&&t&&!W&&!K&&n("/dashboard")},[t,e,n,location.pathname]),P.useEffect(()=>{s.get("canceled")==="true"&&Ge.error("Checkout was canceled. Feel free to try again when you're ready!")},[s]);const F=async(W,K=!1)=>{if(!y){Ge.error("Please enter your email address");return}if(!w.trim()){Ge.error("Please enter your full name");return}I(!0),o(W+(K?"_direct":""));const Z=Sst();try{const{data:re,error:he}=await ee.functions.invoke("create-checkout",{body:{tier:W,email:y,name:w.trim(),couponCode:C.trim()||void 0,skipTrial:K,referralCode:Z}});if(he)throw he;if(re!=null&&re.url)window.open(re.url,"_blank","noopener,noreferrer"),Ge.success("Checkout opened in a new tab");else throw new Error("No checkout URL returned")}catch(re){console.error("Checkout error:",re),Ge.error(re.message||"Failed to start checkout. Please try again.")}finally{I(!1),o(null),m(!1),a(null)}},q=()=>{c&&F(c.tier,c.skipTrial)};return e?r.jsx("div",{className:"flex min-h-screen items-center justify-center bg-[#4a6b6d]",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-white border-t-transparent"})}):r.jsxs("div",{className:"min-h-screen bg-background overflow-hidden",children:[r.jsx("nav",{className:"fixed top-0 left-0 right-0 z-50 bg-[#4a6b6d] shadow-md",children:r.jsxs("div",{className:"container mx-auto px-4 py-3 flex items-center justify-between",children:[r.jsx("div",{className:"flex items-center",children:r.jsx("img",{src:Kee,alt:"LevelUp",className:"h-8 md:h-10"})}),r.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[r.jsx(te,{variant:"ghost",className:"text-white/90 hover:text-white hover:bg-white/10 hidden sm:inline-flex",onClick:()=>{var W;return(W=document.getElementById("features"))==null?void 0:W.scrollIntoView({behavior:"smooth"})},children:"Features"}),r.jsx(te,{variant:"ghost",className:"text-white/90 hover:text-white hover:bg-white/10 hidden sm:inline-flex",onClick:()=>{var W;return(W=document.getElementById("pricing"))==null?void 0:W.scrollIntoView({behavior:"smooth"})},children:"Pricing"}),r.jsx(te,{onClick:()=>n("/auth"),className:"bg-white text-[#4a6b6d] hover:bg-gray-100 font-medium shadow-md",children:"Sign In"})]})]})}),r.jsxs("section",{className:"relative pt-24 pb-20 bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsx("div",{className:"container mx-auto px-4 relative",children:r.jsxs("div",{className:"max-w-5xl mx-auto text-center space-y-8",children:[r.jsx("div",{className:"flex justify-center mb-8",children:r.jsx("img",{alt:"LevelUp Consulting Group",className:"h-[136px] md:h-[164px] drop-shadow-lg",src:"/lovable-uploads/3a0c7ef9-9e79-411f-a9af-6f2a99e8bd7b.webp"})}),r.jsxs("p",{className:"text-lg text-white/80 max-w-3xl mx-auto leading-relaxed font-sans font-bold md:text-4xl",children:["The tools you need to get it done.",r.jsx("br",{}),r.jsx("em",{children:"The platform you need to keep it going."})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center items-center pt-4",children:[r.jsxs(te,{size:"lg",onClick:()=>{var W;return(W=document.getElementById("free-trial"))==null?void 0:W.scrollIntoView({behavior:"smooth"})},className:"px-8 py-7 text-lg font-semibold bg-white text-[#1e3a4c] hover:bg-white/90 shadow-2xl transition-all hover:scale-105 group rounded-full",children:["Start Your Free Trial",r.jsx(Ho,{className:"ml-2 w-5 h-5 group-hover:translate-x-1 transition-transform"})]}),r.jsx(te,{size:"lg",variant:"outline",onClick:()=>{var W;return(W=document.getElementById("features"))==null?void 0:W.scrollIntoView({behavior:"smooth"})},className:"px-8 py-7 text-lg font-semibold border-2 border-white text-white bg-transparent hover:bg-white hover:text-[#1e3a4c] rounded-full",children:"See What's Included"})]})]})})]}),r.jsx("section",{className:"py-20 bg-background",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsxs("div",{className:"max-w-4xl mx-auto text-center space-y-8",children:[r.jsx("h2",{className:"text-3xl md:text-5xl leading-tight font-sans font-semibold text-secondary",children:"We help brokerages and agents grow with training, tools, and built-in execution."}),r.jsxs("div",{className:"space-y-2 text-lg text-muted-foreground",children:[r.jsx("p",{children:"Agents get weekly coaching + plug-and-play marketing."}),r.jsx("p",{children:"Brokerages get higher adoption, consistency, and real engagement."})]}),r.jsx("p",{className:"text-2xl md:text-4xl text-[#4a6b6d] pt-4 font-sans font-bold",children:"LEVELUP EQUIPS BOTH TO THRIVE."}),r.jsx("p",{className:"text-lg text-muted-foreground",children:"Learn how we support agents and empower brokerages to grow—together."}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center pt-4",children:[r.jsxs(te,{size:"lg",variant:"outline",onClick:()=>{var W;return(W=document.getElementById("brokerage"))==null?void 0:W.scrollIntoView({behavior:"smooth"})},className:"border-[#4a6b6d] text-[#4a6b6d] hover:bg-[#4a6b6d]/5",children:[r.jsx(ra,{className:"mr-2 h-5 w-5"}),"Brokerage Partnership"]}),r.jsxs(te,{size:"lg",onClick:()=>{var W;return(W=document.getElementById("pricing"))==null?void 0:W.scrollIntoView({behavior:"smooth"})},className:"bg-[#4a6b6d] hover:bg-[#3d5a5c]",children:[r.jsx(jc,{className:"mr-2 h-5 w-5"}),"Individual Membership"]})]})]})})}),r.jsx("section",{id:"features",className:"py-20 bg-muted/30",children:r.jsxs("div",{className:"container mx-auto px-4",children:[r.jsxs("div",{className:"text-center max-w-3xl mx-auto mb-16",children:[r.jsx("h2",{className:"text-3xl md:text-4xl mb-6 font-sans font-bold",children:"What's inside our members only portal?"}),r.jsx("p",{className:"text-lg text-muted-foreground",children:"Everything you need to grow your business, all in one place."})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8 max-w-6xl mx-auto",children:Tst.map((W,K)=>r.jsxs(Ye,{className:"group relative overflow-hidden border hover:border-[#4a6b6d]/50 transition-all duration-300 hover:shadow-lg bg-background",children:[r.jsxs(Ht,{children:[r.jsx("div",{className:"w-14 h-14 rounded-2xl bg-[#4a6b6d]/10 flex items-center justify-center mb-4",children:r.jsx(W.icon,{className:"w-7 h-7 text-[#4a6b6d]"})}),r.jsx(Yt,{className:"text-xl font-sans",children:W.title})]}),r.jsx(Je,{children:r.jsx("p",{className:"text-muted-foreground leading-relaxed",children:W.description})})]},K))})]})}),r.jsxs("section",{id:"agent-os",className:"py-20 bg-gradient-to-br from-[#4a6b6d] to-[#3d5a5c] relative overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsxs("div",{className:"container mx-auto px-4 relative",children:[r.jsxs("div",{className:"text-center max-w-3xl mx-auto mb-16",children:[r.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-white/10 text-white text-sm font-medium mb-6",children:[r.jsx(Mi,{className:"w-4 h-4"}),"Included with Membership"]}),r.jsxs("h2",{className:"text-3xl mb-6 text-white font-sans font-bold md:text-6xl",children:["Meet ",r.jsx("span",{className:"italic",children:"Agent OS"})]}),r.jsx("p",{className:"text-lg text-white/80",children:"Your relationship-first operating system. Never forget a follow-up, track every touchpoint, and turn your sphere into a referral machine."})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 max-w-6xl mx-auto",children:Ast.map((W,K)=>r.jsxs(Ye,{className:"group relative overflow-hidden border-0 bg-white/10 backdrop-blur-sm hover:bg-white/20 transition-all duration-300",children:[r.jsxs(Ht,{className:"pb-3",children:[r.jsx("div",{className:"w-12 h-12 rounded-xl bg-white/20 flex items-center justify-center mb-3",children:r.jsx(W.icon,{className:"w-6 h-6 text-white"})}),r.jsx(Yt,{className:"text-lg font-semibold text-white",children:W.title})]}),r.jsx(Je,{children:r.jsx("p",{className:"text-white/70 text-sm leading-relaxed",children:W.description})})]},K))}),r.jsx("div",{className:"text-center mt-12",children:r.jsxs(te,{size:"lg",onClick:()=>{var W;return(W=document.getElementById("pricing"))==null?void 0:W.scrollIntoView({behavior:"smooth"})},className:"bg-white text-[#4a6b6d] hover:bg-white/90 shadow-xl transition-all hover:scale-105",children:["Get Agent OS with Your Membership",r.jsx(Ho,{className:"ml-2 w-5 h-5"})]})})]})]}),r.jsx("section",{id:"brokerage",className:"py-20 bg-[#4a6b6d]/5",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsx("div",{className:"max-w-6xl mx-auto",children:r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-12 items-center",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-[#4a6b6d]/10 text-[#4a6b6d] text-sm font-medium",children:[r.jsx(ra,{className:"w-4 h-4"}),"For Brokerages"]}),r.jsxs("h2",{className:"text-3xl font-sans font-bold md:text-6xl",children:["Empower Your"," ",r.jsx("span",{className:"italic text-[#4a6b6d]",children:"Entire Team"})]}),r.jsx("p",{className:"text-lg text-muted-foreground",children:"Give every agent on your team access to world-class training and resources. Track performance, streamline onboarding, and watch your brokerage thrive."}),r.jsx("ul",{className:"space-y-4",children:["Dedicated brokerage manager dashboard","Invite and manage agents with one click","Exclusive brokerage-only resources","Team analytics and performance tracking","Simplified agent onboarding","Share resources across your team"].map((W,K)=>r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-6 h-6 rounded-full bg-[#4a6b6d]/10 flex items-center justify-center flex-shrink-0",children:r.jsx(Ba,{className:"w-4 h-4 text-[#4a6b6d]"})}),r.jsx("span",{className:"text-foreground",children:W})]},K))}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-4",children:[r.jsxs(te,{size:"lg",onClick:()=>{var W;return(W=document.getElementById("pricing"))==null?void 0:W.scrollIntoView({behavior:"smooth"})},className:"bg-[#4a6b6d] hover:bg-[#3d5a5c]",children:["See Brokerage Plans",r.jsx(Ha,{className:"ml-2 w-5 h-5"})]}),r.jsxs(te,{size:"lg",variant:"outline",onClick:()=>D(!0),className:"border-[#4a6b6d] text-[#4a6b6d] hover:bg-[#4a6b6d]/10",children:[r.jsx(li,{className:"mr-2 w-5 h-5"}),"Schedule Info Session"]})]})]}),r.jsx("div",{className:"relative hidden md:block",children:r.jsx("img",{src:Cst,alt:"Scale Your Team from 5 to 500 Agents",className:"w-full rounded-3xl shadow-lg"})})]})})})}),r.jsx("section",{className:"py-20 bg-background",children:r.jsxs("div",{className:"container mx-auto px-4",children:[r.jsxs("div",{className:"text-center max-w-3xl mx-auto mb-16",children:[r.jsxs("h2",{className:"text-3xl mb-6 font-sans md:text-5xl font-bold",children:["Agents Love ",r.jsx("span",{className:"italic text-[#4a6b6d]",children:"LevelUp"})]}),r.jsx("p",{className:"text-lg text-muted-foreground",children:"See what top producers are saying about the platform."})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8 max-w-6xl mx-auto",children:Est.map((W,K)=>r.jsx(Ye,{className:"bg-muted/30 border-0",children:r.jsxs(Je,{className:"pt-8",children:[r.jsx("div",{className:"flex gap-1 mb-4",children:[1,2,3,4,5].map(Z=>r.jsx(Ca,{className:"w-5 h-5 fill-yellow-400 text-yellow-400"},Z))}),r.jsxs("p",{className:"text-lg mb-6 italic text-muted-foreground",children:['"',W.quote,'"']}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:W.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:W.role})]})]})},K))})]})}),r.jsxs("section",{id:"free-trial",className:"py-20 bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] relative overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsx("div",{className:"container mx-auto px-4 relative",children:r.jsxs("div",{className:"max-w-3xl mx-auto text-center space-y-8",children:[r.jsxs("h2",{className:"text-3xl md:text-5xl font-bold text-white",children:["Start Your Free Trial ",r.jsx("span",{className:"italic",children:"Today"})]}),r.jsx("p",{className:"text-lg md:text-xl text-white/80 leading-relaxed",children:"Get instant access to 7 days of trainings, templates, and tools — designed to give you quick wins now and resources you'll keep forever."}),r.jsx("div",{className:"pt-4",children:r.jsxs(te,{size:"lg",className:"px-12 py-7 text-lg font-semibold bg-white text-[#4a6b6d] hover:bg-white/90 shadow-2xl transition-all hover:scale-105 group rounded-full",onClick:()=>$("individual_agent"),children:["Start Free Trial",r.jsx(Ho,{className:"ml-2 w-5 h-5 group-hover:translate-x-1 transition-transform"})]})})]})})]}),r.jsx("section",{id:"pricing",className:"py-20 bg-muted/30",children:r.jsxs("div",{className:"container mx-auto px-4",children:[r.jsxs("div",{className:"text-center mb-16",children:[r.jsxs("h2",{className:"text-3xl mb-6 font-sans md:text-5xl font-bold",children:["Simple, Transparent ",r.jsx("span",{className:"italic text-[#4a6b6d]",children:"Pricing"})]}),r.jsx("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto",children:"Choose the plan that fits your needs. All plans include everything you need to succeed."})]}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8 max-w-6xl mx-auto",children:[r.jsxs(Ye,{className:"relative flex flex-col border hover:border-[#4a6b6d]/50 transition-all hover:shadow-xl bg-background",children:[r.jsxs(Ht,{className:"pb-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#4a6b6d]/10 flex items-center justify-center",children:r.jsx(jc,{className:"w-5 h-5 text-[#4a6b6d]"})}),r.jsx(Yt,{className:"text-xl font-sans",children:Xc.individual_agent.name})]}),r.jsxs("div",{className:"flex items-baseline gap-1 mt-4",children:[r.jsx("span",{className:"text-5xl font-bold",children:Xc.individual_agent.price}),r.jsx("span",{className:"text-muted-foreground text-lg",children:Xc.individual_agent.period})]}),r.jsx(An,{className:"text-base mt-2",children:Xc.individual_agent.description}),r.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-green-500/10 text-green-600 text-sm font-medium mt-4",children:[r.jsx(Xi,{className:"w-4 h-4"}),Xc.individual_agent.trial]})]}),r.jsx(Je,{className:"flex-1 pt-0",children:r.jsx("ul",{className:"space-y-3",children:Xc.individual_agent.features.map((W,K)=>r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(Ba,{className:"w-5 h-5 text-[#4a6b6d] flex-shrink-0"}),r.jsx("span",{children:W})]},K))})}),r.jsxs(OT,{className:"flex flex-col gap-3 pt-4",children:[r.jsx(te,{className:"w-full py-6 text-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:()=>$("individual_agent"),children:"Start Free Trial"}),r.jsx(te,{variant:"outline",className:"w-full rounded-full border-2 border-[#4a6b6d] text-[#4a6b6d] bg-white hover:bg-[#4a6b6d]/5 uppercase text-sm font-medium tracking-wide",onClick:()=>$("individual_agent",!0),children:"Skip Trial, Subscribe Now"})]})]}),r.jsxs(Ye,{className:"relative flex flex-col border-2 border-[#4a6b6d] shadow-2xl scale-105 bg-background",children:[r.jsx("div",{className:"absolute -top-4 left-1/2 -translate-x-1/2 px-6 py-2 bg-[#4a6b6d] text-white text-sm font-semibold rounded-full shadow-lg",children:"Most Popular"}),r.jsxs(Ht,{className:"pb-4 pt-8",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#4a6b6d]/20 flex items-center justify-center",children:r.jsx(ra,{className:"w-5 h-5 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx(Yt,{className:"text-xl font-sans",children:Xc.brokerage_under_25.name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:Xc.brokerage_under_25.subtitle})]})]}),r.jsxs("div",{className:"flex items-baseline gap-1 mt-4",children:[r.jsx("span",{className:"text-5xl font-bold",children:Xc.brokerage_under_25.price}),r.jsx("span",{className:"text-muted-foreground text-lg",children:Xc.brokerage_under_25.period})]}),r.jsx(An,{className:"text-base mt-2",children:Xc.brokerage_under_25.description})]}),r.jsx(Je,{className:"flex-1 pt-0",children:r.jsx("ul",{className:"space-y-3",children:Xc.brokerage_under_25.features.map((W,K)=>r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(Ba,{className:"w-5 h-5 text-[#4a6b6d] flex-shrink-0"}),r.jsx("span",{children:W})]},K))})}),r.jsx(OT,{className:"pt-4",children:r.jsx(te,{className:"w-full py-6 text-lg shadow-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:()=>$("brokerage_under_25"),children:"Get Started"})})]}),r.jsxs(Ye,{className:"relative flex flex-col border hover:border-[#4a6b6d]/50 transition-all hover:shadow-xl bg-background",children:[r.jsxs(Ht,{className:"pb-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#4a6b6d]/10 flex items-center justify-center",children:r.jsx(ra,{className:"w-5 h-5 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx(Yt,{className:"text-xl font-sans",children:Xc.brokerage_over_25.name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:Xc.brokerage_over_25.subtitle})]})]}),r.jsxs("div",{className:"flex items-baseline gap-1 mt-4",children:[r.jsx("span",{className:"text-5xl font-bold",children:Xc.brokerage_over_25.price}),r.jsx("span",{className:"text-muted-foreground text-lg",children:Xc.brokerage_over_25.period})]}),r.jsx(An,{className:"text-base mt-2",children:Xc.brokerage_over_25.description})]}),r.jsx(Je,{className:"flex-1 pt-0",children:r.jsx("ul",{className:"space-y-3",children:Xc.brokerage_over_25.features.map((W,K)=>r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(Ba,{className:"w-5 h-5 text-[#4a6b6d] flex-shrink-0"}),r.jsx("span",{children:W})]},K))})}),r.jsx(OT,{className:"pt-4",children:r.jsx(te,{className:"w-full py-6 text-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:()=>$("brokerage_over_25"),children:"Get Started"})})]})]})]})}),r.jsxs("section",{className:"py-20 bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] relative overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsx("div",{className:"container mx-auto px-4 relative",children:r.jsxs("div",{className:"max-w-4xl mx-auto text-center space-y-8",children:[r.jsx("h2",{className:"text-3xl text-white font-sans md:text-5xl",children:"Ready to Level Up?"}),r.jsx("p",{className:"text-lg text-white/80 max-w-2xl mx-auto",children:"Join thousands of agents who are closing more deals, saving time, and growing their business with LevelUp."}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[r.jsxs(te,{size:"lg",onClick:()=>{var W;return(W=document.getElementById("pricing"))==null?void 0:W.scrollIntoView({behavior:"smooth"})},className:"px-10 py-7 text-lg font-semibold bg-white text-[#4a6b6d] hover:bg-white/90 shadow-2xl transition-all hover:scale-105",children:["Start Your Free Trial",r.jsx(Ho,{className:"ml-2 w-5 h-5"})]}),r.jsx(te,{size:"lg",onClick:()=>n("/auth"),className:"px-10 py-7 text-lg font-semibold border-2 border-white text-white bg-transparent hover:bg-white hover:text-[#4a6b6d]",children:"Sign In"})]})]})})]}),r.jsx("footer",{className:"py-12 bg-[#3d5a5c] text-white/80",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsxs("div",{className:"flex flex-col md:flex-row items-center justify-between gap-4",children:[r.jsx("img",{src:Kee,alt:"LevelUp",className:"h-8"}),r.jsxs("p",{className:"text-sm",children:["© ",new Date().getFullYear()," LevelUp. All rights reserved."]}),r.jsxs("div",{className:"flex items-center gap-6",children:[r.jsx("a",{href:"/privacy-policy",className:"text-white/60 hover:text-white transition-colors text-sm",children:"Privacy Policy"}),r.jsx("a",{href:"mailto:support@relevelup.com",className:"text-white/60 hover:text-white transition-colors text-sm",children:"Contact Support"})]})]})})}),r.jsx(Mst,{open:A,onOpenChange:D}),r.jsx($r,{open:f,onOpenChange:m,children:r.jsxs(zr,{className:"sm:max-w-md",children:[r.jsxs(Zr,{children:[r.jsx(Kr,{className:"text-xl font-sans font-semibold",children:"Enter your details to get started"}),r.jsx(ls,{children:(c==null?void 0:c.tier)==="individual_agent"&&!(c!=null&&c.skipTrial)?"Start your 7-day free trial":(c==null?void 0:c.tier)==="individual_agent"?"Subscribe to Individual Agent":(c==null?void 0:c.tier)==="brokerage_under_25"?"Subscribe to Brokerage (Under 25 Agents)":"Subscribe to Brokerage (Over 25 Agents)"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsxs(Qe,{htmlFor:"dialog-name",children:["Full Name ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx(yt,{id:"dialog-name",type:"text",placeholder:"John Smith",value:w,onChange:W=>k(W.target.value),className:"mt-1",required:!0})]}),r.jsxs("div",{children:[r.jsxs(Qe,{htmlFor:"dialog-email",children:["Email Address ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx(yt,{id:"dialog-email",type:"email",placeholder:"you@example.com",value:y,onChange:W=>v(W.target.value),className:"mt-1",required:!0})]}),r.jsxs("div",{children:[r.jsxs(Qe,{htmlFor:"dialog-coupon",children:["Discount Code ",r.jsx("span",{className:"text-muted-foreground",children:"(Optional)"})]}),r.jsx(yt,{id:"dialog-coupon",type:"text",placeholder:"Enter discount code",value:C,onChange:W=>S(W.target.value),className:"mt-1"})]})]}),r.jsx(te,{className:"w-full py-6 text-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:q,disabled:T,children:T?"Loading...":"Continue to Checkout"})]})})]})},Pst=()=>r.jsxs(r.Fragment,{children:[r.jsxs(Mg,{children:[r.jsx("title",{children:"Privacy Policy | LevelUp"}),r.jsx("meta",{name:"description",content:"Privacy Policy for LevelUp platform"})]}),r.jsx("div",{className:"min-h-screen bg-background py-12 px-4 sm:px-6 lg:px-8",children:r.jsxs("div",{className:"max-w-3xl mx-auto",children:[r.jsx("h1",{className:"text-3xl font-bold text-foreground mb-8",children:"Privacy Policy"}),r.jsxs("div",{className:"prose prose-sm max-w-none text-muted-foreground space-y-6",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Last updated: January 17, 2026"}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"1. Introduction"}),r.jsx("p",{children:'Welcome to LevelUp ("we," "our," or "us"). We are committed to protecting your personal information and your right to privacy. This Privacy Policy explains how we collect, use, disclose, and safeguard your information when you use our platform.'})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"2. Information We Collect"}),r.jsx("p",{children:"We collect information that you provide directly to us, including:"}),r.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Name and contact information (email address, phone number)"}),r.jsx("li",{children:"Account credentials"}),r.jsx("li",{children:"Profile information"}),r.jsx("li",{children:"Transaction and billing information"}),r.jsx("li",{children:"Communications you send to us"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"3. How We Use Your Information"}),r.jsx("p",{children:"We use the information we collect to:"}),r.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Provide, maintain, and improve our services"}),r.jsx("li",{children:"Process transactions and send related information"}),r.jsx("li",{children:"Send you technical notices and support messages"}),r.jsx("li",{children:"Respond to your comments and questions"}),r.jsx("li",{children:"Communicate with you about products, services, and events"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"4. Information Sharing"}),r.jsx("p",{children:"We do not sell, trade, or otherwise transfer your personal information to third parties without your consent, except as described in this policy or as required by law."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"5. Data Security"}),r.jsx("p",{children:"We implement appropriate technical and organizational measures to protect the security of your personal information. However, no method of transmission over the Internet is 100% secure."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"6. Your Rights"}),r.jsx("p",{children:"You have the right to:"}),r.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Access your personal information"}),r.jsx("li",{children:"Correct inaccurate data"}),r.jsx("li",{children:"Request deletion of your data"}),r.jsx("li",{children:"Opt-out of marketing communications"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"7. Third-Party Services"}),r.jsx("p",{children:"Our platform may integrate with third-party services such as Facebook and Instagram for social media posting features. When you connect these accounts, you are subject to their respective privacy policies."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"8. Contact Us"}),r.jsxs("p",{children:["If you have questions about this Privacy Policy, please contact us at"," ",r.jsx("a",{href:"mailto:support@relevelup.com",className:"text-primary hover:underline",children:"support@relevelup.com"})]})]})]})]})})]}),Lst=()=>r.jsxs(r.Fragment,{children:[r.jsxs(Mg,{children:[r.jsx("title",{children:"Terms of Service | LevelUp"}),r.jsx("meta",{name:"description",content:"Terms of Service for LevelUp platform"})]}),r.jsx("div",{className:"min-h-screen bg-background py-12 px-4 sm:px-6 lg:px-8",children:r.jsxs("div",{className:"max-w-3xl mx-auto",children:[r.jsx("h1",{className:"text-3xl font-bold text-foreground mb-8",children:"Terms of Service"}),r.jsxs("div",{className:"prose prose-sm max-w-none text-muted-foreground space-y-6",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Last updated: January 17, 2026"}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"1. Acceptance of Terms"}),r.jsx("p",{children:'By accessing or using the LevelUp platform ("Service"), you agree to be bound by these Terms of Service. If you do not agree to these terms, please do not use our Service.'})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"2. Description of Service"}),r.jsx("p",{children:"LevelUp provides a platform for real estate professionals to access training, resources, marketing tools, and community features. We reserve the right to modify or discontinue the Service at any time."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"3. User Accounts"}),r.jsx("p",{children:"To use certain features, you must create an account. You agree to:"}),r.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Provide accurate and complete information"}),r.jsx("li",{children:"Maintain the security of your account credentials"}),r.jsx("li",{children:"Notify us immediately of any unauthorized access"}),r.jsx("li",{children:"Accept responsibility for all activities under your account"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"4. Acceptable Use"}),r.jsx("p",{children:"You agree not to:"}),r.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Violate any applicable laws or regulations"}),r.jsx("li",{children:"Infringe on the rights of others"}),r.jsx("li",{children:"Upload malicious code or interfere with the Service"}),r.jsx("li",{children:"Attempt to gain unauthorized access to any part of the Service"}),r.jsx("li",{children:"Use the Service for any unlawful purpose"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"5. Intellectual Property"}),r.jsx("p",{children:"The Service and its original content, features, and functionality are owned by LevelUp and are protected by international copyright, trademark, and other intellectual property laws."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"6. Third-Party Integrations"}),r.jsx("p",{children:"Our Service may integrate with third-party platforms such as Facebook and Instagram. Your use of these integrations is subject to the terms and policies of those third parties. We are not responsible for the content or practices of any third-party services."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"7. Payment Terms"}),r.jsx("p",{children:"Certain features may require payment. By subscribing to paid features, you agree to pay all applicable fees. All payments are non-refundable unless otherwise specified."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"8. Limitation of Liability"}),r.jsx("p",{children:"To the maximum extent permitted by law, LevelUp shall not be liable for any indirect, incidental, special, consequential, or punitive damages resulting from your use of the Service."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"9. Termination"}),r.jsx("p",{children:"We may terminate or suspend your account at any time, without prior notice, for conduct that we believe violates these Terms or is harmful to other users, us, or third parties."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"10. Changes to Terms"}),r.jsx("p",{children:"We reserve the right to modify these Terms at any time. We will notify you of significant changes by posting a notice on our platform. Continued use of the Service constitutes acceptance of the modified terms."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"11. Contact Us"}),r.jsxs("p",{children:["If you have questions about these Terms, please contact us at"," ",r.jsx("a",{href:"mailto:support@relevelup.com",className:"text-primary hover:underline",children:"support@relevelup.com"})]})]})]})]})})]}),Ost=()=>r.jsxs(r.Fragment,{children:[r.jsxs(Mg,{children:[r.jsx("title",{children:"Data Deletion | LevelUp"}),r.jsx("meta",{name:"description",content:"Data deletion instructions for LevelUp platform"})]}),r.jsx("div",{className:"min-h-screen bg-background py-12 px-4 sm:px-6 lg:px-8",children:r.jsxs("div",{className:"max-w-3xl mx-auto",children:[r.jsx("h1",{className:"text-3xl font-bold text-foreground mb-8",children:"Data Deletion Instructions"}),r.jsxs("div",{className:"prose prose-sm max-w-none text-muted-foreground space-y-6",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Last updated: January 17, 2026"}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"How to Request Data Deletion"}),r.jsx("p",{children:"If you wish to have your data deleted from LevelUp, you can request deletion through one of the following methods:"})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"Option 1: Email Request"}),r.jsxs("p",{children:["Send an email to"," ",r.jsx("a",{href:"mailto:support@relevelup.com",className:"text-primary hover:underline",children:"support@relevelup.com"})," ",'with the subject line "Data Deletion Request" and include:']}),r.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Your full name"}),r.jsx("li",{children:"The email address associated with your account"}),r.jsx("li",{children:"A clear statement requesting deletion of your data"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"Option 2: Account Settings"}),r.jsx("p",{children:"If you have an active account, you can request data deletion through your account settings:"}),r.jsxs("ol",{className:"list-decimal pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Log in to your LevelUp account"}),r.jsx("li",{children:"Navigate to your Profile settings"}),r.jsx("li",{children:"Contact support through the Support page to request account deletion"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"What Data Will Be Deleted"}),r.jsx("p",{children:"Upon a valid deletion request, we will delete:"}),r.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Your account information (name, email, profile data)"}),r.jsx("li",{children:"Any content you have created or uploaded"}),r.jsx("li",{children:"Your activity history and preferences"}),r.jsx("li",{children:"Connected social media account tokens and data"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"Data Retention"}),r.jsx("p",{children:"Some data may be retained for legal or legitimate business purposes, such as:"}),r.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Transaction records required for financial reporting"}),r.jsx("li",{children:"Data necessary to comply with legal obligations"}),r.jsx("li",{children:"Anonymized or aggregated data that cannot identify you"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"Facebook/Instagram Data"}),r.jsx("p",{children:"If you have connected your Facebook or Instagram account to LevelUp, you can also manage your data through Facebook's settings:"}),r.jsxs("ol",{className:"list-decimal pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Go to your Facebook Settings & Privacy → Settings"}),r.jsx("li",{children:'Click on "Apps and Websites"'}),r.jsx("li",{children:'Find LevelUp and click "Remove"'}),r.jsx("li",{children:"This will revoke our access to your Facebook/Instagram data"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"Processing Time"}),r.jsx("p",{children:"We will process your data deletion request within 30 days of receiving it. You will receive a confirmation email once your data has been deleted."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"Contact Us"}),r.jsxs("p",{children:["If you have questions about data deletion, please contact us at"," ",r.jsx("a",{href:"mailto:support@relevelup.com",className:"text-primary hover:underline",children:"support@relevelup.com"})]})]})]})]})})]});var Xa;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{const o={};for(const c of i)o[c]=c;return o},t.getValidEnumValues=i=>{const o=t.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),c={};for(const a of o)c[a]=i[a];return t.objectValues(c)},t.objectValues=i=>t.objectKeys(i).map(function(o){return i[o]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const o=[];for(const c in i)Object.prototype.hasOwnProperty.call(i,c)&&o.push(c);return o},t.find=(i,o)=>{for(const c of i)if(o(c))return c},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function s(i,o=" | "){return i.map(c=>typeof c=="string"?`'${c}'`:c).join(o)}t.joinValues=s,t.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(Xa||(Xa={}));var ije;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(ije||(ije={}));const ws=Xa.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Jx=t=>{switch(typeof t){case"undefined":return ws.undefined;case"string":return ws.string;case"number":return Number.isNaN(t)?ws.nan:ws.number;case"boolean":return ws.boolean;case"function":return ws.function;case"bigint":return ws.bigint;case"symbol":return ws.symbol;case"object":return Array.isArray(t)?ws.array:t===null?ws.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ws.promise:typeof Map<"u"&&t instanceof Map?ws.map:typeof Set<"u"&&t instanceof Set?ws.set:typeof Date<"u"&&t instanceof Date?ws.date:ws.object;default:return ws.unknown}},In=Xa.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class vg extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(o){return o.message},s={_errors:[]},i=o=>{for(const c of o.issues)if(c.code==="invalid_union")c.unionErrors.map(i);else if(c.code==="invalid_return_type")i(c.returnTypeError);else if(c.code==="invalid_arguments")i(c.argumentsError);else if(c.path.length===0)s._errors.push(n(c));else{let a=s,f=0;for(;fn.message){const n={},s=[];for(const i of this.issues)if(i.path.length>0){const o=i.path[0];n[o]=n[o]||[],n[o].push(e(i))}else s.push(e(i));return{formErrors:s,fieldErrors:n}}get formErrors(){return this.flatten()}}vg.create=t=>new vg(t);const Zue=(t,e)=>{let n;switch(t.code){case In.invalid_type:t.received===ws.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case In.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,Xa.jsonStringifyReplacer)}`;break;case In.unrecognized_keys:n=`Unrecognized key(s) in object: ${Xa.joinValues(t.keys,", ")}`;break;case In.invalid_union:n="Invalid input";break;case In.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Xa.joinValues(t.options)}`;break;case In.invalid_enum_value:n=`Invalid enum value. Expected ${Xa.joinValues(t.options)}, received '${t.received}'`;break;case In.invalid_arguments:n="Invalid function arguments";break;case In.invalid_return_type:n="Invalid function return type";break;case In.invalid_date:n="Invalid date";break;case In.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:Xa.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case In.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case In.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case In.custom:n="Invalid input";break;case In.invalid_intersection_types:n="Intersection results could not be merged";break;case In.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case In.not_finite:n="Number must be finite";break;default:n=e.defaultError,Xa.assertNever(t)}return{message:n}};let Dst=Zue;function Rst(){return Dst}const Fst=t=>{const{data:e,path:n,errorMaps:s,issueData:i}=t,o=[...n,...i.path||[]],c={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a="";const f=s.filter(m=>!!m).slice().reverse();for(const m of f)a=m(c,{data:e,defaultError:a}).message;return{...i,path:o,message:a}};function as(t,e){const n=Rst(),s=Fst({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Zue?void 0:Zue].filter(i=>!!i)});t.common.issues.push(s)}class Wh{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const s=[];for(const i of n){if(i.status==="aborted")return Ui;i.status==="dirty"&&e.dirty(),s.push(i.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,n){const s=[];for(const i of n){const o=await i.key,c=await i.value;s.push({key:o,value:c})}return Wh.mergeObjectSync(e,s)}static mergeObjectSync(e,n){const s={};for(const i of n){const{key:o,value:c}=i;if(o.status==="aborted"||c.status==="aborted")return Ui;o.status==="dirty"&&e.dirty(),c.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof c.value<"u"||i.alwaysSet)&&(s[o.value]=c.value)}return{status:e.value,value:s}}}const Ui=Object.freeze({status:"aborted"}),B5=t=>({status:"dirty",value:t}),Zf=t=>({status:"valid",value:t}),aje=t=>t.status==="aborted",oje=t=>t.status==="dirty",F4=t=>t.status==="valid",Zee=t=>typeof Promise<"u"&&t instanceof Promise;var Is;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Is||(Is={}));class y1{constructor(e,n,s,i){this._cachedPath=[],this.parent=e,this.data=n,this._path=s,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const lje=(t,e)=>{if(F4(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new vg(t.common.issues);return this._error=n,this._error}}};function fa(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:s,description:i}=t;if(e&&(n||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(c,a)=>{const{message:f}=t;return c.code==="invalid_enum_value"?{message:f??a.defaultError}:typeof a.data>"u"?{message:f??s??a.defaultError}:c.code!=="invalid_type"?{message:a.defaultError}:{message:f??n??a.defaultError}},description:i}}class Ga{get description(){return this._def.description}_getType(e){return Jx(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Jx(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Wh,ctx:{common:e.parent.common,data:e.data,parsedType:Jx(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Zee(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const s=this.safeParse(e,n);if(s.success)return s.data;throw s.error}safeParse(e,n){const s={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Jx(e)},i=this._parseSync({data:e,path:s.path,parent:s});return lje(s,i)}"~validate"(e){var s,i;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Jx(e)};if(!this["~standard"].async)try{const o=this._parseSync({data:e,path:[],parent:n});return F4(o)?{value:o.value}:{issues:n.common.issues}}catch(o){(i=(s=o==null?void 0:o.message)==null?void 0:s.toLowerCase())!=null&&i.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(o=>F4(o)?{value:o.value}:{issues:n.common.issues})}async parseAsync(e,n){const s=await this.safeParseAsync(e,n);if(s.success)return s.data;throw s.error}async safeParseAsync(e,n){const s={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Jx(e)},i=this._parse({data:e,path:s.path,parent:s}),o=await(Zee(i)?i:Promise.resolve(i));return lje(s,o)}refine(e,n){const s=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,o)=>{const c=e(i),a=()=>o.addIssue({code:In.custom,...s(i)});return typeof Promise<"u"&&c instanceof Promise?c.then(f=>f?!0:(a(),!1)):c?!0:(a(),!1)})}refinement(e,n){return this._refinement((s,i)=>e(s)?!0:(i.addIssue(typeof n=="function"?n(s,i):n),!1))}_refinement(e){return new $4({schema:this,typeName:qi.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return n1.create(this,this._def)}nullable(){return U4.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return mg.create(this)}promise(){return Jee.create(this,this._def)}or(e){return Xee.create([this,e],this._def)}and(e){return Qee.create(this,e,this._def)}transform(e){return new $4({...fa(this._def),schema:this,typeName:qi.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new Jue({...fa(this._def),innerType:this,defaultValue:n,typeName:qi.ZodDefault})}brand(){return new oit({typeName:qi.ZodBranded,type:this,...fa(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new ehe({...fa(this._def),innerType:this,catchValue:n,typeName:qi.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return pge.create(this,e)}readonly(){return the.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const zst=/^c[^\s-]{8,}$/i,Bst=/^[0-9a-z]+$/,$st=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ust=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,qst=/^[a-z0-9_-]{21}$/i,Vst=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Hst=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Wst=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Gst="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Ile;const Kst=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Zst=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Yst=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Xst=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Qst=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Jst=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,VPe="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",eit=new RegExp(`^${VPe}$`);function HPe(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function tit(t){return new RegExp(`^${HPe(t)}$`)}function rit(t){let e=`${VPe}T${HPe(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function nit(t,e){return!!((e==="v4"||!e)&&Kst.test(t)||(e==="v6"||!e)&&Yst.test(t))}function sit(t,e){if(!Vst.test(t))return!1;try{const[n]=t.split(".");if(!n)return!1;const s=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(s));return!(typeof i!="object"||i===null||"typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function iit(t,e){return!!((e==="v4"||!e)&&Zst.test(t)||(e==="v6"||!e)&&Xst.test(t))}class S0 extends Ga{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ws.string){const o=this._getOrReturnCtx(e);return as(o,{code:In.invalid_type,expected:ws.string,received:o.parsedType}),Ui}const s=new Wh;let i;for(const o of this._def.checks)if(o.kind==="min")e.data.lengtho.value&&(i=this._getOrReturnCtx(e,i),as(i,{code:In.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),s.dirty());else if(o.kind==="length"){const c=e.data.length>o.value,a=e.data.lengthe.test(i),{validation:n,code:In.invalid_string,...Is.errToObj(s)})}_addCheck(e){return new S0({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Is.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Is.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Is.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Is.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Is.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Is.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Is.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Is.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Is.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Is.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Is.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Is.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Is.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...Is.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...Is.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Is.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...Is.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...Is.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...Is.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...Is.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...Is.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...Is.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...Is.errToObj(n)})}nonempty(e){return this.min(1,Is.errToObj(e))}trim(){return new S0({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new S0({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new S0({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.valuenew S0({checks:[],typeName:qi.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...fa(t)});function ait(t,e){const n=(t.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,i=n>s?n:s,o=Number.parseInt(t.toFixed(i).replace(".","")),c=Number.parseInt(e.toFixed(i).replace(".",""));return o%c/10**i}class z4 extends Ga{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==ws.number){const o=this._getOrReturnCtx(e);return as(o,{code:In.invalid_type,expected:ws.number,received:o.parsedType}),Ui}let s;const i=new Wh;for(const o of this._def.checks)o.kind==="int"?Xa.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),as(s,{code:In.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?e.datao.value:e.data>=o.value)&&(s=this._getOrReturnCtx(e,s),as(s,{code:In.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?ait(e.data,o.value)!==0&&(s=this._getOrReturnCtx(e,s),as(s,{code:In.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),as(s,{code:In.not_finite,message:o.message}),i.dirty()):Xa.assertNever(o);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,Is.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Is.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Is.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Is.toString(n))}setLimit(e,n,s,i){return new z4({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:s,message:Is.toString(i)}]})}_addCheck(e){return new z4({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Is.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Is.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Is.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Is.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Is.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Is.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:Is.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Is.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Is.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.valuee.kind==="int"||e.kind==="multipleOf"&&Xa.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(n===null||s.value>n)&&(n=s.value):s.kind==="max"&&(e===null||s.valuenew z4({checks:[],typeName:qi.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...fa(t)});class OA extends Ga{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==ws.bigint)return this._getInvalidInput(e);let s;const i=new Wh;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?e.datao.value:e.data>=o.value)&&(s=this._getOrReturnCtx(e,s),as(s,{code:In.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),as(s,{code:In.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):Xa.assertNever(o);return{status:i.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return as(n,{code:In.invalid_type,expected:ws.bigint,received:n.parsedType}),Ui}gte(e,n){return this.setLimit("min",e,!0,Is.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Is.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Is.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Is.toString(n))}setLimit(e,n,s,i){return new OA({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:s,message:Is.toString(i)}]})}_addCheck(e){return new OA({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Is.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Is.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Is.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Is.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Is.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.valuenew OA({checks:[],typeName:qi.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...fa(t)});class Yue extends Ga{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ws.boolean){const s=this._getOrReturnCtx(e);return as(s,{code:In.invalid_type,expected:ws.boolean,received:s.parsedType}),Ui}return Zf(e.data)}}Yue.create=t=>new Yue({typeName:qi.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...fa(t)});class Yee extends Ga{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ws.date){const o=this._getOrReturnCtx(e);return as(o,{code:In.invalid_type,expected:ws.date,received:o.parsedType}),Ui}if(Number.isNaN(e.data.getTime())){const o=this._getOrReturnCtx(e);return as(o,{code:In.invalid_date}),Ui}const s=new Wh;let i;for(const o of this._def.checks)o.kind==="min"?e.data.getTime()o.value&&(i=this._getOrReturnCtx(e,i),as(i,{code:In.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),s.dirty()):Xa.assertNever(o);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Yee({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:Is.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:Is.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.valuenew Yee({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:qi.ZodDate,...fa(t)});class cje extends Ga{_parse(e){if(this._getType(e)!==ws.symbol){const s=this._getOrReturnCtx(e);return as(s,{code:In.invalid_type,expected:ws.symbol,received:s.parsedType}),Ui}return Zf(e.data)}}cje.create=t=>new cje({typeName:qi.ZodSymbol,...fa(t)});class dje extends Ga{_parse(e){if(this._getType(e)!==ws.undefined){const s=this._getOrReturnCtx(e);return as(s,{code:In.invalid_type,expected:ws.undefined,received:s.parsedType}),Ui}return Zf(e.data)}}dje.create=t=>new dje({typeName:qi.ZodUndefined,...fa(t)});class uje extends Ga{_parse(e){if(this._getType(e)!==ws.null){const s=this._getOrReturnCtx(e);return as(s,{code:In.invalid_type,expected:ws.null,received:s.parsedType}),Ui}return Zf(e.data)}}uje.create=t=>new uje({typeName:qi.ZodNull,...fa(t)});class hje extends Ga{constructor(){super(...arguments),this._any=!0}_parse(e){return Zf(e.data)}}hje.create=t=>new hje({typeName:qi.ZodAny,...fa(t)});class fje extends Ga{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Zf(e.data)}}fje.create=t=>new fje({typeName:qi.ZodUnknown,...fa(t)});class x1 extends Ga{_parse(e){const n=this._getOrReturnCtx(e);return as(n,{code:In.invalid_type,expected:ws.never,received:n.parsedType}),Ui}}x1.create=t=>new x1({typeName:qi.ZodNever,...fa(t)});class pje extends Ga{_parse(e){if(this._getType(e)!==ws.undefined){const s=this._getOrReturnCtx(e);return as(s,{code:In.invalid_type,expected:ws.void,received:s.parsedType}),Ui}return Zf(e.data)}}pje.create=t=>new pje({typeName:qi.ZodVoid,...fa(t)});class mg extends Ga{_parse(e){const{ctx:n,status:s}=this._processInputParams(e),i=this._def;if(n.parsedType!==ws.array)return as(n,{code:In.invalid_type,expected:ws.array,received:n.parsedType}),Ui;if(i.exactLength!==null){const c=n.data.length>i.exactLength.value,a=n.data.lengthi.maxLength.value&&(as(n,{code:In.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),s.dirty()),n.common.async)return Promise.all([...n.data].map((c,a)=>i.type._parseAsync(new y1(n,c,n.path,a)))).then(c=>Wh.mergeArray(s,c));const o=[...n.data].map((c,a)=>i.type._parseSync(new y1(n,c,n.path,a)));return Wh.mergeArray(s,o)}get element(){return this._def.type}min(e,n){return new mg({...this._def,minLength:{value:e,message:Is.toString(n)}})}max(e,n){return new mg({...this._def,maxLength:{value:e,message:Is.toString(n)}})}length(e,n){return new mg({...this._def,exactLength:{value:e,message:Is.toString(n)}})}nonempty(e){return this.min(1,e)}}mg.create=(t,e)=>new mg({type:t,minLength:null,maxLength:null,exactLength:null,typeName:qi.ZodArray,...fa(e)});function XN(t){if(t instanceof yc){const e={};for(const n in t.shape){const s=t.shape[n];e[n]=n1.create(XN(s))}return new yc({...t._def,shape:()=>e})}else return t instanceof mg?new mg({...t._def,type:XN(t.element)}):t instanceof n1?n1.create(XN(t.unwrap())):t instanceof U4?U4.create(XN(t.unwrap())):t instanceof pj?pj.create(t.items.map(e=>XN(e))):t}class yc extends Ga{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=Xa.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==ws.object){const m=this._getOrReturnCtx(e);return as(m,{code:In.invalid_type,expected:ws.object,received:m.parsedType}),Ui}const{status:s,ctx:i}=this._processInputParams(e),{shape:o,keys:c}=this._getCached(),a=[];if(!(this._def.catchall instanceof x1&&this._def.unknownKeys==="strip"))for(const m in i.data)c.includes(m)||a.push(m);const f=[];for(const m of c){const y=o[m],v=i.data[m];f.push({key:{status:"valid",value:m},value:y._parse(new y1(i,v,i.path,m)),alwaysSet:m in i.data})}if(this._def.catchall instanceof x1){const m=this._def.unknownKeys;if(m==="passthrough")for(const y of a)f.push({key:{status:"valid",value:y},value:{status:"valid",value:i.data[y]}});else if(m==="strict")a.length>0&&(as(i,{code:In.unrecognized_keys,keys:a}),s.dirty());else if(m!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const m=this._def.catchall;for(const y of a){const v=i.data[y];f.push({key:{status:"valid",value:y},value:m._parse(new y1(i,v,i.path,y)),alwaysSet:y in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const m=[];for(const y of f){const v=await y.key,w=await y.value;m.push({key:v,value:w,alwaysSet:y.alwaysSet})}return m}).then(m=>Wh.mergeObjectSync(s,m)):Wh.mergeObjectSync(s,f)}get shape(){return this._def.shape()}strict(e){return Is.errToObj,new yc({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,s)=>{var o,c;const i=((c=(o=this._def).errorMap)==null?void 0:c.call(o,n,s).message)??s.defaultError;return n.code==="unrecognized_keys"?{message:Is.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new yc({...this._def,unknownKeys:"strip"})}passthrough(){return new yc({...this._def,unknownKeys:"passthrough"})}extend(e){return new yc({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new yc({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:qi.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new yc({...this._def,catchall:e})}pick(e){const n={};for(const s of Xa.objectKeys(e))e[s]&&this.shape[s]&&(n[s]=this.shape[s]);return new yc({...this._def,shape:()=>n})}omit(e){const n={};for(const s of Xa.objectKeys(this.shape))e[s]||(n[s]=this.shape[s]);return new yc({...this._def,shape:()=>n})}deepPartial(){return XN(this)}partial(e){const n={};for(const s of Xa.objectKeys(this.shape)){const i=this.shape[s];e&&!e[s]?n[s]=i:n[s]=i.optional()}return new yc({...this._def,shape:()=>n})}required(e){const n={};for(const s of Xa.objectKeys(this.shape))if(e&&!e[s])n[s]=this.shape[s];else{let o=this.shape[s];for(;o instanceof n1;)o=o._def.innerType;n[s]=o}return new yc({...this._def,shape:()=>n})}keyof(){return WPe(Xa.objectKeys(this.shape))}}yc.create=(t,e)=>new yc({shape:()=>t,unknownKeys:"strip",catchall:x1.create(),typeName:qi.ZodObject,...fa(e)});yc.strictCreate=(t,e)=>new yc({shape:()=>t,unknownKeys:"strict",catchall:x1.create(),typeName:qi.ZodObject,...fa(e)});yc.lazycreate=(t,e)=>new yc({shape:t,unknownKeys:"strip",catchall:x1.create(),typeName:qi.ZodObject,...fa(e)});class Xee extends Ga{_parse(e){const{ctx:n}=this._processInputParams(e),s=this._def.options;function i(o){for(const a of o)if(a.result.status==="valid")return a.result;for(const a of o)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const c=o.map(a=>new vg(a.ctx.common.issues));return as(n,{code:In.invalid_union,unionErrors:c}),Ui}if(n.common.async)return Promise.all(s.map(async o=>{const c={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:c}),ctx:c}})).then(i);{let o;const c=[];for(const f of s){const m={...n,common:{...n.common,issues:[]},parent:null},y=f._parseSync({data:n.data,path:n.path,parent:m});if(y.status==="valid")return y;y.status==="dirty"&&!o&&(o={result:y,ctx:m}),m.common.issues.length&&c.push(m.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const a=c.map(f=>new vg(f));return as(n,{code:In.invalid_union,unionErrors:a}),Ui}}get options(){return this._def.options}}Xee.create=(t,e)=>new Xee({options:t,typeName:qi.ZodUnion,...fa(e)});function Xue(t,e){const n=Jx(t),s=Jx(e);if(t===e)return{valid:!0,data:t};if(n===ws.object&&s===ws.object){const i=Xa.objectKeys(e),o=Xa.objectKeys(t).filter(a=>i.indexOf(a)!==-1),c={...t,...e};for(const a of o){const f=Xue(t[a],e[a]);if(!f.valid)return{valid:!1};c[a]=f.data}return{valid:!0,data:c}}else if(n===ws.array&&s===ws.array){if(t.length!==e.length)return{valid:!1};const i=[];for(let o=0;o{if(aje(o)||aje(c))return Ui;const a=Xue(o.value,c.value);return a.valid?((oje(o)||oje(c))&&n.dirty(),{status:n.value,value:a.data}):(as(s,{code:In.invalid_intersection_types}),Ui)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([o,c])=>i(o,c)):i(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}Qee.create=(t,e,n)=>new Qee({left:t,right:e,typeName:qi.ZodIntersection,...fa(n)});class pj extends Ga{_parse(e){const{status:n,ctx:s}=this._processInputParams(e);if(s.parsedType!==ws.array)return as(s,{code:In.invalid_type,expected:ws.array,received:s.parsedType}),Ui;if(s.data.lengththis._def.items.length&&(as(s,{code:In.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...s.data].map((c,a)=>{const f=this._def.items[a]||this._def.rest;return f?f._parse(new y1(s,c,s.path,a)):null}).filter(c=>!!c);return s.common.async?Promise.all(o).then(c=>Wh.mergeArray(n,c)):Wh.mergeArray(n,o)}get items(){return this._def.items}rest(e){return new pj({...this._def,rest:e})}}pj.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new pj({items:t,typeName:qi.ZodTuple,rest:null,...fa(e)})};class mje extends Ga{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:s}=this._processInputParams(e);if(s.parsedType!==ws.map)return as(s,{code:In.invalid_type,expected:ws.map,received:s.parsedType}),Ui;const i=this._def.keyType,o=this._def.valueType,c=[...s.data.entries()].map(([a,f],m)=>({key:i._parse(new y1(s,a,s.path,[m,"key"])),value:o._parse(new y1(s,f,s.path,[m,"value"]))}));if(s.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const f of c){const m=await f.key,y=await f.value;if(m.status==="aborted"||y.status==="aborted")return Ui;(m.status==="dirty"||y.status==="dirty")&&n.dirty(),a.set(m.value,y.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const f of c){const m=f.key,y=f.value;if(m.status==="aborted"||y.status==="aborted")return Ui;(m.status==="dirty"||y.status==="dirty")&&n.dirty(),a.set(m.value,y.value)}return{status:n.value,value:a}}}}mje.create=(t,e,n)=>new mje({valueType:e,keyType:t,typeName:qi.ZodMap,...fa(n)});class DA extends Ga{_parse(e){const{status:n,ctx:s}=this._processInputParams(e);if(s.parsedType!==ws.set)return as(s,{code:In.invalid_type,expected:ws.set,received:s.parsedType}),Ui;const i=this._def;i.minSize!==null&&s.data.sizei.maxSize.value&&(as(s,{code:In.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const o=this._def.valueType;function c(f){const m=new Set;for(const y of f){if(y.status==="aborted")return Ui;y.status==="dirty"&&n.dirty(),m.add(y.value)}return{status:n.value,value:m}}const a=[...s.data.values()].map((f,m)=>o._parse(new y1(s,f,s.path,m)));return s.common.async?Promise.all(a).then(f=>c(f)):c(a)}min(e,n){return new DA({...this._def,minSize:{value:e,message:Is.toString(n)}})}max(e,n){return new DA({...this._def,maxSize:{value:e,message:Is.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}DA.create=(t,e)=>new DA({valueType:t,minSize:null,maxSize:null,typeName:qi.ZodSet,...fa(e)});class gje extends Ga{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}gje.create=(t,e)=>new gje({getter:t,typeName:qi.ZodLazy,...fa(e)});class Que extends Ga{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return as(n,{received:n.data,code:In.invalid_literal,expected:this._def.value}),Ui}return{status:"valid",value:e.data}}get value(){return this._def.value}}Que.create=(t,e)=>new Que({value:t,typeName:qi.ZodLiteral,...fa(e)});function WPe(t,e){return new B4({values:t,typeName:qi.ZodEnum,...fa(e)})}class B4 extends Ga{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),s=this._def.values;return as(n,{expected:Xa.joinValues(s),received:n.parsedType,code:In.invalid_type}),Ui}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const n=this._getOrReturnCtx(e),s=this._def.values;return as(n,{received:n.data,code:In.invalid_enum_value,options:s}),Ui}return Zf(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return B4.create(e,{...this._def,...n})}exclude(e,n=this._def){return B4.create(this.options.filter(s=>!e.includes(s)),{...this._def,...n})}}B4.create=WPe;class yje extends Ga{_parse(e){const n=Xa.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==ws.string&&s.parsedType!==ws.number){const i=Xa.objectValues(n);return as(s,{expected:Xa.joinValues(i),received:s.parsedType,code:In.invalid_type}),Ui}if(this._cache||(this._cache=new Set(Xa.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const i=Xa.objectValues(n);return as(s,{received:s.data,code:In.invalid_enum_value,options:i}),Ui}return Zf(e.data)}get enum(){return this._def.values}}yje.create=(t,e)=>new yje({values:t,typeName:qi.ZodNativeEnum,...fa(e)});class Jee extends Ga{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==ws.promise&&n.common.async===!1)return as(n,{code:In.invalid_type,expected:ws.promise,received:n.parsedType}),Ui;const s=n.parsedType===ws.promise?n.data:Promise.resolve(n.data);return Zf(s.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Jee.create=(t,e)=>new Jee({type:t,typeName:qi.ZodPromise,...fa(e)});class $4 extends Ga{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===qi.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:s}=this._processInputParams(e),i=this._def.effect||null,o={addIssue:c=>{as(s,c),c.fatal?n.abort():n.dirty()},get path(){return s.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){const c=i.transform(s.data,o);if(s.common.async)return Promise.resolve(c).then(async a=>{if(n.value==="aborted")return Ui;const f=await this._def.schema._parseAsync({data:a,path:s.path,parent:s});return f.status==="aborted"?Ui:f.status==="dirty"||n.value==="dirty"?B5(f.value):f});{if(n.value==="aborted")return Ui;const a=this._def.schema._parseSync({data:c,path:s.path,parent:s});return a.status==="aborted"?Ui:a.status==="dirty"||n.value==="dirty"?B5(a.value):a}}if(i.type==="refinement"){const c=a=>{const f=i.refinement(a,o);if(s.common.async)return Promise.resolve(f);if(f instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(s.common.async===!1){const a=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?Ui:(a.status==="dirty"&&n.dirty(),c(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(a=>a.status==="aborted"?Ui:(a.status==="dirty"&&n.dirty(),c(a.value).then(()=>({status:n.value,value:a.value}))))}if(i.type==="transform")if(s.common.async===!1){const c=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!F4(c))return Ui;const a=i.transform(c.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(c=>F4(c)?Promise.resolve(i.transform(c.value,o)).then(a=>({status:n.value,value:a})):Ui);Xa.assertNever(i)}}$4.create=(t,e,n)=>new $4({schema:t,typeName:qi.ZodEffects,effect:e,...fa(n)});$4.createWithPreprocess=(t,e,n)=>new $4({schema:e,effect:{type:"preprocess",transform:t},typeName:qi.ZodEffects,...fa(n)});class n1 extends Ga{_parse(e){return this._getType(e)===ws.undefined?Zf(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}n1.create=(t,e)=>new n1({innerType:t,typeName:qi.ZodOptional,...fa(e)});class U4 extends Ga{_parse(e){return this._getType(e)===ws.null?Zf(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}U4.create=(t,e)=>new U4({innerType:t,typeName:qi.ZodNullable,...fa(e)});class Jue extends Ga{_parse(e){const{ctx:n}=this._processInputParams(e);let s=n.data;return n.parsedType===ws.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Jue.create=(t,e)=>new Jue({innerType:t,typeName:qi.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...fa(e)});class ehe extends Ga{_parse(e){const{ctx:n}=this._processInputParams(e),s={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return Zee(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new vg(s.common.issues)},input:s.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new vg(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}ehe.create=(t,e)=>new ehe({innerType:t,typeName:qi.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...fa(e)});class xje extends Ga{_parse(e){if(this._getType(e)!==ws.nan){const s=this._getOrReturnCtx(e);return as(s,{code:In.invalid_type,expected:ws.nan,received:s.parsedType}),Ui}return{status:"valid",value:e.data}}}xje.create=t=>new xje({typeName:qi.ZodNaN,...fa(t)});class oit extends Ga{_parse(e){const{ctx:n}=this._processInputParams(e),s=n.data;return this._def.type._parse({data:s,path:n.path,parent:n})}unwrap(){return this._def.type}}class pge extends Ga{_parse(e){const{status:n,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?Ui:o.status==="dirty"?(n.dirty(),B5(o.value)):this._def.out._parseAsync({data:o.value,path:s.path,parent:s})})();{const i=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?Ui:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:s.path,parent:s})}}static create(e,n){return new pge({in:e,out:n,typeName:qi.ZodPipeline})}}class the extends Ga{_parse(e){const n=this._def.innerType._parse(e),s=i=>(F4(i)&&(i.value=Object.freeze(i.value)),i);return Zee(n)?n.then(i=>s(i)):s(n)}unwrap(){return this._def.innerType}}the.create=(t,e)=>new the({innerType:t,typeName:qi.ZodReadonly,...fa(e)});var qi;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(qi||(qi={}));const ec=S0.create,DT=z4.create,lit=Yue.create;x1.create;mg.create;const UC=yc.create;Xee.create;Qee.create;pj.create;const vje=Que.create,GPe=B4.create;Jee.create;n1.create;U4.create;const cit="/assets/levelup-logo-horizontal-DEFNc0ms.png",dit=UC({email:ec().email("Invalid email address"),password:ec().min(6,"Password must be at least 6 characters")}),uit=()=>{const{signIn:t,user:e}=Fr(),n=es(),[s,i]=P.useState(!1),[o,c]=P.useState({}),[a,f]=P.useState(""),[m,y]=P.useState(!1),[v,w]=P.useState(!1);P.useEffect(()=>{e&&n("/dashboard")},[e,n]);const k=async S=>{S.preventDefault(),c({}),i(!0);const T=new FormData(S.currentTarget),I=T.get("email"),A=T.get("password");try{dit.parse({email:I,password:A}),await t(I,A)}catch(D){if(D instanceof vg){const $={};D.errors.forEach(F=>{F.path[0]&&($[F.path[0]]=F.message)}),c($)}}finally{i(!1)}},C=async()=>{if(!a){Ge.error("Please enter your email address");return}y(!0);try{const{error:S}=await ee.functions.invoke("send-password-reset",{body:{email:a,redirectTo:"https://dashboard.relevelup.com/profile?reset=true"}});if(S)throw S;Ge.success("Password reset email sent! Check your inbox."),w(!1),f("")}catch(S){Ge.error(S.message||"Failed to send reset email")}finally{y(!1)}};return r.jsxs("div",{className:"min-h-screen relative overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-[#4a6b6d] via-[#3d5a5c] to-[#2a4347]",children:r.jsxs("div",{className:"absolute inset-0 opacity-30",children:[r.jsx("div",{className:"absolute top-0 left-0 w-96 h-96 bg-white/10 rounded-full blur-3xl animate-pulse"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-96 h-96 bg-white/5 rounded-full blur-3xl animate-pulse",style:{animationDelay:"1s"}}),r.jsx("div",{className:"absolute top-1/2 left-1/2 w-64 h-64 bg-white/5 rounded-full blur-3xl animate-pulse",style:{animationDelay:"2s"}})]})}),r.jsxs("div",{className:"relative z-10 flex flex-col min-h-screen",children:[r.jsx("header",{className:"p-6",children:r.jsxs(ao,{to:"/",className:"inline-flex items-center gap-2 text-sm text-white/80 hover:text-white transition-colors",children:[r.jsx(Va,{className:"h-4 w-4"}),"Back to Home"]})}),r.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:r.jsxs("div",{className:"w-full max-w-md",children:[r.jsx("div",{className:"flex justify-center mb-8",children:r.jsx("div",{className:"bg-white rounded-xl p-4 shadow-2xl",children:r.jsx("img",{src:cit,alt:"LevelUp",className:"h-12 w-auto"})})}),r.jsxs(Ye,{className:"border-0 shadow-2xl bg-white/95 backdrop-blur-sm",children:[r.jsxs(Ht,{className:"space-y-1 text-center pb-4",children:[r.jsx(Yt,{className:"text-3xl font-bold text-[#2a4347]",style:{fontFamily:"'Libre Baskerville', serif"},children:"Welcome Back"}),r.jsx(An,{className:"text-gray-600",children:"Sign in to access your dashboard"})]}),r.jsx(Je,{children:r.jsxs("form",{onSubmit:k,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"signin-email",className:"text-gray-700",children:"Email"}),r.jsx(yt,{id:"signin-email",name:"email",type:"email",placeholder:"your@email.com",required:!0,className:"border-gray-300 focus:border-[#4a6b6d] focus:ring-[#4a6b6d]"}),o.email&&r.jsx("p",{className:"text-sm text-red-600",children:o.email})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"signin-password",className:"text-gray-700",children:"Password"}),r.jsx(yt,{id:"signin-password",name:"password",type:"password",required:!0,className:"border-gray-300 focus:border-[#4a6b6d] focus:ring-[#4a6b6d]"}),o.password&&r.jsx("p",{className:"text-sm text-red-600",children:o.password})]}),r.jsx(te,{type:"submit",className:"w-full bg-[#4a6b6d] hover:bg-[#3d5a5c] text-white font-semibold py-6 text-lg transition-all duration-200 shadow-lg hover:shadow-xl",disabled:s,children:s?"Signing in...":"Sign In"}),r.jsxs($r,{open:v,onOpenChange:w,children:[r.jsx(Lo,{asChild:!0,children:r.jsx(te,{variant:"link",className:"w-full text-sm text-[#4a6b6d] hover:text-[#3d5a5c]",children:"Forgot password?"})}),r.jsxs(zr,{className:"bg-white",children:[r.jsxs(Zr,{children:[r.jsx(Kr,{className:"text-[#2a4347]",style:{fontFamily:"'Libre Baskerville', serif"},children:"Reset Password"}),r.jsx(ls,{className:"text-gray-600",children:"Enter your email address and we'll send you a link to reset your password."})]}),r.jsxs("div",{className:"space-y-4 pt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"reset-email",className:"text-gray-700",children:"Email"}),r.jsx(yt,{id:"reset-email",type:"email",placeholder:"your@email.com",value:a,onChange:S=>f(S.target.value),className:"border-gray-300 focus:border-[#4a6b6d] focus:ring-[#4a6b6d]"})]}),r.jsx(te,{onClick:C,className:"w-full bg-[#4a6b6d] hover:bg-[#3d5a5c] text-white",disabled:m,children:m?"Sending...":"Send Reset Link"})]})]})]})]})})]}),r.jsxs("p",{className:"text-center text-white/70 text-sm mt-6",children:["Don't have an account?"," ",r.jsx(ao,{to:"/",className:"text-white hover:underline font-medium",children:"View Plans"})]})]})})]})]})},hit=()=>{const[t]=Ed(),e=t.get("tier"),n=e==null?void 0:e.includes("brokerage");return r.jsx("div",{className:"min-h-screen bg-gradient-to-br from-background via-primary/5 to-secondary/10 flex items-center justify-center p-4",children:r.jsxs(Ye,{className:"max-w-lg w-full",children:[r.jsxs(Ht,{className:"text-center",children:[r.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-green-500/10 flex items-center justify-center mb-4",children:r.jsx(za,{className:"w-10 h-10 text-green-500"})}),r.jsx(Yt,{className:"text-2xl",children:"Welcome to LevelUp!"}),r.jsx(An,{className:"text-lg",children:"Your subscription has been activated successfully."})]}),r.jsxs(Je,{className:"space-y-6",children:[r.jsxs("div",{className:"p-4 rounded-lg bg-primary/10 border border-primary/20 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-primary",children:[r.jsx(di,{className:"w-5 h-5"}),r.jsx("span",{className:"font-semibold",children:"Check your email to sign in"})]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"We've sent you an email with a secure link to access your account. Click the link in your email to get started."})]}),n?r.jsxs("div",{className:"space-y-3",children:[r.jsx("h3",{className:"font-semibold",children:"What's next?"}),r.jsxs("ul",{className:"space-y-2 text-sm text-muted-foreground",children:[r.jsxs("li",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"font-bold text-primary",children:"1."}),"Click the link in your email to sign in"]}),r.jsxs("li",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"font-bold text-primary",children:"2."}),"Create and name your brokerage"]}),r.jsxs("li",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"font-bold text-primary",children:"3."}),"Set your password and complete your profile"]}),r.jsxs("li",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"font-bold text-primary",children:"4."}),"Start inviting agents to join your team"]})]})]}):r.jsxs("div",{className:"space-y-3",children:[r.jsx("h3",{className:"font-semibold",children:"What's next?"}),r.jsxs("ul",{className:"space-y-2 text-sm text-muted-foreground",children:[r.jsxs("li",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"font-bold text-primary",children:"1."}),"Click the link in your email to sign in"]}),r.jsxs("li",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"font-bold text-primary",children:"2."}),"Set your password and complete your profile"]}),r.jsxs("li",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"font-bold text-primary",children:"3."}),"Start exploring templates, training videos, and more!"]})]}),r.jsx("p",{className:"text-sm text-green-600 font-medium mt-4",children:"🎉 Your 7-day free trial has started!"})]}),r.jsx("div",{className:"p-3 rounded-lg bg-muted/50 text-center",children:r.jsx("p",{className:"text-sm text-muted-foreground",children:"Didn't receive the email? Check your spam folder or contact support."})})]})]})})},mge=t=>{const[e,n]=P.useState(null),[s,i]=P.useState(!0);return P.useEffect(()=>{if(!t){i(!1);return}(async()=>{try{const{data:a}=await ee.storage.from("avatars").list(`${t}`);if(a&&a.length>0){const{data:f}=ee.storage.from("avatars").getPublicUrl(`${t}/${a[0].name}`);n(`${f.publicUrl}?t=${Date.now()}`)}else n(null)}catch(a){console.error("Error fetching avatar:",a),n(null)}finally{i(!1)}})()},[t]),{avatarUrl:e,loading:s,refreshAvatar:async()=>{if(t)try{const{data:c}=await ee.storage.from("avatars").list(`${t}`);if(c&&c.length>0){const{data:a}=ee.storage.from("avatars").getPublicUrl(`${t}/${c[0].name}`);n(`${a.publicUrl}?t=${Date.now()}`)}}catch(c){console.error("Error refreshing avatar:",c)}}}},$5=async t=>{const e=new Map;return await Promise.all(t.map(async n=>{try{const{data:s}=await ee.storage.from("avatars").list(`${n}`);if(s&&s.length>0){const{data:i}=ee.storage.from("avatars").getPublicUrl(`${n}/${s[0].name}`);e.set(n,i.publicUrl)}}catch{}})),e},fit=t=>{const[e,n]=P.useState({isTrial:!1,isExpired:!1,expiresAt:null,daysLeft:null,loading:!0});return P.useEffect(()=>{if(!t){n(i=>({...i,loading:!1}));return}(async()=>{try{const{data:i,error:o}=await ee.from("profiles").select("is_trial, trial_expires_at, subscription_status, subscription_end_date").eq("id",t).single();if(o){console.error("Error fetching trial status:",o),n(f=>({...f,loading:!1}));return}const c=(i==null?void 0:i.subscription_status)==="trialing"&&(i==null?void 0:i.subscription_end_date),a=(i==null?void 0:i.is_trial)&&(i==null?void 0:i.trial_expires_at);if(c){const f=new Date().getTime(),m=new Date(i.subscription_end_date).getTime(),y=Math.ceil((m-f)/(1e3*60*60*24)),v=y<=0;n({isTrial:!0,isExpired:v,expiresAt:i.subscription_end_date,daysLeft:v?0:y,loading:!1})}else if(a){const f=new Date().getTime(),m=new Date(i.trial_expires_at).getTime(),y=Math.ceil((m-f)/(1e3*60*60*24)),v=y<=0;n({isTrial:!0,isExpired:v,expiresAt:i.trial_expires_at,daysLeft:v?0:y,loading:!1})}else n({isTrial:!1,isExpired:!1,expiresAt:null,daysLeft:null,loading:!1})}catch(i){console.error("Error in useTrialStatus:",i),n(o=>({...o,loading:!1}))}})()},[t]),e},KPe=()=>{const{data:t,isLoading:e}=rr({queryKey:["feature-flags"],queryFn:async()=>{const{data:s,error:i}=await ee.from("feature_flags").select("*");if(i)throw i;return s}}),n=s=>{if(!t)return!1;const i=t.find(o=>o.key===s);return(i==null?void 0:i.enabled)??!1};return{flags:t,isLoading:e,isFeatureEnabled:n,isAgentOSEnabled:n("agent_os_enabled"),isInnerCircleEnabled:n("innercircle_enabled"),isMarketplaceEnabled:n("marketplace")}},_je="community_last_seen_post_at";function pit(){const{user:t}=Fr(),e=Cg(),[n,s]=P.useState(0),[i,o]=P.useState(null);P.useEffect(()=>{if(!t)return;const a=localStorage.getItem(`${_je}_${t.id}`);o(a)},[t]),P.useEffect(()=>{if(!t)return;(async()=>{let f=ee.from("community_posts").select("id",{count:"exact",head:!0});i&&(f=f.gt("created_at",i));const{data:m}=await ee.from("profiles").select("brokerage_id").eq("id",t.id).single(),{count:y,error:v}=await f;!v&&y!==null&&s(y)})()},[t,i]),P.useEffect(()=>{if(!t)return;const a=ee.channel("community-new-posts").on("postgres_changes",{event:"INSERT",schema:"public",table:"community_posts"},async f=>{const m=f.new;if(m.user_id===t.id)return;const y=e.pathname==="/community";y||s(C=>C+1);const{data:v}=await ee.from("profiles").select("name").eq("id",m.user_id).single(),w=(v==null?void 0:v.name)||"Someone",k=m.content.length>50?m.content.substring(0,50)+"...":m.content;y||Ge("New Community Post",{description:`${w}: ${k}`,action:{label:"View",onClick:()=>{window.location.href="/community"}}})}).subscribe();return()=>{ee.removeChannel(a)}},[t,e.pathname]);const c=P.useCallback(()=>{if(!t)return;const a=new Date().toISOString();localStorage.setItem(`${_je}_${t.id}`,a),o(a),s(0)},[t]);return P.useEffect(()=>{e.pathname==="/community"&&n>0&&c()},[e.pathname,n,c]),{unreadCount:n,markAsRead:c}}function mit(){const{isAdmin:t}=Fr(),{data:e=0}=rr({queryKey:["wishlist-open-count"],queryFn:async()=>{const{count:n,error:s}=await ee.from("wishlist_items").select("*",{count:"exact",head:!0}).eq("status","open");if(s)throw s;return n||0},enabled:t,staleTime:6e4});return{openCount:t?e:0}}var ZPe={exports:{}},YPe={};/** * @license React * use-sync-external-store-shim.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var q4=P;function git(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var yit=typeof Object.is=="function"?Object.is:git,xit=q4.useState,vit=q4.useEffect,_it=q4.useLayoutEffect,bit=q4.useDebugValue;function wit(t,e){var n=e(),s=xit({inst:{value:n,getSnapshot:e}}),i=s[0].inst,o=s[1];return _it(function(){i.value=n,i.getSnapshot=e,Ple(i)&&o({inst:i})},[t,n,e]),vit(function(){return Ple(i)&&o({inst:i}),t(function(){Ple(i)&&o({inst:i})})},[t]),bit(n),n}function Ple(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!yit(t,n)}catch{return!0}}function jit(t,e){return e()}var kit=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?jit:wit;YPe.useSyncExternalStore=q4.useSyncExternalStore!==void 0?q4.useSyncExternalStore:kit;ZPe.exports=YPe;var Nit=ZPe.exports;function Sit(){return Nit.useSyncExternalStore(Cit,()=>!0,()=>!1)}function Cit(){return()=>{}}var gge="Avatar",[Mit]=Zl(gge),[Tit,XPe]=Mit(gge),QPe=P.forwardRef((t,e)=>{const{__scopeAvatar:n,...s}=t,[i,o]=P.useState("idle");return r.jsx(Tit,{scope:n,imageLoadingStatus:i,onImageLoadingStatusChange:o,children:r.jsx(On.span,{...s,ref:e})})});QPe.displayName=gge;var JPe="AvatarImage",e6e=P.forwardRef((t,e)=>{const{__scopeAvatar:n,src:s,onLoadingStatusChange:i=()=>{},...o}=t,c=XPe(JPe,n),a=Ait(s,o),f=$l(m=>{i(m),c.onImageLoadingStatusChange(m)});return Gl(()=>{a!=="idle"&&f(a)},[a,f]),a==="loaded"?r.jsx(On.img,{...o,ref:e,src:s}):null});e6e.displayName=JPe;var t6e="AvatarFallback",r6e=P.forwardRef((t,e)=>{const{__scopeAvatar:n,delayMs:s,...i}=t,o=XPe(t6e,n),[c,a]=P.useState(s===void 0);return P.useEffect(()=>{if(s!==void 0){const f=window.setTimeout(()=>a(!0),s);return()=>window.clearTimeout(f)}},[s]),c&&o.imageLoadingStatus!=="loaded"?r.jsx(On.span,{...i,ref:e}):null});r6e.displayName=t6e;function bje(t,e){return t?e?(t.src!==e&&(t.src=e),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function Ait(t,{referrerPolicy:e,crossOrigin:n}){const s=Sit(),i=P.useRef(null),o=s?(i.current||(i.current=new window.Image),i.current):null,[c,a]=P.useState(()=>bje(o,t));return Gl(()=>{a(bje(o,t))},[o,t]),Gl(()=>{const f=v=>()=>{a(v)};if(!o)return;const m=f("loaded"),y=f("error");return o.addEventListener("load",m),o.addEventListener("error",y),e&&(o.referrerPolicy=e),typeof n=="string"&&(o.crossOrigin=n),()=>{o.removeEventListener("load",m),o.removeEventListener("error",y)}},[o,n,e]),c}var n6e=QPe,s6e=e6e,i6e=r6e;const Li=P.forwardRef(({className:t,...e},n)=>r.jsx(n6e,{ref:n,className:zt("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...e}));Li.displayName=n6e.displayName;const Io=P.forwardRef(({className:t,...e},n)=>r.jsx(s6e,{ref:n,className:zt("aspect-square h-full w-full",t),...e}));Io.displayName=s6e.displayName;const Oi=P.forwardRef(({className:t,...e},n)=>r.jsx(i6e,{ref:n,className:zt("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...e}));Oi.displayName=i6e.displayName;const qne=Rne,yge=uge,Eit=Fne,a6e=P.forwardRef(({className:t,...e},n)=>r.jsx(zC,{className:zt("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:n}));a6e.displayName=zC.displayName;const Iit=MC("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),tI=P.forwardRef(({side:t="right",className:e,children:n,...s},i)=>r.jsxs(Eit,{children:[r.jsx(a6e,{}),r.jsxs(BC,{ref:i,className:zt(Iit({side:t}),e),...s,children:[n,r.jsxs(zne,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-secondary hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[r.jsx(Ms,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));tI.displayName=BC.displayName;const Vne=({className:t,...e})=>r.jsx("div",{className:zt("flex flex-col space-y-2 text-center sm:text-left",t),...e});Vne.displayName="SheetHeader";const Hne=P.forwardRef(({className:t,...e},n)=>r.jsx(QE,{ref:n,className:zt("text-lg font-semibold text-foreground",t),...e}));Hne.displayName=QE.displayName;const Pit=P.forwardRef(({className:t,...e},n)=>r.jsx(JE,{ref:n,className:zt("text-sm text-muted-foreground",t),...e}));Pit.displayName=JE.displayName;function Lit(t,e){return P.useReducer((n,s)=>e[n][s]??n,t)}var xge="ScrollArea",[o6e]=Zl(xge),[Oit,Yf]=o6e(xge),l6e=P.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:s="hover",dir:i,scrollHideDelay:o=600,...c}=t,[a,f]=P.useState(null),[m,y]=P.useState(null),[v,w]=P.useState(null),[k,C]=P.useState(null),[S,T]=P.useState(null),[I,A]=P.useState(0),[D,$]=P.useState(0),[F,q]=P.useState(!1),[W,K]=P.useState(!1),Z=Gs(e,he=>f(he)),re=Rj(i);return r.jsx(Oit,{scope:n,type:s,dir:re,scrollHideDelay:o,scrollArea:a,viewport:m,onViewportChange:y,content:v,onContentChange:w,scrollbarX:k,onScrollbarXChange:C,scrollbarXEnabled:F,onScrollbarXEnabledChange:q,scrollbarY:S,onScrollbarYChange:T,scrollbarYEnabled:W,onScrollbarYEnabledChange:K,onCornerWidthChange:A,onCornerHeightChange:$,children:r.jsx(On.div,{dir:re,...c,ref:Z,style:{position:"relative","--radix-scroll-area-corner-width":I+"px","--radix-scroll-area-corner-height":D+"px",...t.style}})})});l6e.displayName=xge;var c6e="ScrollAreaViewport",d6e=P.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:s,nonce:i,...o}=t,c=Yf(c6e,n),a=P.useRef(null),f=Gs(e,a,c.onViewportChange);return r.jsxs(r.Fragment,{children:[r.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),r.jsx(On.div,{"data-radix-scroll-area-viewport":"",...o,ref:f,style:{overflowX:c.scrollbarXEnabled?"scroll":"hidden",overflowY:c.scrollbarYEnabled?"scroll":"hidden",...t.style},children:r.jsx("div",{ref:c.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})});d6e.displayName=c6e;var Tg="ScrollAreaScrollbar",vge=P.forwardRef((t,e)=>{const{forceMount:n,...s}=t,i=Yf(Tg,t.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:c}=i,a=t.orientation==="horizontal";return P.useEffect(()=>(a?o(!0):c(!0),()=>{a?o(!1):c(!1)}),[a,o,c]),i.type==="hover"?r.jsx(Dit,{...s,ref:e,forceMount:n}):i.type==="scroll"?r.jsx(Rit,{...s,ref:e,forceMount:n}):i.type==="auto"?r.jsx(u6e,{...s,ref:e,forceMount:n}):i.type==="always"?r.jsx(_ge,{...s,ref:e}):null});vge.displayName=Tg;var Dit=P.forwardRef((t,e)=>{const{forceMount:n,...s}=t,i=Yf(Tg,t.__scopeScrollArea),[o,c]=P.useState(!1);return P.useEffect(()=>{const a=i.scrollArea;let f=0;if(a){const m=()=>{window.clearTimeout(f),c(!0)},y=()=>{f=window.setTimeout(()=>c(!1),i.scrollHideDelay)};return a.addEventListener("pointerenter",m),a.addEventListener("pointerleave",y),()=>{window.clearTimeout(f),a.removeEventListener("pointerenter",m),a.removeEventListener("pointerleave",y)}}},[i.scrollArea,i.scrollHideDelay]),r.jsx(oc,{present:n||o,children:r.jsx(u6e,{"data-state":o?"visible":"hidden",...s,ref:e})})}),Rit=P.forwardRef((t,e)=>{const{forceMount:n,...s}=t,i=Yf(Tg,t.__scopeScrollArea),o=t.orientation==="horizontal",c=Gne(()=>f("SCROLL_END"),100),[a,f]=Lit("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return P.useEffect(()=>{if(a==="idle"){const m=window.setTimeout(()=>f("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(m)}},[a,i.scrollHideDelay,f]),P.useEffect(()=>{const m=i.viewport,y=o?"scrollLeft":"scrollTop";if(m){let v=m[y];const w=()=>{const k=m[y];v!==k&&(f("SCROLL"),c()),v=k};return m.addEventListener("scroll",w),()=>m.removeEventListener("scroll",w)}},[i.viewport,o,f,c]),r.jsx(oc,{present:n||a!=="hidden",children:r.jsx(_ge,{"data-state":a==="hidden"?"hidden":"visible",...s,ref:e,onPointerEnter:an(t.onPointerEnter,()=>f("POINTER_ENTER")),onPointerLeave:an(t.onPointerLeave,()=>f("POINTER_LEAVE"))})})}),u6e=P.forwardRef((t,e)=>{const n=Yf(Tg,t.__scopeScrollArea),{forceMount:s,...i}=t,[o,c]=P.useState(!1),a=t.orientation==="horizontal",f=Gne(()=>{if(n.viewport){const m=n.viewport.offsetWidth{const{orientation:n="vertical",...s}=t,i=Yf(Tg,t.__scopeScrollArea),o=P.useRef(null),c=P.useRef(0),[a,f]=P.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),m=g6e(a.viewport,a.content),y={...s,sizes:a,onSizesChange:f,hasThumb:m>0&&m<1,onThumbChange:w=>o.current=w,onThumbPointerUp:()=>c.current=0,onThumbPointerDown:w=>c.current=w};function v(w,k){return qit(w,c.current,a,k)}return n==="horizontal"?r.jsx(Fit,{...y,ref:e,onThumbPositionChange:()=>{if(i.viewport&&o.current){const w=i.viewport.scrollLeft,k=wje(w,a,i.dir);o.current.style.transform=`translate3d(${k}px, 0, 0)`}},onWheelScroll:w=>{i.viewport&&(i.viewport.scrollLeft=w)},onDragScroll:w=>{i.viewport&&(i.viewport.scrollLeft=v(w,i.dir))}}):n==="vertical"?r.jsx(zit,{...y,ref:e,onThumbPositionChange:()=>{if(i.viewport&&o.current){const w=i.viewport.scrollTop,k=wje(w,a);o.current.style.transform=`translate3d(0, ${k}px, 0)`}},onWheelScroll:w=>{i.viewport&&(i.viewport.scrollTop=w)},onDragScroll:w=>{i.viewport&&(i.viewport.scrollTop=v(w))}}):null}),Fit=P.forwardRef((t,e)=>{const{sizes:n,onSizesChange:s,...i}=t,o=Yf(Tg,t.__scopeScrollArea),[c,a]=P.useState(),f=P.useRef(null),m=Gs(e,f,o.onScrollbarXChange);return P.useEffect(()=>{f.current&&a(getComputedStyle(f.current))},[f]),r.jsx(f6e,{"data-orientation":"horizontal",...i,ref:m,sizes:n,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Wne(n)+"px",...t.style},onThumbPointerDown:y=>t.onThumbPointerDown(y.x),onDragScroll:y=>t.onDragScroll(y.x),onWheelScroll:(y,v)=>{if(o.viewport){const w=o.viewport.scrollLeft+y.deltaX;t.onWheelScroll(w),x6e(w,v)&&y.preventDefault()}},onResize:()=>{f.current&&o.viewport&&c&&s({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:f.current.clientWidth,paddingStart:tte(c.paddingLeft),paddingEnd:tte(c.paddingRight)}})}})}),zit=P.forwardRef((t,e)=>{const{sizes:n,onSizesChange:s,...i}=t,o=Yf(Tg,t.__scopeScrollArea),[c,a]=P.useState(),f=P.useRef(null),m=Gs(e,f,o.onScrollbarYChange);return P.useEffect(()=>{f.current&&a(getComputedStyle(f.current))},[f]),r.jsx(f6e,{"data-orientation":"vertical",...i,ref:m,sizes:n,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Wne(n)+"px",...t.style},onThumbPointerDown:y=>t.onThumbPointerDown(y.y),onDragScroll:y=>t.onDragScroll(y.y),onWheelScroll:(y,v)=>{if(o.viewport){const w=o.viewport.scrollTop+y.deltaY;t.onWheelScroll(w),x6e(w,v)&&y.preventDefault()}},onResize:()=>{f.current&&o.viewport&&c&&s({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:f.current.clientHeight,paddingStart:tte(c.paddingTop),paddingEnd:tte(c.paddingBottom)}})}})}),[Bit,h6e]=o6e(Tg),f6e=P.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:s,hasThumb:i,onThumbChange:o,onThumbPointerUp:c,onThumbPointerDown:a,onThumbPositionChange:f,onDragScroll:m,onWheelScroll:y,onResize:v,...w}=t,k=Yf(Tg,n),[C,S]=P.useState(null),T=Gs(e,Z=>S(Z)),I=P.useRef(null),A=P.useRef(""),D=k.viewport,$=s.content-s.viewport,F=$l(y),q=$l(f),W=Gne(v,10);function K(Z){if(I.current){const re=Z.clientX-I.current.left,he=Z.clientY-I.current.top;m({x:re,y:he})}}return P.useEffect(()=>{const Z=re=>{const he=re.target;(C==null?void 0:C.contains(he))&&F(re,$)};return document.addEventListener("wheel",Z,{passive:!1}),()=>document.removeEventListener("wheel",Z,{passive:!1})},[D,C,$,F]),P.useEffect(q,[s,q]),V4(C,W),V4(k.content,W),r.jsx(Bit,{scope:n,scrollbar:C,hasThumb:i,onThumbChange:$l(o),onThumbPointerUp:$l(c),onThumbPositionChange:q,onThumbPointerDown:$l(a),children:r.jsx(On.div,{...w,ref:T,style:{position:"absolute",...w.style},onPointerDown:an(t.onPointerDown,Z=>{Z.button===0&&(Z.target.setPointerCapture(Z.pointerId),I.current=C.getBoundingClientRect(),A.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",k.viewport&&(k.viewport.style.scrollBehavior="auto"),K(Z))}),onPointerMove:an(t.onPointerMove,K),onPointerUp:an(t.onPointerUp,Z=>{const re=Z.target;re.hasPointerCapture(Z.pointerId)&&re.releasePointerCapture(Z.pointerId),document.body.style.webkitUserSelect=A.current,k.viewport&&(k.viewport.style.scrollBehavior=""),I.current=null})})})}),ete="ScrollAreaThumb",p6e=P.forwardRef((t,e)=>{const{forceMount:n,...s}=t,i=h6e(ete,t.__scopeScrollArea);return r.jsx(oc,{present:n||i.hasThumb,children:r.jsx($it,{ref:e,...s})})}),$it=P.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:s,...i}=t,o=Yf(ete,n),c=h6e(ete,n),{onThumbPositionChange:a}=c,f=Gs(e,v=>c.onThumbChange(v)),m=P.useRef(void 0),y=Gne(()=>{m.current&&(m.current(),m.current=void 0)},100);return P.useEffect(()=>{const v=o.viewport;if(v){const w=()=>{if(y(),!m.current){const k=Vit(v,a);m.current=k,a()}};return a(),v.addEventListener("scroll",w),()=>v.removeEventListener("scroll",w)}},[o.viewport,y,a]),r.jsx(On.div,{"data-state":c.hasThumb?"visible":"hidden",...i,ref:f,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...s},onPointerDownCapture:an(t.onPointerDownCapture,v=>{const k=v.target.getBoundingClientRect(),C=v.clientX-k.left,S=v.clientY-k.top;c.onThumbPointerDown({x:C,y:S})}),onPointerUp:an(t.onPointerUp,c.onThumbPointerUp)})});p6e.displayName=ete;var bge="ScrollAreaCorner",m6e=P.forwardRef((t,e)=>{const n=Yf(bge,t.__scopeScrollArea),s=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&s?r.jsx(Uit,{...t,ref:e}):null});m6e.displayName=bge;var Uit=P.forwardRef((t,e)=>{const{__scopeScrollArea:n,...s}=t,i=Yf(bge,n),[o,c]=P.useState(0),[a,f]=P.useState(0),m=!!(o&&a);return V4(i.scrollbarX,()=>{var v;const y=((v=i.scrollbarX)==null?void 0:v.offsetHeight)||0;i.onCornerHeightChange(y),f(y)}),V4(i.scrollbarY,()=>{var v;const y=((v=i.scrollbarY)==null?void 0:v.offsetWidth)||0;i.onCornerWidthChange(y),c(y)}),m?r.jsx(On.div,{...s,ref:e,style:{width:o,height:a,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function tte(t){return t?parseInt(t,10):0}function g6e(t,e){const n=t/e;return isNaN(n)?0:n}function Wne(t){const e=g6e(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=(t.scrollbar.size-n)*e;return Math.max(s,18)}function qit(t,e,n,s="ltr"){const i=Wne(n),o=i/2,c=e||o,a=i-c,f=n.scrollbar.paddingStart+c,m=n.scrollbar.size-n.scrollbar.paddingEnd-a,y=n.content-n.viewport,v=s==="ltr"?[0,y]:[y*-1,0];return y6e([f,m],v)(t)}function wje(t,e,n="ltr"){const s=Wne(e),i=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,o=e.scrollbar.size-i,c=e.content-e.viewport,a=o-s,f=n==="ltr"?[0,c]:[c*-1,0],m=LA(t,f);return y6e([0,c],[0,a])(m)}function y6e(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const s=(e[1]-e[0])/(t[1]-t[0]);return e[0]+s*(n-t[0])}}function x6e(t,e){return t>0&&t{})=>{let n={left:t.scrollLeft,top:t.scrollTop},s=0;return function i(){const o={left:t.scrollLeft,top:t.scrollTop},c=n.left!==o.left,a=n.top!==o.top;(c||a)&&e(),n=o,s=window.requestAnimationFrame(i)}(),()=>window.cancelAnimationFrame(s)};function Gne(t,e){const n=$l(t),s=P.useRef(0);return P.useEffect(()=>()=>window.clearTimeout(s.current),[]),P.useCallback(()=>{window.clearTimeout(s.current),s.current=window.setTimeout(n,e)},[n,e])}function V4(t,e){const n=$l(e);Gl(()=>{let s=0;if(t){const i=new ResizeObserver(()=>{cancelAnimationFrame(s),s=window.requestAnimationFrame(n)});return i.observe(t),()=>{window.cancelAnimationFrame(s),i.unobserve(t)}}},[t,n])}var v6e=l6e,Hit=d6e,Wit=m6e;const xl=P.forwardRef(({className:t,children:e,...n},s)=>r.jsxs(v6e,{ref:s,className:zt("relative overflow-hidden",t),...n,children:[r.jsx(Hit,{className:"h-full w-full rounded-[inherit]",children:e}),r.jsx(wge,{}),r.jsx(Wit,{})]}));xl.displayName=v6e.displayName;const wge=P.forwardRef(({className:t,orientation:e="vertical",...n},s)=>r.jsx(vge,{ref:s,orientation:e,className:zt("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...n,children:r.jsx(p6e,{className:"relative flex-1 rounded-full bg-border"})}));wge.displayName=vge.displayName;var Lle="rovingFocusGroup.onEntryFocus",Git={bubbles:!1,cancelable:!0},rI="RovingFocusGroup",[rhe,_6e,Kit]=$E(rI),[Zit,qC]=Zl(rI,[Kit]),[Yit,Xit]=Zit(rI),b6e=P.forwardRef((t,e)=>r.jsx(rhe.Provider,{scope:t.__scopeRovingFocusGroup,children:r.jsx(rhe.Slot,{scope:t.__scopeRovingFocusGroup,children:r.jsx(Qit,{...t,ref:e})})}));b6e.displayName=rI;var Qit=P.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:i=!1,dir:o,currentTabStopId:c,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:f,onEntryFocus:m,preventScrollOnEntryFocus:y=!1,...v}=t,w=P.useRef(null),k=Gs(e,w),C=Rj(o),[S,T]=Tu({prop:c,defaultProp:a??null,onChange:f,caller:rI}),[I,A]=P.useState(!1),D=$l(m),$=_6e(n),F=P.useRef(!1),[q,W]=P.useState(0);return P.useEffect(()=>{const K=w.current;if(K)return K.addEventListener(Lle,D),()=>K.removeEventListener(Lle,D)},[D]),r.jsx(Yit,{scope:n,orientation:s,dir:C,loop:i,currentTabStopId:S,onItemFocus:P.useCallback(K=>T(K),[T]),onItemShiftTab:P.useCallback(()=>A(!0),[]),onFocusableItemAdd:P.useCallback(()=>W(K=>K+1),[]),onFocusableItemRemove:P.useCallback(()=>W(K=>K-1),[]),children:r.jsx(On.div,{tabIndex:I||q===0?-1:0,"data-orientation":s,...v,ref:k,style:{outline:"none",...t.style},onMouseDown:an(t.onMouseDown,()=>{F.current=!0}),onFocus:an(t.onFocus,K=>{const Z=!F.current;if(K.target===K.currentTarget&&Z&&!I){const re=new CustomEvent(Lle,Git);if(K.currentTarget.dispatchEvent(re),!re.defaultPrevented){const he=$().filter(ie=>ie.focusable),ue=he.find(ie=>ie.active),Ne=he.find(ie=>ie.id===S),xe=[ue,Ne,...he].filter(Boolean).map(ie=>ie.ref.current);k6e(xe,y)}}F.current=!1}),onBlur:an(t.onBlur,()=>A(!1))})})}),w6e="RovingFocusGroupItem",j6e=P.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:i=!1,tabStopId:o,children:c,...a}=t,f=Fc(),m=o||f,y=Xit(w6e,n),v=y.currentTabStopId===m,w=_6e(n),{onFocusableItemAdd:k,onFocusableItemRemove:C,currentTabStopId:S}=y;return P.useEffect(()=>{if(s)return k(),()=>C()},[s,k,C]),r.jsx(rhe.ItemSlot,{scope:n,id:m,focusable:s,active:i,children:r.jsx(On.span,{tabIndex:v?0:-1,"data-orientation":y.orientation,...a,ref:e,onMouseDown:an(t.onMouseDown,T=>{s?y.onItemFocus(m):T.preventDefault()}),onFocus:an(t.onFocus,()=>y.onItemFocus(m)),onKeyDown:an(t.onKeyDown,T=>{if(T.key==="Tab"&&T.shiftKey){y.onItemShiftTab();return}if(T.target!==T.currentTarget)return;const I=tat(T,y.orientation,y.dir);if(I!==void 0){if(T.metaKey||T.ctrlKey||T.altKey||T.shiftKey)return;T.preventDefault();let D=w().filter($=>$.focusable).map($=>$.ref.current);if(I==="last")D.reverse();else if(I==="prev"||I==="next"){I==="prev"&&D.reverse();const $=D.indexOf(T.currentTarget);D=y.loop?rat(D,$+1):D.slice($+1)}setTimeout(()=>k6e(D))}}),children:typeof c=="function"?c({isCurrentTabStop:v,hasTabStop:S!=null}):c})})});j6e.displayName=w6e;var Jit={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function eat(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function tat(t,e,n){const s=eat(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return Jit[s]}function k6e(t,e=!1){const n=document.activeElement;for(const s of t)if(s===n||(s.focus({preventScroll:e}),document.activeElement!==n))return}function rat(t,e){return t.map((n,s)=>t[(e+s)%t.length])}var jge=b6e,kge=j6e,nhe=["Enter"," "],nat=["ArrowDown","PageUp","Home"],N6e=["ArrowUp","PageDown","End"],sat=[...nat,...N6e],iat={ltr:[...nhe,"ArrowRight"],rtl:[...nhe,"ArrowLeft"]},aat={ltr:["ArrowLeft"],rtl:["ArrowRight"]},nI="Menu",[RA,oat,lat]=$E(nI),[Fj,S6e]=Zl(nI,[lat,Ng,qC]),Kne=Ng(),C6e=qC(),[cat,zj]=Fj(nI),[dat,sI]=Fj(nI),M6e=t=>{const{__scopeMenu:e,open:n=!1,children:s,dir:i,onOpenChange:o,modal:c=!0}=t,a=Kne(e),[f,m]=P.useState(null),y=P.useRef(!1),v=$l(o),w=Rj(i);return P.useEffect(()=>{const k=()=>{y.current=!0,document.addEventListener("pointerdown",C,{capture:!0,once:!0}),document.addEventListener("pointermove",C,{capture:!0,once:!0})},C=()=>y.current=!1;return document.addEventListener("keydown",k,{capture:!0}),()=>{document.removeEventListener("keydown",k,{capture:!0}),document.removeEventListener("pointerdown",C,{capture:!0}),document.removeEventListener("pointermove",C,{capture:!0})}},[]),r.jsx(HE,{...a,children:r.jsx(cat,{scope:e,open:n,onOpenChange:v,content:f,onContentChange:m,children:r.jsx(dat,{scope:e,onClose:P.useCallback(()=>v(!1),[v]),isUsingKeyboardRef:y,dir:w,modal:c,children:s})})})};M6e.displayName=nI;var uat="MenuAnchor",Nge=P.forwardRef((t,e)=>{const{__scopeMenu:n,...s}=t,i=Kne(n);return r.jsx(IC,{...i,...s,ref:e})});Nge.displayName=uat;var Sge="MenuPortal",[hat,T6e]=Fj(Sge,{forceMount:void 0}),A6e=t=>{const{__scopeMenu:e,forceMount:n,children:s,container:i}=t,o=zj(Sge,e);return r.jsx(hat,{scope:e,forceMount:n,children:r.jsx(oc,{present:n||o.open,children:r.jsx(CC,{asChild:!0,container:i,children:s})})})};A6e.displayName=Sge;var $f="MenuContent",[fat,Cge]=Fj($f),E6e=P.forwardRef((t,e)=>{const n=T6e($f,t.__scopeMenu),{forceMount:s=n.forceMount,...i}=t,o=zj($f,t.__scopeMenu),c=sI($f,t.__scopeMenu);return r.jsx(RA.Provider,{scope:t.__scopeMenu,children:r.jsx(oc,{present:s||o.open,children:r.jsx(RA.Slot,{scope:t.__scopeMenu,children:c.modal?r.jsx(pat,{...i,ref:e}):r.jsx(mat,{...i,ref:e})})})})}),pat=P.forwardRef((t,e)=>{const n=zj($f,t.__scopeMenu),s=P.useRef(null),i=Gs(e,s);return P.useEffect(()=>{const o=s.current;if(o)return One(o)},[]),r.jsx(Mge,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:an(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),mat=P.forwardRef((t,e)=>{const n=zj($f,t.__scopeMenu);return r.jsx(Mge,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),gat=p1("MenuContent.ScrollLock"),Mge=P.forwardRef((t,e)=>{const{__scopeMenu:n,loop:s=!1,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:c,disableOutsidePointerEvents:a,onEntryFocus:f,onEscapeKeyDown:m,onPointerDownOutside:y,onFocusOutside:v,onInteractOutside:w,onDismiss:k,disableOutsideScroll:C,...S}=t,T=zj($f,n),I=sI($f,n),A=Kne(n),D=C6e(n),$=oat(n),[F,q]=P.useState(null),W=P.useRef(null),K=Gs(e,W,T.onContentChange),Z=P.useRef(0),re=P.useRef(""),he=P.useRef(0),ue=P.useRef(null),Ne=P.useRef("right"),se=P.useRef(0),xe=C?XE:P.Fragment,ie=C?{as:gat,allowPinchZoom:!0}:void 0,me=ve=>{var Re,$e;const Ie=re.current+ve,Se=$().filter(Pe=>!Pe.disabled),oe=document.activeElement,ae=(Re=Se.find(Pe=>Pe.ref.current===oe))==null?void 0:Re.textValue,je=Se.map(Pe=>Pe.textValue),Me=Mat(je,Ie,ae),Ue=($e=Se.find(Pe=>Pe.textValue===Me))==null?void 0:$e.ref.current;(function Pe(Ae){re.current=Ae,window.clearTimeout(Z.current),Ae!==""&&(Z.current=window.setTimeout(()=>Pe(""),1e3))})(Ie),Ue&&setTimeout(()=>Ue.focus())};P.useEffect(()=>()=>window.clearTimeout(Z.current),[]),Pne();const fe=P.useCallback(ve=>{var Se,oe;return Ne.current===((Se=ue.current)==null?void 0:Se.side)&&Aat(ve,(oe=ue.current)==null?void 0:oe.area)},[]);return r.jsx(fat,{scope:n,searchRef:re,onItemEnter:P.useCallback(ve=>{fe(ve)&&ve.preventDefault()},[fe]),onItemLeave:P.useCallback(ve=>{var Ie;fe(ve)||((Ie=W.current)==null||Ie.focus(),q(null))},[fe]),onTriggerLeave:P.useCallback(ve=>{fe(ve)&&ve.preventDefault()},[fe]),pointerGraceTimerRef:he,onPointerGraceIntentChange:P.useCallback(ve=>{ue.current=ve},[]),children:r.jsx(xe,{...ie,children:r.jsx(YE,{asChild:!0,trapped:i,onMountAutoFocus:an(o,ve=>{var Ie;ve.preventDefault(),(Ie=W.current)==null||Ie.focus({preventScroll:!0})}),onUnmountAutoFocus:c,children:r.jsx(S1,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:m,onPointerDownOutside:y,onFocusOutside:v,onInteractOutside:w,onDismiss:k,children:r.jsx(jge,{asChild:!0,...D,dir:I.dir,orientation:"vertical",loop:s,currentTabStopId:F,onCurrentTabStopIdChange:q,onEntryFocus:an(f,ve=>{I.isUsingKeyboardRef.current||ve.preventDefault()}),preventScrollOnEntryFocus:!0,children:r.jsx(WE,{role:"menu","aria-orientation":"vertical","data-state":G6e(T.open),"data-radix-menu-content":"",dir:I.dir,...A,...S,ref:K,style:{outline:"none",...S.style},onKeyDown:an(S.onKeyDown,ve=>{const Se=ve.target.closest("[data-radix-menu-content]")===ve.currentTarget,oe=ve.ctrlKey||ve.altKey||ve.metaKey,ae=ve.key.length===1;Se&&(ve.key==="Tab"&&ve.preventDefault(),!oe&&ae&&me(ve.key));const je=W.current;if(ve.target!==je||!sat.includes(ve.key))return;ve.preventDefault();const Ue=$().filter(Re=>!Re.disabled).map(Re=>Re.ref.current);N6e.includes(ve.key)&&Ue.reverse(),Sat(Ue)}),onBlur:an(t.onBlur,ve=>{ve.currentTarget.contains(ve.target)||(window.clearTimeout(Z.current),re.current="")}),onPointerMove:an(t.onPointerMove,FA(ve=>{const Ie=ve.target,Se=se.current!==ve.clientX;if(ve.currentTarget.contains(Ie)&&Se){const oe=ve.clientX>se.current?"right":"left";Ne.current=oe,se.current=ve.clientX}}))})})})})})})});E6e.displayName=$f;var yat="MenuGroup",Tge=P.forwardRef((t,e)=>{const{__scopeMenu:n,...s}=t;return r.jsx(On.div,{role:"group",...s,ref:e})});Tge.displayName=yat;var xat="MenuLabel",I6e=P.forwardRef((t,e)=>{const{__scopeMenu:n,...s}=t;return r.jsx(On.div,{...s,ref:e})});I6e.displayName=xat;var rte="MenuItem",jje="menu.itemSelect",Zne=P.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:s,...i}=t,o=P.useRef(null),c=sI(rte,t.__scopeMenu),a=Cge(rte,t.__scopeMenu),f=Gs(e,o),m=P.useRef(!1),y=()=>{const v=o.current;if(!n&&v){const w=new CustomEvent(jje,{bubbles:!0,cancelable:!0});v.addEventListener(jje,k=>s==null?void 0:s(k),{once:!0}),Cme(v,w),w.defaultPrevented?m.current=!1:c.onClose()}};return r.jsx(P6e,{...i,ref:f,disabled:n,onClick:an(t.onClick,y),onPointerDown:v=>{var w;(w=t.onPointerDown)==null||w.call(t,v),m.current=!0},onPointerUp:an(t.onPointerUp,v=>{var w;m.current||(w=v.currentTarget)==null||w.click()}),onKeyDown:an(t.onKeyDown,v=>{const w=a.searchRef.current!=="";n||w&&v.key===" "||nhe.includes(v.key)&&(v.currentTarget.click(),v.preventDefault())})})});Zne.displayName=rte;var P6e=P.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:s=!1,textValue:i,...o}=t,c=Cge(rte,n),a=C6e(n),f=P.useRef(null),m=Gs(e,f),[y,v]=P.useState(!1),[w,k]=P.useState("");return P.useEffect(()=>{const C=f.current;C&&k((C.textContent??"").trim())},[o.children]),r.jsx(RA.ItemSlot,{scope:n,disabled:s,textValue:i??w,children:r.jsx(kge,{asChild:!0,...a,focusable:!s,children:r.jsx(On.div,{role:"menuitem","data-highlighted":y?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...o,ref:m,onPointerMove:an(t.onPointerMove,FA(C=>{s?c.onItemLeave(C):(c.onItemEnter(C),C.defaultPrevented||C.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:an(t.onPointerLeave,FA(C=>c.onItemLeave(C))),onFocus:an(t.onFocus,()=>v(!0)),onBlur:an(t.onBlur,()=>v(!1))})})})}),vat="MenuCheckboxItem",L6e=P.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:s,...i}=t;return r.jsx(z6e,{scope:t.__scopeMenu,checked:n,children:r.jsx(Zne,{role:"menuitemcheckbox","aria-checked":nte(n)?"mixed":n,...i,ref:e,"data-state":Ege(n),onSelect:an(i.onSelect,()=>s==null?void 0:s(nte(n)?!0:!n),{checkForDefaultPrevented:!1})})})});L6e.displayName=vat;var O6e="MenuRadioGroup",[_at,bat]=Fj(O6e,{value:void 0,onValueChange:()=>{}}),D6e=P.forwardRef((t,e)=>{const{value:n,onValueChange:s,...i}=t,o=$l(s);return r.jsx(_at,{scope:t.__scopeMenu,value:n,onValueChange:o,children:r.jsx(Tge,{...i,ref:e})})});D6e.displayName=O6e;var R6e="MenuRadioItem",F6e=P.forwardRef((t,e)=>{const{value:n,...s}=t,i=bat(R6e,t.__scopeMenu),o=n===i.value;return r.jsx(z6e,{scope:t.__scopeMenu,checked:o,children:r.jsx(Zne,{role:"menuitemradio","aria-checked":o,...s,ref:e,"data-state":Ege(o),onSelect:an(s.onSelect,()=>{var c;return(c=i.onValueChange)==null?void 0:c.call(i,n)},{checkForDefaultPrevented:!1})})})});F6e.displayName=R6e;var Age="MenuItemIndicator",[z6e,wat]=Fj(Age,{checked:!1}),B6e=P.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:s,...i}=t,o=wat(Age,n);return r.jsx(oc,{present:s||nte(o.checked)||o.checked===!0,children:r.jsx(On.span,{...i,ref:e,"data-state":Ege(o.checked)})})});B6e.displayName=Age;var jat="MenuSeparator",$6e=P.forwardRef((t,e)=>{const{__scopeMenu:n,...s}=t;return r.jsx(On.div,{role:"separator","aria-orientation":"horizontal",...s,ref:e})});$6e.displayName=jat;var kat="MenuArrow",U6e=P.forwardRef((t,e)=>{const{__scopeMenu:n,...s}=t,i=Kne(n);return r.jsx(GE,{...i,...s,ref:e})});U6e.displayName=kat;var Nat="MenuSub",[MGt,q6e]=Fj(Nat),U5="MenuSubTrigger",V6e=P.forwardRef((t,e)=>{const n=zj(U5,t.__scopeMenu),s=sI(U5,t.__scopeMenu),i=q6e(U5,t.__scopeMenu),o=Cge(U5,t.__scopeMenu),c=P.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:f}=o,m={__scopeMenu:t.__scopeMenu},y=P.useCallback(()=>{c.current&&window.clearTimeout(c.current),c.current=null},[]);return P.useEffect(()=>y,[y]),P.useEffect(()=>{const v=a.current;return()=>{window.clearTimeout(v),f(null)}},[a,f]),r.jsx(Nge,{asChild:!0,...m,children:r.jsx(P6e,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":G6e(n.open),...t,ref:Uy(e,i.onTriggerChange),onClick:v=>{var w;(w=t.onClick)==null||w.call(t,v),!(t.disabled||v.defaultPrevented)&&(v.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:an(t.onPointerMove,FA(v=>{o.onItemEnter(v),!v.defaultPrevented&&!t.disabled&&!n.open&&!c.current&&(o.onPointerGraceIntentChange(null),c.current=window.setTimeout(()=>{n.onOpenChange(!0),y()},100))})),onPointerLeave:an(t.onPointerLeave,FA(v=>{var k,C;y();const w=(k=n.content)==null?void 0:k.getBoundingClientRect();if(w){const S=(C=n.content)==null?void 0:C.dataset.side,T=S==="right",I=T?-5:5,A=w[T?"left":"right"],D=w[T?"right":"left"];o.onPointerGraceIntentChange({area:[{x:v.clientX+I,y:v.clientY},{x:A,y:w.top},{x:D,y:w.top},{x:D,y:w.bottom},{x:A,y:w.bottom}],side:S}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(v),v.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:an(t.onKeyDown,v=>{var k;const w=o.searchRef.current!=="";t.disabled||w&&v.key===" "||iat[s.dir].includes(v.key)&&(n.onOpenChange(!0),(k=n.content)==null||k.focus(),v.preventDefault())})})})});V6e.displayName=U5;var H6e="MenuSubContent",W6e=P.forwardRef((t,e)=>{const n=T6e($f,t.__scopeMenu),{forceMount:s=n.forceMount,...i}=t,o=zj($f,t.__scopeMenu),c=sI($f,t.__scopeMenu),a=q6e(H6e,t.__scopeMenu),f=P.useRef(null),m=Gs(e,f);return r.jsx(RA.Provider,{scope:t.__scopeMenu,children:r.jsx(oc,{present:s||o.open,children:r.jsx(RA.Slot,{scope:t.__scopeMenu,children:r.jsx(Mge,{id:a.contentId,"aria-labelledby":a.triggerId,...i,ref:m,align:"start",side:c.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:y=>{var v;c.isUsingKeyboardRef.current&&((v=f.current)==null||v.focus()),y.preventDefault()},onCloseAutoFocus:y=>y.preventDefault(),onFocusOutside:an(t.onFocusOutside,y=>{y.target!==a.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:an(t.onEscapeKeyDown,y=>{c.onClose(),y.preventDefault()}),onKeyDown:an(t.onKeyDown,y=>{var k;const v=y.currentTarget.contains(y.target),w=aat[c.dir].includes(y.key);v&&w&&(o.onOpenChange(!1),(k=a.trigger)==null||k.focus(),y.preventDefault())})})})})})});W6e.displayName=H6e;function G6e(t){return t?"open":"closed"}function nte(t){return t==="indeterminate"}function Ege(t){return nte(t)?"indeterminate":t?"checked":"unchecked"}function Sat(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function Cat(t,e){return t.map((n,s)=>t[(e+s)%t.length])}function Mat(t,e,n){const i=e.length>1&&Array.from(e).every(m=>m===e[0])?e[0]:e,o=n?t.indexOf(n):-1;let c=Cat(t,Math.max(o,0));i.length===1&&(c=c.filter(m=>m!==n));const f=c.find(m=>m.toLowerCase().startsWith(i.toLowerCase()));return f!==n?f:void 0}function Tat(t,e){const{x:n,y:s}=t;let i=!1;for(let o=0,c=e.length-1;os!=w>s&&n<(v-m)*(s-y)/(w-y)+m&&(i=!i)}return i}function Aat(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return Tat(n,e)}function FA(t){return e=>e.pointerType==="mouse"?t(e):void 0}var Eat=M6e,Iat=Nge,Pat=A6e,Lat=E6e,Oat=Tge,Dat=I6e,Rat=Zne,Fat=L6e,zat=D6e,Bat=F6e,$at=B6e,Uat=$6e,qat=U6e,Vat=V6e,Hat=W6e,Yne="DropdownMenu",[Wat]=Zl(Yne,[S6e]),Lu=S6e(),[Gat,K6e]=Wat(Yne),Z6e=t=>{const{__scopeDropdownMenu:e,children:n,dir:s,open:i,defaultOpen:o,onOpenChange:c,modal:a=!0}=t,f=Lu(e),m=P.useRef(null),[y,v]=Tu({prop:i,defaultProp:o??!1,onChange:c,caller:Yne});return r.jsx(Gat,{scope:e,triggerId:Fc(),triggerRef:m,contentId:Fc(),open:y,onOpenChange:v,onOpenToggle:P.useCallback(()=>v(w=>!w),[v]),modal:a,children:r.jsx(Eat,{...f,open:y,onOpenChange:v,dir:s,modal:a,children:n})})};Z6e.displayName=Yne;var Y6e="DropdownMenuTrigger",X6e=P.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:s=!1,...i}=t,o=K6e(Y6e,n),c=Lu(n);return r.jsx(Iat,{asChild:!0,...c,children:r.jsx(On.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":s?"":void 0,disabled:s,...i,ref:Uy(e,o.triggerRef),onPointerDown:an(t.onPointerDown,a=>{!s&&a.button===0&&a.ctrlKey===!1&&(o.onOpenToggle(),o.open||a.preventDefault())}),onKeyDown:an(t.onKeyDown,a=>{s||(["Enter"," "].includes(a.key)&&o.onOpenToggle(),a.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});X6e.displayName=Y6e;var Kat="DropdownMenuPortal",Q6e=t=>{const{__scopeDropdownMenu:e,...n}=t,s=Lu(e);return r.jsx(Pat,{...s,...n})};Q6e.displayName=Kat;var J6e="DropdownMenuContent",eLe=P.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,i=K6e(J6e,n),o=Lu(n),c=P.useRef(!1);return r.jsx(Lat,{id:i.contentId,"aria-labelledby":i.triggerId,...o,...s,ref:e,onCloseAutoFocus:an(t.onCloseAutoFocus,a=>{var f;c.current||(f=i.triggerRef.current)==null||f.focus(),c.current=!1,a.preventDefault()}),onInteractOutside:an(t.onInteractOutside,a=>{const f=a.detail.originalEvent,m=f.button===0&&f.ctrlKey===!0,y=f.button===2||m;(!i.modal||y)&&(c.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});eLe.displayName=J6e;var Zat="DropdownMenuGroup",Yat=P.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,i=Lu(n);return r.jsx(Oat,{...i,...s,ref:e})});Yat.displayName=Zat;var Xat="DropdownMenuLabel",tLe=P.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,i=Lu(n);return r.jsx(Dat,{...i,...s,ref:e})});tLe.displayName=Xat;var Qat="DropdownMenuItem",rLe=P.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,i=Lu(n);return r.jsx(Rat,{...i,...s,ref:e})});rLe.displayName=Qat;var Jat="DropdownMenuCheckboxItem",nLe=P.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,i=Lu(n);return r.jsx(Fat,{...i,...s,ref:e})});nLe.displayName=Jat;var eot="DropdownMenuRadioGroup",tot=P.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,i=Lu(n);return r.jsx(zat,{...i,...s,ref:e})});tot.displayName=eot;var rot="DropdownMenuRadioItem",sLe=P.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,i=Lu(n);return r.jsx(Bat,{...i,...s,ref:e})});sLe.displayName=rot;var not="DropdownMenuItemIndicator",iLe=P.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,i=Lu(n);return r.jsx($at,{...i,...s,ref:e})});iLe.displayName=not;var sot="DropdownMenuSeparator",aLe=P.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,i=Lu(n);return r.jsx(Uat,{...i,...s,ref:e})});aLe.displayName=sot;var iot="DropdownMenuArrow",aot=P.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,i=Lu(n);return r.jsx(qat,{...i,...s,ref:e})});aot.displayName=iot;var oot="DropdownMenuSubTrigger",oLe=P.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,i=Lu(n);return r.jsx(Vat,{...i,...s,ref:e})});oLe.displayName=oot;var lot="DropdownMenuSubContent",lLe=P.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,i=Lu(n);return r.jsx(Hat,{...i,...s,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});lLe.displayName=lot;var cot=Z6e,dot=X6e,uot=Q6e,cLe=eLe,dLe=tLe,uLe=rLe,hLe=nLe,fLe=sLe,pLe=iLe,mLe=aLe,gLe=oLe,yLe=lLe;const fm=cot,pm=dot,hot=P.forwardRef(({className:t,inset:e,children:n,...s},i)=>r.jsxs(gLe,{ref:i,className:zt("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[state=open]:bg-accent focus:bg-accent",e&&"pl-8",t),...s,children:[n,r.jsx(Ha,{className:"ml-auto h-4 w-4"})]}));hot.displayName=gLe.displayName;const fot=P.forwardRef(({className:t,...e},n)=>r.jsx(yLe,{ref:n,className:zt("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...e}));fot.displayName=yLe.displayName;const Xf=P.forwardRef(({className:t,sideOffset:e=4,...n},s)=>r.jsx(uot,{children:r.jsx(cLe,{ref:s,sideOffset:e,className:zt("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n})}));Xf.displayName=cLe.displayName;const uo=P.forwardRef(({className:t,inset:e,...n},s)=>r.jsx(uLe,{ref:s,className:zt("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e&&"pl-8",t),...n}));uo.displayName=uLe.displayName;const pot=P.forwardRef(({className:t,children:e,checked:n,...s},i)=>r.jsxs(hLe,{ref:i,className:zt("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",t),checked:n,...s,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(pLe,{children:r.jsx(Ba,{className:"h-4 w-4"})})}),e]}));pot.displayName=hLe.displayName;const mot=P.forwardRef(({className:t,children:e,...n},s)=>r.jsxs(fLe,{ref:s,className:zt("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",t),...n,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(pLe,{children:r.jsx(Mu,{className:"h-2 w-2 fill-current"})})}),e]}));mot.displayName=fLe.displayName;const she=P.forwardRef(({className:t,inset:e,...n},s)=>r.jsx(dLe,{ref:s,className:zt("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...n}));she.displayName=dLe.displayName;const H4=P.forwardRef(({className:t,...e},n)=>r.jsx(mLe,{ref:n,className:zt("-mx-1 my-1 h-px bg-muted",t),...e}));H4.displayName=mLe.displayName;var Xne="Collapsible",[got]=Zl(Xne),[yot,Ige]=got(Xne),xLe=P.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:s,defaultOpen:i,disabled:o,onOpenChange:c,...a}=t,[f,m]=Tu({prop:s,defaultProp:i??!1,onChange:c,caller:Xne});return r.jsx(yot,{scope:n,disabled:o,contentId:Fc(),open:f,onOpenToggle:P.useCallback(()=>m(y=>!y),[m]),children:r.jsx(On.div,{"data-state":Lge(f),"data-disabled":o?"":void 0,...a,ref:e})})});xLe.displayName=Xne;var vLe="CollapsibleTrigger",_Le=P.forwardRef((t,e)=>{const{__scopeCollapsible:n,...s}=t,i=Ige(vLe,n);return r.jsx(On.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":Lge(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...s,ref:e,onClick:an(t.onClick,i.onOpenToggle)})});_Le.displayName=vLe;var Pge="CollapsibleContent",bLe=P.forwardRef((t,e)=>{const{forceMount:n,...s}=t,i=Ige(Pge,t.__scopeCollapsible);return r.jsx(oc,{present:n||i.open,children:({present:o})=>r.jsx(xot,{...s,ref:e,present:o})})});bLe.displayName=Pge;var xot=P.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:s,children:i,...o}=t,c=Ige(Pge,n),[a,f]=P.useState(s),m=P.useRef(null),y=Gs(e,m),v=P.useRef(0),w=v.current,k=P.useRef(0),C=k.current,S=c.open||a,T=P.useRef(S),I=P.useRef(void 0);return P.useEffect(()=>{const A=requestAnimationFrame(()=>T.current=!1);return()=>cancelAnimationFrame(A)},[]),Gl(()=>{const A=m.current;if(A){I.current=I.current||{transitionDuration:A.style.transitionDuration,animationName:A.style.animationName},A.style.transitionDuration="0s",A.style.animationName="none";const D=A.getBoundingClientRect();v.current=D.height,k.current=D.width,T.current||(A.style.transitionDuration=I.current.transitionDuration,A.style.animationName=I.current.animationName),f(s)}},[c.open,s]),r.jsx(On.div,{"data-state":Lge(c.open),"data-disabled":c.disabled?"":void 0,id:c.contentId,hidden:!S,...o,ref:y,style:{"--radix-collapsible-content-height":w?`${w}px`:void 0,"--radix-collapsible-content-width":C?`${C}px`:void 0,...t.style},children:S&&i})});function Lge(t){return t?"open":"closed"}var vot=xLe;const RT=vot,FT=_Le,zT=bLe,kje="/assets/levelup-logo-Eif24dqY.png",_ot="/assets/levelup-logo-icon-C-7iromj.png";var iI=t=>t.type==="checkbox",fw=t=>t instanceof Date,mu=t=>t==null;const wLe=t=>typeof t=="object";var ac=t=>!mu(t)&&!Array.isArray(t)&&wLe(t)&&!fw(t),jLe=t=>ac(t)&&t.target?iI(t.target)?t.target.checked:t.target.value:t,bot=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,kLe=(t,e)=>t.has(bot(e)),wot=t=>{const e=t.constructor&&t.constructor.prototype;return ac(e)&&e.hasOwnProperty("isPrototypeOf")},Oge=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ec(t){let e;const n=Array.isArray(t),s=typeof FileList<"u"?t instanceof FileList:!1;if(t instanceof Date)e=new Date(t);else if(!(Oge&&(t instanceof Blob||s))&&(n||ac(t)))if(e=n?[]:{},!n&&!wot(t))e=t;else for(const i in t)t.hasOwnProperty(i)&&(e[i]=Ec(t[i]));else return t;return e}var Qne=t=>/^\w*$/.test(t),tc=t=>t===void 0,Dge=t=>Array.isArray(t)?t.filter(Boolean):[],Rge=t=>Dge(t.replace(/["|']|\]/g,"").split(/\.|\[/)),Vn=(t,e,n)=>{if(!e||!ac(t))return n;const s=(Qne(e)?[e]:Rge(e)).reduce((i,o)=>mu(i)?i:i[o],t);return tc(s)||s===t?tc(t[e])?n:t[e]:s},Ih=t=>typeof t=="boolean",go=(t,e,n)=>{let s=-1;const i=Qne(e)?[e]:Rge(e),o=i.length,c=o-1;for(;++slt.useContext(Fge),jot=t=>{const{children:e,...n}=t;return lt.createElement(Fge.Provider,{value:n},e)};var NLe=(t,e,n,s=!0)=>{const i={defaultValues:e._defaultValues};for(const o in t)Object.defineProperty(i,o,{get:()=>{const c=o;return e._proxyFormState[c]!==Hp.all&&(e._proxyFormState[c]=!s||Hp.all),n&&(n[c]=!0),t[c]}});return i};const zge=typeof window<"u"?lt.useLayoutEffect:lt.useEffect;function kot(t){const e=Jne(),{control:n=e.control,disabled:s,name:i,exact:o}=t||{},[c,a]=lt.useState(n._formState),f=lt.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return zge(()=>n._subscribe({name:i,formState:f.current,exact:o,callback:m=>{!s&&a({...n._formState,...m})}}),[i,s,o]),lt.useEffect(()=>{f.current.isValid&&n._setValid(!0)},[n]),lt.useMemo(()=>NLe(c,n,f.current,!1),[c,n])}var eg=t=>typeof t=="string",SLe=(t,e,n,s,i)=>eg(t)?(s&&e.watch.add(t),Vn(n,t,i)):Array.isArray(t)?t.map(o=>(s&&e.watch.add(o),Vn(n,o))):(s&&(e.watchAll=!0),n),ihe=t=>mu(t)||!wLe(t);function vy(t,e,n=new WeakSet){if(ihe(t)||ihe(e))return t===e;if(fw(t)&&fw(e))return t.getTime()===e.getTime();const s=Object.keys(t),i=Object.keys(e);if(s.length!==i.length)return!1;if(n.has(t)||n.has(e))return!0;n.add(t),n.add(e);for(const o of s){const c=t[o];if(!i.includes(o))return!1;if(o!=="ref"){const a=e[o];if(fw(c)&&fw(a)||ac(c)&&ac(a)||Array.isArray(c)&&Array.isArray(a)?!vy(c,a,n):c!==a)return!1}}return!0}function Not(t){const e=Jne(),{control:n=e.control,name:s,defaultValue:i,disabled:o,exact:c,compute:a}=t||{},f=lt.useRef(i),m=lt.useRef(a),y=lt.useRef(void 0);m.current=a;const v=lt.useMemo(()=>n._getWatch(s,f.current),[n,s]),[w,k]=lt.useState(m.current?m.current(v):v);return zge(()=>n._subscribe({name:s,formState:{values:!0},exact:c,callback:C=>{if(!o){const S=SLe(s,n._names,C.values||n._formValues,!1,f.current);if(m.current){const T=m.current(S);vy(T,y.current)||(k(T),y.current=T)}else k(S)}}}),[n,o,s,c]),lt.useEffect(()=>n._removeUnmounted()),w}function Sot(t){const e=Jne(),{name:n,disabled:s,control:i=e.control,shouldUnregister:o,defaultValue:c}=t,a=kLe(i._names.array,n),f=lt.useMemo(()=>Vn(i._formValues,n,Vn(i._defaultValues,n,c)),[i,n,c]),m=Not({control:i,name:n,defaultValue:f,exact:!0}),y=kot({control:i,name:n,exact:!0}),v=lt.useRef(t),w=lt.useRef(i.register(n,{...t.rules,value:m,...Ih(t.disabled)?{disabled:t.disabled}:{}}));v.current=t;const k=lt.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Vn(y.errors,n)},isDirty:{enumerable:!0,get:()=>!!Vn(y.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!Vn(y.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!Vn(y.validatingFields,n)},error:{enumerable:!0,get:()=>Vn(y.errors,n)}}),[y,n]),C=lt.useCallback(A=>w.current.onChange({target:{value:jLe(A),name:n},type:ste.CHANGE}),[n]),S=lt.useCallback(()=>w.current.onBlur({target:{value:Vn(i._formValues,n),name:n},type:ste.BLUR}),[n,i._formValues]),T=lt.useCallback(A=>{const D=Vn(i._fields,n);D&&A&&(D._f.ref={focus:()=>A.focus&&A.focus(),select:()=>A.select&&A.select(),setCustomValidity:$=>A.setCustomValidity($),reportValidity:()=>A.reportValidity()})},[i._fields,n]),I=lt.useMemo(()=>({name:n,value:m,...Ih(s)||y.disabled?{disabled:y.disabled||s}:{},onChange:C,onBlur:S,ref:T}),[n,s,y.disabled,C,S,T,m]);return lt.useEffect(()=>{const A=i._options.shouldUnregister||o;i.register(n,{...v.current.rules,...Ih(v.current.disabled)?{disabled:v.current.disabled}:{}});const D=($,F)=>{const q=Vn(i._fields,$);q&&q._f&&(q._f.mount=F)};if(D(n,!0),A){const $=Ec(Vn(i._options.defaultValues,n));go(i._defaultValues,n,$),tc(Vn(i._formValues,n))&&go(i._formValues,n,$)}return!a&&i.register(n),()=>{(a?A&&!i._state.action:A)?i.unregister(n):D(n,!1)}},[n,i,a,o]),lt.useEffect(()=>{i._setDisabledField({disabled:s,name:n})},[s,n,i]),lt.useMemo(()=>({field:I,formState:y,fieldState:k}),[I,y,k])}const Cot=t=>t.render(Sot(t));var CLe=(t,e,n,s,i)=>e?{...n[t],types:{...n[t]&&n[t].types?n[t].types:{},[s]:i||!0}}:{},BT=t=>Array.isArray(t)?t:[t],Nje=()=>{let t=[];return{get observers(){return t},next:i=>{for(const o of t)o.next&&o.next(i)},subscribe:i=>(t.push(i),{unsubscribe:()=>{t=t.filter(o=>o!==i)}}),unsubscribe:()=>{t=[]}}},Qu=t=>ac(t)&&!Object.keys(t).length,Bge=t=>t.type==="file",Wp=t=>typeof t=="function",ite=t=>{if(!Oge)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},MLe=t=>t.type==="select-multiple",$ge=t=>t.type==="radio",Mot=t=>$ge(t)||iI(t),Ole=t=>ite(t)&&t.isConnected;function Tot(t,e){const n=e.slice(0,-1).length;let s=0;for(;s{for(const e in t)if(Wp(t[e]))return!0;return!1};function ate(t,e={}){const n=Array.isArray(t);if(ac(t)||n)for(const s in t)Array.isArray(t[s])||ac(t[s])&&!TLe(t[s])?(e[s]=Array.isArray(t[s])?[]:{},ate(t[s],e[s])):mu(t[s])||(e[s]=!0);return e}function ALe(t,e,n){const s=Array.isArray(t);if(ac(t)||s)for(const i in t)Array.isArray(t[i])||ac(t[i])&&!TLe(t[i])?tc(e)||ihe(n[i])?n[i]=Array.isArray(t[i])?ate(t[i],[]):{...ate(t[i])}:ALe(t[i],mu(e)?{}:e[i],n[i]):n[i]=!vy(t[i],e[i]);return n}var h5=(t,e)=>ALe(t,e,ate(e));const Sje={value:!1,isValid:!1},Cje={value:!0,isValid:!0};var ELe=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!tc(t[0].attributes.value)?tc(t[0].value)||t[0].value===""?Cje:{value:t[0].value,isValid:!0}:Cje:Sje}return Sje},ILe=(t,{valueAsNumber:e,valueAsDate:n,setValueAs:s})=>tc(t)?t:e?t===""?NaN:t&&+t:n&&eg(t)?new Date(t):s?s(t):t;const Mje={isValid:!1,value:null};var PLe=t=>Array.isArray(t)?t.reduce((e,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:e,Mje):Mje;function Tje(t){const e=t.ref;return Bge(e)?e.files:$ge(e)?PLe(t.refs).value:MLe(e)?[...e.selectedOptions].map(({value:n})=>n):iI(e)?ELe(t.refs).value:ILe(tc(e.value)?t.ref.value:e.value,t)}var Eot=(t,e,n,s)=>{const i={};for(const o of t){const c=Vn(e,o);c&&go(i,o,c._f)}return{criteriaMode:n,names:[...t],fields:i,shouldUseNativeValidation:s}},ote=t=>t instanceof RegExp,f5=t=>tc(t)?t:ote(t)?t.source:ac(t)?ote(t.value)?t.value.source:t.value:t,Aje=t=>({isOnSubmit:!t||t===Hp.onSubmit,isOnBlur:t===Hp.onBlur,isOnChange:t===Hp.onChange,isOnAll:t===Hp.all,isOnTouch:t===Hp.onTouched});const Eje="AsyncFunction";var Iot=t=>!!t&&!!t.validate&&!!(Wp(t.validate)&&t.validate.constructor.name===Eje||ac(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===Eje)),Pot=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate),Ije=(t,e,n)=>!n&&(e.watchAll||e.watch.has(t)||[...e.watch].some(s=>t.startsWith(s)&&/^\.\w+/.test(t.slice(s.length))));const $T=(t,e,n,s)=>{for(const i of n||Object.keys(t)){const o=Vn(t,i);if(o){const{_f:c,...a}=o;if(c){if(c.refs&&c.refs[0]&&e(c.refs[0],i)&&!s)return!0;if(c.ref&&e(c.ref,c.name)&&!s)return!0;if($T(a,e))break}else if(ac(a)&&$T(a,e))break}}};function Pje(t,e,n){const s=Vn(t,n);if(s||Qne(n))return{error:s,name:n};const i=n.split(".");for(;i.length;){const o=i.join("."),c=Vn(e,o),a=Vn(t,o);if(c&&!Array.isArray(c)&&n!==o)return{name:n};if(a&&a.type)return{name:o,error:a};if(a&&a.root&&a.root.type)return{name:`${o}.root`,error:a.root};i.pop()}return{name:n}}var Lot=(t,e,n,s)=>{n(t);const{name:i,...o}=t;return Qu(o)||Object.keys(o).length>=Object.keys(e).length||Object.keys(o).find(c=>e[c]===(!s||Hp.all))},Oot=(t,e,n)=>!t||!e||t===e||BT(t).some(s=>s&&(n?s===e:s.startsWith(e)||e.startsWith(s))),Dot=(t,e,n,s,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(e||t):(n?s.isOnBlur:i.isOnBlur)?!t:(n?s.isOnChange:i.isOnChange)?t:!0,Rot=(t,e)=>!Dge(Vn(t,e)).length&&pc(t,e),Fot=(t,e,n)=>{const s=BT(Vn(t,n));return go(s,"root",e[n]),go(t,n,s),t},eee=t=>eg(t);function Lje(t,e,n="validate"){if(eee(t)||Array.isArray(t)&&t.every(eee)||Ih(t)&&!t)return{type:n,message:eee(t)?t:"",ref:e}}var DN=t=>ac(t)&&!ote(t)?t:{value:t,message:""},Oje=async(t,e,n,s,i,o)=>{const{ref:c,refs:a,required:f,maxLength:m,minLength:y,min:v,max:w,pattern:k,validate:C,name:S,valueAsNumber:T,mount:I}=t._f,A=Vn(n,S);if(!I||e.has(S))return{};const D=a?a[0]:c,$=ue=>{i&&D.reportValidity&&(D.setCustomValidity(Ih(ue)?"":ue||""),D.reportValidity())},F={},q=$ge(c),W=iI(c),K=q||W,Z=(T||Bge(c))&&tc(c.value)&&tc(A)||ite(c)&&c.value===""||A===""||Array.isArray(A)&&!A.length,re=CLe.bind(null,S,s,F),he=(ue,Ne,se,xe=ry.maxLength,ie=ry.minLength)=>{const me=ue?Ne:se;F[S]={type:ue?xe:ie,message:me,ref:c,...re(ue?xe:ie,me)}};if(o?!Array.isArray(A)||!A.length:f&&(!K&&(Z||mu(A))||Ih(A)&&!A||W&&!ELe(a).isValid||q&&!PLe(a).isValid)){const{value:ue,message:Ne}=eee(f)?{value:!!f,message:f}:DN(f);if(ue&&(F[S]={type:ry.required,message:Ne,ref:D,...re(ry.required,Ne)},!s))return $(Ne),F}if(!Z&&(!mu(v)||!mu(w))){let ue,Ne;const se=DN(w),xe=DN(v);if(!mu(A)&&!isNaN(A)){const ie=c.valueAsNumber||A&&+A;mu(se.value)||(ue=ie>se.value),mu(xe.value)||(Ne=ienew Date(new Date().toDateString()+" "+Ie),fe=c.type=="time",ve=c.type=="week";eg(se.value)&&A&&(ue=fe?me(A)>me(se.value):ve?A>se.value:ie>new Date(se.value)),eg(xe.value)&&A&&(Ne=fe?me(A)+ue.value,xe=!mu(Ne.value)&&A.length<+Ne.value;if((se||xe)&&(he(se,ue.message,Ne.message),!s))return $(F[S].message),F}if(k&&!Z&&eg(A)){const{value:ue,message:Ne}=DN(k);if(ote(ue)&&!A.match(ue)&&(F[S]={type:ry.pattern,message:Ne,ref:c,...re(ry.pattern,Ne)},!s))return $(Ne),F}if(C){if(Wp(C)){const ue=await C(A,n),Ne=Lje(ue,D);if(Ne&&(F[S]={...Ne,...re(ry.validate,Ne.message)},!s))return $(Ne.message),F}else if(ac(C)){let ue={};for(const Ne in C){if(!Qu(ue)&&!s)break;const se=Lje(await C[Ne](A,n),D,Ne);se&&(ue={...se,...re(Ne,se.message)},$(se.message),s&&(F[S]=ue))}if(!Qu(ue)&&(F[S]={ref:D,...ue},!s))return F}}return $(!0),F};const zot={mode:Hp.onSubmit,reValidateMode:Hp.onChange,shouldFocusError:!0};function Bot(t={}){let e={...zot,...t},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:Wp(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1},s={},i=ac(e.defaultValues)||ac(e.values)?Ec(e.defaultValues||e.values)||{}:{},o=e.shouldUnregister?{}:Ec(i),c={action:!1,mount:!1,watch:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},f,m=0;const y={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let v={...y};const w={array:Nje(),state:Nje()},k=e.criteriaMode===Hp.all,C=Fe=>Ke=>{clearTimeout(m),m=setTimeout(Fe,Ke)},S=async Fe=>{if(!e.disabled&&(y.isValid||v.isValid||Fe)){const Ke=e.resolver?Qu((await W()).errors):await Z(s,!0);Ke!==n.isValid&&w.state.next({isValid:Ke})}},T=(Fe,Ke)=>{!e.disabled&&(y.isValidating||y.validatingFields||v.isValidating||v.validatingFields)&&((Fe||Array.from(a.mount)).forEach(Le=>{Le&&(Ke?go(n.validatingFields,Le,Ke):pc(n.validatingFields,Le))}),w.state.next({validatingFields:n.validatingFields,isValidating:!Qu(n.validatingFields)}))},I=(Fe,Ke=[],Le,ft,Nt=!0,Mt=!0)=>{if(ft&&Le&&!e.disabled){if(c.action=!0,Mt&&Array.isArray(Vn(s,Fe))){const It=Le(Vn(s,Fe),ft.argA,ft.argB);Nt&&go(s,Fe,It)}if(Mt&&Array.isArray(Vn(n.errors,Fe))){const It=Le(Vn(n.errors,Fe),ft.argA,ft.argB);Nt&&go(n.errors,Fe,It),Rot(n.errors,Fe)}if((y.touchedFields||v.touchedFields)&&Mt&&Array.isArray(Vn(n.touchedFields,Fe))){const It=Le(Vn(n.touchedFields,Fe),ft.argA,ft.argB);Nt&&go(n.touchedFields,Fe,It)}(y.dirtyFields||v.dirtyFields)&&(n.dirtyFields=h5(i,o)),w.state.next({name:Fe,isDirty:he(Fe,Ke),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else go(o,Fe,Ke)},A=(Fe,Ke)=>{go(n.errors,Fe,Ke),w.state.next({errors:n.errors})},D=Fe=>{n.errors=Fe,w.state.next({errors:n.errors,isValid:!1})},$=(Fe,Ke,Le,ft)=>{const Nt=Vn(s,Fe);if(Nt){const Mt=Vn(o,Fe,tc(Le)?Vn(i,Fe):Le);tc(Mt)||ft&&ft.defaultChecked||Ke?go(o,Fe,Ke?Mt:Tje(Nt._f)):se(Fe,Mt),c.mount&&S()}},F=(Fe,Ke,Le,ft,Nt)=>{let Mt=!1,It=!1;const tr={name:Fe};if(!e.disabled){if(!Le||ft){(y.isDirty||v.isDirty)&&(It=n.isDirty,n.isDirty=tr.isDirty=he(),Mt=It!==tr.isDirty);const Mr=vy(Vn(i,Fe),Ke);It=!!Vn(n.dirtyFields,Fe),Mr?pc(n.dirtyFields,Fe):go(n.dirtyFields,Fe,!0),tr.dirtyFields=n.dirtyFields,Mt=Mt||(y.dirtyFields||v.dirtyFields)&&It!==!Mr}if(Le){const Mr=Vn(n.touchedFields,Fe);Mr||(go(n.touchedFields,Fe,Le),tr.touchedFields=n.touchedFields,Mt=Mt||(y.touchedFields||v.touchedFields)&&Mr!==Le)}Mt&&Nt&&w.state.next(tr)}return Mt?tr:{}},q=(Fe,Ke,Le,ft)=>{const Nt=Vn(n.errors,Fe),Mt=(y.isValid||v.isValid)&&Ih(Ke)&&n.isValid!==Ke;if(e.delayError&&Le?(f=C(()=>A(Fe,Le)),f(e.delayError)):(clearTimeout(m),f=null,Le?go(n.errors,Fe,Le):pc(n.errors,Fe)),(Le?!vy(Nt,Le):Nt)||!Qu(ft)||Mt){const It={...ft,...Mt&&Ih(Ke)?{isValid:Ke}:{},errors:n.errors,name:Fe};n={...n,...It},w.state.next(It)}},W=async Fe=>{T(Fe,!0);const Ke=await e.resolver(o,e.context,Eot(Fe||a.mount,s,e.criteriaMode,e.shouldUseNativeValidation));return T(Fe),Ke},K=async Fe=>{const{errors:Ke}=await W(Fe);if(Fe)for(const Le of Fe){const ft=Vn(Ke,Le);ft?go(n.errors,Le,ft):pc(n.errors,Le)}else n.errors=Ke;return Ke},Z=async(Fe,Ke,Le={valid:!0})=>{for(const ft in Fe){const Nt=Fe[ft];if(Nt){const{_f:Mt,...It}=Nt;if(Mt){const tr=a.array.has(Mt.name),Mr=Nt._f&&Iot(Nt._f);Mr&&y.validatingFields&&T([ft],!0);const pn=await Oje(Nt,a.disabled,o,k,e.shouldUseNativeValidation&&!Ke,tr);if(Mr&&y.validatingFields&&T([ft]),pn[Mt.name]&&(Le.valid=!1,Ke))break;!Ke&&(Vn(pn,Mt.name)?tr?Fot(n.errors,pn,Mt.name):go(n.errors,Mt.name,pn[Mt.name]):pc(n.errors,Mt.name))}!Qu(It)&&await Z(It,Ke,Le)}}return Le.valid},re=()=>{for(const Fe of a.unMount){const Ke=Vn(s,Fe);Ke&&(Ke._f.refs?Ke._f.refs.every(Le=>!Ole(Le)):!Ole(Ke._f.ref))&&Re(Fe)}a.unMount=new Set},he=(Fe,Ke)=>!e.disabled&&(Fe&&Ke&&go(o,Fe,Ke),!vy(Ie(),i)),ue=(Fe,Ke,Le)=>SLe(Fe,a,{...c.mount?o:tc(Ke)?i:eg(Fe)?{[Fe]:Ke}:Ke},Le,Ke),Ne=Fe=>Dge(Vn(c.mount?o:i,Fe,e.shouldUnregister?Vn(i,Fe,[]):[])),se=(Fe,Ke,Le={})=>{const ft=Vn(s,Fe);let Nt=Ke;if(ft){const Mt=ft._f;Mt&&(!Mt.disabled&&go(o,Fe,ILe(Ke,Mt)),Nt=ite(Mt.ref)&&mu(Ke)?"":Ke,MLe(Mt.ref)?[...Mt.ref.options].forEach(It=>It.selected=Nt.includes(It.value)):Mt.refs?iI(Mt.ref)?Mt.refs.forEach(It=>{(!It.defaultChecked||!It.disabled)&&(Array.isArray(Nt)?It.checked=!!Nt.find(tr=>tr===It.value):It.checked=Nt===It.value||!!Nt)}):Mt.refs.forEach(It=>It.checked=It.value===Nt):Bge(Mt.ref)?Mt.ref.value="":(Mt.ref.value=Nt,Mt.ref.type||w.state.next({name:Fe,values:Ec(o)})))}(Le.shouldDirty||Le.shouldTouch)&&F(Fe,Nt,Le.shouldTouch,Le.shouldDirty,!0),Le.shouldValidate&&ve(Fe)},xe=(Fe,Ke,Le)=>{for(const ft in Ke){if(!Ke.hasOwnProperty(ft))return;const Nt=Ke[ft],Mt=Fe+"."+ft,It=Vn(s,Mt);(a.array.has(Fe)||ac(Nt)||It&&!It._f)&&!fw(Nt)?xe(Mt,Nt,Le):se(Mt,Nt,Le)}},ie=(Fe,Ke,Le={})=>{const ft=Vn(s,Fe),Nt=a.array.has(Fe),Mt=Ec(Ke);go(o,Fe,Mt),Nt?(w.array.next({name:Fe,values:Ec(o)}),(y.isDirty||y.dirtyFields||v.isDirty||v.dirtyFields)&&Le.shouldDirty&&w.state.next({name:Fe,dirtyFields:h5(i,o),isDirty:he(Fe,Mt)})):ft&&!ft._f&&!mu(Mt)?xe(Fe,Mt,Le):se(Fe,Mt,Le),Ije(Fe,a)&&w.state.next({...n,name:Fe}),w.state.next({name:c.mount?Fe:void 0,values:Ec(o)})},me=async Fe=>{c.mount=!0;const Ke=Fe.target;let Le=Ke.name,ft=!0;const Nt=Vn(s,Le),Mt=Mr=>{ft=Number.isNaN(Mr)||fw(Mr)&&isNaN(Mr.getTime())||vy(Mr,Vn(o,Le,Mr))},It=Aje(e.mode),tr=Aje(e.reValidateMode);if(Nt){let Mr,pn;const fs=Ke.type?Tje(Nt._f):jLe(Fe),Qn=Fe.type===ste.BLUR||Fe.type===ste.FOCUS_OUT,js=!Pot(Nt._f)&&!e.resolver&&!Vn(n.errors,Le)&&!Nt._f.deps||Dot(Qn,Vn(n.touchedFields,Le),n.isSubmitted,tr,It),Qs=Ije(Le,a,Qn);go(o,Le,fs),Qn?(Nt._f.onBlur&&Nt._f.onBlur(Fe),f&&f(0)):Nt._f.onChange&&Nt._f.onChange(Fe);const si=F(Le,fs,Qn),wr=!Qu(si)||Qs;if(!Qn&&w.state.next({name:Le,type:Fe.type,values:Ec(o)}),js)return(y.isValid||v.isValid)&&(e.mode==="onBlur"?Qn&&S():Qn||S()),wr&&w.state.next({name:Le,...Qs?{}:si});if(!Qn&&Qs&&w.state.next({...n}),e.resolver){const{errors:Ts}=await W([Le]);if(Mt(fs),ft){const ii=Pje(n.errors,s,Le),mi=Pje(Ts,s,ii.name||Le);Mr=mi.error,Le=mi.name,pn=Qu(Ts)}}else T([Le],!0),Mr=(await Oje(Nt,a.disabled,o,k,e.shouldUseNativeValidation))[Le],T([Le]),Mt(fs),ft&&(Mr?pn=!1:(y.isValid||v.isValid)&&(pn=await Z(s,!0)));ft&&(Nt._f.deps&&ve(Nt._f.deps),q(Le,pn,Mr,si))}},fe=(Fe,Ke)=>{if(Vn(n.errors,Ke)&&Fe.focus)return Fe.focus(),1},ve=async(Fe,Ke={})=>{let Le,ft;const Nt=BT(Fe);if(e.resolver){const Mt=await K(tc(Fe)?Fe:Nt);Le=Qu(Mt),ft=Fe?!Nt.some(It=>Vn(Mt,It)):Le}else Fe?(ft=(await Promise.all(Nt.map(async Mt=>{const It=Vn(s,Mt);return await Z(It&&It._f?{[Mt]:It}:It)}))).every(Boolean),!(!ft&&!n.isValid)&&S()):ft=Le=await Z(s);return w.state.next({...!eg(Fe)||(y.isValid||v.isValid)&&Le!==n.isValid?{}:{name:Fe},...e.resolver||!Fe?{isValid:Le}:{},errors:n.errors}),Ke.shouldFocus&&!ft&&$T(s,fe,Fe?Nt:a.mount),ft},Ie=Fe=>{const Ke={...c.mount?o:i};return tc(Fe)?Ke:eg(Fe)?Vn(Ke,Fe):Fe.map(Le=>Vn(Ke,Le))},Se=(Fe,Ke)=>({invalid:!!Vn((Ke||n).errors,Fe),isDirty:!!Vn((Ke||n).dirtyFields,Fe),error:Vn((Ke||n).errors,Fe),isValidating:!!Vn(n.validatingFields,Fe),isTouched:!!Vn((Ke||n).touchedFields,Fe)}),oe=Fe=>{Fe&&BT(Fe).forEach(Ke=>pc(n.errors,Ke)),w.state.next({errors:Fe?n.errors:{}})},ae=(Fe,Ke,Le)=>{const ft=(Vn(s,Fe,{_f:{}})._f||{}).ref,Nt=Vn(n.errors,Fe)||{},{ref:Mt,message:It,type:tr,...Mr}=Nt;go(n.errors,Fe,{...Mr,...Ke,ref:ft}),w.state.next({name:Fe,errors:n.errors,isValid:!1}),Le&&Le.shouldFocus&&ft&&ft.focus&&ft.focus()},je=(Fe,Ke)=>Wp(Fe)?w.state.subscribe({next:Le=>"values"in Le&&Fe(ue(void 0,Ke),Le)}):ue(Fe,Ke,!0),Me=Fe=>w.state.subscribe({next:Ke=>{Oot(Fe.name,Ke.name,Fe.exact)&&Lot(Ke,Fe.formState||y,We,Fe.reRenderRoot)&&Fe.callback({values:{...o},...n,...Ke,defaultValues:i})}}).unsubscribe,Ue=Fe=>(c.mount=!0,v={...v,...Fe.formState},Me({...Fe,formState:v})),Re=(Fe,Ke={})=>{for(const Le of Fe?BT(Fe):a.mount)a.mount.delete(Le),a.array.delete(Le),Ke.keepValue||(pc(s,Le),pc(o,Le)),!Ke.keepError&&pc(n.errors,Le),!Ke.keepDirty&&pc(n.dirtyFields,Le),!Ke.keepTouched&&pc(n.touchedFields,Le),!Ke.keepIsValidating&&pc(n.validatingFields,Le),!e.shouldUnregister&&!Ke.keepDefaultValue&&pc(i,Le);w.state.next({values:Ec(o)}),w.state.next({...n,...Ke.keepDirty?{isDirty:he()}:{}}),!Ke.keepIsValid&&S()},$e=({disabled:Fe,name:Ke})=>{(Ih(Fe)&&c.mount||Fe||a.disabled.has(Ke))&&(Fe?a.disabled.add(Ke):a.disabled.delete(Ke))},Pe=(Fe,Ke={})=>{let Le=Vn(s,Fe);const ft=Ih(Ke.disabled)||Ih(e.disabled);return go(s,Fe,{...Le||{},_f:{...Le&&Le._f?Le._f:{ref:{name:Fe}},name:Fe,mount:!0,...Ke}}),a.mount.add(Fe),Le?$e({disabled:Ih(Ke.disabled)?Ke.disabled:e.disabled,name:Fe}):$(Fe,!0,Ke.value),{...ft?{disabled:Ke.disabled||e.disabled}:{},...e.progressive?{required:!!Ke.required,min:f5(Ke.min),max:f5(Ke.max),minLength:f5(Ke.minLength),maxLength:f5(Ke.maxLength),pattern:f5(Ke.pattern)}:{},name:Fe,onChange:me,onBlur:me,ref:Nt=>{if(Nt){Pe(Fe,Ke),Le=Vn(s,Fe);const Mt=tc(Nt.value)&&Nt.querySelectorAll&&Nt.querySelectorAll("input,select,textarea")[0]||Nt,It=Mot(Mt),tr=Le._f.refs||[];if(It?tr.find(Mr=>Mr===Mt):Mt===Le._f.ref)return;go(s,Fe,{_f:{...Le._f,...It?{refs:[...tr.filter(Ole),Mt,...Array.isArray(Vn(i,Fe))?[{}]:[]],ref:{type:Mt.type,name:Fe}}:{ref:Mt}}}),$(Fe,!1,void 0,Mt)}else Le=Vn(s,Fe,{}),Le._f&&(Le._f.mount=!1),(e.shouldUnregister||Ke.shouldUnregister)&&!(kLe(a.array,Fe)&&c.action)&&a.unMount.add(Fe)}}},Ae=()=>e.shouldFocusError&&$T(s,fe,a.mount),nt=Fe=>{Ih(Fe)&&(w.state.next({disabled:Fe}),$T(s,(Ke,Le)=>{const ft=Vn(s,Le);ft&&(Ke.disabled=ft._f.disabled||Fe,Array.isArray(ft._f.refs)&&ft._f.refs.forEach(Nt=>{Nt.disabled=ft._f.disabled||Fe}))},0,!1))},Te=(Fe,Ke)=>async Le=>{let ft;Le&&(Le.preventDefault&&Le.preventDefault(),Le.persist&&Le.persist());let Nt=Ec(o);if(w.state.next({isSubmitting:!0}),e.resolver){const{errors:Mt,values:It}=await W();n.errors=Mt,Nt=Ec(It)}else await Z(s);if(a.disabled.size)for(const Mt of a.disabled)pc(Nt,Mt);if(pc(n.errors,"root"),Qu(n.errors)){w.state.next({errors:{}});try{await Fe(Nt,Le)}catch(Mt){ft=Mt}}else Ke&&await Ke({...n.errors},Le),Ae(),setTimeout(Ae);if(w.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Qu(n.errors)&&!ft,submitCount:n.submitCount+1,errors:n.errors}),ft)throw ft},Xe=(Fe,Ke={})=>{Vn(s,Fe)&&(tc(Ke.defaultValue)?ie(Fe,Ec(Vn(i,Fe))):(ie(Fe,Ke.defaultValue),go(i,Fe,Ec(Ke.defaultValue))),Ke.keepTouched||pc(n.touchedFields,Fe),Ke.keepDirty||(pc(n.dirtyFields,Fe),n.isDirty=Ke.defaultValue?he(Fe,Ec(Vn(i,Fe))):he()),Ke.keepError||(pc(n.errors,Fe),y.isValid&&S()),w.state.next({...n}))},ge=(Fe,Ke={})=>{const Le=Fe?Ec(Fe):i,ft=Ec(Le),Nt=Qu(Fe),Mt=Nt?i:ft;if(Ke.keepDefaultValues||(i=Le),!Ke.keepValues){if(Ke.keepDirtyValues){const It=new Set([...a.mount,...Object.keys(h5(i,o))]);for(const tr of Array.from(It))Vn(n.dirtyFields,tr)?go(Mt,tr,Vn(o,tr)):ie(tr,Vn(Mt,tr))}else{if(Oge&&tc(Fe))for(const It of a.mount){const tr=Vn(s,It);if(tr&&tr._f){const Mr=Array.isArray(tr._f.refs)?tr._f.refs[0]:tr._f.ref;if(ite(Mr)){const pn=Mr.closest("form");if(pn){pn.reset();break}}}}if(Ke.keepFieldsRef)for(const It of a.mount)ie(It,Vn(Mt,It));else s={}}o=e.shouldUnregister?Ke.keepDefaultValues?Ec(i):{}:Ec(Mt),w.array.next({values:{...Mt}}),w.state.next({values:{...Mt}})}a={mount:Ke.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},c.mount=!y.isValid||!!Ke.keepIsValid||!!Ke.keepDirtyValues,c.watch=!!e.shouldUnregister,w.state.next({submitCount:Ke.keepSubmitCount?n.submitCount:0,isDirty:Nt?!1:Ke.keepDirty?n.isDirty:!!(Ke.keepDefaultValues&&!vy(Fe,i)),isSubmitted:Ke.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:Nt?{}:Ke.keepDirtyValues?Ke.keepDefaultValues&&o?h5(i,o):n.dirtyFields:Ke.keepDefaultValues&&Fe?h5(i,Fe):Ke.keepDirty?n.dirtyFields:{},touchedFields:Ke.keepTouched?n.touchedFields:{},errors:Ke.keepErrors?n.errors:{},isSubmitSuccessful:Ke.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},mt=(Fe,Ke)=>ge(Wp(Fe)?Fe(o):Fe,Ke),rt=(Fe,Ke={})=>{const Le=Vn(s,Fe),ft=Le&&Le._f;if(ft){const Nt=ft.refs?ft.refs[0]:ft.ref;Nt.focus&&(Nt.focus(),Ke.shouldSelect&&Wp(Nt.select)&&Nt.select())}},We=Fe=>{n={...n,...Fe}},et={control:{register:Pe,unregister:Re,getFieldState:Se,handleSubmit:Te,setError:ae,_subscribe:Me,_runSchema:W,_focusError:Ae,_getWatch:ue,_getDirty:he,_setValid:S,_setFieldArray:I,_setDisabledField:$e,_setErrors:D,_getFieldArray:Ne,_reset:ge,_resetDefaultValues:()=>Wp(e.defaultValues)&&e.defaultValues().then(Fe=>{mt(Fe,e.resetOptions),w.state.next({isLoading:!1})}),_removeUnmounted:re,_disableForm:nt,_subjects:w,_proxyFormState:y,get _fields(){return s},get _formValues(){return o},get _state(){return c},set _state(Fe){c=Fe},get _defaultValues(){return i},get _names(){return a},set _names(Fe){a=Fe},get _formState(){return n},get _options(){return e},set _options(Fe){e={...e,...Fe}}},subscribe:Ue,trigger:ve,register:Pe,handleSubmit:Te,watch:je,setValue:ie,getValues:Ie,reset:mt,resetField:Xe,clearErrors:oe,unregister:Re,setError:ae,setFocus:rt,getFieldState:Se};return{...et,formControl:et}}function ese(t={}){const e=lt.useRef(void 0),n=lt.useRef(void 0),[s,i]=lt.useState({isDirty:!1,isValidating:!1,isLoading:Wp(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,isReady:!1,defaultValues:Wp(t.defaultValues)?void 0:t.defaultValues});if(!e.current)if(t.formControl)e.current={...t.formControl,formState:s},t.defaultValues&&!Wp(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions);else{const{formControl:c,...a}=Bot(t);e.current={...a,formState:s}}const o=e.current.control;return o._options=t,zge(()=>{const c=o._subscribe({formState:o._proxyFormState,callback:()=>i({...o._formState}),reRenderRoot:!0});return i(a=>({...a,isReady:!0})),o._formState.isReady=!0,c},[o]),lt.useEffect(()=>o._disableForm(t.disabled),[o,t.disabled]),lt.useEffect(()=>{t.mode&&(o._options.mode=t.mode),t.reValidateMode&&(o._options.reValidateMode=t.reValidateMode)},[o,t.mode,t.reValidateMode]),lt.useEffect(()=>{t.errors&&(o._setErrors(t.errors),o._focusError())},[o,t.errors]),lt.useEffect(()=>{t.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,t.shouldUnregister]),lt.useEffect(()=>{if(o._proxyFormState.isDirty){const c=o._getDirty();c!==s.isDirty&&o._subjects.state.next({isDirty:c})}},[o,s.isDirty]),lt.useEffect(()=>{t.values&&!vy(t.values,n.current)?(o._reset(t.values,{keepFieldsRef:!0,...o._options.resetOptions}),n.current=t.values,i(c=>({...c}))):o._resetDefaultValues()},[o,t.values]),lt.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),e.current.formState=NLe(s,o),e.current}const Dje=(t,e,n)=>{if(t&&"reportValidity"in t){const s=Vn(n,e);t.setCustomValidity(s&&s.message||""),t.reportValidity()}},LLe=(t,e)=>{for(const n in e.fields){const s=e.fields[n];s&&s.ref&&"reportValidity"in s.ref?Dje(s.ref,n,t):s.refs&&s.refs.forEach(i=>Dje(i,n,t))}},$ot=(t,e)=>{e.shouldUseNativeValidation&&LLe(t,e);const n={};for(const s in t){const i=Vn(e.fields,s),o=Object.assign(t[s]||{},{ref:i&&i.ref});if(Uot(e.names||Object.keys(t),s)){const c=Object.assign({},Vn(n,s));go(c,"root",o),go(n,s,c)}else go(n,s,o)}return n},Uot=(t,e)=>t.some(n=>n.startsWith(e+"."));var qot=function(t,e){for(var n={};t.length;){var s=t[0],i=s.code,o=s.message,c=s.path.join(".");if(!n[c])if("unionErrors"in s){var a=s.unionErrors[0].errors[0];n[c]={message:a.message,type:a.code}}else n[c]={message:o,type:i};if("unionErrors"in s&&s.unionErrors.forEach(function(y){return y.errors.forEach(function(v){return t.push(v)})}),e){var f=n[c].types,m=f&&f[s.code];n[c]=CLe(c,e,n,i,m?[].concat(m,s.message):s.message)}t.shift()}return n},tse=function(t,e,n){return n===void 0&&(n={}),function(s,i,o){try{return Promise.resolve(function(c,a){try{var f=Promise.resolve(t[n.mode==="sync"?"parse":"parseAsync"](s,e)).then(function(m){return o.shouldUseNativeValidation&&LLe({},o),{errors:{},values:n.raw?s:m}})}catch(m){return a(m)}return f&&f.then?f.then(void 0,a):f}(0,function(c){if(function(a){return Array.isArray(a==null?void 0:a.errors)}(c))return{values:{},errors:$ot(qot(c.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw c}))}catch(c){return Promise.reject(c)}}};const rse=jot,OLe=P.createContext({}),jl=({...t})=>r.jsx(OLe.Provider,{value:{name:t.name},children:r.jsx(Cot,{...t})}),nse=()=>{const t=P.useContext(OLe),e=P.useContext(DLe),{getFieldState:n,formState:s}=Jne(),i=n(t.name,s);if(!t)throw new Error("useFormField should be used within ");const{id:o}=e;return{id:o,name:t.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...i}},DLe=P.createContext({}),hl=P.forwardRef(({className:t,...e},n)=>{const s=P.useId();return r.jsx(DLe.Provider,{value:{id:s},children:r.jsx("div",{ref:n,className:zt("space-y-2",t),...e})})});hl.displayName="FormItem";const fl=P.forwardRef(({className:t,...e},n)=>{const{error:s,formItemId:i}=nse();return r.jsx(Qe,{ref:n,className:zt(s&&"text-destructive",t),htmlFor:i,...e})});fl.displayName="FormLabel";const pl=P.forwardRef(({...t},e)=>{const{error:n,formItemId:s,formDescriptionId:i,formMessageId:o}=nse();return r.jsx(Sme,{ref:e,id:s,"aria-describedby":n?`${i} ${o}`:`${i}`,"aria-invalid":!!n,...t})});pl.displayName="FormControl";const tee=P.forwardRef(({className:t,...e},n)=>{const{formDescriptionId:s}=nse();return r.jsx("p",{ref:n,id:s,className:zt("text-sm text-muted-foreground",t),...e})});tee.displayName="FormDescription";const gu=P.forwardRef(({className:t,children:e,...n},s)=>{const{error:i,formMessageId:o}=nse(),c=i?String(i==null?void 0:i.message):e;return c?r.jsx("p",{ref:s,id:o,className:zt("text-sm font-medium text-destructive",t),...n,children:c}):null});gu.displayName="FormMessage";const ps=P.forwardRef(({className:t,...e},n)=>r.jsx("textarea",{className:zt("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:n,...e}));ps.displayName="Textarea";const Vot=UC({category:GPe(["general","technology","crm","marketing"]),subject:ec().min(5,"Subject must be at least 5 characters").max(200),description:ec().min(20,"Please provide more details (at least 20 characters)").max(2e3)}),Hot={general:"General Support",technology:"Technology Support",crm:"CRM Support",marketing:"Marketing Support"};function ahe({trigger:t}){const[e,n]=P.useState(!1),[s,i]=P.useState(!1),{user:o}=Fr(),c=ese({resolver:tse(Vot),defaultValues:{category:"general",subject:"",description:""}}),a=async f=>{if(!o){Ge.error("You must be logged in to submit a ticket");return}i(!0);try{const{error:m}=await ee.from("support_tickets").insert({user_id:o.id,category:f.category,subject:f.subject,description:f.description});if(m)throw m;try{await ee.functions.invoke("support-ticket-notify",{body:{category:Hot[f.category],subject:f.subject}})}catch(y){console.log("Notification send attempted:",y)}Ge.success("Support ticket submitted successfully!"),c.reset(),n(!1)}catch(m){console.error("Error submitting ticket:",m),Ge.error("Failed to submit ticket. Please try again.")}finally{i(!1)}};return r.jsxs($r,{open:e,onOpenChange:n,children:[r.jsx(Lo,{asChild:!0,children:t||r.jsxs(te,{variant:"ghost",size:"icon",className:"relative",children:[r.jsx(gT,{className:"h-5 w-5"}),r.jsx("span",{className:"sr-only",children:"Support"})]})}),r.jsxs(zr,{className:"sm:max-w-[500px]",children:[r.jsxs(Zr,{children:[r.jsx(Kr,{children:"Need Help?"}),r.jsx(ls,{children:"Submit a support ticket and we'll get back to you as soon as possible."})]}),r.jsxs("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-lg mb-4",children:[r.jsx(Wa,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:["You can also text us at: ",r.jsx("span",{className:"font-medium text-foreground",children:"1-866-527-8668"})]})]}),r.jsx(rse,{...c,children:r.jsxs("form",{onSubmit:c.handleSubmit(a),className:"space-y-4",children:[r.jsx(jl,{control:c.control,name:"category",render:({field:f})=>r.jsxs(hl,{children:[r.jsx(fl,{children:"Category"}),r.jsxs(_n,{onValueChange:f.onChange,defaultValue:f.value,children:[r.jsx(pl,{children:r.jsx(xn,{children:r.jsx(bn,{placeholder:"Select a category"})})}),r.jsxs(vn,{children:[r.jsx(er,{value:"general",children:"General Support"}),r.jsx(er,{value:"technology",children:"Technology Support"}),r.jsx(er,{value:"crm",children:"CRM Support"}),r.jsx(er,{value:"marketing",children:"Marketing Support"})]})]}),r.jsx(gu,{})]})}),r.jsx(jl,{control:c.control,name:"subject",render:({field:f})=>r.jsxs(hl,{children:[r.jsx(fl,{children:"Subject"}),r.jsx(pl,{children:r.jsx(yt,{placeholder:"Brief description of your issue",...f})}),r.jsx(gu,{})]})}),r.jsx(jl,{control:c.control,name:"description",render:({field:f})=>r.jsxs(hl,{children:[r.jsx(fl,{children:"Description"}),r.jsx(pl,{children:r.jsx(ps,{placeholder:"Please describe your issue in detail...",className:"min-h-[120px]",...f})}),r.jsx(gu,{})]})}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>n(!1),children:"Cancel"}),r.jsx(te,{type:"submit",disabled:s,children:s?"Submitting...":"Submit Ticket"})]})]})})]})]})}function xs(t){const e=Object.prototype.toString.call(t);return t instanceof Date||typeof t=="object"&&e==="[object Date]"?new t.constructor(+t):typeof t=="number"||e==="[object Number]"||typeof t=="string"||e==="[object String]"?new Date(t):new Date(NaN)}function xo(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}function Rl(t,e){const n=xs(t);return isNaN(e)?xo(t,NaN):(e&&n.setDate(n.getDate()+e),n)}function Gf(t,e){const n=xs(t);if(isNaN(e))return xo(t,NaN);if(!e)return n;const s=n.getDate(),i=xo(t,n.getTime());i.setMonth(n.getMonth()+e+1,0);const o=i.getDate();return s>=o?i:(n.setFullYear(i.getFullYear(),i.getMonth(),s),n)}function RLe(t,e){const n=+xs(t);return xo(t,n+e)}const Uge=6048e5,Wot=864e5,FLe=6e4,zLe=36e5,Got=1e3,rL=43200,Rje=1440;function lte(t,e){return RLe(t,e*zLe)}let Kot={};function I1(){return Kot}function Gh(t,e){var a,f,m,y;const n=I1(),s=(e==null?void 0:e.weekStartsOn)??((f=(a=e==null?void 0:e.locale)==null?void 0:a.options)==null?void 0:f.weekStartsOn)??n.weekStartsOn??((y=(m=n.locale)==null?void 0:m.options)==null?void 0:y.weekStartsOn)??0,i=xs(t),o=i.getDay(),c=(o=i.getTime()?n+1:e.getTime()>=c.getTime()?n:n-1}function Kh(t){const e=xs(t);return e.setHours(0,0,0,0),e}function v1(t){const e=xs(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function Yp(t,e){const n=Kh(t),s=Kh(e),i=+n-v1(n),o=+s-v1(s);return Math.round((i-o)/Wot)}function Zot(t){const e=BLe(t),n=xo(t,0);return n.setFullYear(e,0,4),n.setHours(0,0,0,0),Hy(n)}function $Le(t,e){return RLe(t,e*FLe)}function ohe(t,e){const n=e*7;return Rl(t,n)}function Yot(t,e){return Gf(t,e*12)}function Xot(t){let e;return t.forEach(function(n){const s=xs(n);(e===void 0||e{const s=xs(n);(!e||e>s||isNaN(+s))&&(e=s)}),e||new Date(NaN)}function ree(t,e){const n=xs(t),s=xs(e),i=n.getTime()-s.getTime();return i<0?-1:i>0?1:i}function Jot(t){return xo(t,Date.now())}function Vl(t,e){const n=Kh(t),s=Kh(e);return+n==+s}function qge(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function lhe(t){if(!qge(t)&&typeof t!="number")return!1;const e=xs(t);return!isNaN(Number(e))}function W4(t,e){const n=xs(t),s=xs(e),i=n.getFullYear()-s.getFullYear(),o=n.getMonth()-s.getMonth();return i*12+o}function elt(t,e,n){const s=Gh(t,n),i=Gh(e,n),o=+s-v1(s),c=+i-v1(i);return Math.round((o-c)/Uge)}function G4(t,e){const n=xs(t),s=xs(e),i=Fje(n,s),o=Math.abs(Yp(n,s));n.setDate(n.getDate()-i*o);const c=+(Fje(n,s)===-i),a=i*(o-c);return a===0?0:a}function Fje(t,e){const n=t.getFullYear()-e.getFullYear()||t.getMonth()-e.getMonth()||t.getDate()-e.getDate()||t.getHours()-e.getHours()||t.getMinutes()-e.getMinutes()||t.getSeconds()-e.getSeconds()||t.getMilliseconds()-e.getMilliseconds();return n<0?-1:n>0?1:n}function tlt(t){return e=>{const s=(t?Math[t]:Math.trunc)(e);return s===0?0:s}}function rlt(t,e){return+xs(t)-+xs(e)}function nlt(t){const e=xs(t);return e.setHours(23,59,59,999),e}function sse(t){const e=xs(t),n=e.getMonth();return e.setFullYear(e.getFullYear(),n+1,0),e.setHours(23,59,59,999),e}function slt(t){const e=xs(t);return+nlt(e)==+sse(e)}function ilt(t,e){const n=xs(t),s=xs(e),i=ree(n,s),o=Math.abs(W4(n,s));let c;if(o<1)c=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-i*o);let a=ree(n,s)===-i;slt(xs(t))&&o===1&&ree(t,s)===1&&(a=!1),c=i*(o-Number(a))}return c===0?0:c}function alt(t,e,n){const s=rlt(t,e)/1e3;return tlt(n==null?void 0:n.roundingMethod)(s)}function hh(t){const e=xs(t);return e.setDate(1),e.setHours(0,0,0,0),e}function ULe(t){const e=xs(t),n=xo(t,0);return n.setFullYear(e.getFullYear(),0,1),n.setHours(0,0,0,0),n}function Vge(t,e){var a,f,m,y;const n=I1(),s=(e==null?void 0:e.weekStartsOn)??((f=(a=e==null?void 0:e.locale)==null?void 0:a.options)==null?void 0:f.weekStartsOn)??n.weekStartsOn??((y=(m=n.locale)==null?void 0:m.options)==null?void 0:y.weekStartsOn)??0,i=xs(t),o=i.getDay(),c=(o{let s;const i=olt[t];return typeof i=="string"?s=i:e===1?s=i.one:s=i.other.replace("{{count}}",e.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+s:s+" ago":s};function Dle(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const clt={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},dlt={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},ult={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},hlt={date:Dle({formats:clt,defaultWidth:"full"}),time:Dle({formats:dlt,defaultWidth:"full"}),dateTime:Dle({formats:ult,defaultWidth:"full"})},flt={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},plt=(t,e,n,s)=>flt[t];function p5(t){return(e,n)=>{const s=n!=null&&n.context?String(n.context):"standalone";let i;if(s==="formatting"&&t.formattingValues){const c=t.defaultFormattingWidth||t.defaultWidth,a=n!=null&&n.width?String(n.width):c;i=t.formattingValues[a]||t.formattingValues[c]}else{const c=t.defaultWidth,a=n!=null&&n.width?String(n.width):t.defaultWidth;i=t.values[a]||t.values[c]}const o=t.argumentCallback?t.argumentCallback(e):e;return i[o]}}const mlt={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},glt={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},ylt={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},xlt={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},vlt={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},_lt={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},blt=(t,e)=>{const n=Number(t),s=n%100;if(s>20||s<10)switch(s%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},wlt={ordinalNumber:blt,era:p5({values:mlt,defaultWidth:"wide"}),quarter:p5({values:glt,defaultWidth:"wide",argumentCallback:t=>t-1}),month:p5({values:ylt,defaultWidth:"wide"}),day:p5({values:xlt,defaultWidth:"wide"}),dayPeriod:p5({values:vlt,defaultWidth:"wide",formattingValues:_lt,defaultFormattingWidth:"wide"})};function m5(t){return(e,n={})=>{const s=n.width,i=s&&t.matchPatterns[s]||t.matchPatterns[t.defaultMatchWidth],o=e.match(i);if(!o)return null;const c=o[0],a=s&&t.parsePatterns[s]||t.parsePatterns[t.defaultParseWidth],f=Array.isArray(a)?klt(a,v=>v.test(c)):jlt(a,v=>v.test(c));let m;m=t.valueCallback?t.valueCallback(f):f,m=n.valueCallback?n.valueCallback(m):m;const y=e.slice(c.length);return{value:m,rest:y}}}function jlt(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function klt(t,e){for(let n=0;n{const s=e.match(t.matchPattern);if(!s)return null;const i=s[0],o=e.match(t.parsePattern);if(!o)return null;let c=t.valueCallback?t.valueCallback(o[0]):o[0];c=n.valueCallback?n.valueCallback(c):c;const a=e.slice(i.length);return{value:c,rest:a}}}const Slt=/^(\d+)(th|st|nd|rd)?/i,Clt=/\d+/i,Mlt={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Tlt={any:[/^b/i,/^(a|c)/i]},Alt={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Elt={any:[/1/i,/2/i,/3/i,/4/i]},Ilt={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Plt={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Llt={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Olt={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Dlt={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Rlt={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Flt={ordinalNumber:Nlt({matchPattern:Slt,parsePattern:Clt,valueCallback:t=>parseInt(t,10)}),era:m5({matchPatterns:Mlt,defaultMatchWidth:"wide",parsePatterns:Tlt,defaultParseWidth:"any"}),quarter:m5({matchPatterns:Alt,defaultMatchWidth:"wide",parsePatterns:Elt,defaultParseWidth:"any",valueCallback:t=>t+1}),month:m5({matchPatterns:Ilt,defaultMatchWidth:"wide",parsePatterns:Plt,defaultParseWidth:"any"}),day:m5({matchPatterns:Llt,defaultMatchWidth:"wide",parsePatterns:Olt,defaultParseWidth:"any"}),dayPeriod:m5({matchPatterns:Dlt,defaultMatchWidth:"any",parsePatterns:Rlt,defaultParseWidth:"any"})},ise={code:"en-US",formatDistance:llt,formatLong:hlt,formatRelative:plt,localize:wlt,match:Flt,options:{weekStartsOn:0,firstWeekContainsDate:1}};function zlt(t){const e=xs(t);return Yp(e,ULe(e))+1}function Hge(t){const e=xs(t),n=+Hy(e)-+Zot(e);return Math.round(n/Uge)+1}function Wge(t,e){var y,v,w,k;const n=xs(t),s=n.getFullYear(),i=I1(),o=(e==null?void 0:e.firstWeekContainsDate)??((v=(y=e==null?void 0:e.locale)==null?void 0:y.options)==null?void 0:v.firstWeekContainsDate)??i.firstWeekContainsDate??((k=(w=i.locale)==null?void 0:w.options)==null?void 0:k.firstWeekContainsDate)??1,c=xo(t,0);c.setFullYear(s+1,0,o),c.setHours(0,0,0,0);const a=Gh(c,e),f=xo(t,0);f.setFullYear(s,0,o),f.setHours(0,0,0,0);const m=Gh(f,e);return n.getTime()>=a.getTime()?s+1:n.getTime()>=m.getTime()?s:s-1}function Blt(t,e){var a,f,m,y;const n=I1(),s=(e==null?void 0:e.firstWeekContainsDate)??((f=(a=e==null?void 0:e.locale)==null?void 0:a.options)==null?void 0:f.firstWeekContainsDate)??n.firstWeekContainsDate??((y=(m=n.locale)==null?void 0:m.options)==null?void 0:y.firstWeekContainsDate)??1,i=Wge(t,e),o=xo(t,0);return o.setFullYear(i,0,s),o.setHours(0,0,0,0),Gh(o,e)}function Gge(t,e){const n=xs(t),s=+Gh(n,e)-+Blt(n,e);return Math.round(s/Uge)+1}function yo(t,e){const n=t<0?"-":"",s=Math.abs(t).toString().padStart(e,"0");return n+s}const Ux={y(t,e){const n=t.getFullYear(),s=n>0?n:1-n;return yo(e==="yy"?s%100:s,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):yo(n+1,2)},d(t,e){return yo(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(t,e){return yo(t.getHours()%12||12,e.length)},H(t,e){return yo(t.getHours(),e.length)},m(t,e){return yo(t.getMinutes(),e.length)},s(t,e){return yo(t.getSeconds(),e.length)},S(t,e){const n=e.length,s=t.getMilliseconds(),i=Math.trunc(s*Math.pow(10,n-3));return yo(i,e.length)}},RN={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},zje={G:function(t,e,n){const s=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(s,{width:"abbreviated"});case"GGGGG":return n.era(s,{width:"narrow"});case"GGGG":default:return n.era(s,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const s=t.getFullYear(),i=s>0?s:1-s;return n.ordinalNumber(i,{unit:"year"})}return Ux.y(t,e)},Y:function(t,e,n,s){const i=Wge(t,s),o=i>0?i:1-i;if(e==="YY"){const c=o%100;return yo(c,2)}return e==="Yo"?n.ordinalNumber(o,{unit:"year"}):yo(o,e.length)},R:function(t,e){const n=BLe(t);return yo(n,e.length)},u:function(t,e){const n=t.getFullYear();return yo(n,e.length)},Q:function(t,e,n){const s=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(s);case"QQ":return yo(s,2);case"Qo":return n.ordinalNumber(s,{unit:"quarter"});case"QQQ":return n.quarter(s,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(s,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(s,{width:"wide",context:"formatting"})}},q:function(t,e,n){const s=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(s);case"qq":return yo(s,2);case"qo":return n.ordinalNumber(s,{unit:"quarter"});case"qqq":return n.quarter(s,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(s,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(s,{width:"wide",context:"standalone"})}},M:function(t,e,n){const s=t.getMonth();switch(e){case"M":case"MM":return Ux.M(t,e);case"Mo":return n.ordinalNumber(s+1,{unit:"month"});case"MMM":return n.month(s,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(s,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(s,{width:"wide",context:"formatting"})}},L:function(t,e,n){const s=t.getMonth();switch(e){case"L":return String(s+1);case"LL":return yo(s+1,2);case"Lo":return n.ordinalNumber(s+1,{unit:"month"});case"LLL":return n.month(s,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(s,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(s,{width:"wide",context:"standalone"})}},w:function(t,e,n,s){const i=Gge(t,s);return e==="wo"?n.ordinalNumber(i,{unit:"week"}):yo(i,e.length)},I:function(t,e,n){const s=Hge(t);return e==="Io"?n.ordinalNumber(s,{unit:"week"}):yo(s,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):Ux.d(t,e)},D:function(t,e,n){const s=zlt(t);return e==="Do"?n.ordinalNumber(s,{unit:"dayOfYear"}):yo(s,e.length)},E:function(t,e,n){const s=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(s,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(s,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(s,{width:"short",context:"formatting"});case"EEEE":default:return n.day(s,{width:"wide",context:"formatting"})}},e:function(t,e,n,s){const i=t.getDay(),o=(i-s.weekStartsOn+8)%7||7;switch(e){case"e":return String(o);case"ee":return yo(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});case"eeee":default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(t,e,n,s){const i=t.getDay(),o=(i-s.weekStartsOn+8)%7||7;switch(e){case"c":return String(o);case"cc":return yo(o,e.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});case"cccc":default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(t,e,n){const s=t.getDay(),i=s===0?7:s;switch(e){case"i":return String(i);case"ii":return yo(i,e.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(s,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(s,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(s,{width:"short",context:"formatting"});case"iiii":default:return n.day(s,{width:"wide",context:"formatting"})}},a:function(t,e,n){const i=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(t,e,n){const s=t.getHours();let i;switch(s===12?i=RN.noon:s===0?i=RN.midnight:i=s/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(t,e,n){const s=t.getHours();let i;switch(s>=17?i=RN.evening:s>=12?i=RN.afternoon:s>=4?i=RN.morning:i=RN.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let s=t.getHours()%12;return s===0&&(s=12),n.ordinalNumber(s,{unit:"hour"})}return Ux.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):Ux.H(t,e)},K:function(t,e,n){const s=t.getHours()%12;return e==="Ko"?n.ordinalNumber(s,{unit:"hour"}):yo(s,e.length)},k:function(t,e,n){let s=t.getHours();return s===0&&(s=24),e==="ko"?n.ordinalNumber(s,{unit:"hour"}):yo(s,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):Ux.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):Ux.s(t,e)},S:function(t,e){return Ux.S(t,e)},X:function(t,e,n){const s=t.getTimezoneOffset();if(s===0)return"Z";switch(e){case"X":return $je(s);case"XXXX":case"XX":return ew(s);case"XXXXX":case"XXX":default:return ew(s,":")}},x:function(t,e,n){const s=t.getTimezoneOffset();switch(e){case"x":return $je(s);case"xxxx":case"xx":return ew(s);case"xxxxx":case"xxx":default:return ew(s,":")}},O:function(t,e,n){const s=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+Bje(s,":");case"OOOO":default:return"GMT"+ew(s,":")}},z:function(t,e,n){const s=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+Bje(s,":");case"zzzz":default:return"GMT"+ew(s,":")}},t:function(t,e,n){const s=Math.trunc(t.getTime()/1e3);return yo(s,e.length)},T:function(t,e,n){const s=t.getTime();return yo(s,e.length)}};function Bje(t,e=""){const n=t>0?"-":"+",s=Math.abs(t),i=Math.trunc(s/60),o=s%60;return o===0?n+String(i):n+String(i)+e+yo(o,2)}function $je(t,e){return t%60===0?(t>0?"-":"+")+yo(Math.abs(t)/60,2):ew(t,e)}function ew(t,e=""){const n=t>0?"-":"+",s=Math.abs(t),i=yo(Math.trunc(s/60),2),o=yo(s%60,2);return n+i+e+o}const Uje=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},VLe=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},$lt=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],s=n[1],i=n[2];if(!i)return Uje(t,e);let o;switch(s){case"P":o=e.dateTime({width:"short"});break;case"PP":o=e.dateTime({width:"medium"});break;case"PPP":o=e.dateTime({width:"long"});break;case"PPPP":default:o=e.dateTime({width:"full"});break}return o.replace("{{date}}",Uje(s,e)).replace("{{time}}",VLe(i,e))},che={p:VLe,P:$lt},Ult=/^D+$/,qlt=/^Y+$/,Vlt=["D","DD","YY","YYYY"];function HLe(t){return Ult.test(t)}function WLe(t){return qlt.test(t)}function dhe(t,e,n){const s=Hlt(t,e,n);if(console.warn(s),Vlt.includes(t))throw new RangeError(s)}function Hlt(t,e,n){const s=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${s} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Wlt=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Glt=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Klt=/^'([^]*?)'?$/,Zlt=/''/g,Ylt=/[a-zA-Z]/;function un(t,e,n){var y,v,w,k,C,S,T,I;const s=I1(),i=(n==null?void 0:n.locale)??s.locale??ise,o=(n==null?void 0:n.firstWeekContainsDate)??((v=(y=n==null?void 0:n.locale)==null?void 0:y.options)==null?void 0:v.firstWeekContainsDate)??s.firstWeekContainsDate??((k=(w=s.locale)==null?void 0:w.options)==null?void 0:k.firstWeekContainsDate)??1,c=(n==null?void 0:n.weekStartsOn)??((S=(C=n==null?void 0:n.locale)==null?void 0:C.options)==null?void 0:S.weekStartsOn)??s.weekStartsOn??((I=(T=s.locale)==null?void 0:T.options)==null?void 0:I.weekStartsOn)??0,a=xs(t);if(!lhe(a))throw new RangeError("Invalid time value");let f=e.match(Glt).map(A=>{const D=A[0];if(D==="p"||D==="P"){const $=che[D];return $(A,i.formatLong)}return A}).join("").match(Wlt).map(A=>{if(A==="''")return{isToken:!1,value:"'"};const D=A[0];if(D==="'")return{isToken:!1,value:Xlt(A)};if(zje[D])return{isToken:!0,value:A};if(D.match(Ylt))throw new RangeError("Format string contains an unescaped latin alphabet character `"+D+"`");return{isToken:!1,value:A}});i.localize.preprocessor&&(f=i.localize.preprocessor(a,f));const m={firstWeekContainsDate:o,weekStartsOn:c,locale:i};return f.map(A=>{if(!A.isToken)return A.value;const D=A.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&WLe(D)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&HLe(D))&&dhe(D,e,String(t));const $=zje[D[0]];return $(a,D,i.localize,m)}).join("")}function Xlt(t){const e=t.match(Klt);return e?e[1].replace(Zlt,"'"):t}function Qlt(t,e,n){const s=I1(),i=(n==null?void 0:n.locale)??s.locale??ise,o=2520,c=ree(t,e);if(isNaN(c))throw new RangeError("Invalid time value");const a=Object.assign({},n,{addSuffix:n==null?void 0:n.addSuffix,comparison:c});let f,m;c>0?(f=xs(e),m=xs(t)):(f=xs(t),m=xs(e));const y=alt(m,f),v=(v1(m)-v1(f))/1e3,w=Math.round((y-v)/60);let k;if(w<2)return n!=null&&n.includeSeconds?y<5?i.formatDistance("lessThanXSeconds",5,a):y<10?i.formatDistance("lessThanXSeconds",10,a):y<20?i.formatDistance("lessThanXSeconds",20,a):y<40?i.formatDistance("halfAMinute",0,a):y<60?i.formatDistance("lessThanXMinutes",1,a):i.formatDistance("xMinutes",1,a):w===0?i.formatDistance("lessThanXMinutes",1,a):i.formatDistance("xMinutes",w,a);if(w<45)return i.formatDistance("xMinutes",w,a);if(w<90)return i.formatDistance("aboutXHours",1,a);if(ws.getTime()}function ase(t,e){const n=xs(t),s=xs(e);return+n<+s}function ict(t){return+xs(t)>Date.now()}function act(t,e){const n=e instanceof Date?xo(e,0):new e(0);return n.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),n.setHours(t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()),n}const oct=10;class GLe{constructor(){qn(this,"subPriority",0)}validate(e,n){return!0}}class lct extends GLe{constructor(e,n,s,i,o){super(),this.value=e,this.validateValue=n,this.setValue=s,this.priority=i,o&&(this.subPriority=o)}validate(e,n){return this.validateValue(e,this.value,n)}set(e,n,s){return this.setValue(e,n,this.value,s)}}class cct extends GLe{constructor(){super(...arguments);qn(this,"priority",oct);qn(this,"subPriority",-1)}set(n,s){return s.timestampIsSet?n:xo(n,act(n,Date))}}class oo{run(e,n,s,i){const o=this.parse(e,n,s,i);return o?{setter:new lct(o.value,this.validate,this.set,this.priority,this.subPriority),rest:o.rest}:null}validate(e,n,s){return!0}}class dct extends oo{constructor(){super(...arguments);qn(this,"priority",140);qn(this,"incompatibleTokens",["R","u","t","T"])}parse(n,s,i){switch(s){case"G":case"GG":case"GGG":return i.era(n,{width:"abbreviated"})||i.era(n,{width:"narrow"});case"GGGGG":return i.era(n,{width:"narrow"});case"GGGG":default:return i.era(n,{width:"wide"})||i.era(n,{width:"abbreviated"})||i.era(n,{width:"narrow"})}}set(n,s,i){return s.era=i,n.setFullYear(i,0,1),n.setHours(0,0,0,0),n}}const nc={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},Xm={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function sc(t,e){return t&&{value:e(t.value),rest:t.rest}}function Sl(t,e){const n=e.match(t);return n?{value:parseInt(n[0],10),rest:e.slice(n[0].length)}:null}function Qm(t,e){const n=e.match(t);if(!n)return null;if(n[0]==="Z")return{value:0,rest:e.slice(1)};const s=n[1]==="+"?1:-1,i=n[2]?parseInt(n[2],10):0,o=n[3]?parseInt(n[3],10):0,c=n[5]?parseInt(n[5],10):0;return{value:s*(i*zLe+o*FLe+c*Got),rest:e.slice(n[0].length)}}function KLe(t){return Sl(nc.anyDigitsSigned,t)}function Kl(t,e){switch(t){case 1:return Sl(nc.singleDigit,e);case 2:return Sl(nc.twoDigits,e);case 3:return Sl(nc.threeDigits,e);case 4:return Sl(nc.fourDigits,e);default:return Sl(new RegExp("^\\d{1,"+t+"}"),e)}}function dte(t,e){switch(t){case 1:return Sl(nc.singleDigitSigned,e);case 2:return Sl(nc.twoDigitsSigned,e);case 3:return Sl(nc.threeDigitsSigned,e);case 4:return Sl(nc.fourDigitsSigned,e);default:return Sl(new RegExp("^-?\\d{1,"+t+"}"),e)}}function Kge(t){switch(t){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;case"am":case"midnight":case"night":default:return 0}}function ZLe(t,e){const n=e>0,s=n?e:1-e;let i;if(s<=50)i=t||100;else{const o=s+50,c=Math.trunc(o/100)*100,a=t>=o%100;i=t+c-(a?100:0)}return n?i:1-i}function YLe(t){return t%400===0||t%4===0&&t%100!==0}class uct extends oo{constructor(){super(...arguments);qn(this,"priority",130);qn(this,"incompatibleTokens",["Y","R","u","w","I","i","e","c","t","T"])}parse(n,s,i){const o=c=>({year:c,isTwoDigitYear:s==="yy"});switch(s){case"y":return sc(Kl(4,n),o);case"yo":return sc(i.ordinalNumber(n,{unit:"year"}),o);default:return sc(Kl(s.length,n),o)}}validate(n,s){return s.isTwoDigitYear||s.year>0}set(n,s,i){const o=n.getFullYear();if(i.isTwoDigitYear){const a=ZLe(i.year,o);return n.setFullYear(a,0,1),n.setHours(0,0,0,0),n}const c=!("era"in s)||s.era===1?i.year:1-i.year;return n.setFullYear(c,0,1),n.setHours(0,0,0,0),n}}class hct extends oo{constructor(){super(...arguments);qn(this,"priority",130);qn(this,"incompatibleTokens",["y","R","u","Q","q","M","L","I","d","D","i","t","T"])}parse(n,s,i){const o=c=>({year:c,isTwoDigitYear:s==="YY"});switch(s){case"Y":return sc(Kl(4,n),o);case"Yo":return sc(i.ordinalNumber(n,{unit:"year"}),o);default:return sc(Kl(s.length,n),o)}}validate(n,s){return s.isTwoDigitYear||s.year>0}set(n,s,i,o){const c=Wge(n,o);if(i.isTwoDigitYear){const f=ZLe(i.year,c);return n.setFullYear(f,0,o.firstWeekContainsDate),n.setHours(0,0,0,0),Gh(n,o)}const a=!("era"in s)||s.era===1?i.year:1-i.year;return n.setFullYear(a,0,o.firstWeekContainsDate),n.setHours(0,0,0,0),Gh(n,o)}}class fct extends oo{constructor(){super(...arguments);qn(this,"priority",130);qn(this,"incompatibleTokens",["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"])}parse(n,s){return dte(s==="R"?4:s.length,n)}set(n,s,i){const o=xo(n,0);return o.setFullYear(i,0,4),o.setHours(0,0,0,0),Hy(o)}}class pct extends oo{constructor(){super(...arguments);qn(this,"priority",130);qn(this,"incompatibleTokens",["G","y","Y","R","w","I","i","e","c","t","T"])}parse(n,s){return dte(s==="u"?4:s.length,n)}set(n,s,i){return n.setFullYear(i,0,1),n.setHours(0,0,0,0),n}}class mct extends oo{constructor(){super(...arguments);qn(this,"priority",120);qn(this,"incompatibleTokens",["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"])}parse(n,s,i){switch(s){case"Q":case"QQ":return Kl(s.length,n);case"Qo":return i.ordinalNumber(n,{unit:"quarter"});case"QQQ":return i.quarter(n,{width:"abbreviated",context:"formatting"})||i.quarter(n,{width:"narrow",context:"formatting"});case"QQQQQ":return i.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return i.quarter(n,{width:"wide",context:"formatting"})||i.quarter(n,{width:"abbreviated",context:"formatting"})||i.quarter(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=1&&s<=4}set(n,s,i){return n.setMonth((i-1)*3,1),n.setHours(0,0,0,0),n}}class gct extends oo{constructor(){super(...arguments);qn(this,"priority",120);qn(this,"incompatibleTokens",["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"])}parse(n,s,i){switch(s){case"q":case"qq":return Kl(s.length,n);case"qo":return i.ordinalNumber(n,{unit:"quarter"});case"qqq":return i.quarter(n,{width:"abbreviated",context:"standalone"})||i.quarter(n,{width:"narrow",context:"standalone"});case"qqqqq":return i.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return i.quarter(n,{width:"wide",context:"standalone"})||i.quarter(n,{width:"abbreviated",context:"standalone"})||i.quarter(n,{width:"narrow",context:"standalone"})}}validate(n,s){return s>=1&&s<=4}set(n,s,i){return n.setMonth((i-1)*3,1),n.setHours(0,0,0,0),n}}class yct extends oo{constructor(){super(...arguments);qn(this,"incompatibleTokens",["Y","R","q","Q","L","w","I","D","i","e","c","t","T"]);qn(this,"priority",110)}parse(n,s,i){const o=c=>c-1;switch(s){case"M":return sc(Sl(nc.month,n),o);case"MM":return sc(Kl(2,n),o);case"Mo":return sc(i.ordinalNumber(n,{unit:"month"}),o);case"MMM":return i.month(n,{width:"abbreviated",context:"formatting"})||i.month(n,{width:"narrow",context:"formatting"});case"MMMMM":return i.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return i.month(n,{width:"wide",context:"formatting"})||i.month(n,{width:"abbreviated",context:"formatting"})||i.month(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=0&&s<=11}set(n,s,i){return n.setMonth(i,1),n.setHours(0,0,0,0),n}}class xct extends oo{constructor(){super(...arguments);qn(this,"priority",110);qn(this,"incompatibleTokens",["Y","R","q","Q","M","w","I","D","i","e","c","t","T"])}parse(n,s,i){const o=c=>c-1;switch(s){case"L":return sc(Sl(nc.month,n),o);case"LL":return sc(Kl(2,n),o);case"Lo":return sc(i.ordinalNumber(n,{unit:"month"}),o);case"LLL":return i.month(n,{width:"abbreviated",context:"standalone"})||i.month(n,{width:"narrow",context:"standalone"});case"LLLLL":return i.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return i.month(n,{width:"wide",context:"standalone"})||i.month(n,{width:"abbreviated",context:"standalone"})||i.month(n,{width:"narrow",context:"standalone"})}}validate(n,s){return s>=0&&s<=11}set(n,s,i){return n.setMonth(i,1),n.setHours(0,0,0,0),n}}function vct(t,e,n){const s=xs(t),i=Gge(s,n)-e;return s.setDate(s.getDate()-i*7),s}class _ct extends oo{constructor(){super(...arguments);qn(this,"priority",100);qn(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","i","t","T"])}parse(n,s,i){switch(s){case"w":return Sl(nc.week,n);case"wo":return i.ordinalNumber(n,{unit:"week"});default:return Kl(s.length,n)}}validate(n,s){return s>=1&&s<=53}set(n,s,i,o){return Gh(vct(n,i,o),o)}}function bct(t,e){const n=xs(t),s=Hge(n)-e;return n.setDate(n.getDate()-s*7),n}class wct extends oo{constructor(){super(...arguments);qn(this,"priority",100);qn(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"])}parse(n,s,i){switch(s){case"I":return Sl(nc.week,n);case"Io":return i.ordinalNumber(n,{unit:"week"});default:return Kl(s.length,n)}}validate(n,s){return s>=1&&s<=53}set(n,s,i){return Hy(bct(n,i))}}const jct=[31,28,31,30,31,30,31,31,30,31,30,31],kct=[31,29,31,30,31,30,31,31,30,31,30,31];class Nct extends oo{constructor(){super(...arguments);qn(this,"priority",90);qn(this,"subPriority",1);qn(this,"incompatibleTokens",["Y","R","q","Q","w","I","D","i","e","c","t","T"])}parse(n,s,i){switch(s){case"d":return Sl(nc.date,n);case"do":return i.ordinalNumber(n,{unit:"date"});default:return Kl(s.length,n)}}validate(n,s){const i=n.getFullYear(),o=YLe(i),c=n.getMonth();return o?s>=1&&s<=kct[c]:s>=1&&s<=jct[c]}set(n,s,i){return n.setDate(i),n.setHours(0,0,0,0),n}}class Sct extends oo{constructor(){super(...arguments);qn(this,"priority",90);qn(this,"subpriority",1);qn(this,"incompatibleTokens",["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"])}parse(n,s,i){switch(s){case"D":case"DD":return Sl(nc.dayOfYear,n);case"Do":return i.ordinalNumber(n,{unit:"date"});default:return Kl(s.length,n)}}validate(n,s){const i=n.getFullYear();return YLe(i)?s>=1&&s<=366:s>=1&&s<=365}set(n,s,i){return n.setMonth(0,i),n.setHours(0,0,0,0),n}}function Zge(t,e,n){var v,w,k,C;const s=I1(),i=(n==null?void 0:n.weekStartsOn)??((w=(v=n==null?void 0:n.locale)==null?void 0:v.options)==null?void 0:w.weekStartsOn)??s.weekStartsOn??((C=(k=s.locale)==null?void 0:k.options)==null?void 0:C.weekStartsOn)??0,o=xs(t),c=o.getDay(),f=(e%7+7)%7,m=7-i,y=e<0||e>6?e-(c+m)%7:(f+m)%7-(c+m)%7;return Rl(o,y)}class Cct extends oo{constructor(){super(...arguments);qn(this,"priority",90);qn(this,"incompatibleTokens",["D","i","e","c","t","T"])}parse(n,s,i){switch(s){case"E":case"EE":case"EEE":return i.day(n,{width:"abbreviated",context:"formatting"})||i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"});case"EEEEE":return i.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"});case"EEEE":default:return i.day(n,{width:"wide",context:"formatting"})||i.day(n,{width:"abbreviated",context:"formatting"})||i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=0&&s<=6}set(n,s,i,o){return n=Zge(n,i,o),n.setHours(0,0,0,0),n}}class Mct extends oo{constructor(){super(...arguments);qn(this,"priority",90);qn(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"])}parse(n,s,i,o){const c=a=>{const f=Math.floor((a-1)/7)*7;return(a+o.weekStartsOn+6)%7+f};switch(s){case"e":case"ee":return sc(Kl(s.length,n),c);case"eo":return sc(i.ordinalNumber(n,{unit:"day"}),c);case"eee":return i.day(n,{width:"abbreviated",context:"formatting"})||i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"});case"eeeee":return i.day(n,{width:"narrow",context:"formatting"});case"eeeeee":return i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"});case"eeee":default:return i.day(n,{width:"wide",context:"formatting"})||i.day(n,{width:"abbreviated",context:"formatting"})||i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=0&&s<=6}set(n,s,i,o){return n=Zge(n,i,o),n.setHours(0,0,0,0),n}}class Tct extends oo{constructor(){super(...arguments);qn(this,"priority",90);qn(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"])}parse(n,s,i,o){const c=a=>{const f=Math.floor((a-1)/7)*7;return(a+o.weekStartsOn+6)%7+f};switch(s){case"c":case"cc":return sc(Kl(s.length,n),c);case"co":return sc(i.ordinalNumber(n,{unit:"day"}),c);case"ccc":return i.day(n,{width:"abbreviated",context:"standalone"})||i.day(n,{width:"short",context:"standalone"})||i.day(n,{width:"narrow",context:"standalone"});case"ccccc":return i.day(n,{width:"narrow",context:"standalone"});case"cccccc":return i.day(n,{width:"short",context:"standalone"})||i.day(n,{width:"narrow",context:"standalone"});case"cccc":default:return i.day(n,{width:"wide",context:"standalone"})||i.day(n,{width:"abbreviated",context:"standalone"})||i.day(n,{width:"short",context:"standalone"})||i.day(n,{width:"narrow",context:"standalone"})}}validate(n,s){return s>=0&&s<=6}set(n,s,i,o){return n=Zge(n,i,o),n.setHours(0,0,0,0),n}}function Act(t,e){const n=xs(t),s=tct(n),i=e-s;return Rl(n,i)}class Ect extends oo{constructor(){super(...arguments);qn(this,"priority",90);qn(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"])}parse(n,s,i){const o=c=>c===0?7:c;switch(s){case"i":case"ii":return Kl(s.length,n);case"io":return i.ordinalNumber(n,{unit:"day"});case"iii":return sc(i.day(n,{width:"abbreviated",context:"formatting"})||i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"}),o);case"iiiii":return sc(i.day(n,{width:"narrow",context:"formatting"}),o);case"iiiiii":return sc(i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"}),o);case"iiii":default:return sc(i.day(n,{width:"wide",context:"formatting"})||i.day(n,{width:"abbreviated",context:"formatting"})||i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"}),o)}}validate(n,s){return s>=1&&s<=7}set(n,s,i){return n=Act(n,i),n.setHours(0,0,0,0),n}}class Ict extends oo{constructor(){super(...arguments);qn(this,"priority",80);qn(this,"incompatibleTokens",["b","B","H","k","t","T"])}parse(n,s,i){switch(s){case"a":case"aa":case"aaa":return i.dayPeriod(n,{width:"abbreviated",context:"formatting"})||i.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaaa":return i.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaa":default:return i.dayPeriod(n,{width:"wide",context:"formatting"})||i.dayPeriod(n,{width:"abbreviated",context:"formatting"})||i.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,s,i){return n.setHours(Kge(i),0,0,0),n}}class Pct extends oo{constructor(){super(...arguments);qn(this,"priority",80);qn(this,"incompatibleTokens",["a","B","H","k","t","T"])}parse(n,s,i){switch(s){case"b":case"bb":case"bbb":return i.dayPeriod(n,{width:"abbreviated",context:"formatting"})||i.dayPeriod(n,{width:"narrow",context:"formatting"});case"bbbbb":return i.dayPeriod(n,{width:"narrow",context:"formatting"});case"bbbb":default:return i.dayPeriod(n,{width:"wide",context:"formatting"})||i.dayPeriod(n,{width:"abbreviated",context:"formatting"})||i.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,s,i){return n.setHours(Kge(i),0,0,0),n}}class Lct extends oo{constructor(){super(...arguments);qn(this,"priority",80);qn(this,"incompatibleTokens",["a","b","t","T"])}parse(n,s,i){switch(s){case"B":case"BB":case"BBB":return i.dayPeriod(n,{width:"abbreviated",context:"formatting"})||i.dayPeriod(n,{width:"narrow",context:"formatting"});case"BBBBB":return i.dayPeriod(n,{width:"narrow",context:"formatting"});case"BBBB":default:return i.dayPeriod(n,{width:"wide",context:"formatting"})||i.dayPeriod(n,{width:"abbreviated",context:"formatting"})||i.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,s,i){return n.setHours(Kge(i),0,0,0),n}}class Oct extends oo{constructor(){super(...arguments);qn(this,"priority",70);qn(this,"incompatibleTokens",["H","K","k","t","T"])}parse(n,s,i){switch(s){case"h":return Sl(nc.hour12h,n);case"ho":return i.ordinalNumber(n,{unit:"hour"});default:return Kl(s.length,n)}}validate(n,s){return s>=1&&s<=12}set(n,s,i){const o=n.getHours()>=12;return o&&i<12?n.setHours(i+12,0,0,0):!o&&i===12?n.setHours(0,0,0,0):n.setHours(i,0,0,0),n}}class Dct extends oo{constructor(){super(...arguments);qn(this,"priority",70);qn(this,"incompatibleTokens",["a","b","h","K","k","t","T"])}parse(n,s,i){switch(s){case"H":return Sl(nc.hour23h,n);case"Ho":return i.ordinalNumber(n,{unit:"hour"});default:return Kl(s.length,n)}}validate(n,s){return s>=0&&s<=23}set(n,s,i){return n.setHours(i,0,0,0),n}}class Rct extends oo{constructor(){super(...arguments);qn(this,"priority",70);qn(this,"incompatibleTokens",["h","H","k","t","T"])}parse(n,s,i){switch(s){case"K":return Sl(nc.hour11h,n);case"Ko":return i.ordinalNumber(n,{unit:"hour"});default:return Kl(s.length,n)}}validate(n,s){return s>=0&&s<=11}set(n,s,i){return n.getHours()>=12&&i<12?n.setHours(i+12,0,0,0):n.setHours(i,0,0,0),n}}class Fct extends oo{constructor(){super(...arguments);qn(this,"priority",70);qn(this,"incompatibleTokens",["a","b","h","H","K","t","T"])}parse(n,s,i){switch(s){case"k":return Sl(nc.hour24h,n);case"ko":return i.ordinalNumber(n,{unit:"hour"});default:return Kl(s.length,n)}}validate(n,s){return s>=1&&s<=24}set(n,s,i){const o=i<=24?i%24:i;return n.setHours(o,0,0,0),n}}class zct extends oo{constructor(){super(...arguments);qn(this,"priority",60);qn(this,"incompatibleTokens",["t","T"])}parse(n,s,i){switch(s){case"m":return Sl(nc.minute,n);case"mo":return i.ordinalNumber(n,{unit:"minute"});default:return Kl(s.length,n)}}validate(n,s){return s>=0&&s<=59}set(n,s,i){return n.setMinutes(i,0,0),n}}class Bct extends oo{constructor(){super(...arguments);qn(this,"priority",50);qn(this,"incompatibleTokens",["t","T"])}parse(n,s,i){switch(s){case"s":return Sl(nc.second,n);case"so":return i.ordinalNumber(n,{unit:"second"});default:return Kl(s.length,n)}}validate(n,s){return s>=0&&s<=59}set(n,s,i){return n.setSeconds(i,0),n}}class $ct extends oo{constructor(){super(...arguments);qn(this,"priority",30);qn(this,"incompatibleTokens",["t","T"])}parse(n,s){const i=o=>Math.trunc(o*Math.pow(10,-s.length+3));return sc(Kl(s.length,n),i)}set(n,s,i){return n.setMilliseconds(i),n}}class Uct extends oo{constructor(){super(...arguments);qn(this,"priority",10);qn(this,"incompatibleTokens",["t","T","x"])}parse(n,s){switch(s){case"X":return Qm(Xm.basicOptionalMinutes,n);case"XX":return Qm(Xm.basic,n);case"XXXX":return Qm(Xm.basicOptionalSeconds,n);case"XXXXX":return Qm(Xm.extendedOptionalSeconds,n);case"XXX":default:return Qm(Xm.extended,n)}}set(n,s,i){return s.timestampIsSet?n:xo(n,n.getTime()-v1(n)-i)}}class qct extends oo{constructor(){super(...arguments);qn(this,"priority",10);qn(this,"incompatibleTokens",["t","T","X"])}parse(n,s){switch(s){case"x":return Qm(Xm.basicOptionalMinutes,n);case"xx":return Qm(Xm.basic,n);case"xxxx":return Qm(Xm.basicOptionalSeconds,n);case"xxxxx":return Qm(Xm.extendedOptionalSeconds,n);case"xxx":default:return Qm(Xm.extended,n)}}set(n,s,i){return s.timestampIsSet?n:xo(n,n.getTime()-v1(n)-i)}}class Vct extends oo{constructor(){super(...arguments);qn(this,"priority",40);qn(this,"incompatibleTokens","*")}parse(n){return KLe(n)}set(n,s,i){return[xo(n,i*1e3),{timestampIsSet:!0}]}}class Hct extends oo{constructor(){super(...arguments);qn(this,"priority",20);qn(this,"incompatibleTokens","*")}parse(n){return KLe(n)}set(n,s,i){return[xo(n,i),{timestampIsSet:!0}]}}const Wct={G:new dct,y:new uct,Y:new hct,R:new fct,u:new pct,Q:new mct,q:new gct,M:new yct,L:new xct,w:new _ct,I:new wct,d:new Nct,D:new Sct,E:new Cct,e:new Mct,c:new Tct,i:new Ect,a:new Ict,b:new Pct,B:new Lct,h:new Oct,H:new Dct,K:new Rct,k:new Fct,m:new zct,s:new Bct,S:new $ct,X:new Uct,x:new qct,t:new Vct,T:new Hct},Gct=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Kct=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Zct=/^'([^]*?)'?$/,Yct=/''/g,Xct=/\S/,Qct=/[a-zA-Z]/;function Yge(t,e,n,s){var S,T,I,A;const i=ect(),o=i.locale??ise,c=i.firstWeekContainsDate??((T=(S=i.locale)==null?void 0:S.options)==null?void 0:T.firstWeekContainsDate)??1,a=i.weekStartsOn??((A=(I=i.locale)==null?void 0:I.options)==null?void 0:A.weekStartsOn)??0;if(e==="")return t===""?xs(n):xo(n,NaN);const f={firstWeekContainsDate:c,weekStartsOn:a,locale:o},m=[new cct],y=e.match(Kct).map(D=>{const $=D[0];if($ in che){const F=che[$];return F(D,o.formatLong)}return D}).join("").match(Gct),v=[];for(let D of y){WLe(D)&&dhe(D,e,t),HLe(D)&&dhe(D,e,t);const $=D[0],F=Wct[$];if(F){const{incompatibleTokens:q}=F;if(Array.isArray(q)){const K=v.find(Z=>q.includes(Z.token)||Z.token===$);if(K)throw new RangeError(`The format string mustn't contain \`${K.fullToken}\` and \`${D}\` at the same time`)}else if(F.incompatibleTokens==="*"&&v.length>0)throw new RangeError(`The format string mustn't contain \`${D}\` and any other token at the same time`);v.push({token:$,fullToken:D});const W=F.run(t,D,o.match,f);if(!W)return xo(n,NaN);m.push(W.setter),t=W.rest}else{if($.match(Qct))throw new RangeError("Format string contains an unescaped latin alphabet character `"+$+"`");if(D==="''"?D="'":$==="'"&&(D=Jct(D)),t.indexOf(D)===0)t=t.slice(D.length);else return xo(n,NaN)}}if(t.length>0&&Xct.test(t))return xo(n,NaN);const w=m.map(D=>D.priority).sort((D,$)=>$-D).filter((D,$,F)=>F.indexOf(D)===$).map(D=>m.filter($=>$.priority===D).sort(($,F)=>F.subPriority-$.subPriority)).map(D=>D[0]);let k=xs(n);if(isNaN(k.getTime()))return xo(n,NaN);const C={};for(const D of w){if(!D.validate(k,f))return xo(n,NaN);const $=D.set(k,C,f);Array.isArray($)?(k=$[0],Object.assign(C,$[1])):k=$}return xo(n,k)}function Jct(t){return t.match(Zct)[1].replace(Yct,"'")}function ute(t){return+xs(t)o-c);return n>=s&&n<=i}function Rle(t,e){return Rl(t,-e)}function Fle(t,e){const n=xs(t),s=n.getFullYear(),i=n.getDate(),o=xo(t,0);o.setFullYear(s,e,15),o.setHours(0,0,0,0);const c=Jlt(o);return n.setMonth(e,Math.min(i,c)),n}function QLe(t,e){const n=xs(t);return n.setHours(e),n}function JLe(t,e){const n=xs(t);return n.setMinutes(e),n}function Vje(t,e){const n=xs(t);return isNaN(+n)?xo(t,NaN):(n.setFullYear(e),n)}function tdt(t,e){return Gf(t,-12)}const rdt=()=>{const{user:t}=Fr(),e=es(),[n,s]=P.useState([]),[i,o]=P.useState(0),[c,a]=P.useState(!1),[f,m]=P.useState(null);P.useEffect(()=>{if(!t)return;const C=`notification_last_read_${t.id}`;let S=f;if(!S){const A=localStorage.getItem(C);A&&(S=A,m(A))}(async()=>{const{data:A,error:D}=await ee.from("push_notifications").select("*").order("created_at",{ascending:!1}).limit(20);if(!D&&A){s(A);const $=S?new Date(S):null,F=A.filter(q=>$?new Date(q.created_at)>$:!0);o(F.length)}})();const I=ee.channel("push-notifications").on("postgres_changes",{event:"INSERT",schema:"public",table:"push_notifications"},A=>{const D=A.new;s(F=>[D,...F].slice(0,20));const $=S?new Date(S):null;(!$||new Date(D.created_at)>$)&&o(F=>F+1),Notification.permission==="granted"&&new Notification(D.title,{body:D.body,icon:"/favicon.ico"})}).subscribe();return()=>{ee.removeChannel(I)}},[t,f]);const y=C=>{const S=C.toLowerCase();return S.includes("community")||S.includes("post")?Wl:S.includes("academy")||S.includes("video")?Gi:S.includes("template")?Gd:S.includes("event")?li:S.includes("newsletter")?Ay:S.includes("brokerage")?dh:S.includes("swag")||S.includes("social")?Qa:S.includes("toolbox")||S.includes("tool")?Iy:S.includes("brief")?Mi:Wl},v=C=>{a(!1),C.url&&C.url!=="/"&&e(C.url)},w=()=>{if(!t)return;const C=new Date().toISOString(),S=`notification_last_read_${t.id}`;localStorage.setItem(S,C),m(C),o(0)},k=C=>{a(C),C&&i>0&&w()};return r.jsxs(fm,{open:c,onOpenChange:k,children:[r.jsx(pm,{asChild:!0,children:r.jsxs(te,{variant:"ghost",size:"icon",className:"relative",children:[r.jsx(ag,{className:"h-5 w-5"}),i>0&&r.jsx(Rt,{variant:"destructive",className:"absolute -top-1 -right-1 h-5 w-5 flex items-center justify-center p-0 text-xs",children:i>9?"9+":i})]})}),r.jsxs(Xf,{align:"end",className:"w-80",children:[r.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b",children:[r.jsx("span",{className:"font-semibold",children:"Notifications"}),n.length>0&&r.jsx(te,{variant:"ghost",size:"sm",className:"text-xs h-6",onClick:w,children:"Mark all read"})]}),r.jsx(xl,{className:"h-[300px]",children:n.length===0?r.jsx("div",{className:"p-4 text-center text-muted-foreground text-sm",children:"No notifications yet"}):n.map(C=>{const S=y(C.title);return r.jsxs(uo,{className:"group flex items-start gap-3 p-3 cursor-pointer data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",onClick:()=>v(C),children:[r.jsx("div",{className:"flex-shrink-0 mt-0.5",children:r.jsx(S,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[r.jsx("span",{className:"font-medium text-sm",children:C.title}),r.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2 group-data-[highlighted]:text-accent-foreground/80",children:C.body}),r.jsx("span",{className:"text-xs text-muted-foreground group-data-[highlighted]:text-accent-foreground/80",children:Yd(new Date(C.created_at),{addSuffix:!0})})]})]},C.id)})})]})]})};var Hje=1,ndt=.9,sdt=.8,idt=.17,zle=.1,Ble=.999,adt=.9999,odt=.99,ldt=/[\\\/_+.#"@\[\(\{&]/,cdt=/[\\\/_+.#"@\[\(\{&]/g,ddt=/[\s-]/,eOe=/[\s-]/g;function uhe(t,e,n,s,i,o,c){if(o===e.length)return i===t.length?Hje:odt;var a=`${i},${o}`;if(c[a]!==void 0)return c[a];for(var f=s.charAt(o),m=n.indexOf(f,i),y=0,v,w,k,C;m>=0;)v=uhe(t,e,n,s,m+1,o+1,c),v>y&&(m===i?v*=Hje:ldt.test(t.charAt(m-1))?(v*=sdt,k=t.slice(i,m-1).match(cdt),k&&i>0&&(v*=Math.pow(Ble,k.length))):ddt.test(t.charAt(m-1))?(v*=ndt,C=t.slice(i,m-1).match(eOe),C&&i>0&&(v*=Math.pow(Ble,C.length))):(v*=idt,i>0&&(v*=Math.pow(Ble,m-i))),t.charAt(m)!==e.charAt(o)&&(v*=adt)),(vv&&(v=w*zle)),v>y&&(y=v),m=n.indexOf(f,m+1);return c[a]=y,y}function Wje(t){return t.toLowerCase().replace(eOe," ")}function udt(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,uhe(t,e,Wje(t),Wje(e),0,0,{})}var g5='[cmdk-group=""]',$le='[cmdk-group-items=""]',hdt='[cmdk-group-heading=""]',tOe='[cmdk-item=""]',Gje=`${tOe}:not([aria-disabled="true"])`,hhe="cmdk-item-select",QN="data-value",fdt=(t,e,n)=>udt(t,e,n),rOe=P.createContext(void 0),aI=()=>P.useContext(rOe),nOe=P.createContext(void 0),Qge=()=>P.useContext(nOe),sOe=P.createContext(void 0),iOe=P.forwardRef((t,e)=>{let n=JN(()=>{var oe,ae;return{search:"",value:(ae=(oe=t.value)!=null?oe:t.defaultValue)!=null?ae:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),s=JN(()=>new Set),i=JN(()=>new Map),o=JN(()=>new Map),c=JN(()=>new Set),a=aOe(t),{label:f,children:m,value:y,onValueChange:v,filter:w,shouldFilter:k,loop:C,disablePointerSelection:S=!1,vimBindings:T=!0,...I}=t,A=Fc(),D=Fc(),$=Fc(),F=P.useRef(null),q=kdt();mj(()=>{if(y!==void 0){let oe=y.trim();n.current.value=oe,W.emit()}},[y]),mj(()=>{q(6,Ne)},[]);let W=P.useMemo(()=>({subscribe:oe=>(c.current.add(oe),()=>c.current.delete(oe)),snapshot:()=>n.current,setState:(oe,ae,je)=>{var Me,Ue,Re,$e;if(!Object.is(n.current[oe],ae)){if(n.current[oe]=ae,oe==="search")ue(),re(),q(1,he);else if(oe==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Pe=document.getElementById($);Pe?Pe.focus():(Me=document.getElementById(A))==null||Me.focus()}if(q(7,()=>{var Pe;n.current.selectedItemId=(Pe=se())==null?void 0:Pe.id,W.emit()}),je||q(5,Ne),((Ue=a.current)==null?void 0:Ue.value)!==void 0){let Pe=ae??"";($e=(Re=a.current).onValueChange)==null||$e.call(Re,Pe);return}}W.emit()}},emit:()=>{c.current.forEach(oe=>oe())}}),[]),K=P.useMemo(()=>({value:(oe,ae,je)=>{var Me;ae!==((Me=o.current.get(oe))==null?void 0:Me.value)&&(o.current.set(oe,{value:ae,keywords:je}),n.current.filtered.items.set(oe,Z(ae,je)),q(2,()=>{re(),W.emit()}))},item:(oe,ae)=>(s.current.add(oe),ae&&(i.current.has(ae)?i.current.get(ae).add(oe):i.current.set(ae,new Set([oe]))),q(3,()=>{ue(),re(),n.current.value||he(),W.emit()}),()=>{o.current.delete(oe),s.current.delete(oe),n.current.filtered.items.delete(oe);let je=se();q(4,()=>{ue(),(je==null?void 0:je.getAttribute("id"))===oe&&he(),W.emit()})}),group:oe=>(i.current.has(oe)||i.current.set(oe,new Set),()=>{o.current.delete(oe),i.current.delete(oe)}),filter:()=>a.current.shouldFilter,label:f||t["aria-label"],getDisablePointerSelection:()=>a.current.disablePointerSelection,listId:A,inputId:$,labelId:D,listInnerRef:F}),[]);function Z(oe,ae){var je,Me;let Ue=(Me=(je=a.current)==null?void 0:je.filter)!=null?Me:fdt;return oe?Ue(oe,n.current.search,ae):0}function re(){if(!n.current.search||a.current.shouldFilter===!1)return;let oe=n.current.filtered.items,ae=[];n.current.filtered.groups.forEach(Me=>{let Ue=i.current.get(Me),Re=0;Ue.forEach($e=>{let Pe=oe.get($e);Re=Math.max(Pe,Re)}),ae.push([Me,Re])});let je=F.current;xe().sort((Me,Ue)=>{var Re,$e;let Pe=Me.getAttribute("id"),Ae=Ue.getAttribute("id");return((Re=oe.get(Ae))!=null?Re:0)-(($e=oe.get(Pe))!=null?$e:0)}).forEach(Me=>{let Ue=Me.closest($le);Ue?Ue.appendChild(Me.parentElement===Ue?Me:Me.closest(`${$le} > *`)):je.appendChild(Me.parentElement===je?Me:Me.closest(`${$le} > *`))}),ae.sort((Me,Ue)=>Ue[1]-Me[1]).forEach(Me=>{var Ue;let Re=(Ue=F.current)==null?void 0:Ue.querySelector(`${g5}[${QN}="${encodeURIComponent(Me[0])}"]`);Re==null||Re.parentElement.appendChild(Re)})}function he(){let oe=xe().find(je=>je.getAttribute("aria-disabled")!=="true"),ae=oe==null?void 0:oe.getAttribute(QN);W.setState("value",ae||void 0)}function ue(){var oe,ae,je,Me;if(!n.current.search||a.current.shouldFilter===!1){n.current.filtered.count=s.current.size;return}n.current.filtered.groups=new Set;let Ue=0;for(let Re of s.current){let $e=(ae=(oe=o.current.get(Re))==null?void 0:oe.value)!=null?ae:"",Pe=(Me=(je=o.current.get(Re))==null?void 0:je.keywords)!=null?Me:[],Ae=Z($e,Pe);n.current.filtered.items.set(Re,Ae),Ae>0&&Ue++}for(let[Re,$e]of i.current)for(let Pe of $e)if(n.current.filtered.items.get(Pe)>0){n.current.filtered.groups.add(Re);break}n.current.filtered.count=Ue}function Ne(){var oe,ae,je;let Me=se();Me&&(((oe=Me.parentElement)==null?void 0:oe.firstChild)===Me&&((je=(ae=Me.closest(g5))==null?void 0:ae.querySelector(hdt))==null||je.scrollIntoView({block:"nearest"})),Me.scrollIntoView({block:"nearest"}))}function se(){var oe;return(oe=F.current)==null?void 0:oe.querySelector(`${tOe}[aria-selected="true"]`)}function xe(){var oe;return Array.from(((oe=F.current)==null?void 0:oe.querySelectorAll(Gje))||[])}function ie(oe){let ae=xe()[oe];ae&&W.setState("value",ae.getAttribute(QN))}function me(oe){var ae;let je=se(),Me=xe(),Ue=Me.findIndex($e=>$e===je),Re=Me[Ue+oe];(ae=a.current)!=null&&ae.loop&&(Re=Ue+oe<0?Me[Me.length-1]:Ue+oe===Me.length?Me[0]:Me[Ue+oe]),Re&&W.setState("value",Re.getAttribute(QN))}function fe(oe){let ae=se(),je=ae==null?void 0:ae.closest(g5),Me;for(;je&&!Me;)je=oe>0?wdt(je,g5):jdt(je,g5),Me=je==null?void 0:je.querySelector(Gje);Me?W.setState("value",Me.getAttribute(QN)):me(oe)}let ve=()=>ie(xe().length-1),Ie=oe=>{oe.preventDefault(),oe.metaKey?ve():oe.altKey?fe(1):me(1)},Se=oe=>{oe.preventDefault(),oe.metaKey?ie(0):oe.altKey?fe(-1):me(-1)};return P.createElement(On.div,{ref:e,tabIndex:-1,...I,"cmdk-root":"",onKeyDown:oe=>{var ae;(ae=I.onKeyDown)==null||ae.call(I,oe);let je=oe.nativeEvent.isComposing||oe.keyCode===229;if(!(oe.defaultPrevented||je))switch(oe.key){case"n":case"j":{T&&oe.ctrlKey&&Ie(oe);break}case"ArrowDown":{Ie(oe);break}case"p":case"k":{T&&oe.ctrlKey&&Se(oe);break}case"ArrowUp":{Se(oe);break}case"Home":{oe.preventDefault(),ie(0);break}case"End":{oe.preventDefault(),ve();break}case"Enter":{oe.preventDefault();let Me=se();if(Me){let Ue=new Event(hhe);Me.dispatchEvent(Ue)}}}}},P.createElement("label",{"cmdk-label":"",htmlFor:K.inputId,id:K.labelId,style:Sdt},f),ose(t,oe=>P.createElement(nOe.Provider,{value:W},P.createElement(rOe.Provider,{value:K},oe))))}),pdt=P.forwardRef((t,e)=>{var n,s;let i=Fc(),o=P.useRef(null),c=P.useContext(sOe),a=aI(),f=aOe(t),m=(s=(n=f.current)==null?void 0:n.forceMount)!=null?s:c==null?void 0:c.forceMount;mj(()=>{if(!m)return a.item(i,c==null?void 0:c.id)},[m]);let y=oOe(i,o,[t.value,t.children,o],t.keywords),v=Qge(),w=_1(q=>q.value&&q.value===y.current),k=_1(q=>m||a.filter()===!1?!0:q.search?q.filtered.items.get(i)>0:!0);P.useEffect(()=>{let q=o.current;if(!(!q||t.disabled))return q.addEventListener(hhe,C),()=>q.removeEventListener(hhe,C)},[k,t.onSelect,t.disabled]);function C(){var q,W;S(),(W=(q=f.current).onSelect)==null||W.call(q,y.current)}function S(){v.setState("value",y.current,!0)}if(!k)return null;let{disabled:T,value:I,onSelect:A,forceMount:D,keywords:$,...F}=t;return P.createElement(On.div,{ref:Uy(o,e),...F,id:i,"cmdk-item":"",role:"option","aria-disabled":!!T,"aria-selected":!!w,"data-disabled":!!T,"data-selected":!!w,onPointerMove:T||a.getDisablePointerSelection()?void 0:S,onClick:T?void 0:C},t.children)}),mdt=P.forwardRef((t,e)=>{let{heading:n,children:s,forceMount:i,...o}=t,c=Fc(),a=P.useRef(null),f=P.useRef(null),m=Fc(),y=aI(),v=_1(k=>i||y.filter()===!1?!0:k.search?k.filtered.groups.has(c):!0);mj(()=>y.group(c),[]),oOe(c,a,[t.value,t.heading,f]);let w=P.useMemo(()=>({id:c,forceMount:i}),[i]);return P.createElement(On.div,{ref:Uy(a,e),...o,"cmdk-group":"",role:"presentation",hidden:v?void 0:!0},n&&P.createElement("div",{ref:f,"cmdk-group-heading":"","aria-hidden":!0,id:m},n),ose(t,k=>P.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?m:void 0},P.createElement(sOe.Provider,{value:w},k))))}),gdt=P.forwardRef((t,e)=>{let{alwaysRender:n,...s}=t,i=P.useRef(null),o=_1(c=>!c.search);return!n&&!o?null:P.createElement(On.div,{ref:Uy(i,e),...s,"cmdk-separator":"",role:"separator"})}),ydt=P.forwardRef((t,e)=>{let{onValueChange:n,...s}=t,i=t.value!=null,o=Qge(),c=_1(m=>m.search),a=_1(m=>m.selectedItemId),f=aI();return P.useEffect(()=>{t.value!=null&&o.setState("search",t.value)},[t.value]),P.createElement(On.input,{ref:e,...s,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":f.listId,"aria-labelledby":f.labelId,"aria-activedescendant":a,id:f.inputId,type:"text",value:i?t.value:c,onChange:m=>{i||o.setState("search",m.target.value),n==null||n(m.target.value)}})}),xdt=P.forwardRef((t,e)=>{let{children:n,label:s="Suggestions",...i}=t,o=P.useRef(null),c=P.useRef(null),a=_1(m=>m.selectedItemId),f=aI();return P.useEffect(()=>{if(c.current&&o.current){let m=c.current,y=o.current,v,w=new ResizeObserver(()=>{v=requestAnimationFrame(()=>{let k=m.offsetHeight;y.style.setProperty("--cmdk-list-height",k.toFixed(1)+"px")})});return w.observe(m),()=>{cancelAnimationFrame(v),w.unobserve(m)}}},[]),P.createElement(On.div,{ref:Uy(o,e),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":a,"aria-label":s,id:f.listId},ose(t,m=>P.createElement("div",{ref:Uy(c,f.listInnerRef),"cmdk-list-sizer":""},m)))}),vdt=P.forwardRef((t,e)=>{let{open:n,onOpenChange:s,overlayClassName:i,contentClassName:o,container:c,...a}=t;return P.createElement(Rne,{open:n,onOpenChange:s},P.createElement(Fne,{container:c},P.createElement(zC,{"cmdk-overlay":"",className:i}),P.createElement(BC,{"aria-label":t.label,"cmdk-dialog":"",className:o},P.createElement(iOe,{ref:e,...a}))))}),_dt=P.forwardRef((t,e)=>_1(n=>n.filtered.count===0)?P.createElement(On.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),bdt=P.forwardRef((t,e)=>{let{progress:n,children:s,label:i="Loading...",...o}=t;return P.createElement(On.div,{ref:e,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},ose(t,c=>P.createElement("div",{"aria-hidden":!0},c)))}),gh=Object.assign(iOe,{List:xdt,Item:pdt,Input:ydt,Group:mdt,Separator:gdt,Dialog:vdt,Empty:_dt,Loading:bdt});function wdt(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function jdt(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function aOe(t){let e=P.useRef(t);return mj(()=>{e.current=t}),e}var mj=typeof window>"u"?P.useEffect:P.useLayoutEffect;function JN(t){let e=P.useRef();return e.current===void 0&&(e.current=t()),e}function _1(t){let e=Qge(),n=()=>t(e.snapshot());return P.useSyncExternalStore(e.subscribe,n,n)}function oOe(t,e,n,s=[]){let i=P.useRef(),o=aI();return mj(()=>{var c;let a=(()=>{var m;for(let y of n){if(typeof y=="string")return y.trim();if(typeof y=="object"&&"current"in y)return y.current?(m=y.current.textContent)==null?void 0:m.trim():i.current}})(),f=s.map(m=>m.trim());o.value(t,a,f),(c=e.current)==null||c.setAttribute(QN,a),i.current=a}),i}var kdt=()=>{let[t,e]=P.useState(),n=JN(()=>new Map);return mj(()=>{n.current.forEach(s=>s()),n.current=new Map},[t]),(s,i)=>{n.current.set(s,i),e({})}};function Ndt(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function ose({asChild:t,children:e},n){return t&&P.isValidElement(e)?P.cloneElement(Ndt(e),{ref:e.ref},n(e.props.children)):n(e)}var Sdt={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const gj=P.forwardRef(({className:t,...e},n)=>r.jsx(gh,{ref:n,className:zt("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...e}));gj.displayName=gh.displayName;const Cdt=({children:t,...e})=>r.jsx($r,{...e,children:r.jsx(zr,{className:"overflow-hidden p-0 shadow-lg",children:r.jsx(gj,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:t})})}),yj=P.forwardRef(({className:t,...e},n)=>r.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[r.jsx(Ti,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),r.jsx(gh.Input,{ref:n,className:zt("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...e})]}));yj.displayName=gh.Input.displayName;const xj=P.forwardRef(({className:t,...e},n)=>r.jsx(gh.List,{ref:n,className:zt("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...e}));xj.displayName=gh.List.displayName;const vj=P.forwardRef((t,e)=>r.jsx(gh.Empty,{ref:e,className:"py-6 text-center text-sm",...t}));vj.displayName=gh.Empty.displayName;const _j=P.forwardRef(({className:t,...e},n)=>r.jsx(gh.Group,{ref:n,className:zt("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...e}));_j.displayName=gh.Group.displayName;const Mdt=P.forwardRef(({className:t,...e},n)=>r.jsx(gh.Separator,{ref:n,className:zt("-mx-1 h-px bg-border",t),...e}));Mdt.displayName=gh.Separator.displayName;const bj=P.forwardRef(({className:t,...e},n)=>r.jsx(gh.Item,{ref:n,className:zt("group relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-primary/80 data-[selected=true]:text-primary-foreground data-[disabled=true]:opacity-50",t),...e}));bj.displayName=gh.Item.displayName;const Tdt={event:{label:"Events",icon:em,color:"bg-blue-500/10 text-blue-600"},template:{label:"Templates",icon:Gd,color:"bg-purple-500/10 text-purple-600"},academy:{label:"Academy",icon:W0,color:"bg-amber-500/10 text-amber-600"},toolbox:{label:"Toolbox",icon:Iy,color:"bg-green-500/10 text-green-600"},"social-swag":{label:"Social Swag",icon:Mi,color:"bg-fuchsia-500/10 text-fuchsia-600"}},Kje=()=>{const[t,e]=P.useState(!1),[n,s]=P.useState(""),[i,o]=P.useState([]),[c,a]=P.useState(!1),f=es();P.useEffect(()=>{const w=k=>{k.key==="k"&&(k.metaKey||k.ctrlKey)&&(k.preventDefault(),e(C=>!C))};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[]);const m=P.useCallback(async w=>{if(!w.trim()){o([]);return}a(!0);const k=`%${w}%`;try{const[C,S,T,I,A]=await Promise.all([ee.from("events").select("id, title, description, event_date").eq("is_published",!0).or(`title.ilike.${k},description.ilike.${k}`).limit(5),ee.from("canva_templates").select("id, name, description, publish_date").or(`name.ilike.${k},description.ilike.${k}`).limit(5),ee.from("academy_videos").select("id, title, description, publish_date").eq("is_published",!0).or(`title.ilike.${k},description.ilike.${k}`).limit(5),ee.from("resource_kits").select("id, name, description, publish_date").eq("is_published",!0).or(`name.ilike.${k},description.ilike.${k}`).limit(5),ee.from("social_swag").select("id, title, description, publish_date").eq("is_published",!0).or(`title.ilike.${k},description.ilike.${k}`).limit(5)]),D=[];C.data&&C.data.forEach($=>{D.push({id:$.id,title:$.title,description:$.description,type:"event",date:$.event_date,path:`/event/${$.id}`})}),S.data&&S.data.forEach($=>{D.push({id:$.id,title:$.name,description:$.description,type:"template",date:$.publish_date,path:`/templates/${$.id}`})}),T.data&&T.data.forEach($=>{D.push({id:$.id,title:$.title,description:$.description,type:"academy",date:$.publish_date,path:`/academy/${$.id}`})}),I.data&&I.data.forEach($=>{D.push({id:$.id,title:$.name,description:$.description,type:"toolbox",date:$.publish_date,path:`/toolbox/${$.id}`})}),A.data&&A.data.forEach($=>{D.push({id:$.id,title:$.title,description:$.description,type:"social-swag",date:$.publish_date,path:`/social-swag/${$.id}`})}),o(D)}catch(C){console.error("Search error:",C)}finally{a(!1)}},[]);P.useEffect(()=>{const w=setTimeout(()=>{m(n)},300);return()=>clearTimeout(w)},[n,m]);const y=w=>{e(!1),s(""),f(w)},v=i.reduce((w,k)=>(w[k.type]||(w[k.type]=[]),w[k.type].push(k),w),{});return r.jsxs(r.Fragment,{children:[r.jsxs(te,{variant:"outline",className:"relative h-9 w-9 p-0 xl:h-9 xl:w-60 xl:justify-start xl:px-3 xl:py-2",onClick:()=>e(!0),children:[r.jsx(Ti,{className:"h-4 w-4 xl:mr-2"}),r.jsx("span",{className:"hidden xl:inline-flex text-muted-foreground text-sm",children:"Search..."}),r.jsxs("kbd",{className:"pointer-events-none absolute right-1.5 top-1.5 hidden h-6 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium opacity-100 xl:flex",children:[r.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),r.jsxs(Cdt,{open:t,onOpenChange:e,children:[r.jsx(yj,{placeholder:"Search events, templates, academy, toolbox, social swag...",value:n,onValueChange:s}),r.jsxs(xj,{children:[c&&r.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Searching..."}),!c&&n&&i.length===0&&r.jsxs(vj,{children:['No results found for "',n,'"']}),!c&&!n&&r.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Start typing to search across all content..."}),Object.entries(v).map(([w,k])=>{const C=Tdt[w],S=C.icon;return r.jsx(_j,{heading:C.label,children:k.map(T=>r.jsxs(bj,{value:`${T.type}-${T.id}-${T.title}`,onSelect:()=>y(T.path),className:"flex items-start gap-3 py-3 cursor-pointer",children:[r.jsx("div",{className:`p-2 rounded-md ${C.color}`,children:r.jsx(S,{className:"h-4 w-4"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"font-medium truncate",children:T.title}),T.description&&r.jsx("div",{className:"text-sm text-muted-foreground truncate group-data-[selected=true]:text-primary-foreground/80",children:T.description})]}),r.jsxs("div",{className:"flex flex-col items-end gap-1 shrink-0",children:[r.jsx(Rt,{variant:"secondary",className:"text-xs",children:C.label}),r.jsx("span",{className:"text-xs text-muted-foreground",children:Yd(new Date(T.date),{addSuffix:!0})})]})]},`${T.type}-${T.id}`))},w)})]})]})]})},Adt=({expiresAt:t,className:e,showUpgradeButton:n=!0})=>{const[s,i]=P.useState(null),o=es();if(P.useEffect(()=>{const m=()=>{const v=new Date().getTime(),k=new Date(t).getTime()-v;if(k<=0){i({days:0,hours:0,minutes:0});return}const C=Math.floor(k/(1e3*60*60*24)),S=Math.floor(k%(1e3*60*60*24)/(1e3*60*60)),T=Math.floor(k%(1e3*60*60)/(1e3*60));i({days:C,hours:S,minutes:T})};m();const y=setInterval(m,6e4);return()=>clearInterval(y)},[t]),!s)return null;const c=s.days===0&&s.hours===0&&s.minutes===0,a=s.days<=1,f=s.days<=3&&!a;return c?r.jsxs("div",{className:zt("flex items-center justify-between gap-3 px-4 py-2 rounded-lg bg-destructive/10 border border-destructive/20",e),children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ph,{className:"h-4 w-4 text-destructive"}),r.jsx("span",{className:"text-sm font-medium text-destructive",children:"Your free trial has expired"})]}),n&&r.jsxs(te,{size:"sm",onClick:()=>o("/subscription"),className:"bg-primary hover:bg-primary/90 text-xs h-7 px-3",children:[r.jsx(Mi,{className:"h-3 w-3 mr-1"}),"Upgrade Now"]})]}):r.jsxs("div",{className:zt("flex items-center justify-between gap-3 px-4 py-2 rounded-lg border transition-colors",a?"bg-destructive/10 border-destructive/20":f?"bg-amber-500/10 border-amber-500/20":"bg-primary/10 border-primary/20",e),children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Xi,{className:zt("h-4 w-4",a?"text-destructive":f?"text-amber-500":"text-primary")}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:zt("text-sm font-medium",a?"text-destructive":f?"text-amber-600":"text-primary"),children:"Free Trial:"}),r.jsxs("div",{className:"flex items-center gap-1",children:[s.days>0&&r.jsxs("span",{className:zt("text-sm font-bold",a?"text-destructive":f?"text-amber-600":"text-primary"),children:[s.days,"d"]}),r.jsxs("span",{className:zt("text-sm font-bold",a?"text-destructive":f?"text-amber-600":"text-primary"),children:[s.hours,"h"]}),r.jsxs("span",{className:zt("text-sm font-bold",a?"text-destructive":f?"text-amber-600":"text-primary"),children:[s.minutes,"m"]}),r.jsx("span",{className:zt("text-xs",a?"text-destructive/70":f?"text-amber-600/70":"text-primary/70"),children:"remaining"})]})]})]}),n&&r.jsxs(te,{size:"sm",onClick:()=>o("/subscription"),variant:a?"destructive":f?"default":"outline",className:zt("text-xs h-7 px-3",f&&"bg-amber-500 hover:bg-amber-600 text-white"),children:[r.jsx(Mi,{className:"h-3 w-3 mr-1"}),"Upgrade"]})]})},Edt=()=>{const t=es();return r.jsx("div",{className:"fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center p-4 overflow-y-auto",children:r.jsxs(Ye,{className:"w-full max-w-2xl shadow-2xl border-destructive/20 my-8",children:[r.jsxs(Ht,{className:"text-center pb-2",children:[r.jsx("div",{className:"mx-auto mb-4 h-16 w-16 rounded-full bg-destructive/10 flex items-center justify-center",children:r.jsx(Ph,{className:"h-8 w-8 text-destructive"})}),r.jsx(Yt,{className:"text-2xl",children:"Your Free Trial Has Ended"}),r.jsx(An,{className:"text-base",children:"Your 7-day free trial has expired. Upgrade now to continue accessing all the powerful tools and resources LevelUp has to offer!"})]}),r.jsxs(Je,{className:"space-y-6",children:[r.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[r.jsx(Ye,{className:"border-2 border-primary/20 hover:border-primary/50 transition-colors cursor-pointer",onClick:()=>t("/subscription"),children:r.jsxs(Je,{className:"p-5 text-center",children:[r.jsx("div",{className:"mx-auto mb-3 h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center",children:r.jsx(hs,{className:"h-6 w-6 text-primary"})}),r.jsx("h3",{className:"font-semibold text-lg mb-1",children:"Individual Agent"}),r.jsxs("p",{className:"text-2xl font-bold text-primary mb-2",children:["$39",r.jsx("span",{className:"text-sm font-normal text-muted-foreground",children:"/mo"})]}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Perfect for solo agents ready to level up"}),r.jsxs(te,{className:"w-full",onClick:e=>{e.stopPropagation(),t("/subscription")},children:[r.jsx(Mi,{className:"h-4 w-4 mr-2"}),"Choose Individual"]})]})}),r.jsx(Ye,{className:"border-2 border-amber-500/20 hover:border-amber-500/50 transition-colors cursor-pointer",onClick:()=>t("/subscription"),children:r.jsxs(Je,{className:"p-5 text-center",children:[r.jsx("div",{className:"mx-auto mb-3 h-12 w-12 rounded-full bg-amber-500/10 flex items-center justify-center",children:r.jsx(ra,{className:"h-6 w-6 text-amber-600"})}),r.jsx("h3",{className:"font-semibold text-lg mb-1",children:"Brokerage"}),r.jsxs("p",{className:"text-2xl font-bold text-amber-600 mb-2",children:["$299",r.jsx("span",{className:"text-sm font-normal text-muted-foreground",children:"/mo"})]}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"For teams and brokerages"}),r.jsxs(te,{variant:"outline",className:"w-full border-amber-500 text-amber-600 hover:bg-amber-50",onClick:e=>{e.stopPropagation(),t("/subscription")},children:[r.jsx(ra,{className:"h-4 w-4 mr-2"}),"Choose Brokerage"]})]})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm text-muted-foreground text-center",children:"With a full membership, you'll get:"}),r.jsxs("ul",{className:"text-sm space-y-1 text-muted-foreground grid sm:grid-cols-2 gap-x-4",children:[r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"✓"})," Unlimited access to all marketing templates"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"✓"})," Complete Academy training library"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"✓"})," AI-powered tools and resources"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"✓"})," Community forums and support"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"✓"})," Exclusive member events and workshops"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"✓"})," Deal pipeline & scorecard tracking"]})]})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 space-y-3",children:[r.jsx("p",{className:"text-sm font-medium text-center",children:"Questions? Contact us:"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-center",children:[r.jsxs("a",{href:"tel:1-866-527-8668",className:"flex items-center justify-center gap-2 text-primary hover:underline",children:[r.jsx(Wa,{className:"h-4 w-4"}),r.jsx("span",{children:"1-866-527-8668"})]}),r.jsxs("a",{href:"mailto:support@relevelup.com",className:"flex items-center justify-center gap-2 text-primary hover:underline",children:[r.jsx(di,{className:"h-4 w-4"}),r.jsx("span",{children:"support@relevelup.com"})]})]})]})]})]})})},Idt=({hasUnseenBrief:t,onClick:e,className:n})=>r.jsxs(fg,{children:[r.jsx(pg,{asChild:!0,children:r.jsxs(te,{variant:"ghost",size:"icon",onClick:e,className:zt("relative transition-colors",t&&"text-primary hover:text-primary",n),children:[r.jsx(nm,{className:"h-5 w-5"}),t&&r.jsx("span",{className:"absolute top-1 right-1 h-2 w-2 rounded-full bg-primary animate-pulse"})]})}),r.jsx(am,{children:r.jsx("p",{children:"The LevelUp Brief"})})]});var lse="Checkbox",[Pdt]=Zl(lse),[Ldt,Jge]=Pdt(lse);function Odt(t){const{__scopeCheckbox:e,checked:n,children:s,defaultChecked:i,disabled:o,form:c,name:a,onCheckedChange:f,required:m,value:y="on",internal_do_not_use_render:v}=t,[w,k]=Tu({prop:n,defaultProp:i??!1,onChange:f,caller:lse}),[C,S]=P.useState(null),[T,I]=P.useState(null),A=P.useRef(!1),D=C?!!c||!!C.closest("form"):!0,$={checked:w,disabled:o,setChecked:k,control:C,setControl:S,name:a,form:c,value:y,hasConsumerStoppedPropagationRef:A,required:m,defaultChecked:s1(i)?!1:i,isFormControl:D,bubbleInput:T,setBubbleInput:I};return r.jsx(Ldt,{scope:e,...$,children:Ddt(v)?v($):s})}var lOe="CheckboxTrigger",cOe=P.forwardRef(({__scopeCheckbox:t,onKeyDown:e,onClick:n,...s},i)=>{const{control:o,value:c,disabled:a,checked:f,required:m,setControl:y,setChecked:v,hasConsumerStoppedPropagationRef:w,isFormControl:k,bubbleInput:C}=Jge(lOe,t),S=Gs(i,y),T=P.useRef(f);return P.useEffect(()=>{const I=o==null?void 0:o.form;if(I){const A=()=>v(T.current);return I.addEventListener("reset",A),()=>I.removeEventListener("reset",A)}},[o,v]),r.jsx(On.button,{type:"button",role:"checkbox","aria-checked":s1(f)?"mixed":f,"aria-required":m,"data-state":pOe(f),"data-disabled":a?"":void 0,disabled:a,value:c,...s,ref:S,onKeyDown:an(e,I=>{I.key==="Enter"&&I.preventDefault()}),onClick:an(n,I=>{v(A=>s1(A)?!0:!A),C&&k&&(w.current=I.isPropagationStopped(),w.current||I.stopPropagation())})})});cOe.displayName=lOe;var eye=P.forwardRef((t,e)=>{const{__scopeCheckbox:n,name:s,checked:i,defaultChecked:o,required:c,disabled:a,value:f,onCheckedChange:m,form:y,...v}=t;return r.jsx(Odt,{__scopeCheckbox:n,checked:i,defaultChecked:o,disabled:a,required:c,onCheckedChange:m,name:s,form:y,value:f,internal_do_not_use_render:({isFormControl:w})=>r.jsxs(r.Fragment,{children:[r.jsx(cOe,{...v,ref:e,__scopeCheckbox:n}),w&&r.jsx(fOe,{__scopeCheckbox:n})]})})});eye.displayName=lse;var dOe="CheckboxIndicator",uOe=P.forwardRef((t,e)=>{const{__scopeCheckbox:n,forceMount:s,...i}=t,o=Jge(dOe,n);return r.jsx(oc,{present:s||s1(o.checked)||o.checked===!0,children:r.jsx(On.span,{"data-state":pOe(o.checked),"data-disabled":o.disabled?"":void 0,...i,ref:e,style:{pointerEvents:"none",...t.style}})})});uOe.displayName=dOe;var hOe="CheckboxBubbleInput",fOe=P.forwardRef(({__scopeCheckbox:t,...e},n)=>{const{control:s,hasConsumerStoppedPropagationRef:i,checked:o,defaultChecked:c,required:a,disabled:f,name:m,value:y,form:v,bubbleInput:w,setBubbleInput:k}=Jge(hOe,t),C=Gs(n,k),S=eI(o),T=VE(s);P.useEffect(()=>{const A=w;if(!A)return;const D=window.HTMLInputElement.prototype,F=Object.getOwnPropertyDescriptor(D,"checked").set,q=!i.current;if(S!==o&&F){const W=new Event("click",{bubbles:q});A.indeterminate=s1(o),F.call(A,s1(o)?!1:o),A.dispatchEvent(W)}},[w,S,o,i]);const I=P.useRef(s1(o)?!1:o);return r.jsx(On.input,{type:"checkbox","aria-hidden":!0,defaultChecked:c??I.current,required:a,disabled:f,name:m,value:y,form:v,...e,tabIndex:-1,ref:C,style:{...e.style,...T,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});fOe.displayName=hOe;function Ddt(t){return typeof t=="function"}function s1(t){return t==="indeterminate"}function pOe(t){return s1(t)?"indeterminate":t?"checked":"unchecked"}const _c=P.forwardRef(({className:t,...e},n)=>r.jsx(eye,{ref:n,className:zt("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...e,children:r.jsx(uOe,{className:zt("flex items-center justify-center text-current"),children:r.jsx(Ba,{className:"h-4 w-4"})})}));_c.displayName=eye.displayName;var tye="Radio",[Rdt,mOe]=Zl(tye),[Fdt,zdt]=Rdt(tye),gOe=P.forwardRef((t,e)=>{const{__scopeRadio:n,name:s,checked:i=!1,required:o,disabled:c,value:a="on",onCheck:f,form:m,...y}=t,[v,w]=P.useState(null),k=Gs(e,T=>w(T)),C=P.useRef(!1),S=v?m||!!v.closest("form"):!0;return r.jsxs(Fdt,{scope:n,checked:i,disabled:c,children:[r.jsx(On.button,{type:"button",role:"radio","aria-checked":i,"data-state":_Oe(i),"data-disabled":c?"":void 0,disabled:c,value:a,...y,ref:k,onClick:an(t.onClick,T=>{i||f==null||f(),S&&(C.current=T.isPropagationStopped(),C.current||T.stopPropagation())})}),S&&r.jsx(vOe,{control:v,bubbles:!C.current,name:s,value:a,checked:i,required:o,disabled:c,form:m,style:{transform:"translateX(-100%)"}})]})});gOe.displayName=tye;var yOe="RadioIndicator",xOe=P.forwardRef((t,e)=>{const{__scopeRadio:n,forceMount:s,...i}=t,o=zdt(yOe,n);return r.jsx(oc,{present:s||o.checked,children:r.jsx(On.span,{"data-state":_Oe(o.checked),"data-disabled":o.disabled?"":void 0,...i,ref:e})})});xOe.displayName=yOe;var Bdt="RadioBubbleInput",vOe=P.forwardRef(({__scopeRadio:t,control:e,checked:n,bubbles:s=!0,...i},o)=>{const c=P.useRef(null),a=Gs(c,o),f=eI(n),m=VE(e);return P.useEffect(()=>{const y=c.current;if(!y)return;const v=window.HTMLInputElement.prototype,k=Object.getOwnPropertyDescriptor(v,"checked").set;if(f!==n&&k){const C=new Event("click",{bubbles:s});k.call(y,n),y.dispatchEvent(C)}},[f,n,s]),r.jsx(On.input,{type:"radio","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:a,style:{...i.style,...m,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});vOe.displayName=Bdt;function _Oe(t){return t?"checked":"unchecked"}var $dt=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],cse="RadioGroup",[Udt]=Zl(cse,[qC,mOe]),bOe=qC(),wOe=mOe(),[qdt,Vdt]=Udt(cse),jOe=P.forwardRef((t,e)=>{const{__scopeRadioGroup:n,name:s,defaultValue:i,value:o,required:c=!1,disabled:a=!1,orientation:f,dir:m,loop:y=!0,onValueChange:v,...w}=t,k=bOe(n),C=Rj(m),[S,T]=Tu({prop:o,defaultProp:i??null,onChange:v,caller:cse});return r.jsx(qdt,{scope:n,name:s,required:c,disabled:a,value:S,onValueChange:T,children:r.jsx(jge,{asChild:!0,...k,orientation:f,dir:C,loop:y,children:r.jsx(On.div,{role:"radiogroup","aria-required":c,"aria-orientation":f,"data-disabled":a?"":void 0,dir:C,...w,ref:e})})})});jOe.displayName=cse;var kOe="RadioGroupItem",NOe=P.forwardRef((t,e)=>{const{__scopeRadioGroup:n,disabled:s,...i}=t,o=Vdt(kOe,n),c=o.disabled||s,a=bOe(n),f=wOe(n),m=P.useRef(null),y=Gs(e,m),v=o.value===i.value,w=P.useRef(!1);return P.useEffect(()=>{const k=S=>{$dt.includes(S.key)&&(w.current=!0)},C=()=>w.current=!1;return document.addEventListener("keydown",k),document.addEventListener("keyup",C),()=>{document.removeEventListener("keydown",k),document.removeEventListener("keyup",C)}},[]),r.jsx(kge,{asChild:!0,...a,focusable:!c,active:v,children:r.jsx(gOe,{disabled:c,required:o.required,checked:v,...f,...i,name:o.name,ref:y,onCheck:()=>o.onValueChange(i.value),onKeyDown:an(k=>{k.key==="Enter"&&k.preventDefault()}),onFocus:an(i.onFocus,()=>{var k;w.current&&((k=m.current)==null||k.click())})})})});NOe.displayName=kOe;var Hdt="RadioGroupIndicator",SOe=P.forwardRef((t,e)=>{const{__scopeRadioGroup:n,...s}=t,i=wOe(n);return r.jsx(xOe,{...i,...s,ref:e})});SOe.displayName=Hdt;var COe=jOe,MOe=NOe,Wdt=SOe;const TOe=P.forwardRef(({className:t,...e},n)=>r.jsx(COe,{className:zt("grid gap-2",t),...e,ref:n}));TOe.displayName=COe.displayName;const AOe=P.forwardRef(({className:t,...e},n)=>r.jsx(MOe,{ref:n,className:zt("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...e,children:r.jsx(Wdt,{className:"flex items-center justify-center",children:r.jsx(Mu,{className:"h-2.5 w-2.5 fill-current text-current"})})}));AOe.displayName=MOe.displayName;const Gdt=({brief:t,open:e,onClose:n,onDismiss:s})=>{const{user:i}=Fr(),[o,c]=P.useState({}),[a,f]=P.useState({}),[m,y]=P.useState([]);P.useEffect(()=>{e&&i&&t.polls.length>0&&v()},[e,i,t.polls]);const v=async()=>{if(!i)return;const T=t.polls.map(A=>A.id),{data:I}=await ee.from("levelup_brief_poll_responses").select("poll_id, option_id").eq("user_id",i.id).in("poll_id",T);if(I){const A={};I.forEach(D=>{A[D.poll_id]||(A[D.poll_id]=[]),A[D.poll_id].push(D.option_id)}),f(A)}},w=(T,I)=>{c(A=>({...A,[T]:I}))},k=(T,I,A)=>{c(D=>{const $=D[T]||[];return A?{...D,[T]:[...$,I]}:{...D,[T]:$.filter(F=>F!==I)}})},C=async T=>{if(!i)return;const I=o[T];if(!I||Array.isArray(I)&&I.length===0){Ge.error("Please select an option");return}y(A=>[...A,T]);try{await ee.from("levelup_brief_poll_responses").delete().eq("poll_id",T).eq("user_id",i.id);const A=Array.isArray(I)?I:[I],D=A.map(F=>({poll_id:T,option_id:F,user_id:i.id})),{error:$}=await ee.from("levelup_brief_poll_responses").insert(D);if($)throw $;f(F=>({...F,[T]:A})),Ge.success("Response submitted!")}catch(A){console.error("Error submitting poll response:",A),Ge.error("Failed to submit response")}finally{y(A=>A.filter(D=>D!==T))}},S=T=>(T.includes("mediadelivery.net")||T.includes("bunny"),T);return r.jsx($r,{open:e,onOpenChange:T=>!T&&n(),children:r.jsxs(zr,{className:"max-w-2xl max-h-[90vh] p-0 overflow-hidden",children:[r.jsx("div",{className:"bg-gradient-to-r from-primary to-primary/80 p-4 text-primary-foreground",children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-white/20 rounded-lg",children:r.jsx(nm,{className:"h-6 w-6"})}),r.jsxs("div",{children:[r.jsx(Rt,{variant:"secondary",className:"mb-1 bg-white/20 text-white border-0",children:"The LevelUp Brief"}),r.jsx(Kr,{className:"text-xl font-bold text-white",children:t.brief.title})]})]})}),r.jsx(xl,{className:"max-h-[calc(90vh-180px)]",children:r.jsxs("div",{className:"p-6 space-y-6",children:[t.brief.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:t.brief.description}}),t.brief.video_url&&r.jsx("div",{className:"relative w-full aspect-video rounded-lg overflow-hidden bg-muted",children:r.jsx("iframe",{src:S(t.brief.video_url),className:"absolute inset-0 w-full h-full",allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0})}),t.links.length>0&&r.jsxs("div",{className:"space-y-3",children:[r.jsx("h4",{className:"font-semibold text-foreground",children:"Quick Links"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:t.links.map(T=>r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>window.open(T.url,"_blank"),className:"gap-2",children:[r.jsx(Fs,{className:"h-4 w-4"}),T.title]},T.id))})]}),t.polls.map(T=>{var D,$;const I=((D=a[T.id])==null?void 0:D.length)>0,A=m.includes(T.id);return r.jsxs("div",{className:"space-y-3 p-4 bg-muted/50 rounded-lg border",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h4",{className:"font-semibold text-foreground",children:T.question}),I&&r.jsxs(Rt,{variant:"secondary",className:"gap-1",children:[r.jsx(io,{className:"h-3 w-3"}),"Responded"]})]}),T.poll_type==="single"?r.jsx(TOe,{value:o[T.id]||(($=a[T.id])==null?void 0:$[0])||"",onValueChange:F=>w(T.id,F),className:"space-y-2",children:T.options.map(F=>r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(AOe,{value:F.id,id:F.id}),r.jsx(Qe,{htmlFor:F.id,className:"cursor-pointer",children:F.option_text})]},F.id))}):r.jsx("div",{className:"space-y-2",children:T.options.map(F=>{const W=(o[T.id]||a[T.id]||[]).includes(F.id);return r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(_c,{id:F.id,checked:W,onCheckedChange:K=>k(T.id,F.id,K)}),r.jsx(Qe,{htmlFor:F.id,className:"cursor-pointer",children:F.option_text})]},F.id)})}),r.jsx(te,{size:"sm",onClick:()=>C(T.id),disabled:A,children:A?"Submitting...":I?"Update Response":"Submit"})]},T.id)})]})}),r.jsxs("div",{className:"p-4 border-t bg-muted/30 flex justify-between items-center",children:[r.jsx(te,{variant:"ghost",size:"sm",onClick:s,children:"Don't show again"}),r.jsx(te,{onClick:n,children:"Got it!"})]})]})})},Kdt=()=>{const{user:t}=Fr(),[e,n]=P.useState(null),[s,i]=P.useState(!1),[o,c]=P.useState(!0),[a,f]=P.useState(!1),m=P.useCallback(async()=>{if(!t){c(!1);return}try{const{data:C,error:S}=await ee.from("levelup_briefs").select("*").eq("is_published",!0).lte("publish_date",new Date().toISOString()).order("publish_date",{ascending:!1}).limit(1).single();if(S||!C){c(!1);return}const{data:T}=await ee.from("levelup_brief_views").select("*").eq("brief_id",C.id).eq("user_id",t.id).maybeSingle(),[I,A]=await Promise.all([ee.from("levelup_brief_links").select("*").eq("brief_id",C.id).order("sort_order"),ee.from("levelup_brief_polls").select("*").eq("brief_id",C.id).order("sort_order")]),D=[];if(A.data)for(const W of A.data){const{data:K}=await ee.from("levelup_brief_poll_options").select("*").eq("poll_id",W.id).order("sort_order");D.push({...W,options:K||[]})}const $={brief:C,links:I.data||[],polls:D};n($);const F=!!T,q=(T==null?void 0:T.dismissed_at)!==null;if(!F)i(!0),f(!0);else if(C.show_frequency==="every_login"&&!q)i(!0),f(!0);else if(C.show_frequency==="daily"){const W=new Date(T.viewed_at);(new Date().getTime()-W.getTime())/(1e3*60*60)>=24&&!q&&(i(!0),f(!0))}else f(!q)}catch(C){console.error("Error fetching brief:",C)}finally{c(!1)}},[t]);P.useEffect(()=>{m()},[m]);const y=async()=>{if(!(!t||!e))try{const{data:C}=await ee.from("levelup_brief_views").select("id").eq("brief_id",e.brief.id).eq("user_id",t.id).maybeSingle();C?await ee.from("levelup_brief_views").update({viewed_at:new Date().toISOString()}).eq("id",C.id):await ee.from("levelup_brief_views").insert({brief_id:e.brief.id,user_id:t.id})}catch(C){console.error("Error marking brief as viewed:",C)}};return{currentBrief:e,shouldShowPopup:s,hasUnseenBrief:a,loading:o,openBrief:()=>{i(!0)},closeBrief:()=>{i(!1),y()},dismissBrief:async()=>{if(!(!t||!e))try{const{data:C}=await ee.from("levelup_brief_views").select("id").eq("brief_id",e.brief.id).eq("user_id",t.id).maybeSingle();C?await ee.from("levelup_brief_views").update({dismissed_at:new Date().toISOString()}).eq("id",C.id):await ee.from("levelup_brief_views").insert({brief_id:e.brief.id,user_id:t.id,dismissed_at:new Date().toISOString()}),i(!1),f(!1)}catch(C){console.error("Error dismissing brief:",C)}},refetch:m}};function Zdt(){const[t,e]=P.useState(!1),[n,s]=P.useState(!1),[i,o]=P.useState(null);P.useEffect(()=>{if(localStorage.getItem("install-banner-dismissed")||window.matchMedia("(display-mode: standalone)").matches||!/iPhone|iPad|iPod|Android/i.test(navigator.userAgent))return;const v=/iPhone|iPad|iPod/i.test(navigator.userAgent);s(v),e(!0);const w=k=>{k.preventDefault(),o(k)};return window.addEventListener("beforeinstallprompt",w),()=>{window.removeEventListener("beforeinstallprompt",w)}},[]);const c=()=>{localStorage.setItem("install-banner-dismissed","true"),e(!1)},a=async()=>{if(i){await i.prompt();const{outcome:f}=await i.userChoice;f==="accepted"&&c(),o(null)}};return t?r.jsx("div",{className:"fixed bottom-0 left-0 right-0 z-50 p-4 bg-primary text-primary-foreground shadow-lg animate-in slide-in-from-bottom duration-300",children:r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[r.jsx("div",{className:"flex-shrink-0 p-2 bg-primary-foreground/10 rounded-full",children:r.jsx(Mo,{className:"h-5 w-5"})}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("p",{className:"font-medium text-sm",children:"Add LevelUp to your home screen"}),n?r.jsxs("p",{className:"text-xs opacity-80 flex items-center gap-1",children:["Tap ",r.jsx(wT,{className:"h-3 w-3 inline"}),' then "Add to Home Screen"']}):r.jsx("p",{className:"text-xs opacity-80",children:"Quick access anytime"})]})]}),r.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[!n&&i&&r.jsx(te,{size:"sm",variant:"secondary",onClick:a,className:"text-xs",children:"Install"}),r.jsx("button",{onClick:c,className:"p-1.5 hover:bg-primary-foreground/10 rounded-full transition-colors","aria-label":"Dismiss",children:r.jsx(Ms,{className:"h-4 w-4"})})]})]})}):null}const Ydt=({children:t,onRefresh:e})=>{const[n,s]=P.useState(!1),[i,o]=P.useState(0),[c,a]=P.useState(!1),f=P.useRef(null),m=P.useRef(0),y=Xr(),v=80,w=120,k=P.useCallback(A=>{const D=f.current;D&&D.scrollTop<=0&&(m.current=A.touches[0].clientY,s(!0))},[]),C=P.useCallback(A=>{if(!n||c)return;const D=f.current;if(!D||D.scrollTop>0){s(!1),o(0);return}const F=A.touches[0].clientY-m.current;if(F>0){const W=Math.min(F*.5,w);o(W),W>10&&A.preventDefault()}},[n,c]),S=P.useCallback(async()=>{if(n)if(s(!1),i>=v&&!c){a(!0),o(v);try{e?await e():await y.invalidateQueries()}catch(A){console.error("Refresh failed:",A)}finally{a(!1),o(0)}}else o(0)},[n,i,c,e,y]),T=Math.min(i/v,1),I=T*180;return r.jsxs("div",{ref:f,className:"h-full overflow-auto",onTouchStart:k,onTouchMove:C,onTouchEnd:S,children:[r.jsx("div",{className:"flex justify-center items-center overflow-hidden transition-all duration-200 ease-out",style:{height:i>0?i:0,opacity:T},children:r.jsx("div",{className:`p-2 rounded-full bg-primary/10 ${c?"animate-spin":""}`,style:{transform:c?void 0:`rotate(${I}deg)`,transition:c?void 0:"transform 0.1s ease-out"},children:r.jsx(Dl,{className:"h-5 w-5 text-primary"})})}),r.jsx("div",{style:{transform:i>0?`translateY(${Math.max(0,i-60)}px)`:void 0,transition:n?void 0:"transform 0.2s ease-out"},children:t})]})},EOe=()=>{const{user:t}=Fr(),[e,n]=P.useState(!1),[s,i]=P.useState(!1),[o,c]=P.useState(0),[a,f]=P.useState(!0);P.useEffect(()=>{(async()=>{if(!t){f(!1);return}try{const{data:k}=await ee.from("membership_reviews").select("id").eq("user_id",t.id).maybeSingle();if(k){i(!0),n(!1),f(!1);return}const{data:C}=await ee.from("profiles").select("login_count").eq("id",t.id).single(),S=(C==null?void 0:C.login_count)||0;c(S);const T=sessionStorage.getItem("review-prompt-dismissed");n(S>=4&&!T)}catch(k){console.error("Error checking review eligibility:",k)}finally{f(!1)}})()},[t]);const m=P.useCallback(()=>{sessionStorage.setItem("review-prompt-dismissed","true"),n(!1)},[]),y=P.useCallback(async(w,k)=>{if(!t)return{success:!1,error:"Not authenticated"};try{const{error:C}=await ee.from("membership_reviews").insert({user_id:t.id,rating:w,review_text:k});if(C)throw C;const{data:S,error:T}=await ee.from("agent_attendance_stats").select("total_points, spendable_points").eq("user_id",t.id).maybeSingle();T&&console.error("Error fetching current stats:",T);const I=(S==null?void 0:S.spendable_points)||0,A=(S==null?void 0:S.total_points)||0,D=I+25,$=A+25,{error:F}=await ee.from("agent_attendance_stats").upsert({user_id:t.id,total_points:$,spendable_points:D,updated_at:new Date().toISOString()},{onConflict:"user_id"});F&&console.error("Error upserting attendance stats:",F);const{error:q}=await ee.from("agent_points").insert({user_id:t.id,points:25,reason:"Left a membership review"});return q&&console.error("Error logging points:",q),i(!0),n(!1),{success:!0,pointsAwarded:25}}catch(C){return console.error("Error submitting review:",C),{success:!1,error:C.message}}},[t]),v=P.useCallback(async()=>{if(t)try{await ee.from("membership_reviews").update({posted_to_google:!0}).eq("user_id",t.id)}catch(w){console.error("Error updating Google review status:",w)}},[t]);return{shouldShowPrompt:e,hasSubmittedReview:s,loginCount:o,isLoading:a,dismissPrompt:m,submitReview:y,markPostedToGoogle:v}},Xdt="https://search.google.com/local/writereview?placeid=ChIJM73ERQD1QogRPxupMFObuck&source=g.page.m.ia._&laa=nmx-review-solicitation-ia2",Qdt=()=>{const{shouldShowPrompt:t,isLoading:e,dismissPrompt:n,submitReview:s,markPostedToGoogle:i}=EOe(),[o,c]=P.useState(!1),[a,f]=P.useState("review"),[m,y]=P.useState(0),[v,w]=P.useState(0),[k,C]=P.useState(""),[S,T]=P.useState(!1),[I,A]=P.useState(!1);if(e||!t&&!I)return null;const D=async()=>{if(m===0){Wi({title:"Please select a rating",variant:"destructive"});return}T(!0);const q=await s(m,k);T(!1),q.success?(A(!0),Wi({title:"Thank you for your feedback!",description:"Your review helps us improve."}),f("google")):Wi({title:"Error submitting review",description:q.error,variant:"destructive"})},$=async q=>{q&&(await navigator.clipboard.writeText(k||`${m} star rating for LevelUp!`),Wi({title:"Review copied!",description:"Paste it on Google Reviews."}),await i(),window.open(Xdt,"_blank")),c(!1),n()},F=()=>{c(!1),n()};return r.jsxs(r.Fragment,{children:[r.jsxs("button",{onClick:()=>c(!0),className:"fixed bottom-20 left-1/2 -translate-x-1/2 z-40 flex items-center gap-2 rounded-full bg-primary/90 px-3 py-2 text-xs text-primary-foreground shadow-lg backdrop-blur-sm transition-all hover:bg-primary hover:scale-105 md:bottom-6",children:[r.jsx(Ca,{className:"h-3.5 w-3.5 fill-current"}),r.jsx("span",{className:"hidden sm:inline",children:"Leave a Review"})]}),r.jsx($r,{open:o,onOpenChange:F,children:r.jsx(zr,{className:"sm:max-w-md",children:a==="review"?r.jsxs(r.Fragment,{children:[r.jsxs(Zr,{children:[r.jsx(Kr,{className:"text-center",children:"How are you enjoying LevelUp?"}),r.jsx(ls,{className:"text-center",children:"Your feedback helps us improve the experience for all members."})]}),r.jsxs("div",{className:"space-y-6 py-4",children:[r.jsx("div",{className:"flex justify-center gap-1",children:[1,2,3,4,5].map(q=>r.jsx("button",{type:"button",onClick:()=>y(q),onMouseEnter:()=>w(q),onMouseLeave:()=>w(0),className:"p-1 transition-transform hover:scale-110",children:r.jsx(Ca,{className:zt("h-8 w-8 transition-colors",(v||m)>=q?"fill-yellow-400 text-yellow-400":"text-muted-foreground")})},q))}),r.jsx(ps,{placeholder:"Tell us about your experience (optional)",value:k,onChange:q=>C(q.target.value),rows:4,className:"resize-none"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(te,{variant:"outline",onClick:F,className:"flex-1",children:"Maybe Later"}),r.jsx(te,{onClick:D,disabled:S||m===0,className:"flex-1",children:S?"Submitting...":"Submit Review"})]})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs(Zr,{children:[r.jsx(Kr,{className:"text-center",children:"🎉 Thank you!"}),r.jsx(ls,{className:"text-center",children:"Would you mind sharing your review on Google? It really helps other agents discover LevelUp!"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsx("p",{className:"text-center text-sm text-muted-foreground",children:"We'll copy your review so you can easily paste it."}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(te,{variant:"outline",onClick:()=>$(!1),className:"flex-1",children:"No Thanks"}),r.jsx(te,{onClick:()=>$(!0),className:"flex-1",children:"Yes, Open Google"})]})]})]})})})]})};function Jdt(t){const e="=".repeat((4-t.length%4)%4),n=(t+e).replace(/-/g,"+").replace(/_/g,"/"),s=window.atob(n),i=new Uint8Array(s.length);for(let o=0;o{if(!v){c(!1);return}(async()=>{try{const{data:S,error:T}=await ee.functions.invoke("get-vapid-public-key",{body:{}});if(T)throw T;const I=S==null?void 0:S.vapidPublicKey;if(!I)throw new Error("Missing VAPID public key");y(I);const A=await navigator.serviceWorker.register("/push-sw.js");f(A),n(Notification.permission);const D=await A.pushManager.getSubscription();i(!!D)}catch(S){console.error("Error initializing push notifications:",S)}finally{c(!1)}})()},[v]);const w=P.useCallback(async()=>{if(!v||!a||!t)return console.error("Push notifications not supported or user not logged in"),!1;if(!m)return Ge.error("Push notifications are not ready yet. Please try again in a moment."),!1;try{c(!0);const C=await a.pushManager.getSubscription();if(C){try{await C.unsubscribe()}catch($){console.warn("Failed to unsubscribe existing push subscription:",$)}const{error:D}=await ee.from("push_subscriptions").delete().eq("user_id",t.id);D&&console.warn("Failed to cleanup push_subscriptions rows:",D)}if(Notification.permission!=="granted"){const D=await Notification.requestPermission();if(n(D),D!=="granted")return D==="denied"?Ge.error("Notifications blocked. Please enable them in your browser settings (click the lock icon in the address bar)."):Ge.error("Notification permission was dismissed. Please try again."),!1}const S=Jdt(m);let T;try{T=await a.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:S})}catch(D){console.error("PushManager.subscribe() failed:",D);const $=(D==null?void 0:D.message)||String(D);return $.includes("permission")?Ge.error("Push permission denied. Check your browser notification settings."):$.includes("key")||$.includes("VAPID")?Ge.error("Push configuration error. Please contact support."):$.includes("AbortError")?Ge.error("Push subscription was cancelled. Please try again."):Ge.error(`Failed to subscribe: ${$}`),!1}const I=T.toJSON(),{error:A}=await ee.from("push_subscriptions").upsert({user_id:t.id,endpoint:I.endpoint,p256dh_key:I.keys.p256dh,auth_key:I.keys.auth},{onConflict:"user_id,endpoint"});if(A)throw console.error("Error saving subscription:",A),Ge.error("Failed to save notification preferences. Please try again."),A;return i(!0),Ge.success("Push notifications enabled!"),!0}catch(C){if(console.error("Error subscribing to push notifications:",C),!(C instanceof Error&&C.message.includes("toast"))){const S=C instanceof Error?C.message:"Unknown error";Ge.error("Failed to enable push notifications: "+S)}return!1}finally{c(!1)}},[v,a,t,m]),k=P.useCallback(async()=>{if(!a||!t)return!1;try{c(!0);const C=await a.pushManager.getSubscription();return C&&await C.unsubscribe(),await ee.from("push_subscriptions").delete().eq("user_id",t.id),i(!1),Ge.success("Push notifications disabled"),!0}catch(C){console.error("Error unsubscribing:",C);const S=C instanceof Error?C.message:"Unknown error";return Ge.error("Failed to disable push notifications: "+S),!1}finally{c(!1)}},[a,t]);return{isSupported:v,permission:e,isSubscribed:s,isLoading:o,vapidPublicKey:m,subscribe:w,unsubscribe:k}}const Zje="push_notification_prompt_dismissed",eut=()=>{const{user:t}=Fr(),{isSupported:e,isSubscribed:n,isLoading:s,subscribe:i}=IOe(),[o,c]=P.useState(!1),[a,f]=P.useState(!1);P.useEffect(()=>{if(!t||!e||n||s||localStorage.getItem(`${Zje}_${t.id}`))return;const w=setTimeout(()=>{c(!0)},2e3);return()=>clearTimeout(w)},[t,e,n,s]);const m=async()=>{f(!0);const v=await i();f(!1),v&&c(!1)},y=()=>{t&&localStorage.setItem(`${Zje}_${t.id}`,"true"),c(!1)};return!e||n?null:r.jsx($r,{open:o,onOpenChange:v=>!v&&y(),children:r.jsxs(zr,{className:"sm:max-w-md",children:[r.jsxs(Zr,{children:[r.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-primary/10",children:r.jsx(ag,{className:"h-6 w-6 text-primary"})}),r.jsx(Kr,{className:"text-center",children:"Stay in the Loop!"}),r.jsx(ls,{className:"text-center",children:"Enable push notifications to get alerted when:"})]}),r.jsxs("ul",{className:"my-4 space-y-2 text-sm text-muted-foreground",children:[r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"•"})," New events go live"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"•"})," Fresh templates are added"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"•"})," New toolbox resources drop"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"•"})," Social swag updates"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"•"})," New newsletters arrive"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"•"})," Posts in your community groups"]})]}),r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsx(te,{onClick:m,disabled:a,className:"w-full",children:a?"Enabling...":"Enable Notifications"}),r.jsx(te,{variant:"ghost",onClick:y,className:"w-full",children:"Not Now"})]}),r.jsx("p",{className:"text-center text-xs text-muted-foreground",children:"You can always change this in your Profile settings."})]})})},Yje=t=>{let e;const n=new Set,s=(m,y)=>{const v=typeof m=="function"?m(e):m;if(!Object.is(v,e)){const w=e;e=y??(typeof v!="object"||v===null)?v:Object.assign({},e,v),n.forEach(k=>k(e,w))}},i=()=>e,a={setState:s,getState:i,getInitialState:()=>f,subscribe:m=>(n.add(m),()=>n.delete(m))},f=e=t(s,i,a);return a},tut=t=>t?Yje(t):Yje,rut=t=>t;function nut(t,e=rut){const n=lt.useSyncExternalStore(t.subscribe,lt.useCallback(()=>e(t.getState()),[t,e]),lt.useCallback(()=>e(t.getInitialState()),[t,e]));return lt.useDebugValue(n),n}const sut=t=>{const e=tut(t),n=s=>nut(e,s);return Object.assign(n,e),n},iut=t=>sut;function aut(t,e){let n;try{n=t()}catch{return}return{getItem:i=>{var o;const c=f=>f===null?null:JSON.parse(f,void 0),a=(o=n.getItem(i))!=null?o:null;return a instanceof Promise?a.then(c):c(a)},setItem:(i,o)=>n.setItem(i,JSON.stringify(o,void 0)),removeItem:i=>n.removeItem(i)}}const fhe=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(s){return fhe(s)(n)},catch(s){return this}}}catch(n){return{then(s){return this},catch(s){return fhe(s)(n)}}}},out=(t,e)=>(n,s,i)=>{let o={storage:aut(()=>localStorage),partialize:S=>S,version:0,merge:(S,T)=>({...T,...S}),...e},c=!1;const a=new Set,f=new Set;let m=o.storage;if(!m)return t((...S)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),n(...S)},s,i);const y=()=>{const S=o.partialize({...s()});return m.setItem(o.name,{state:S,version:o.version})},v=i.setState;i.setState=(S,T)=>(v(S,T),y());const w=t((...S)=>(n(...S),y()),s,i);i.getInitialState=()=>w;let k;const C=()=>{var S,T;if(!m)return;c=!1,a.forEach(A=>{var D;return A((D=s())!=null?D:w)});const I=((T=o.onRehydrateStorage)==null?void 0:T.call(o,(S=s())!=null?S:w))||void 0;return fhe(m.getItem.bind(m))(o.name).then(A=>{if(A)if(typeof A.version=="number"&&A.version!==o.version){if(o.migrate){const D=o.migrate(A.state,A.version);return D instanceof Promise?D.then($=>[!0,$]):[!0,D]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,A.state];return[!1,void 0]}).then(A=>{var D;const[$,F]=A;if(k=o.merge(F,(D=s())!=null?D:w),n(k,!0),$)return y()}).then(()=>{I==null||I(k,void 0),k=s(),c=!0,f.forEach(A=>A(k))}).catch(A=>{I==null||I(void 0,A)})};return i.persist={setOptions:S=>{o={...o,...S},S.storage&&(m=S.storage)},clearStorage:()=>{m==null||m.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>C(),hasHydrated:()=>c,onHydrate:S=>(a.add(S),()=>{a.delete(S)}),onFinishHydration:S=>(f.add(S),()=>{f.delete(S)})},o.skipHydration||C(),k||w},lut=out,dse=iut()(lut((t,e)=>({cartItems:[],addToCart:(n,s,i=1,o)=>{t(c=>{const a=c.cartItems.findIndex(f=>{var m;return f.product.id===n.id&&((m=f.variant)==null?void 0:m.id)===(s==null?void 0:s.id)});if(a>=0){const f=[...c.cartItems];return f[a].quantity+=i,o&&(f[a].artworkUrl=o),{cartItems:f}}return{cartItems:[...c.cartItems,{product:n,variant:s,quantity:i,artworkUrl:o}]}})},removeFromCart:(n,s)=>{t(i=>({cartItems:i.cartItems.filter(o=>{var c;return!(o.product.id===n&&((c=o.variant)==null?void 0:c.id)===s)})}))},updateQuantity:(n,s,i)=>{t(o=>({cartItems:o.cartItems.map(c=>{var a;return c.product.id===n&&((a=c.variant)==null?void 0:a.id)===s?{...c,quantity:Math.max(1,i)}:c})}))},updateArtwork:(n,s,i)=>{t(o=>({cartItems:o.cartItems.map(c=>{var a;return c.product.id===n&&((a=c.variant)==null?void 0:a.id)===s?{...c,artworkUrl:i}:c})}))},clearCart:()=>t({cartItems:[]}),getItemPrice:n=>{const s=Number(n.product.base_price),i=n.variant?Number(n.variant.price_adjustment):0;return s+i},getSubtotal:()=>{const{cartItems:n,getItemPrice:s}=e();return n.reduce((i,o)=>i+s(o)*o.quantity,0)},getShippingTotal:()=>{const{cartItems:n}=e();return n.reduce((s,i)=>s+Number(i.product.shipping_fee)*i.quantity,0)},getTotal:()=>{const{getSubtotal:n,getShippingTotal:s}=e();return n()+s()}}),{name:"marketplace-cart",partialize:t=>({cartItems:t.cartItems})})),POe=P.createContext({onlineUsers:[],totalOnline:0}),cut=async t=>{try{const{data:e}=await ee.storage.from("avatars").list(`${t}`);if(e&&e.length>0){const{data:n}=ee.storage.from("avatars").getPublicUrl(`${t}/${e[0].name}`);return n.publicUrl}}catch{}},dut=({children:t})=>{const{user:e,brokerageId:n,isAdmin:s}=Fr(),[i,o]=P.useState([]),[c,a]=P.useState(null);P.useEffect(()=>{if(!e)return;const m=ee.channel("app-presence",{config:{presence:{key:e.id}}});return m.on("presence",{event:"sync"},()=>{const y=m.presenceState(),v=[];Object.entries(y).forEach(([w,k])=>{if(k&&k.length>0){const C=k[0];v.push({id:w,name:C.name||"Unknown",avatarUrl:C.avatarUrl,brokerageId:C.brokerageId,onlineSince:C.onlineSince})}}),o(v)}).on("presence",{event:"join"},()=>{}).on("presence",{event:"leave"},()=>{}).subscribe(async y=>{var v;if(y==="SUBSCRIBED"){const{data:w}=await ee.from("profiles").select("name, brokerage_id").eq("id",e.id).single(),k=await cut(e.id);await m.track({name:(w==null?void 0:w.name)||((v=e.email)==null?void 0:v.split("@")[0])||"User",avatarUrl:k,brokerageId:w==null?void 0:w.brokerage_id,onlineSince:new Date().toISOString()})}}),a(m),()=>{m.unsubscribe()}},[e]);const f=i.filter(m=>m.id===(e==null?void 0:e.id)?!1:!!(s||n&&m.brokerageId===n||!n&&!m.brokerageId));return r.jsx(POe.Provider,{value:{onlineUsers:f,totalOnline:i.length},children:t})},LOe=()=>P.useContext(POe),Xje="dashboard-sidebar-collapsed",Or=({children:t,title:e})=>{var ve,Ie,Se;const{user:n,signOut:s,isAdmin:i,isBrokerageManager:o,brokerageId:c}=Fr(),{avatarUrl:a}=mge(n==null?void 0:n.id),{isTrial:f,isExpired:m,expiresAt:y}=fit(n==null?void 0:n.id),{isMarketplaceEnabled:v}=KPe(),{currentBrief:w,shouldShowPopup:k,hasUnseenBrief:C,openBrief:S,closeBrief:T,dismissBrief:I}=Kdt(),{unreadCount:A}=pit(),{openCount:D}=mit(),F=dse(oe=>oe.cartItems).reduce((oe,ae)=>oe+ae.quantity,0),q=es(),W=Cg(),[K,Z]=P.useState(()=>typeof window<"u"?localStorage.getItem(Xje)==="true":!1);P.useEffect(()=>{localStorage.setItem(Xje,String(K))},[K]);const[re,he]=P.useState({agentos:!0,tools:!0,marketing:!0,learning:!0,community:!0,help:!1}),ue=oe=>{he(ae=>({...ae,[oe]:!ae[oe]}))},Ne=oe=>oe.split(" ").map(ae=>ae[0]).join("").toUpperCase().slice(0,2),se=oe=>W.pathname===oe,xe=oe=>oe.some(ae=>W.pathname===ae),ie=({path:oe,icon:ae,label:je,badgeCount:Me})=>{const Ue=r.jsxs(te,{variant:"ghost",size:"sm",className:zt("text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground relative",se(oe)&&"bg-sidebar-accent text-sidebar-accent-foreground",K?"w-10 h-10 p-0 justify-center":"w-full justify-start gap-2"),onClick:()=>q(oe),children:[r.jsxs("div",{className:"relative",children:[r.jsx(ae,{className:"h-4 w-4 shrink-0"}),K&&Me!=null&&Me>0&&r.jsx("span",{className:"absolute -top-1 -right-1 h-2 w-2 rounded-full bg-destructive"})]}),!K&&je,!K&&Me!=null&&Me>0&&r.jsx("span",{className:"ml-auto flex h-5 w-5 items-center justify-center rounded-full bg-destructive text-destructive-foreground text-xs",children:Me>9?"9+":Me})]});return K?r.jsxs(fg,{delayDuration:0,children:[r.jsx(pg,{asChild:!0,children:Ue}),r.jsxs(am,{side:"right",className:"flex items-center gap-2",children:[je,Me!=null&&Me>0&&r.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-destructive text-destructive-foreground text-xs",children:Me>9?"9+":Me})]})]}):Ue},me=({id:oe,label:ae,icon:je,children:Me,activePaths:Ue,showBetaBadge:Re,defaultPath:$e,badgeCount:Pe})=>{if(K){const Ae=$e||Ue[0];return r.jsxs(fg,{delayDuration:0,children:[r.jsx(pg,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"sm",className:zt("w-10 h-10 p-0 justify-center text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground relative",xe(Ue)&&"text-primary"),onClick:()=>q(Ae),children:r.jsxs("div",{className:"relative",children:[r.jsx(je,{className:"h-4 w-4"}),Pe!=null&&Pe>0&&r.jsx("span",{className:"absolute -top-1 -right-1 h-2 w-2 rounded-full bg-destructive"})]})})}),r.jsxs(am,{side:"right",className:"flex items-center gap-2",children:[ae,Re&&r.jsx("span",{className:"text-[9px] font-bold uppercase tracking-wide px-1 py-0.5 rounded border border-amber-500 text-amber-600",children:"Beta"}),Pe!=null&&Pe>0&&r.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-destructive text-destructive-foreground text-xs",children:Pe>9?"9+":Pe})]})]})}return r.jsxs(RT,{open:re[oe],onOpenChange:()=>ue(oe),children:[r.jsx(FT,{asChild:!0,children:r.jsxs(te,{variant:"ghost",size:"sm",className:zt("w-full justify-between gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",xe(Ue)&&"text-primary"),children:[r.jsxs("span",{className:"flex items-center gap-2 font-semibold text-[15px]",children:[r.jsx(je,{className:"h-4 w-4"}),ae,Re&&r.jsx("span",{className:"text-[9px] font-bold uppercase tracking-wide px-1 py-0.5 rounded border border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10",children:"Beta"})]}),r.jsxs("span",{className:"flex items-center gap-1",children:[Pe!=null&&Pe>0&&r.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-destructive text-destructive-foreground text-xs",children:Pe>9?"9+":Pe}),r.jsx(uh,{className:zt("h-4 w-4 transition-transform duration-200",re[oe]&&"rotate-180")})]})]})}),r.jsx(zT,{className:"pl-4 space-y-1 mt-1",children:Me})]})},fe=({isMobile:oe=!1})=>{const ae=oe?!1:K;return r.jsxs("div",{className:"flex flex-col h-full",children:[r.jsxs("div",{className:zt("p-3 border-b border-sidebar-border",ae?"flex flex-col items-center gap-2":"flex items-center justify-between"),children:[ae?r.jsx("img",{src:_ot,alt:"LevelUp",className:"h-8 w-auto"}):r.jsx("img",{src:kje,alt:"LevelUp",className:"h-8 w-auto"}),!oe&&r.jsxs(fg,{delayDuration:0,children:[r.jsx(pg,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0",onClick:()=>Z(!ae),children:r.jsx(sd,{className:zt("h-4 w-4 transition-transform duration-300",ae&&"rotate-180")})})}),r.jsx(am,{side:"right",children:ae?"Expand sidebar":"Collapse sidebar"})]})]}),r.jsx(xl,{className:"flex-1",children:r.jsxs("nav",{className:zt("p-3 space-y-1",ae&&"flex flex-col items-center"),children:[r.jsx(ie,{path:"/dashboard",icon:$S,label:"Dashboard"}),r.jsx(ie,{path:"/events",icon:em,label:"Events"}),r.jsxs(me,{id:"agentos",label:"Agent OS",icon:PS,activePaths:["/innercircle","/innercircle/contacts","/innercircle/plans","/innercircle/popbys","/innercircle/video-library","/innercircle/scorecard","/innercircle/listings","/innercircle/pipeline"],showBetaBadge:!0,defaultPath:"/innercircle",children:[r.jsx(ie,{path:"/innercircle",icon:ql,label:"InnerCircle"}),r.jsx(ie,{path:"/innercircle/contacts",icon:hs,label:"Contacts"}),r.jsx(ie,{path:"/innercircle/plans",icon:em,label:"TouchPlans"}),r.jsx(ie,{path:"/innercircle/pipeline",icon:G0,label:"Deal Pipeline"}),r.jsx(ie,{path:"/innercircle/popbys",icon:Qa,label:"Popbys"}),r.jsx(ie,{path:"/innercircle/video-library",icon:Gi,label:"Video Library"}),r.jsx(ie,{path:"/innercircle/scorecard",icon:xc,label:"Scorecard"}),r.jsx(ie,{path:"/innercircle/listings",icon:ra,label:"Listing Exchange"})]}),r.jsx(me,{id:"tools",label:"Tools",icon:Th,activePaths:["/apps","/ai-toolkit"],defaultPath:"/apps",children:r.jsx(ie,{path:"/apps",icon:Th,label:"Apps & Tools"})}),r.jsxs(me,{id:"marketing",label:"Marketing",icon:nm,activePaths:["/templates","/social-swag-2","/newsletters","/listing-swag"],defaultPath:"/templates",children:[r.jsx(ie,{path:"/templates",icon:Gd,label:"Templates"}),!ae&&r.jsxs(te,{variant:"ghost",size:"sm",className:zt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",se("/social-swag-2")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>q("/social-swag-2"),children:[r.jsx(Q0,{className:"h-4 w-4"}),"Social Swag",r.jsx("span",{className:"ml-auto text-[9px] font-bold uppercase tracking-wide px-1.5 py-0.5 rounded-full bg-destructive text-destructive-foreground",children:"New"})]}),ae&&r.jsx(ie,{path:"/social-swag-2",icon:Q0,label:"Social Swag"}),r.jsx(ie,{path:"/newsletters",icon:Ay,label:"Newsletters"}),i&&!ae&&r.jsxs(te,{variant:"ghost",size:"sm",className:zt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",se("/listing-swag")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>q("/listing-swag"),children:[r.jsx(Wo,{className:"h-4 w-4"}),"Listing Swag",r.jsx("span",{className:"ml-auto text-[9px] font-bold uppercase tracking-wide px-1.5 py-0.5 rounded-full bg-amber-500 text-white",children:"Beta"})]}),i&&ae&&r.jsx(ie,{path:"/listing-swag",icon:Wo,label:"Listing Swag"})]}),r.jsxs(me,{id:"learning",label:"Learning",icon:iT,activePaths:["/academy","/toolbox"],defaultPath:"/academy",children:[r.jsx(ie,{path:"/academy",icon:W0,label:"Academy"}),r.jsx(ie,{path:"/toolbox",icon:Iy,label:"Toolbox"})]}),r.jsxs(me,{id:"community",label:"Community",icon:Wl,activePaths:["/community","/wishlist"],defaultPath:"/community",badgeCount:A,children:[r.jsx(ie,{path:"/community",icon:hs,label:"Community",badgeCount:A}),r.jsx(ie,{path:"/wishlist",icon:K0,label:"Wishlist",badgeCount:D}),!ae&&r.jsxs(te,{variant:"ghost",size:"sm",className:"w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",onClick:()=>window.open("https://www.facebook.com/share/g/1CC6thti2V/","_blank"),children:[r.jsx(Fs,{className:"h-4 w-4"}),"Facebook Group"]})]}),r.jsxs(me,{id:"goods",label:"The Goods",icon:sh,activePaths:["/marketplace","/reward-store"],defaultPath:"/reward-store",children:[v&&!ae&&r.jsxs(te,{variant:"ghost",size:"sm",className:zt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",W.pathname.startsWith("/marketplace")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>q("/marketplace"),children:[r.jsx(sh,{className:"h-4 w-4"}),"Marketplace",r.jsx("span",{className:"ml-auto text-[9px] font-bold uppercase tracking-wide px-1.5 py-0.5 rounded-full bg-primary text-primary-foreground",children:"New"})]}),v&&ae&&r.jsx(ie,{path:"/marketplace",icon:sh,label:"Marketplace"}),r.jsx(ie,{path:"/reward-store",icon:qa,label:"Reward Store"})]}),r.jsxs(me,{id:"help",label:"Help & Services",icon:my,activePaths:["/support","/additional-services"],defaultPath:"/support",children:[r.jsx(ie,{path:"/support",icon:qS,label:"Support"}),r.jsx(ie,{path:"/additional-services",icon:Mi,label:"Additional Services"})]}),i&&r.jsxs(r.Fragment,{children:[!ae&&r.jsx("div",{className:"pt-3 pb-1",children:r.jsx("p",{className:"px-2 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Admin"})}),ae?r.jsx("div",{className:"pt-3 border-t border-sidebar-border mt-3",children:r.jsx(ie,{path:"/admin",icon:Ff,label:"Admin Dashboard"})}):r.jsxs(te,{variant:"ghost",size:"sm",className:zt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",W.pathname.startsWith("/admin")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>q("/admin"),children:[r.jsx(Ff,{className:"h-4 w-4"}),"Admin Dashboard"]})]}),(c||o)&&!i&&r.jsxs(r.Fragment,{children:[!ae&&r.jsx("div",{className:"pt-3 pb-1",children:r.jsx("p",{className:"px-2 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"My Brokerage"})}),ae?r.jsxs("div",{className:"border-t border-sidebar-border mt-3 pt-3 space-y-1",children:[c&&r.jsx(ie,{path:"/my-brokerage",icon:ra,label:"My Brokerage"}),o&&r.jsxs(r.Fragment,{children:[r.jsx(ie,{path:"/brokerage/dashboard",icon:id,label:"Manage Brokerages"}),r.jsx(ie,{path:"/brokerage-resources",icon:dh,label:"Brokerage Resources"})]})]}):r.jsxs(r.Fragment,{children:[c&&r.jsxs(te,{variant:"ghost",size:"sm",className:zt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",se("/my-brokerage")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>q("/my-brokerage"),children:[r.jsx(ra,{className:"h-4 w-4"}),"My Brokerage"]}),o&&r.jsxs(r.Fragment,{children:[r.jsxs(te,{variant:"ghost",size:"sm",className:zt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",se("/brokerage/dashboard")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>q("/brokerage/dashboard"),children:[r.jsx(id,{className:"h-4 w-4"}),"Manage Brokerages"]}),r.jsxs(te,{variant:"ghost",size:"sm",className:zt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",se("/brokerage-resources")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>q("/brokerage-resources"),children:[r.jsx(dh,{className:"h-4 w-4"}),"Brokerage Resources"]})]})]})]})]})}),r.jsxs("div",{className:"p-3 border-t border-sidebar-border md:hidden",children:[r.jsxs(te,{variant:"ghost",size:"sm",className:zt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",se("/profile")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>q("/profile"),children:[r.jsx(jc,{className:"h-4 w-4"}),"Profile"]}),r.jsxs(te,{variant:"ghost",size:"sm",className:"w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",onClick:s,children:[r.jsx(WS,{className:"h-4 w-4"}),"Sign Out"]})]})]})};return r.jsx(dut,{children:r.jsx(KE,{children:r.jsxs("div",{className:"min-h-screen bg-background flex",children:[f&&m&&r.jsx(Edt,{}),r.jsx("aside",{className:zt("hidden md:flex flex-col bg-card border-r border-border fixed h-screen z-[60] pointer-events-auto transition-[width] duration-300",K?"w-16":"w-52"),children:r.jsx(fe,{})}),r.jsxs("div",{className:zt("flex-1 flex flex-col h-screen overflow-hidden transition-all duration-300",K?"md:ml-16":"md:ml-52"),children:[r.jsx("header",{className:"sticky top-0 z-40 bg-card border-b border-border flex-shrink-0",children:r.jsxs("div",{className:"flex items-center justify-between px-6 py-3",children:[r.jsxs(qne,{children:[r.jsx(yge,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",className:"md:hidden",children:r.jsx(mT,{className:"h-5 w-5"})})}),r.jsx(tI,{side:"left",className:"w-52 p-0 bg-card",children:r.jsx(fe,{isMobile:!0})})]}),r.jsx("div",{className:"flex-1 md:hidden",children:r.jsx("img",{src:kje,alt:"LevelUp",className:"h-8 w-auto"})}),r.jsx("div",{className:"hidden md:flex flex-1 justify-center",children:r.jsx(Kje,{})}),r.jsxs("div",{className:"flex items-center gap-3 ml-auto",children:[f&&!m&&y&&r.jsx(Adt,{expiresAt:y,className:"hidden lg:flex"}),r.jsx("div",{className:"md:hidden",children:r.jsx(Kje,{})}),w&&r.jsx(Idt,{hasUnseenBrief:C,onClick:S}),v&&r.jsxs(te,{variant:"ghost",size:"icon",className:"relative",onClick:()=>q("/marketplace/cart"),children:[r.jsx(sh,{className:"h-5 w-5"}),F>0&&r.jsx("span",{className:"absolute -top-1 -right-1 h-5 w-5 rounded-full bg-primary text-primary-foreground text-xs font-medium flex items-center justify-center",children:F>99?"99+":F})]}),r.jsx(rdt,{}),r.jsx(ahe,{}),r.jsxs("span",{className:"hidden sm:block text-sm font-medium text-foreground",children:["Hello, ",((Ie=(ve=n==null?void 0:n.user_metadata)==null?void 0:ve.name)==null?void 0:Ie.split(" ")[0])||"User","!"]}),r.jsxs(fm,{children:[r.jsx(pm,{asChild:!0,children:r.jsx("button",{className:"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 rounded-full",children:r.jsxs(Li,{className:"h-9 w-9 cursor-pointer hover:opacity-80 transition-opacity",children:[r.jsx(Io,{src:a||void 0}),r.jsx(Oi,{className:"bg-primary text-primary-foreground font-medium text-sm",children:Ne(((Se=n==null?void 0:n.user_metadata)==null?void 0:Se.name)||(n==null?void 0:n.email)||"U")})]})})}),r.jsxs(Xf,{align:"end",className:"w-48",children:[r.jsxs(uo,{onClick:()=>q("/profile"),className:"cursor-pointer",children:[r.jsx(jc,{className:"h-4 w-4 mr-2"}),"Profile"]}),r.jsx(H4,{}),r.jsxs(uo,{onClick:s,className:"cursor-pointer text-destructive focus:text-destructive",children:[r.jsx(WS,{className:"h-4 w-4 mr-2"}),"Sign Out"]})]})]})]})]})}),r.jsx(Ydt,{children:r.jsx("main",{className:"p-4 sm:p-6 lg:p-8 overflow-x-hidden",children:t})}),w&&r.jsx(Gdt,{brief:w,open:k,onClose:T,onDismiss:I}),r.jsx(Zdt,{}),r.jsx(Qdt,{}),r.jsx(eut,{})]})]})})})},uut=()=>{const{user:t}=Fr(),[e,n]=P.useState(!1),[s,i]=P.useState(null),[o,c]=P.useState(""),a=async v=>{var w;if(!(t!=null&&t.email)){Ge.error("Please sign in to upgrade");return}n(!0),i(v);try{const{data:k,error:C}=await ee.functions.invoke("create-checkout",{body:{tier:v,email:t.email,name:((w=t.user_metadata)==null?void 0:w.full_name)||t.email,couponCode:o.trim()||void 0,skipTrial:!0}});if(C)throw C;if(k!=null&&k.url)window.open(k.url,"_blank","noopener,noreferrer"),Ge.success("Checkout opened in a new tab");else throw new Error("No checkout URL returned")}catch(k){console.error("Checkout error:",k),Ge.error(k.message||"Failed to start checkout. Please try again.")}finally{n(!1),i(null)}},f=["Unlimited access to all marketing templates","Complete Academy training library","AI-powered tools and resources","Community forums and support","Exclusive member events and workshops","Deal pipeline & scorecard tracking","Listing exchange access","Social media content library"],m=["Everything in Individual plan","Up to 25 agent seats","Brokerage admin dashboard","Team performance analytics","Custom branding options","Priority support","Agent onboarding tools","Brokerage-wide announcements"],y=["Everything in Brokerage plan","Unlimited agent seats","Dedicated account manager","Advanced analytics & reporting","White-label options","API access","Custom integrations","Enterprise-level support"];return r.jsx(Or,{children:r.jsxs("div",{className:"container max-w-6xl py-8 px-4",children:[r.jsxs("div",{className:"text-center mb-8",children:[r.jsx("h1",{className:"text-3xl font-bold mb-2",children:"Upgrade Your Membership"}),r.jsx("p",{className:"text-muted-foreground text-lg",children:"Choose the plan that's right for you and unlock the full power of LevelUp"})]}),r.jsxs("div",{className:"max-w-md mx-auto mb-8",children:[r.jsx(Qe,{htmlFor:"coupon",className:"text-sm font-medium",children:"Have a discount code?"}),r.jsx(yt,{id:"coupon",placeholder:"Enter discount code",value:o,onChange:v=>c(v.target.value),className:"mt-1"})]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6 mb-8",children:[r.jsxs(Ye,{className:"border-2 border-primary/20 hover:border-primary/50 transition-colors relative overflow-hidden",children:[r.jsx("div",{className:"absolute top-0 right-0 bg-primary text-primary-foreground text-xs px-3 py-1 rounded-bl-lg font-medium",children:"Popular"}),r.jsxs(Ht,{className:"text-center pb-2",children:[r.jsx("div",{className:"mx-auto mb-3 h-14 w-14 rounded-full bg-primary/10 flex items-center justify-center",children:r.jsx(hs,{className:"h-7 w-7 text-primary"})}),r.jsx(Yt,{className:"text-xl",children:"Individual Agent"}),r.jsx(An,{children:"Perfect for solo agents ready to level up"})]}),r.jsxs(Je,{className:"space-y-6",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("span",{className:"text-4xl font-bold text-primary",children:"$39"}),r.jsx("span",{className:"text-muted-foreground",children:"/month"})]}),r.jsx("ul",{className:"space-y-2",children:f.map((v,w)=>r.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[r.jsx(Ba,{className:"h-4 w-4 text-primary mt-0.5 shrink-0"}),r.jsx("span",{children:v})]},w))}),r.jsxs(te,{className:"w-full",size:"lg",onClick:()=>a("individual_agent"),disabled:e,children:[e&&s==="individual_agent"?r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(Mi,{className:"h-4 w-4 mr-2"}),"Get Started"]})]})]}),r.jsxs(Ye,{className:"border-2 border-amber-500/20 hover:border-amber-500/50 transition-colors",children:[r.jsxs(Ht,{className:"text-center pb-2",children:[r.jsx("div",{className:"mx-auto mb-3 h-14 w-14 rounded-full bg-amber-500/10 flex items-center justify-center",children:r.jsx(ra,{className:"h-7 w-7 text-amber-600"})}),r.jsx(Yt,{className:"text-xl",children:"Brokerage"}),r.jsx(An,{children:"For teams and brokerages up to 25 agents"})]}),r.jsxs(Je,{className:"space-y-6",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("span",{className:"text-4xl font-bold text-amber-600",children:"$299"}),r.jsx("span",{className:"text-muted-foreground",children:"/month"})]}),r.jsx("ul",{className:"space-y-2",children:m.map((v,w)=>r.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[r.jsx(Ba,{className:"h-4 w-4 text-amber-600 mt-0.5 shrink-0"}),r.jsx("span",{children:v})]},w))}),r.jsxs(te,{variant:"outline",className:"w-full border-amber-500 text-amber-600 hover:bg-amber-50",size:"lg",onClick:()=>a("brokerage_under_25"),disabled:e,children:[e&&s==="brokerage_under_25"?r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(ra,{className:"h-4 w-4 mr-2"}),"Get Started"]})]})]}),r.jsxs(Ye,{className:"border-2 border-purple-500/20 hover:border-purple-500/50 transition-colors",children:[r.jsxs(Ht,{className:"text-center pb-2",children:[r.jsx("div",{className:"mx-auto mb-3 h-14 w-14 rounded-full bg-purple-500/10 flex items-center justify-center",children:r.jsx(ra,{className:"h-7 w-7 text-purple-600"})}),r.jsx(Yt,{className:"text-xl",children:"Brokerage 25+"}),r.jsx(An,{children:"For larger brokerages with 25+ agents"})]}),r.jsxs(Je,{className:"space-y-6",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("span",{className:"text-4xl font-bold text-purple-600",children:"$499"}),r.jsx("span",{className:"text-muted-foreground",children:"/month"})]}),r.jsx("ul",{className:"space-y-2",children:y.map((v,w)=>r.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[r.jsx(Ba,{className:"h-4 w-4 text-purple-600 mt-0.5 shrink-0"}),r.jsx("span",{children:v})]},w))}),r.jsxs(te,{variant:"outline",className:"w-full border-purple-500 text-purple-600 hover:bg-purple-50",size:"lg",onClick:()=>a("brokerage_over_25"),disabled:e,children:[e&&s==="brokerage_over_25"?r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(ra,{className:"h-4 w-4 mr-2"}),"Get Started"]})]})]})]}),r.jsx(Ye,{className:"bg-muted/50",children:r.jsxs(Je,{className:"py-6",children:[r.jsx("p",{className:"text-center font-medium mb-4",children:"Questions? We're here to help!"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[r.jsxs("a",{href:"tel:1-866-527-8668",className:"flex items-center justify-center gap-2 text-primary hover:underline",children:[r.jsx(Wa,{className:"h-4 w-4"}),r.jsx("span",{children:"1-866-527-8668"})]}),r.jsxs("a",{href:"mailto:support@relevelup.com",className:"flex items-center justify-center gap-2 text-primary hover:underline",children:[r.jsx(di,{className:"h-4 w-4"}),r.jsx("span",{children:"support@relevelup.com"})]})]})]})})]})})},hut=()=>{const{user:t,loading:e,isBrokerageManager:n,brokerageId:s}=Fr(),i=es(),[o,c]=P.useState(""),[a,f]=P.useState(!1),[m,y]=P.useState(!1);P.useEffect(()=>{!e&&!t&&i("/auth")},[t,e,i]),P.useEffect(()=>{!e&&t&&s&&i("/profile?setup=true")},[t,e,s,i]);const v=async()=>{if(!o.trim()){Ge.error("Please enter a brokerage name");return}const{data:w}=await ee.auth.getSession(),k=w.session;if(!t||!k){Ge.error("Please sign in again to create your brokerage."),i("/auth");return}f(!0);try{console.log("[SetupBrokerage] Creating brokerage…",{hasUser:!!t,hasSession:!!k,userId:t==null?void 0:t.id});const{data:C,error:S}=await ee.functions.invoke("create-brokerage",{body:{name:o.trim()}});if(console.log("[SetupBrokerage] create-brokerage response",{data:C,error:S}),S)throw S;if(!(C!=null&&C.ok))throw new Error((C==null?void 0:C.error)||"Failed to create brokerage");f(!1),y(!0),Ge.success("Brokerage created! Setting up your account..."),setTimeout(()=>{i("/profile?setup=true")},2e3)}catch(C){console.error("Error creating brokerage:",C),Ge.error(C.message||"Failed to create brokerage"),f(!1)}};return e?r.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):m?r.jsx("div",{className:"min-h-screen bg-gradient-to-br from-background via-primary/5 to-secondary/10 flex items-center justify-center p-4",children:r.jsxs(Ye,{className:"max-w-lg w-full",children:[r.jsxs(Ht,{className:"text-center",children:[r.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center mb-4",children:r.jsx(sn,{className:"w-10 h-10 text-primary animate-spin"})}),r.jsx(Yt,{className:"text-2xl",children:"Setting Up Your Brokerage"}),r.jsx(An,{className:"text-lg",children:"We're assigning you as the brokerage manager and preparing your dashboard..."})]}),r.jsxs(Je,{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-center gap-2 text-muted-foreground",children:[r.jsx(za,{className:"w-5 h-5 text-green-500"}),r.jsx("span",{children:"Brokerage created"})]}),r.jsxs("div",{className:"flex items-center justify-center gap-2 text-muted-foreground",children:[r.jsx(sn,{className:"w-5 h-5 animate-spin text-primary"}),r.jsx("span",{children:"Assigning you as manager..."})]}),r.jsx("p",{className:"text-center text-sm text-muted-foreground mt-4",children:"You'll be redirected to complete your profile setup in a moment."})]})]})}):r.jsx("div",{className:"min-h-screen bg-gradient-to-br from-background via-primary/5 to-secondary/10 flex items-center justify-center p-4",children:r.jsxs(Ye,{className:"max-w-lg w-full",children:[r.jsxs(Ht,{className:"text-center",children:[r.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center mb-4",children:r.jsx(ra,{className:"w-10 h-10 text-primary"})}),r.jsx(Yt,{className:"text-2xl",children:"Set Up Your Brokerage"}),r.jsx(An,{className:"text-lg",children:"Create your brokerage to start managing your team"})]}),r.jsxs(Je,{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"brokerage-name",children:"Brokerage Name"}),r.jsx(yt,{id:"brokerage-name",placeholder:"Enter your brokerage name",value:o,onChange:w=>c(w.target.value),onKeyDown:w=>w.key==="Enter"&&v()}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"This is how your brokerage will appear to your agents"})]}),r.jsxs("div",{className:"p-4 rounded-lg bg-muted/50 space-y-3",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2",children:[r.jsx(hs,{className:"w-4 h-4 text-primary"}),"What you can do as a Brokerage Manager:"]}),r.jsxs("ul",{className:"space-y-2 text-sm text-muted-foreground",children:[r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx(za,{className:"w-4 h-4 text-green-500"}),"Invite agents to join your brokerage"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx(za,{className:"w-4 h-4 text-green-500"}),"Access exclusive brokerage resources"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx(za,{className:"w-4 h-4 text-green-500"}),"Track your team's activity and engagement"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx(za,{className:"w-4 h-4 text-green-500"}),"Share resources with your agents"]})]})]}),r.jsxs(te,{onClick:v,className:"w-full",disabled:a||!o.trim(),children:[a?"Creating...":"Create Brokerage",r.jsx(Ho,{className:"w-4 h-4 ml-2"})]})]})]})})},Qje=()=>{const t=es(),[e,n]=P.useState("verifying"),[s,i]=P.useState("");P.useEffect(()=>{(async()=>{try{const{data:{session:a},error:f}=await ee.auth.getSession();if(f)throw f;if(a!=null&&a.user){const{data:m}=await ee.from("profiles").select("login_count").eq("id",a.user.id).single();if(((m==null?void 0:m.login_count)||0)>1){console.log("Account already claimed, redirecting to dashboard"),n("already_claimed");return}console.log("User logged in successfully:",a.user.email),n("success");try{await ee.functions.invoke("trial-claim-hook",{body:{userId:a.user.id}})}catch(y){console.log("Trial claim hook (non-critical):",y)}setTimeout(()=>{t("/profile?setup=true")},1500)}else setTimeout(()=>{n("already_claimed")},2e3)}catch(a){console.error("Claim error:",a),n("already_claimed")}})()},[t]);const o=()=>{window.location.href="https://dashboard.relevelup.com/auth"};return r.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:r.jsxs(Ye,{className:"w-full max-w-md",children:[r.jsxs(Ht,{className:"space-y-1 text-center",children:[r.jsxs("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-primary/10",children:[e==="verifying"&&r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"}),e==="success"&&r.jsx("svg",{className:"h-8 w-8 text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),e==="already_claimed"&&r.jsx("svg",{className:"h-8 w-8 text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),e==="error"&&r.jsx("svg",{className:"h-8 w-8 text-destructive",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]}),r.jsxs(Yt,{className:"text-2xl",children:[e==="verifying"&&"Claiming Your Account...",e==="success"&&"Account Claimed!",e==="already_claimed"&&"Account Already Claimed",e==="error"&&"Claim Failed"]}),r.jsxs(An,{children:[e==="verifying"&&"Please wait while we verify your account...",e==="success"&&"Redirecting you to complete your profile...",e==="already_claimed"&&"This account has already been set up. Please log in to access your dashboard.",e==="error"&&s]})]}),(e==="already_claimed"||e==="error")&&r.jsx(Je,{children:r.jsx(te,{onClick:o,className:"w-full",children:"Go to Login"})})]})})},fut=()=>{const t=es(),[e]=Ed(),[n,s]=P.useState(e.get("code")||""),[i,o]=P.useState(""),[c,a]=P.useState(""),[f,m]=P.useState(""),[y,v]=P.useState(!1),[w,k]=P.useState(!1),[C,S]=P.useState(!1),[T,I]=P.useState(!1),[A,D]=P.useState(null),[$,F]=P.useState(null),[q,W]=P.useState(null),[K,Z]=P.useState(null);P.useEffect(()=>{const Ne=e.get("code");Ne&&(s(Ne),re(Ne))},[e]);const re=async Ne=>{S(!0);const{data:se,error:xe}=await ee.from("invite_codes").select("id, code, max_uses, uses_count, expires_at, is_active, brokerage_id, trial_days").eq("code",Ne.toUpperCase().trim()).single();if(xe||!se){Ge.error("Invalid invite code"),S(!1);return}if(!se.is_active){Ge.error("This invite code is no longer active"),S(!1);return}if(se.max_uses&&se.uses_count>=se.max_uses){Ge.error("This invite code has reached its maximum uses"),S(!1);return}if(se.expires_at&&new Date(se.expires_at){Ne.preventDefault(),re(n)},ue=async Ne=>{var se;if(Ne.preventDefault(),!f.trim()){Ge.error("Please enter your name");return}if(c.length<6){Ge.error("Password must be at least 6 characters");return}k(!0);try{const xe=`${window.location.origin}/`,{data:ie,error:me}=await ee.auth.signUp({email:i.trim(),password:c,options:{emailRedirectTo:xe,data:{name:f.trim()}}});if(me){me.message.includes("already registered")?Ge.error("This email is already registered. Please sign in instead."):Ge.error(me.message);return}ie.user&&(await ee.rpc("add_default_signup_tag",{user_id:ie.user.id}),$?await ee.functions.invoke("assign-brokerage",{body:{userId:ie.user.id,brokerageId:$}}):K?await ee.functions.invoke("assign-brokerage",{body:{userId:ie.user.id,trialDays:K}}):await ee.functions.invoke("assign-brokerage",{body:{userId:ie.user.id,grandfathered:!0}}),A&&await ee.from("invite_codes").update({uses_count:((se=(await ee.from("invite_codes").select("uses_count").eq("id",A).single()).data)==null?void 0:se.uses_count)+1}).eq("id",A),Ge.success("Account created! You can now access the dashboard."),t("/dashboard"))}catch(xe){console.error("Signup error:",xe),Ge.error("An unexpected error occurred")}finally{k(!1)}};return r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:r.jsxs(Ye,{className:"w-full max-w-md",children:[r.jsxs(Ht,{className:"text-center",children:[r.jsx(Yt,{className:"text-2xl font-bold text-primary",children:q?`Join ${q}`:"Join LevelUp"}),r.jsx(An,{children:T?q?`Create your account to join ${q}`:"Create your account to get started":"Enter your invite code to continue"})]}),r.jsx(Je,{children:T?r.jsxs("form",{onSubmit:ue,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"name",children:"Full Name"}),r.jsx(yt,{id:"name",type:"text",placeholder:"John Doe",value:f,onChange:Ne=>m(Ne.target.value),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"email",children:"Email"}),r.jsx(yt,{id:"email",type:"email",placeholder:"you@example.com",value:i,onChange:Ne=>o(Ne.target.value),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"password",children:"Password"}),r.jsxs("div",{className:"relative",children:[r.jsx(yt,{id:"password",type:y?"text":"password",placeholder:"••••••••",value:c,onChange:Ne=>a(Ne.target.value),required:!0,minLength:6}),r.jsx("button",{type:"button",className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",onClick:()=>v(!y),children:y?r.jsx($w,{className:"h-4 w-4"}):r.jsx(Ml,{className:"h-4 w-4"})})]})]}),r.jsx(te,{type:"submit",className:"w-full",disabled:w,children:w?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating Account..."]}):"Create Account"})]}):r.jsxs("form",{onSubmit:he,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"inviteCode",children:"Invite Code"}),r.jsx(yt,{id:"inviteCode",type:"text",placeholder:"Enter your invite code",value:n,onChange:Ne=>s(Ne.target.value),required:!0,autoFocus:!0})]}),r.jsx(te,{type:"submit",className:"w-full",disabled:C,children:C?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"mr-2 h-4 w-4 animate-spin"}),"Verifying..."]}):"Verify Code"})]})})]})})},put="/assets/testimonial-avatar-1-BsCQFauB.jpg",mut="/assets/testimonial-avatar-2-B6VPVc2t.jpg",gut="/assets/testimonial-avatar-3-GuEFwYUE.jpg",yut="/assets/testimonial-avatar-4-98iKMtkB.jpg",xut="/assets/testimonial-avatar-5-ZsZfyxMX.jpg",vut=[put,mut,gut,yut,xut],_ut=UC({name:ec().trim().min(2,"Name must be at least 2 characters").max(100),email:ec().trim().email("Please enter a valid email address").max(255),phone:ec().trim().min(10,"Please enter a valid phone number").max(20).optional().or(vje("")),brokerage:ec().trim().max(200).optional().or(vje(""))}),but=[{icon:Sf,title:"Academy Training",description:"Access a library of on-demand video training covering lead generation, marketing, technology, and more."},{icon:Gd,title:"300+ Templates",description:"Professional Canva templates for social media, flyers, postcards, and marketing materials."},{icon:li,title:"Live Events",description:"Weekly live training sessions, workshops, and Q&A events with industry experts."},{icon:Hl,title:"Agent Community",description:"Connect with fellow agents, share wins, ask questions, and network in our private community."},{icon:Ai,title:"Resource Kits",description:"Downloadable toolkits with scripts, checklists, guides, and everything you need to close more deals."},{icon:Qa,title:"Social Swag",description:"Fresh social media content and designs updated regularly to help you stand out online."}],wut=[{icon:hs,title:"Contact Management",description:"Organize your sphere into relationship tiers—Top 25, Past Clients, Referral Partners, and more."},{icon:Mi,title:"Smart TouchPlans",description:"Automated action plans that tell you exactly who to contact and how, based on relationship type."},{icon:Wa,title:"One-Tap Actions",description:"Call, text, or email contacts directly with pre-written scripts tailored to each relationship."},{icon:og,title:"Birthday Alerts",description:"Never miss an important date—get reminders for birthdays and home anniversaries."},{icon:yl,title:"Pop-by Map",description:"See all your contacts on a map and plan efficient pop-by routes in your area."},{icon:xc,title:"Momentum Tracking",description:"Track your touch streaks, weekly goals, and relationship health scores."},{icon:ql,title:"Relationship Health",description:"Visual dashboard showing which contacts need attention based on last touch date."},{icon:e1,title:"Daily Action Cards",description:"Wake up to a prioritized list of exactly who to reach out to today."}],jut=[{name:"Sarah M.",role:"Top Producer, RE/MAX",quote:"LevelUp completely transformed how I run my business. The templates alone save me hours every week."},{name:"Mike T.",role:"Brokerage Owner",quote:"Onboarding new agents used to take weeks. Now they're productive from day one with all the training resources."},{name:"Jessica L.",role:"Team Lead",quote:"The community is incredible. I've learned more from other agents here than any conference I've attended."}],kut=()=>{const t=es(),[e,n]=P.useState(!1),[s,i]=P.useState({name:"",email:"",phone:"",brokerage:""}),[o,c]=P.useState({}),a=async f=>{var y,v;f.preventDefault(),c({});const m=_ut.safeParse(s);if(!m.success){const w={};m.error.errors.forEach(k=>{k.path[0]&&(w[k.path[0]]=k.message)}),c(w);return}n(!0);try{const{data:w,error:k}=await ee.functions.invoke("create-trial-signup",{body:{name:s.name.trim(),email:s.email.trim().toLowerCase(),phone:((y=s.phone)==null?void 0:y.trim())||void 0,brokerage:((v=s.brokerage)==null?void 0:v.trim())||void 0}});if(k){console.error("Trial signup error:",k),Ge.error(k.message||"Something went wrong. Please try again.");return}if(w!=null&&w.error){Ge.error(w.error);return}Ge.success("🎉 Welcome aboard! Check your email to claim your account."),t("/trial/success")}catch(w){console.error("Trial signup error:",w),Ge.error("Something went wrong. Please try again.")}finally{n(!1)}};return r.jsxs(r.Fragment,{children:[r.jsxs(Mg,{children:[r.jsx("title",{children:"Start Your Free 7-Day Trial | LevelUp Dashboard"}),r.jsx("meta",{name:"description",content:"Take LevelUp for a free 7-day test drive. No credit card required. The all-in-one platform for real estate agents and brokerages."}),r.jsx("meta",{property:"og:title",content:"Start Your Free 7-Day Trial | LevelUp"}),r.jsx("meta",{property:"og:description",content:"Take LevelUp for a free 7-day test drive. No credit card required."}),r.jsx("meta",{property:"og:type",content:"website"})]}),r.jsxs("div",{className:"min-h-screen bg-background overflow-hidden",children:[r.jsx("nav",{className:"fixed top-0 left-0 right-0 z-50 bg-[#4a6b6d] shadow-md",children:r.jsxs("div",{className:"container mx-auto px-4 py-3 flex items-center justify-between",children:[r.jsx("div",{className:"flex items-center",children:r.jsx("img",{src:Kee,alt:"LevelUp",className:"h-8 md:h-10"})}),r.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[r.jsx(te,{variant:"ghost",className:"text-white/90 hover:text-white hover:bg-white/10 hidden sm:inline-flex",onClick:()=>{var f;return(f=document.getElementById("features"))==null?void 0:f.scrollIntoView({behavior:"smooth"})},children:"Features"}),r.jsx(te,{onClick:()=>t("/auth"),className:"bg-white text-[#4a6b6d] hover:bg-gray-100 font-medium shadow-md",children:"Sign In"})]})]})}),r.jsxs("section",{className:"relative pt-24 pb-20 bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsx("div",{className:"container mx-auto px-4 relative",children:r.jsxs("div",{className:"grid lg:grid-cols-2 gap-12 items-center",children:[r.jsxs("div",{className:"space-y-8 text-center lg:text-left",children:[r.jsx("div",{className:"flex justify-center lg:justify-start",children:r.jsx("img",{alt:"LevelUp Consulting Group",className:"h-24 md:h-32 drop-shadow-lg",src:"/lovable-uploads/3a0c7ef9-9e79-411f-a9af-6f2a99e8bd7b.webp"})}),r.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-white/10 text-white text-sm font-medium",children:[r.jsx(Mi,{className:"h-4 w-4 text-yellow-400"}),r.jsx("span",{children:"7-Day Free Trial • No Credit Card Required"})]}),r.jsxs("h1",{className:"text-3xl md:text-4xl lg:text-5xl font-bold text-white leading-tight font-sans",children:["Take LevelUp for a"," ",r.jsx("span",{className:"italic",children:"Free Test Drive"})]}),r.jsxs("p",{className:"text-lg md:text-xl text-white/80 max-w-xl mx-auto lg:mx-0 font-sans",children:["The tools you need to get it done.",r.jsx("br",{}),r.jsx("em",{children:"The platform you need to keep it going."})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center lg:justify-start",children:[r.jsxs("div",{className:"flex items-center gap-2 text-white/80",children:[r.jsx(io,{className:"h-5 w-5 text-green-400"}),r.jsx("span",{children:"No credit card required"})]}),r.jsxs("div",{className:"flex items-center gap-2 text-white/80",children:[r.jsx(io,{className:"h-5 w-5 text-green-400"}),r.jsx("span",{children:"Full access to all features"})]})]}),r.jsxs("div",{className:"flex items-center gap-4 justify-center lg:justify-start pt-4",children:[r.jsx("div",{className:"flex -space-x-3",children:vut.map((f,m)=>r.jsx("img",{src:f,alt:`Agent ${m+1}`,className:"w-10 h-10 rounded-full border-2 border-white/20 object-cover"},m))}),r.jsxs("div",{children:[r.jsx("div",{className:"flex gap-0.5",children:[1,2,3,4,5].map(f=>r.jsx(Ca,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"},f))}),r.jsx("p",{className:"text-sm text-white/60",children:"Trusted by 3,000+ agents"})]})]})]}),r.jsx("div",{className:"lg:pl-8",children:r.jsx(Ye,{className:"bg-white shadow-2xl border-0",children:r.jsxs(Je,{className:"p-8",children:[r.jsxs("div",{className:"text-center mb-8",children:[r.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-[#4a6b6d] mb-4",children:r.jsx(cg,{className:"h-8 w-8 text-white"})}),r.jsx("h2",{className:"text-2xl font-bold text-foreground font-sans",children:"Start Your Free Trial"}),r.jsx("p",{className:"text-muted-foreground mt-2",children:"Get instant access • No credit card needed"})]}),r.jsxs("form",{onSubmit:a,className:"space-y-5",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"name",children:"Full Name *"}),r.jsx(yt,{id:"name",type:"text",placeholder:"John Smith",value:s.name,onChange:f=>i({...s,name:f.target.value}),required:!0}),o.name&&r.jsx("p",{className:"text-sm text-destructive",children:o.name})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"email",children:"Email Address *"}),r.jsx(yt,{id:"email",type:"email",placeholder:"john@example.com",value:s.email,onChange:f=>i({...s,email:f.target.value}),required:!0}),o.email&&r.jsx("p",{className:"text-sm text-destructive",children:o.email})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"phone",children:"Phone Number"}),r.jsx(yt,{id:"phone",type:"tel",placeholder:"(555) 123-4567",value:s.phone,onChange:f=>i({...s,phone:f.target.value})}),o.phone&&r.jsx("p",{className:"text-sm text-destructive",children:o.phone})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"brokerage",children:"Brokerage Name"}),r.jsx(yt,{id:"brokerage",type:"text",placeholder:"Your brokerage or team name",value:s.brokerage,onChange:f=>i({...s,brokerage:f.target.value})}),o.brokerage&&r.jsx("p",{className:"text-sm text-destructive",children:o.brokerage})]}),r.jsx(te,{type:"submit",className:"w-full h-12 text-lg font-semibold bg-[#4a6b6d] hover:bg-[#3d5a5c]",disabled:e,children:e?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"mr-2 h-5 w-5 animate-spin"}),"Creating Your Account..."]}):r.jsxs(r.Fragment,{children:["Start My Free Trial",r.jsx(Ho,{className:"ml-2 h-5 w-5"})]})}),r.jsxs("p",{className:"text-center text-sm text-muted-foreground",children:["By signing up, you agree to our"," ",r.jsx("a",{href:"/terms-of-service",className:"text-[#4a6b6d] hover:underline",children:"Terms"})," ","and"," ",r.jsx("a",{href:"/privacy-policy",className:"text-[#4a6b6d] hover:underline",children:"Privacy Policy"})]})]})]})})})]})})]}),r.jsx("section",{className:"py-20 bg-background",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsxs("div",{className:"max-w-4xl mx-auto text-center space-y-8",children:[r.jsx("h2",{className:"text-3xl md:text-5xl leading-tight font-sans font-semibold text-secondary",children:"We help brokerages and agents grow with training, tools, and built-in execution."}),r.jsxs("div",{className:"space-y-2 text-lg text-muted-foreground",children:[r.jsx("p",{children:"Agents get weekly coaching + plug-and-play marketing."}),r.jsx("p",{children:"Brokerages get higher adoption, consistency, and real engagement."})]}),r.jsx("p",{className:"text-2xl md:text-4xl text-[#4a6b6d] pt-4 font-sans font-bold",children:"LEVELUP EQUIPS BOTH TO THRIVE."})]})})}),r.jsx("section",{id:"features",className:"py-20 bg-muted/30",children:r.jsxs("div",{className:"container mx-auto px-4",children:[r.jsxs("div",{className:"text-center max-w-3xl mx-auto mb-16",children:[r.jsx("h2",{className:"text-3xl md:text-4xl mb-6 font-sans font-bold",children:"What's inside our members only portal?"}),r.jsx("p",{className:"text-lg text-muted-foreground",children:"Everything you need to grow your business, all in one place."})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8 max-w-6xl mx-auto",children:but.map((f,m)=>r.jsxs(Ye,{className:"group relative overflow-hidden border hover:border-[#4a6b6d]/50 transition-all duration-300 hover:shadow-lg bg-background",children:[r.jsxs(Ht,{children:[r.jsx("div",{className:"w-14 h-14 rounded-2xl bg-[#4a6b6d]/10 flex items-center justify-center mb-4",children:r.jsx(f.icon,{className:"w-7 h-7 text-[#4a6b6d]"})}),r.jsx(Yt,{className:"text-xl font-sans",children:f.title})]}),r.jsx(Je,{children:r.jsx("p",{className:"text-muted-foreground leading-relaxed",children:f.description})})]},m))})]})}),r.jsxs("section",{className:"py-20 bg-gradient-to-br from-[#4a6b6d] to-[#3d5a5c] relative overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsxs("div",{className:"container mx-auto px-4 relative",children:[r.jsxs("div",{className:"text-center max-w-3xl mx-auto mb-16",children:[r.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-white/10 text-white text-sm font-medium mb-6",children:[r.jsx(Mi,{className:"w-4 h-4"}),"Included with Your Trial"]}),r.jsxs("h2",{className:"text-3xl mb-6 text-white font-sans font-bold md:text-6xl",children:["Meet ",r.jsx("span",{className:"italic",children:"Agent OS"})]}),r.jsx("p",{className:"text-lg text-white/80",children:"Your relationship-first operating system. Never forget a follow-up, track every touchpoint, and turn your sphere into a referral machine."})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 max-w-6xl mx-auto",children:wut.map((f,m)=>r.jsxs(Ye,{className:"group relative overflow-hidden border-0 bg-white/10 backdrop-blur-sm hover:bg-white/20 transition-all duration-300",children:[r.jsxs(Ht,{className:"pb-3",children:[r.jsx("div",{className:"w-12 h-12 rounded-xl bg-white/20 flex items-center justify-center mb-3",children:r.jsx(f.icon,{className:"w-6 h-6 text-white"})}),r.jsx(Yt,{className:"text-lg font-semibold text-white",children:f.title})]}),r.jsx(Je,{children:r.jsx("p",{className:"text-white/70 text-sm leading-relaxed",children:f.description})})]},m))})]})]}),r.jsx("section",{className:"py-20 bg-background",children:r.jsxs("div",{className:"container mx-auto px-4",children:[r.jsxs("div",{className:"text-center mb-16",children:[r.jsx("h2",{className:"text-3xl md:text-4xl font-bold mb-4 font-sans",children:"Loved by Top Producers"}),r.jsx("p",{className:"text-lg text-muted-foreground",children:"See what agents are saying about LevelUp"})]}),r.jsx("div",{className:"grid md:grid-cols-3 gap-8 max-w-5xl mx-auto",children:jut.map((f,m)=>r.jsx(Ye,{className:"border hover:shadow-lg transition-shadow",children:r.jsxs(Je,{className:"p-6",children:[r.jsx("div",{className:"flex gap-1 mb-4",children:[1,2,3,4,5].map(y=>r.jsx(Ca,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"},y))}),r.jsxs("p",{className:"text-muted-foreground mb-4 italic",children:['"',f.quote,'"']}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:f.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:f.role})]})]})},m))})]})}),r.jsx("section",{className:"py-16 bg-muted/30",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsxs("div",{className:"flex flex-wrap justify-center gap-8 md:gap-16",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-12 h-12 rounded-full bg-[#4a6b6d]/10 flex items-center justify-center",children:r.jsx(sm,{className:"h-6 w-6 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:"Secure & Private"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Bank-level encryption"})]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-12 h-12 rounded-full bg-[#4a6b6d]/10 flex items-center justify-center",children:r.jsx(e1,{className:"h-6 w-6 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:"Fast Setup"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Start in 2 minutes"})]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-12 h-12 rounded-full bg-[#4a6b6d]/10 flex items-center justify-center",children:r.jsx(hs,{className:"h-6 w-6 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:"Expert Support"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Real estate pros"})]})]})]})})}),r.jsx("section",{id:"free-trial",className:"py-20 bg-background",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsxs(Ye,{className:"bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] border-0 shadow-2xl overflow-hidden relative",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsxs(Je,{className:"p-12 text-center relative",children:[r.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-white mb-4 font-sans",children:"Ready to Level Up Your Business?"}),r.jsx("p",{className:"text-xl text-white/80 mb-8 max-w-2xl mx-auto",children:"Join thousands of successful agents. Start your free 7-day trial today."}),r.jsxs(te,{onClick:()=>window.scrollTo({top:0,behavior:"smooth"}),size:"lg",className:"h-14 px-8 text-lg font-semibold bg-white text-[#1e3a4c] hover:bg-white/90 shadow-2xl transition-all hover:scale-105 rounded-full",children:["Start Your Free Trial Now",r.jsx(Ho,{className:"ml-2 h-5 w-5"})]})]})]})})}),r.jsx("footer",{className:"bg-[#1e3a4c] py-12",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-center gap-6",children:[r.jsx("img",{src:hge,alt:"LevelUp",className:"h-8"}),r.jsxs("div",{className:"flex gap-6 text-sm text-white/60",children:[r.jsx("a",{href:"/privacy-policy",className:"hover:text-white transition-colors",children:"Privacy Policy"}),r.jsx("a",{href:"/terms-of-service",className:"hover:text-white transition-colors",children:"Terms of Service"})]}),r.jsx("p",{className:"text-sm text-white/40",children:"© 2025 LevelUp Consulting Group. All rights reserved."})]})})})]})]})},Nut=()=>{const t=es();return r.jsxs(r.Fragment,{children:[r.jsx(Mg,{children:r.jsx("title",{children:"Welcome to LevelUp! | Check Your Email"})}),r.jsxs("div",{className:"min-h-screen bg-background flex flex-col",children:[r.jsx("nav",{className:"fixed top-0 left-0 right-0 z-50 bg-[#4a6b6d] shadow-md",children:r.jsxs("div",{className:"container mx-auto px-4 py-3 flex items-center justify-between",children:[r.jsx("div",{className:"flex items-center",children:r.jsx("img",{src:Kee,alt:"LevelUp",className:"h-8 md:h-10"})}),r.jsx(te,{onClick:()=>t("/auth"),className:"bg-white text-[#4a6b6d] hover:bg-gray-100 font-medium shadow-md",children:"Sign In"})]})}),r.jsxs("section",{className:"relative pt-24 pb-12 bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] overflow-hidden flex-1 flex items-center",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsx("div",{className:"container mx-auto px-4 relative",children:r.jsx("div",{className:"flex justify-center",children:r.jsx(Ye,{className:"max-w-lg w-full bg-white shadow-2xl border-0",children:r.jsxs(Je,{className:"p-8 md:p-12 text-center",children:[r.jsxs("div",{className:"relative inline-block mb-8",children:[r.jsx("div",{className:"w-24 h-24 rounded-full bg-gradient-to-br from-[#4a6b6d] to-[#3d5a5c] flex items-center justify-center",children:r.jsx(io,{className:"h-12 w-12 text-white"})}),r.jsx("div",{className:"absolute -top-2 -right-2 w-10 h-10 rounded-full bg-yellow-500 flex items-center justify-center animate-bounce",children:r.jsx($h,{className:"h-5 w-5 text-white"})})]}),r.jsx("h1",{className:"text-3xl md:text-4xl font-bold text-foreground mb-4 font-sans",children:"You're In! 🎉"}),r.jsx("p",{className:"text-xl text-muted-foreground mb-8",children:"Your 7-day LevelUp adventure starts now!"}),r.jsxs("div",{className:"bg-[#4a6b6d]/10 rounded-xl p-6 mb-8",children:[r.jsxs("div",{className:"flex items-center justify-center gap-3 mb-4",children:[r.jsx("div",{className:"w-12 h-12 rounded-full bg-[#4a6b6d]/20 flex items-center justify-center",children:r.jsx(di,{className:"h-6 w-6 text-[#4a6b6d]"})}),r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Check Your Inbox"})]}),r.jsx("p",{className:"text-muted-foreground",children:"We just sent you a magic link to claim your account and set up your password. Click the link in your email to get started!"})]}),r.jsxs("div",{className:"text-left space-y-3 mb-8",children:[r.jsx("p",{className:"text-sm text-muted-foreground font-medium uppercase tracking-wide",children:"What happens next:"}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"w-6 h-6 rounded-full bg-[#4a6b6d] flex items-center justify-center flex-shrink-0 mt-0.5",children:r.jsx("span",{className:"text-xs font-bold text-white",children:"1"})}),r.jsx("p",{className:"text-foreground",children:"Check your email for the welcome message"})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"w-6 h-6 rounded-full bg-[#4a6b6d] flex items-center justify-center flex-shrink-0 mt-0.5",children:r.jsx("span",{className:"text-xs font-bold text-white",children:"2"})}),r.jsx("p",{className:"text-foreground",children:'Click "Claim Your Account" to set your password'})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"w-6 h-6 rounded-full bg-[#4a6b6d] flex items-center justify-center flex-shrink-0 mt-0.5",children:r.jsx("span",{className:"text-xs font-bold text-white",children:"3"})}),r.jsx("p",{className:"text-foreground",children:"Start exploring all the features!"})]})]}),r.jsxs("p",{className:"text-sm text-muted-foreground mb-6",children:["Didn't receive the email? Check your spam folder or"," ",r.jsx("button",{onClick:()=>t("/trial"),className:"text-[#4a6b6d] hover:underline font-medium",children:"try again"})]}),r.jsxs(te,{onClick:()=>t("/auth"),className:"bg-[#4a6b6d] hover:bg-[#3d5a5c]",children:["Go to Sign In",r.jsx(Ho,{className:"ml-2 h-4 w-4"})]})]})})})})]}),r.jsx("footer",{className:"bg-[#1e3a4c] py-8",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-center gap-4",children:[r.jsx("img",{src:hge,alt:"LevelUp",className:"h-8"}),r.jsxs("p",{className:"text-sm text-white/40",children:["© ",new Date().getFullYear()," LevelUp Consulting Group. All rights reserved."]})]})})})]})]})},Sut=UC({viewerName:ec().min(1,"Name is required").max(100,"Name must be less than 100 characters"),viewerEmail:ec().email("Please enter a valid email").max(255,"Email must be less than 255 characters"),viewerPhone:ec().max(20,"Phone must be less than 20 characters").optional(),message:ec().min(1,"Message is required").max(1e3,"Message must be less than 1000 characters")});function Cut({shareToken:t,agentName:e,hasContact:n}){const[s,i]=P.useState(!1),[o,c]=P.useState(!1),[a,f]=P.useState(null),m=ese({resolver:tse(Sut),defaultValues:{viewerName:"",viewerEmail:"",viewerPhone:"",message:""}}),y=async v=>{i(!0),f(null);try{const{data:w,error:k}=await ee.functions.invoke("video-reply-notify",{body:{shareToken:t,viewerName:v.viewerName,viewerEmail:v.viewerEmail,viewerPhone:v.viewerPhone||void 0,message:v.message}});if(k)throw new Error(k.message);if(!(w!=null&&w.success))throw new Error((w==null?void 0:w.error)||"Failed to send reply");c(!0)}catch(w){console.error("Failed to submit reply:",w),f(w.message||"Something went wrong. Please try again.")}finally{i(!1)}};return o?r.jsx(Ye,{className:"border-2 border-primary/20 bg-gradient-to-br from-primary/5 to-primary/10",children:r.jsxs(Je,{className:"py-8 text-center",children:[r.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/20 mb-4",children:r.jsx(io,{className:"h-8 w-8 text-primary"})}),r.jsx("h3",{className:"text-xl font-semibold mb-2",children:"Message Sent!"}),r.jsxs("p",{className:"text-muted-foreground",children:[e?`${e} will`:"They'll"," get back to you soon."]})]})}):r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"pb-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx(Hl,{className:"h-5 w-5 text-primary"}),r.jsx(Yt,{className:"text-lg",children:"Reply to this video"})]}),r.jsx(An,{children:n?`Have a question or want to connect? Send ${e||"them"} a message.`:`Interested? Share your info and ${e||"your agent"} will be in touch.`})]}),r.jsx(Je,{children:r.jsx(rse,{...m,children:r.jsxs("form",{onSubmit:m.handleSubmit(y),className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsx(jl,{control:m.control,name:"viewerName",render:({field:v})=>r.jsxs(hl,{children:[r.jsx(fl,{children:"Your Name *"}),r.jsx(pl,{children:r.jsx(yt,{placeholder:"John Smith",...v})}),r.jsx(gu,{})]})}),r.jsx(jl,{control:m.control,name:"viewerEmail",render:({field:v})=>r.jsxs(hl,{children:[r.jsx(fl,{children:"Email *"}),r.jsx(pl,{children:r.jsx(yt,{type:"email",placeholder:"john@example.com",...v})}),r.jsx(gu,{})]})})]}),!n&&r.jsx(jl,{control:m.control,name:"viewerPhone",render:({field:v})=>r.jsxs(hl,{children:[r.jsx(fl,{children:"Phone (optional)"}),r.jsx(pl,{children:r.jsx(yt,{type:"tel",placeholder:"(555) 123-4567",...v})}),r.jsx(gu,{})]})}),r.jsx(jl,{control:m.control,name:"message",render:({field:v})=>r.jsxs(hl,{children:[r.jsx(fl,{children:"Message *"}),r.jsx(pl,{children:r.jsx(ps,{placeholder:n?"Thanks for the video! I had a question about...":"I'm interested in learning more about...",className:"min-h-[100px] resize-none",...v})}),r.jsx(gu,{})]})}),a&&r.jsx("p",{className:"text-sm text-destructive",children:a}),r.jsx(te,{type:"submit",className:"w-full gap-2",disabled:s,children:s?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"h-4 w-4 animate-spin"}),"Sending..."]}):r.jsxs(r.Fragment,{children:[r.jsx(To,{className:"h-4 w-4"}),"Send Message"]})})]})})})]})}const Mut=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute top-4 left-[10%] w-3 h-3 bg-amber-400/60 rounded-full animate-pulse"}),r.jsx("div",{className:"absolute top-12 right-[15%] w-2 h-2 bg-rose-400/60 rounded-full animate-pulse delay-100"}),r.jsx("div",{className:"absolute top-8 left-[30%] w-2.5 h-2.5 bg-sky-400/60 rounded-full animate-pulse delay-200"}),r.jsx("div",{className:"absolute top-16 right-[25%] w-2 h-2 bg-emerald-400/60 rounded-full animate-pulse delay-300"})]}),Tut=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(ql,{className:"absolute top-6 left-[12%] w-4 h-4 text-rose-300/50 fill-rose-300/30 animate-pulse"}),r.jsx(ql,{className:"absolute top-10 right-[18%] w-3 h-3 text-pink-300/50 fill-pink-300/30 animate-pulse delay-150"}),r.jsx(ql,{className:"absolute top-4 left-[40%] w-2.5 h-2.5 text-rose-400/40 fill-rose-400/20 animate-pulse delay-300"}),r.jsx(ql,{className:"absolute top-14 right-[35%] w-3.5 h-3.5 text-pink-300/40 fill-pink-300/20 animate-pulse delay-200"})]}),Aut=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(Ww,{className:"absolute top-6 left-[15%] w-4 h-4 text-amber-400/50 animate-pulse"}),r.jsx(Mi,{className:"absolute top-8 right-[20%] w-3 h-3 text-yellow-400/50 animate-pulse delay-100"}),r.jsx(Ww,{className:"absolute top-12 left-[35%] w-3 h-3 text-orange-300/40 animate-pulse delay-200"})]}),Eut=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(Mi,{className:"absolute top-5 left-[10%] w-4 h-4 text-emerald-400/50 animate-pulse"}),r.jsx($h,{className:"absolute top-10 right-[12%] w-5 h-5 text-amber-400/50 animate-pulse delay-150"}),r.jsx(Mi,{className:"absolute top-8 left-[45%] w-3 h-3 text-sky-400/40 animate-pulse delay-300"})]}),Iut=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(Hi,{className:"absolute top-6 left-[12%] w-4 h-4 text-teal-400/40 animate-pulse"}),r.jsx(Mi,{className:"absolute top-10 right-[15%] w-3 h-3 text-emerald-400/50 animate-pulse delay-100"}),r.jsx(Hi,{className:"absolute top-4 right-[40%] w-3 h-3 text-cyan-400/30 animate-pulse delay-200"})]}),phe=[{id:"default",name:"Classic",description:"Clean, professional look for any occasion",icon:r.jsx(Mi,{className:"h-5 w-5"}),headerText:()=>"Video Message",subText:"A personal video just for you",gradientClasses:"from-background to-muted/30",accentColor:"primary"},{id:"birthday",name:"Birthday",description:"Celebrate their special day",icon:r.jsx(og,{className:"h-5 w-5"}),headerText:t=>t?`Happy Birthday, ${t}!`:"Happy Birthday!",subText:"Wishing you an amazing year ahead",gradientClasses:"from-amber-50/80 via-rose-50/60 to-purple-50/40 dark:from-amber-950/30 dark:via-rose-950/20 dark:to-purple-950/20",accentColor:"amber",decorativeElement:r.jsx(Mut,{})},{id:"home_anniversary",name:"Home Anniversary",description:"Celebrate their home ownership milestone",icon:r.jsx(Hi,{className:"h-5 w-5"}),headerText:t=>t?`Happy Home Anniversary, ${t}!`:"Happy Home Anniversary!",subText:"Celebrating another year in your beautiful home",gradientClasses:"from-teal-50/70 via-cyan-50/50 to-emerald-50/40 dark:from-teal-950/30 dark:via-cyan-950/20 dark:to-emerald-950/20",accentColor:"teal",decorativeElement:r.jsx(Iut,{})},{id:"valentines_day",name:"Valentine's Day",description:"Show appreciation on this special day",icon:r.jsx(ql,{className:"h-5 w-5"}),headerText:t=>t?`Happy Valentine's Day, ${t}!`:"Happy Valentine's Day!",subText:"A heartfelt message from your real estate professional",gradientClasses:"from-rose-50/80 via-pink-50/60 to-red-50/40 dark:from-rose-950/30 dark:via-pink-950/20 dark:to-red-950/20",accentColor:"rose",decorativeElement:r.jsx(Tut,{})},{id:"groundhog_day",name:"Groundhog Day",description:"A fun seasonal greeting",icon:r.jsx(Ww,{className:"h-5 w-5"}),headerText:t=>t?`Happy Groundhog Day, ${t}!`:"Happy Groundhog Day!",subText:"Wishing you an early spring!",gradientClasses:"from-amber-50/70 via-yellow-50/50 to-orange-50/40 dark:from-amber-950/30 dark:via-yellow-950/20 dark:to-orange-950/20",accentColor:"amber",decorativeElement:r.jsx(Aut,{})},{id:"under_contract",name:"Under Contract",description:"Celebrate this exciting milestone",icon:r.jsx($h,{className:"h-5 w-5"}),headerText:t=>t?`Congratulations, ${t}!`:"Congratulations!",subText:"You're under contract – exciting times ahead!",gradientClasses:"from-emerald-50/70 via-teal-50/50 to-cyan-50/40 dark:from-emerald-950/30 dark:via-teal-950/20 dark:to-cyan-950/20",accentColor:"emerald",decorativeElement:r.jsx(Eut,{})}];function UT(t){return phe.find(e=>e.id===t)||phe[0]}function Put(){const{shareToken:t}=dd(),[e,n]=P.useState(null),[s,i]=P.useState(null),[o,c]=P.useState(null),[a,f]=P.useState(!0),[m,y]=P.useState(null),[v,w]=P.useState(!0);P.useEffect(()=>{const q=()=>{['[id*="lc_text_widget"]','[class*="lc-text-widget"]','[id*="chat-widget"]','[class*="chat-widget"]','iframe[src*="widgets.leadconnectorhq"]','iframe[src*="msgsndr"]',"[data-chat-widget]"].forEach(re=>{document.querySelectorAll(re).forEach(he=>{he.style.display="none"})})};q();const W=[setTimeout(q,500),setTimeout(q,1500),setTimeout(q,3e3)],K=new MutationObserver(q);return K.observe(document.body,{childList:!0,subtree:!0}),()=>{W.forEach(clearTimeout),K.disconnect()}},[]),P.useEffect(()=>{(async()=>{if(!t){y("Invalid share link"),f(!1);return}const{data:W,error:K}=await ee.from("agent_videos").select("id, title, playback_url, thumbnail_url, preview_url, duration_seconds, share_token, owner_user_id, contact_id, page_template, recipient_name").eq("share_token",t).eq("is_deleted",!1).single();if(K||!W){y("Video not found or has been removed"),f(!1);return}n(W);try{await ee.rpc("log_video_view",{p_video_id:W.id,p_user_agent:navigator.userAgent,p_referrer:document.referrer||null})}catch(Z){console.warn("Failed to log video view:",Z)}if(W.owner_user_id){const{data:Z}=await ee.from("profiles").select("id, name, email, phone").eq("id",W.owner_user_id).single();if(Z){i(Z);try{const{data:re}=await ee.storage.from("avatars").list(`${W.owner_user_id}`);if(re&&re.length>0){const{data:he}=ee.storage.from("avatars").getPublicUrl(`${W.owner_user_id}/${re[0].name}`);c(he.publicUrl)}}catch{}}}f(!1)})()},[t]);const k=q=>{if(!q)return"0:00";const W=Math.floor(q/60),K=q%60;return`${W}:${K.toString().padStart(2,"0")}`},C=q=>q.includes("iframe.mediadelivery.net/play/")?q.replace("/play/","/embed/")+"?autoplay=true&responsive=true":q,S=q=>{if(!q)return"?";const W=q.split(" ");return W.length>=2?`${W[0][0]}${W[1][0]}`.toUpperCase():q.substring(0,2).toUpperCase()},T=UT((e==null?void 0:e.page_template)||"default"),I=(e==null?void 0:e.recipient_name)||null,A=T.headerText(I),$=`https://dashboard.relevelup.com/share/video/${t}`;if(a)return r.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:r.jsx(sn,{className:"h-8 w-8 animate-spin text-primary"})});if(m||!e)return r.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:r.jsx(Ye,{className:"max-w-md w-full",children:r.jsxs(Je,{className:"py-12 text-center",children:[r.jsx(Gi,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Video Not Found"}),r.jsx("p",{className:"text-muted-foreground",children:m||"This video is no longer available."})]})})});const F=T.id!=="default";return r.jsxs(r.Fragment,{children:[r.jsxs(Mg,{children:[r.jsx("title",{children:A}),r.jsx("meta",{name:"description",content:T.subText}),r.jsx("meta",{property:"og:title",content:A}),r.jsx("meta",{property:"og:description",content:T.subText}),r.jsx("meta",{property:"og:type",content:"video.other"}),r.jsx("meta",{property:"og:url",content:$}),e.preview_url&&r.jsx("meta",{property:"og:image",content:e.preview_url}),!e.preview_url&&e.thumbnail_url&&r.jsx("meta",{property:"og:image",content:e.thumbnail_url}),e.playback_url&&r.jsxs(r.Fragment,{children:[r.jsx("meta",{property:"og:video",content:e.playback_url}),r.jsx("meta",{property:"og:video:type",content:"text/html"}),r.jsx("meta",{property:"og:video:width",content:"1280"}),r.jsx("meta",{property:"og:video:height",content:"720"})]}),r.jsx("meta",{name:"twitter:card",content:"player"}),r.jsx("meta",{name:"twitter:title",content:A}),r.jsx("meta",{name:"twitter:description",content:T.subText}),e.preview_url&&r.jsx("meta",{name:"twitter:image",content:e.preview_url}),e.playback_url&&r.jsxs(r.Fragment,{children:[r.jsx("meta",{name:"twitter:player",content:e.playback_url}),r.jsx("meta",{name:"twitter:player:width",content:"1280"}),r.jsx("meta",{name:"twitter:player:height",content:"720"})]})]}),r.jsxs("div",{className:zt("min-h-screen flex items-center justify-center p-4 bg-gradient-to-b relative",T.gradientClasses),children:[F&&T.decorativeElement,r.jsxs("div",{className:"max-w-2xl w-full space-y-6 relative z-10",children:[F&&r.jsxs("div",{className:"text-center py-4 animate-fade-in",children:[r.jsx("div",{className:"flex justify-center mb-3",children:r.jsx("div",{className:zt("w-14 h-14 rounded-full flex items-center justify-center",T.id==="birthday"&&"bg-amber-100 text-amber-600 dark:bg-amber-900/50 dark:text-amber-400",T.id==="home_anniversary"&&"bg-teal-100 text-teal-600 dark:bg-teal-900/50 dark:text-teal-400",T.id==="valentines_day"&&"bg-rose-100 text-rose-600 dark:bg-rose-900/50 dark:text-rose-400",T.id==="groundhog_day"&&"bg-amber-100 text-amber-600 dark:bg-amber-900/50 dark:text-amber-400",T.id==="under_contract"&&"bg-emerald-100 text-emerald-600 dark:bg-emerald-900/50 dark:text-emerald-400"),children:r.jsx("div",{className:"scale-150",children:T.icon})})}),r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold mb-2",children:A}),r.jsx("p",{className:"text-muted-foreground",children:T.subText})]}),s&&r.jsxs("div",{className:"flex items-center gap-4 p-4 bg-card/90 backdrop-blur-sm rounded-lg border shadow-sm",children:[r.jsxs(Li,{className:"h-14 w-14 border-2 border-primary/20",children:[r.jsx(Io,{src:o||void 0,alt:s.name||"Agent"}),r.jsx(Oi,{className:"bg-primary/10 text-primary font-semibold",children:S(s.name)})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:F?"A special video from":"A personal video from"}),r.jsx("h2",{className:"text-lg font-semibold truncate",children:s.name||"Your Agent"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Your Real Estate Professional"})]}),r.jsxs("div",{className:"flex gap-2 shrink-0",children:[s.phone&&r.jsx(te,{variant:"outline",size:"icon",asChild:!0,className:"h-10 w-10",children:r.jsx("a",{href:`tel:${s.phone}`,"aria-label":"Call agent",children:r.jsx(Wa,{className:"h-4 w-4"})})}),s.email&&r.jsx(te,{variant:"outline",size:"icon",asChild:!0,className:"h-10 w-10",children:r.jsx("a",{href:`mailto:${s.email}`,"aria-label":"Email agent",children:r.jsx(di,{className:"h-4 w-4"})})})]})]}),r.jsx(Ye,{className:"overflow-hidden shadow-lg",children:v&&e.playback_url?r.jsx("div",{className:"relative w-full",style:{paddingBottom:"56.25%"},children:r.jsx("iframe",{src:C(e.playback_url),title:e.title||"Video message",className:"absolute top-0 left-0 w-full h-full",style:{border:0},allow:"accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0})}):r.jsxs("div",{className:"relative aspect-video bg-muted cursor-pointer group",onClick:()=>w(!0),children:[e.preview_url||e.thumbnail_url?r.jsx("img",{src:e.preview_url||e.thumbnail_url||"",alt:e.title?`${e.title} video preview`:"Video message preview",className:"w-full h-full object-cover",onError:q=>{var K;q.currentTarget.style.display="none";const W=(K=q.currentTarget.parentElement)==null?void 0:K.querySelector(".video-fallback");W&&(W.style.display="flex")}}):null,r.jsx("div",{className:"video-fallback w-full h-full items-center justify-center bg-gradient-to-br from-primary/20 to-primary/5",style:{display:e.preview_url||e.thumbnail_url?"none":"flex"},children:r.jsx(Gi,{className:"h-16 w-16 text-primary/50"})}),r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/30 group-hover:bg-black/40 transition-colors",children:r.jsx("div",{className:"w-20 h-20 rounded-full bg-white/90 flex items-center justify-center shadow-lg transform group-hover:scale-105 transition-transform",children:r.jsx(wc,{className:"h-10 w-10 text-primary ml-1"})})}),e.duration_seconds&&r.jsx("div",{className:"absolute bottom-3 right-3 bg-black/70 text-white text-sm px-2 py-1 rounded",children:k(e.duration_seconds)})]})}),!F&&r.jsxs("div",{className:"text-center",children:[r.jsx("h1",{className:"text-2xl font-bold",children:e.title||"Video Message"}),r.jsx("p",{className:"text-muted-foreground mt-2",children:v?"Enjoy the video!":"Click to play the video"})]}),!v&&r.jsx("div",{className:"flex justify-center",children:r.jsxs(te,{size:"lg",onClick:()=>w(!0),className:"gap-2",children:[r.jsx(wc,{className:"h-5 w-5"}),"Watch Video"]})}),r.jsx(Cut,{shareToken:t,agentName:(s==null?void 0:s.name)||null,hasContact:!!e.contact_id})]})]})]})}function Lut(){return P.useEffect(()=>(document.body.classList.add("video-landing-page"),()=>{document.body.classList.remove("video-landing-page")}),[]),r.jsx(oJe,{})}function Out(){const{token:t}=dd();return P.useEffect(()=>{if(!t)return;const e=`https://relzejiswnotikjgvjhz.supabase.co/functions/v1/video-og-image?token=${t}`;window.location.replace(e)},[t]),r.jsx("main",{className:"min-h-screen bg-background flex items-center justify-center",children:r.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[r.jsx(sn,{className:"h-5 w-5 animate-spin"}),r.jsx("span",{children:"Loading video preview…"})]})})}const Dut={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},Rut={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},FN={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function Fut(){var se,xe,ie,me;const{slugOrId:t}=dd(),[e]=Ed(),{data:n,isLoading:s}=zPe(t||""),i=BPe(),o=pst(),c=e.get("ref"),[a,f]=P.useState(""),[m,y]=P.useState(""),[v,w]=P.useState(""),[k,C]=P.useState(""),[S,T]=P.useState(!1),[I,A]=P.useState(!1),[D,$]=P.useState(null),[F,q]=P.useState(!1);P.useEffect(()=>{c&&o.mutate(c)},[c]);const W=fe=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(fe),K=async fe=>{if(fe.preventDefault(),!(!a.trim()||!v.trim()||!n)){T(!0);try{await i.mutateAsync({listingId:n.id,agentId:n.agent_id,firstName:a.trim(),lastName:m.trim(),email:v.trim(),phone:k.trim(),shareToken:c}),A(!0),Ge.success("Thanks! The agent will be in touch soon.")}catch(ve){console.error("Lead submission error:",ve),Ge.error(`Failed to submit: ${ve.message||"Please try again"}`)}finally{T(!1)}}},Z=(n==null?void 0:n.photos)||[],re=Z.find(fe=>fe.is_primary)||Z[0],he=()=>{D!==null&&$(D===0?Z.length-1:D-1)},ue=()=>{D!==null&&$(D===Z.length-1?0:D+1)};if(s)return r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"border-b bg-card",children:r.jsx("div",{className:"container mx-auto px-4 py-4",children:r.jsx(Gr,{className:"h-8 w-32"})})}),r.jsxs("div",{className:"container mx-auto px-4 py-8",children:[r.jsx(Gr,{className:"h-10 w-48 mb-6"}),r.jsx(Gr,{className:"aspect-video mb-6"}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"md:col-span-2 space-y-4",children:[r.jsx(Gr,{className:"h-12 w-48"}),r.jsx(Gr,{className:"h-6 w-full"}),r.jsx(Gr,{className:"h-6 w-3/4"})]}),r.jsx(Gr,{className:"h-64"})]})]})]});if(!n)return r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"border-b bg-card",children:r.jsx("div",{className:"container mx-auto px-4 py-4",children:r.jsx(ao,{to:"/public/listings",className:"flex items-center gap-2",children:r.jsx("img",{src:PA,alt:"LevelUp",className:"h-8"})})})}),r.jsxs("div",{className:"container mx-auto px-4 py-16 text-center",children:[r.jsx(Hi,{className:"h-16 w-16 mx-auto text-muted-foreground mb-4"}),r.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Listing Not Found"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"This listing may no longer be available."}),r.jsx(te,{asChild:!0,children:r.jsx(ao,{to:"/public/listings",children:"Browse All Listings"})})]})]});const Ne=n.property_address?`${n.property_address} - ${n.city}, ${n.state}`:`${n.city}, ${n.state} Home for Sale`;return r.jsxs(r.Fragment,{children:[r.jsxs(Mg,{children:[r.jsxs("title",{children:[Ne," | LevelUp Listings"]}),r.jsx("meta",{name:"description",content:`${W(n.price)} - ${n.bedrooms||""}BD ${n.bathrooms||""}BA ${n.square_footage?n.square_footage.toLocaleString()+" sqft":""} ${FN[n.property_type]} in ${n.city}, ${n.state}. ${((se=n.description)==null?void 0:se.slice(0,150))||""}`}),r.jsx("link",{rel:"canonical",href:`https://listings.relevelup.com/${n.slug||n.id}`}),r.jsx("meta",{property:"og:title",content:Ne}),r.jsx("meta",{property:"og:description",content:`${W(n.price)} - ${n.bedrooms||""}BD ${n.bathrooms||""}BA ${FN[n.property_type]} in ${n.city}, ${n.state}. View photos, details, and contact the listing agent.`}),r.jsx("meta",{property:"og:type",content:"website"}),r.jsx("meta",{property:"og:url",content:`https://listings.relevelup.com/${n.slug||n.id}`}),re&&r.jsx("meta",{property:"og:image",content:re.photo_url}),re&&r.jsx("meta",{property:"og:image:alt",content:`${n.property_address||n.city} - ${FN[n.property_type]} for sale`}),r.jsx("meta",{property:"og:site_name",content:"LevelUp Listings"}),r.jsx("meta",{property:"og:locale",content:"en_US"}),r.jsx("meta",{name:"twitter:card",content:"summary_large_image"}),r.jsx("meta",{name:"twitter:title",content:Ne}),r.jsx("meta",{name:"twitter:description",content:`${W(n.price)} - ${n.bedrooms||""}BD ${n.bathrooms||""}BA in ${n.city}, ${n.state}`}),re&&r.jsx("meta",{name:"twitter:image",content:re.photo_url}),r.jsx("meta",{name:"robots",content:"index, follow"}),r.jsx("meta",{name:"geo.region",content:`US-${n.state}`}),r.jsx("meta",{name:"geo.placename",content:n.city}),r.jsx("script",{type:"application/ld+json",children:JSON.stringify({"@context":"https://schema.org","@type":"RealEstateListing",name:n.property_address||`${n.city}, ${n.state} Home`,description:n.description||`${FN[n.property_type]} for sale in ${n.city}, ${n.state}`,url:`https://listings.relevelup.com/${n.slug||n.id}`,datePosted:n.created_at,image:Z.map(fe=>fe.photo_url),address:{"@type":"PostalAddress",streetAddress:n.property_address||void 0,addressLocality:n.city,addressRegion:n.state,addressCountry:"US"},geo:n.neighborhood?{"@type":"GeoCoordinates",name:n.neighborhood}:void 0,offers:{"@type":"Offer",price:n.price,priceCurrency:"USD",availability:n.status==="sold"?"https://schema.org/SoldOut":n.status==="under_contract"?"https://schema.org/LimitedAvailability":"https://schema.org/InStock"},numberOfRooms:n.bedrooms||void 0,numberOfBathroomsTotal:n.bathrooms||void 0,floorSize:n.square_footage?{"@type":"QuantitativeValue",value:n.square_footage,unitCode:"FTK"}:void 0,yearBuilt:n.year_built||void 0,broker:n.agent?{"@type":"RealEstateAgent",name:n.agent.name,email:n.agent.email,worksFor:(xe=n.agent.brokerage)!=null&&xe.name?{"@type":"RealEstateAgent",name:n.agent.brokerage.name}:void 0}:void 0})})]}),r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"border-b bg-card sticky top-0 z-50",children:r.jsx("div",{className:"container mx-auto px-4 py-4",children:r.jsx("div",{className:"flex items-center justify-between",children:r.jsx(ao,{to:"/public/listings",className:"flex items-center gap-2",children:r.jsx("img",{src:PA,alt:"LevelUp",className:"h-8"})})})})}),r.jsxs("div",{className:"container mx-auto px-4 py-6",children:[r.jsxs(ao,{to:"/public/listings",className:"inline-flex items-center text-muted-foreground hover:text-foreground mb-6",children:[r.jsx(Va,{className:"h-4 w-4 mr-2"}),"Back to Listings"]}),Z.length>0&&r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-8",children:[r.jsx("div",{className:"md:col-span-2",children:r.jsx("div",{className:"aspect-[16/10] rounded-lg overflow-hidden bg-muted cursor-pointer",onClick:()=>$(0),children:r.jsx("img",{src:re==null?void 0:re.photo_url,alt:`${n.property_address||n.city+", "+n.state} - ${FN[n.property_type]} main photo`,className:"w-full h-full object-cover hover:scale-105 transition-transform duration-300"})})}),r.jsx("div",{className:"grid grid-cols-2 gap-2",children:Z.slice(1,5).map((fe,ve)=>r.jsxs("div",{className:"aspect-square rounded-lg overflow-hidden bg-muted cursor-pointer relative",onClick:()=>$(ve+1),children:[r.jsx("img",{src:fe.photo_url,alt:`${n.property_address||n.city} - Photo ${ve+2} of ${Z.length}`,className:"w-full h-full object-cover hover:scale-105 transition-transform duration-300"}),ve===3&&Z.length>5&&r.jsxs("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center text-white font-semibold",children:["+",Z.length-5," more"]})]},fe.id))})]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-8",children:[r.jsxs("div",{className:"md:col-span-2 space-y-6",children:[r.jsxs("div",{children:[r.jsx("div",{className:"flex items-center gap-2 mb-3",children:r.jsx(Rt,{className:`${Dut[n.status]} text-white border-0`,children:Rut[n.status]})}),r.jsx("h1",{className:"text-4xl font-bold text-primary mb-2",children:W(n.price)}),n.property_address&&r.jsx("p",{className:"text-xl font-medium",children:n.property_address}),r.jsxs("p",{className:"text-muted-foreground flex items-center gap-1",children:[r.jsx(yl,{className:"h-4 w-4"}),n.city,", ",n.state,n.neighborhood&&` • ${n.neighborhood}`]})]}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4 py-4 border-y",children:[n.bedrooms&&r.jsxs("div",{className:"text-center",children:[r.jsx(Of,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:n.bedrooms}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Beds"})]}),n.bathrooms&&r.jsxs("div",{className:"text-center",children:[r.jsx(Lf,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:n.bathrooms}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Baths"})]}),n.square_footage&&r.jsxs("div",{className:"text-center",children:[r.jsx(im,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:n.square_footage.toLocaleString()}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Sq Ft"})]}),n.year_built&&r.jsxs("div",{className:"text-center",children:[r.jsx(li,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:n.year_built}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Built"})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(Rt,{variant:"secondary",children:[r.jsx(ra,{className:"h-3 w-3 mr-1"}),FN[n.property_type]]}),n.lot_size&&r.jsxs(Rt,{variant:"secondary",children:["Lot: ",n.lot_size]}),n.has_hoa&&r.jsx(Rt,{variant:"secondary",children:"HOA"})]}),n.description&&r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold mb-2",children:"About This Property"}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:n.description})]}),n.agent_notes&&n.agent_notes_public&&r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Agent Notes"}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:n.agent_notes})]}),n.mls_link&&r.jsx(te,{variant:"outline",asChild:!0,children:r.jsxs("a",{href:n.mls_link,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(Fs,{className:"h-4 w-4 mr-2"}),"View on MLS"]})})]})]}),r.jsxs("div",{className:"space-y-6",children:[n.video&&n.video.playback_url&&r.jsx(Ye,{className:"overflow-hidden bg-gradient-to-br from-primary/5 to-primary/10 border-primary/20",children:r.jsxs(Je,{className:"p-0",children:[r.jsxs("div",{className:"relative aspect-video bg-muted cursor-pointer group",onClick:()=>q(!0),children:[n.video.thumbnail_url?r.jsx("img",{src:n.video.thumbnail_url,alt:"Video thumbnail",className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center bg-gradient-to-br from-primary/20 to-primary/30",children:r.jsx(Gi,{className:"h-12 w-12 text-primary"})}),r.jsx("div",{className:"absolute inset-0 bg-black/30 group-hover:bg-black/40 transition-colors flex items-center justify-center",children:r.jsx("div",{className:"h-16 w-16 rounded-full bg-white/90 group-hover:bg-white flex items-center justify-center transition-colors shadow-lg",children:r.jsx(wc,{className:"h-8 w-8 text-primary fill-primary ml-1"})})})]}),r.jsxs("div",{className:"p-4",children:[r.jsxs(te,{onClick:()=>q(!0),className:"w-full gap-2",size:"lg",children:[r.jsx(wc,{className:"h-4 w-4"}),"Watch Video Tour"]}),n.video.title&&r.jsx("p",{className:"text-xs text-muted-foreground mt-2 text-center truncate",children:n.video.title})]})]})}),n.agent&&r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsxs(Yt,{className:"text-lg flex items-center gap-2",children:[r.jsx(jc,{className:"h-5 w-5"}),"Listing Agent"]})}),r.jsxs(Je,{children:[r.jsx("p",{className:"font-semibold text-lg",children:n.agent.name}),((ie=n.agent.brokerage)==null?void 0:ie.name)&&r.jsx("p",{className:"text-sm text-muted-foreground",children:n.agent.brokerage.name})]})]}),r.jsxs(Ye,{className:"border-primary",children:[r.jsx(Ht,{children:r.jsx(Yt,{className:"text-lg",children:"Interested in this property?"})}),r.jsx(Je,{children:I?r.jsxs("div",{className:"text-center py-4",children:[r.jsx("div",{className:"h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center mx-auto mb-3",children:r.jsx(di,{className:"h-6 w-6 text-primary"})}),r.jsx("p",{className:"font-medium",children:"Thanks for your interest!"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"The listing agent will contact you soon."})]}):r.jsxs("form",{onSubmit:K,className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"firstName",children:"First Name *"}),r.jsx(yt,{id:"firstName",type:"text",placeholder:"John",value:a,onChange:fe=>f(fe.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"lastName",children:"Last Name"}),r.jsx(yt,{id:"lastName",type:"text",placeholder:"Doe",value:m,onChange:fe=>y(fe.target.value)})]})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"email",children:"Email *"}),r.jsx(yt,{id:"email",type:"email",placeholder:"you@example.com",value:v,onChange:fe=>w(fe.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"phone",children:"Phone"}),r.jsx(yt,{id:"phone",type:"tel",placeholder:"(555) 123-4567",value:k,onChange:fe=>C(fe.target.value)})]}),r.jsx(te,{type:"submit",className:"w-full",disabled:S,children:S?"Submitting...":"Get More Info"}),r.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"The listing agent will reach out to you directly."})]})})]})]})]})]}),r.jsx($r,{open:D!==null,onOpenChange:()=>$(null),children:r.jsxs(zr,{className:"max-w-5xl p-0 bg-black/95",children:[r.jsx(Zr,{className:"sr-only",children:r.jsx(Kr,{children:"Photo Gallery"})}),r.jsx("button",{onClick:()=>$(null),className:"absolute right-4 top-4 z-50 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(Ms,{className:"h-5 w-5"})}),D!==null&&Z[D]&&r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:Z[D].photo_url,alt:`Photo ${D+1}`,className:"w-full max-h-[80vh] object-contain"}),Z.length>1&&r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:he,className:"absolute left-4 top-1/2 -translate-y-1/2 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(sd,{className:"h-6 w-6"})}),r.jsx("button",{onClick:ue,className:"absolute right-4 top-1/2 -translate-y-1/2 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(Ha,{className:"h-6 w-6"})}),r.jsxs("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 text-white bg-black/50 px-3 py-1 rounded-full text-sm",children:[D+1," / ",Z.length]})]})]})]})}),r.jsx($r,{open:F,onOpenChange:q,children:r.jsxs(zr,{className:"max-w-4xl p-0 bg-black overflow-hidden",children:[r.jsx(Zr,{className:"sr-only",children:r.jsx(Kr,{children:"Video Tour"})}),r.jsx("button",{onClick:()=>q(!1),className:"absolute right-4 top-4 z-50 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(Ms,{className:"h-5 w-5"})}),((me=n==null?void 0:n.video)==null?void 0:me.playback_url)&&r.jsx("div",{className:"aspect-video w-full",children:r.jsx("iframe",{src:n.video.playback_url,className:"w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})]})}),r.jsx("footer",{className:"border-t py-8 mt-16",children:r.jsxs("div",{className:"container mx-auto px-4 text-center text-sm text-muted-foreground",children:[r.jsxs("p",{children:["© ",new Date().getFullYear()," LevelUp. All rights reserved."]}),r.jsx("p",{className:"mt-2",children:r.jsx("a",{href:"https://relevelup.com",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground",children:"relevelup.com"})})]})})]})]})}function y5({banners:t,autoPlayInterval:e=5e3,className:n}){const[s,i]=P.useState(0),[o,c]=P.useState(!1),a=P.useCallback(()=>{i(v=>(v+1)%t.length)},[t.length]),f=P.useCallback(()=>{i(v=>(v-1+t.length)%t.length)},[t.length]),m=P.useCallback(v=>{i(v)},[]);if(P.useEffect(()=>{if(t.length<=1||o)return;const v=setInterval(a,e);return()=>clearInterval(v)},[t.length,o,e,a]),!t||t.length===0)return null;const y=t[s];return r.jsxs("div",{className:zt("relative w-full overflow-hidden rounded-xl",n),onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[r.jsxs("div",{className:"relative aspect-[21/9] md:aspect-[3/1] w-full",children:[r.jsxs("div",{className:"absolute inset-0 transition-opacity duration-500",children:[r.jsx("img",{src:y.image_url,alt:y.title,className:"w-full h-full object-cover"}),r.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/70 via-black/20 to-transparent"})]}),r.jsxs("div",{className:"absolute bottom-0 left-0 right-0 p-6 md:p-8 text-white",children:[r.jsx("h2",{className:"text-xl md:text-3xl font-bold mb-2 drop-shadow-lg",children:y.title}),y.description&&r.jsx("p",{className:"text-sm md:text-base text-white/90 mb-4 max-w-2xl drop-shadow",children:y.description}),y.link_url&&r.jsx("a",{href:y.link_url,target:"_blank",rel:"noopener noreferrer",className:"inline-block",children:r.jsx(te,{variant:"secondary",className:"bg-white/90 hover:bg-white text-foreground font-semibold",children:y.link_text||"Learn More"})})]}),t.length>1&&r.jsxs(r.Fragment,{children:[r.jsx(te,{variant:"ghost",size:"icon",className:zt("absolute left-2 top-1/2 -translate-y-1/2 bg-black/30 hover:bg-black/50 text-white rounded-full","opacity-0 transition-opacity",o&&"opacity-100"),onClick:f,children:r.jsx(sd,{className:"h-6 w-6"})}),r.jsx(te,{variant:"ghost",size:"icon",className:zt("absolute right-2 top-1/2 -translate-y-1/2 bg-black/30 hover:bg-black/50 text-white rounded-full","opacity-0 transition-opacity",o&&"opacity-100"),onClick:a,children:r.jsx(Ha,{className:"h-6 w-6"})})]})]}),t.length>1&&r.jsx("div",{className:"absolute bottom-3 left-1/2 -translate-x-1/2 flex gap-2",children:t.map((v,w)=>r.jsx("button",{onClick:()=>m(w),className:zt("w-2 h-2 rounded-full transition-all duration-300",w===s?"bg-white w-6":"bg-white/50 hover:bg-white/70"),"aria-label":`Go to slide ${w+1}`},w))})]})}function zut(t){const s=new Intl.DateTimeFormat("en-US",{timeZoneName:"short"}).formatToParts(t).find(i=>i.type==="timeZoneName");return(s==null?void 0:s.value)||""}function rye(t){const n=new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}).format(t),s=zut(t);return`${n} ${s}`}const mhe=t=>{const e=new Date,n=new Date(t),s=$Le(n,-15),i=lte(n,1);return XLe(e,{start:s,end:i})},But=({events:t,registrations:e,onNavigateToEvents:n})=>{const[s,i]=P.useState(new Date);P.useEffect(()=>{const y=setInterval(()=>{i(new Date)},6e4);return()=>clearInterval(y)},[]);const o=t.filter(y=>mhe(y.event_date));if(o.length===0)return null;const c=o[0],a=e.find(y=>y.event_id===c.id),f=(a==null?void 0:a.zoom_join_url)||c.zoom_link,m=!!a;return r.jsxs("div",{className:"relative mb-8 overflow-hidden rounded-xl bg-gradient-to-r from-red-500/10 via-red-500/5 to-primary/10 border border-red-500/30",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-red-500/5 to-transparent animate-pulse"}),r.jsx("div",{className:"relative p-4 sm:p-6",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"relative flex items-center justify-center",children:[r.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-red-500 opacity-75"}),r.jsx("span",{className:"relative flex h-3 w-3 rounded-full bg-red-500"})]}),r.jsxs("div",{className:"flex items-center gap-2 text-red-500 font-bold text-sm uppercase tracking-wider",children:[r.jsx(Hw,{className:"h-4 w-4"}),"Live Now"]})]}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"font-semibold text-lg text-foreground line-clamp-1",children:c.title}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Started at ",rye(new Date(c.event_date))]})]}),r.jsx("div",{className:"flex items-center gap-2",children:m?r.jsxs(te,{onClick:()=>window.open(f,"_blank"),className:"bg-red-500 hover:bg-red-600 text-white gap-2",children:[r.jsx(Fs,{className:"h-4 w-4"}),"Join Now"]}):r.jsxs(te,{variant:"outline",onClick:n,className:"border-red-500/50 text-red-500 hover:bg-red-500/10 gap-2",children:[r.jsx(hs,{className:"h-4 w-4"}),"Register & Join"]})})]})})]})};var nye="Progress",sye=100,[$ut]=Zl(nye),[Uut,qut]=$ut(nye),OOe=P.forwardRef((t,e)=>{const{__scopeProgress:n,value:s=null,max:i,getValueLabel:o=Vut,...c}=t;(i||i===0)&&!Jje(i)&&console.error(Hut(`${i}`,"Progress"));const a=Jje(i)?i:sye;s!==null&&!eke(s,a)&&console.error(Wut(`${s}`,"Progress"));const f=eke(s,a)?s:null,m=hte(f)?o(f,a):void 0;return r.jsx(Uut,{scope:n,value:f,max:a,children:r.jsx(On.div,{"aria-valuemax":a,"aria-valuemin":0,"aria-valuenow":hte(f)?f:void 0,"aria-valuetext":m,role:"progressbar","data-state":FOe(f,a),"data-value":f??void 0,"data-max":a,...c,ref:e})})});OOe.displayName=nye;var DOe="ProgressIndicator",ROe=P.forwardRef((t,e)=>{const{__scopeProgress:n,...s}=t,i=qut(DOe,n);return r.jsx(On.div,{"data-state":FOe(i.value,i.max),"data-value":i.value??void 0,"data-max":i.max,...s,ref:e})});ROe.displayName=DOe;function Vut(t,e){return`${Math.round(t/e*100)}%`}function FOe(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function hte(t){return typeof t=="number"}function Jje(t){return hte(t)&&!isNaN(t)&&t>0}function eke(t,e){return hte(t)&&!isNaN(t)&&t<=e&&t>=0}function Hut(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${sye}\`.`}function Wut(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be: - a positive number - less than the value passed to \`max\` (or ${sye} if no \`max\` prop is set) - \`null\` or \`undefined\` if the progress is indeterminate. Defaulting to \`null\`.`}var zOe=OOe,Gut=ROe;const zc=P.forwardRef(({className:t,value:e,...n},s)=>r.jsx(zOe,{ref:s,className:zt("relative h-4 w-full overflow-hidden rounded-full bg-secondary",t),...n,children:r.jsx(Gut,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));zc.displayName=zOe.displayName;function Kut(){const{user:t,isBrokerageManager:e}=Fr(),[n,s]=P.useState([]),[i,o]=P.useState([]),[c,a]=P.useState(!1),[f,m]=P.useState(!0),y=e?"brokerage_manager":"agent";P.useEffect(()=>{if(!(t!=null&&t.id)){m(!1);return}v()},[t==null?void 0:t.id,y]);const v=async()=>{if(t!=null&&t.id)try{const{data:$,error:F}=await ee.from("onboarding_checklist_items").select("*").eq("target_role",y).eq("is_active",!0).order("sort_order");if(F)throw F;const{data:q,error:W}=await ee.from("onboarding_checklist_progress").select("item_id, completed_at").eq("user_id",t.id);if(W)throw W;const{data:K,error:Z}=await ee.from("onboarding_checklist_dismissed").select("id").eq("user_id",t.id).maybeSingle();if(Z)throw Z;s($||[]),o(q||[]),a(!!K),$&&$.length>0&&await w($,q||[])}catch($){console.error("Error fetching checklist data:",$)}finally{m(!1)}},w=async($,F)=>{var Re,$e;if(!(t!=null&&t.id))return;const q=F.map(Pe=>Pe.item_id),W=$.filter(Pe=>!q.includes(Pe.id));if(W.length===0)return;const[K,Z,re,he,ue,Ne,se,xe,ie,me,fe,ve,Ie,Se]=await Promise.all([ee.from("profiles").select("brokerage_id").eq("id",t.id).maybeSingle(),ee.from("resource_shares").select("id",{count:"exact",head:!0}).eq("sender_id",t.id),ee.from("community_posts").select("id",{count:"exact",head:!0}).eq("user_id",t.id),ee.from("event_registrations").select("id",{count:"exact",head:!0}).eq("user_id",t.id),ee.from("content_engagement_logs").select("id",{count:"exact",head:!0}).eq("user_id",t.id).eq("resource_type","template"),ee.from("content_engagement_logs").select("id",{count:"exact",head:!0}).eq("user_id",t.id).eq("resource_type","academy_video"),ee.from("content_engagement_logs").select("id",{count:"exact",head:!0}).eq("user_id",t.id).eq("resource_type","toolbox"),ee.from("activity_logs").select("id",{count:"exact",head:!0}).eq("user_id",t.id),ee.from("innercircle_contacts").select("id",{count:"exact",head:!0}).eq("owner_user_id",t.id),ee.from("agent_videos").select("id",{count:"exact",head:!0}).eq("owner_user_id",t.id),ee.from("contact_touch_logs").select("id",{count:"exact",head:!0}).eq("owner_user_id",t.id),ee.from("scorecard_transactions").select("id",{count:"exact",head:!0}).eq("owner_user_id",t.id),ee.from("listings").select("id",{count:"exact",head:!0}).eq("agent_id",t.id),ee.from("innercircle_contacts").select("id").eq("owner_user_id",t.id)]),oe={},ae=(Re=K.data)==null?void 0:Re.brokerage_id;oe.share_resource=(Z.count||0)>0,oe.post_community=(re.count||0)>0,oe.register_event=(he.count||0)>0,oe.view_template=(ue.count||0)>0,oe.watch_academy=(Ne.count||0)>0,oe.use_toolbox=(se.count||0)>0,oe.launch_app=(xe.count||0)>0,oe.add_contact=(ie.count||0)>0,oe.create_video=(me.count||0)>0,oe.complete_touch=(fe.count||0)>0,oe.add_transaction=(ve.count||0)>0,oe.add_listing=(Ie.count||0)>0;const je=(($e=Se.data)==null?void 0:$e.map(Pe=>Pe.id))||[],Me=[];ae?Me.push(ee.from("profiles").select("id").eq("brokerage_id",ae).neq("id",t.id).then(Pe=>{var Ae;oe.add_agent=(((Ae=Pe.data)==null?void 0:Ae.length)||0)>0})):oe.add_agent=!1,je.length>0?(Me.push(ee.from("contact_plan_cycles").select("id",{count:"exact",head:!0}).in("contact_id",je).then(Pe=>{oe.add_plan=(Pe.count||0)>0})),Me.push(ee.from("contact_popby_settings").select("id",{count:"exact",head:!0}).in("contact_id",je).then(Pe=>{oe.schedule_popby=(Pe.count||0)>0}))):(oe.add_plan=!1,oe.schedule_popby=!1),await Promise.all(Me);const Ue=W.filter(Pe=>oe[Pe.action_type]);if(Ue.length>0){const Pe=Ue.map(nt=>({user_id:t.id,item_id:nt.id})),{error:Ae}=await ee.from("onboarding_checklist_progress").upsert(Pe,{onConflict:"user_id,item_id",ignoreDuplicates:!0});if(!Ae){const nt=Ue.map(Te=>({item_id:Te.id,completed_at:new Date().toISOString()}));o(Te=>[...Te,...nt])}}},k=async $=>{if(t!=null&&t.id)try{const{error:F}=await ee.from("onboarding_checklist_progress").insert({user_id:t.id,item_id:$});if(F)throw F;o(q=>[...q,{item_id:$,completed_at:new Date().toISOString()}])}catch(F){console.error("Error marking item complete:",F)}},C=async()=>{if(t!=null&&t.id)try{const{error:$}=await ee.from("onboarding_checklist_dismissed").insert({user_id:t.id});if($)throw $;a(!0)}catch($){console.error("Error dismissing checklist:",$)}},S=i.length,T=n.length,I=T>0&&S>=T,A=T>0?S/T*100:0;return{items:n,progress:i,isDismissed:c,loading:f,completedCount:S,totalCount:T,isComplete:I,progressPercentage:A,isItemComplete:$=>i.some(F=>F.item_id===$),markComplete:k,dismiss:C,refetch:v}}const Zut={add_agent:r.jsx(hs,{className:"h-4 w-4"}),share_resource:r.jsx(Kd,{className:"h-4 w-4"}),post_community:r.jsx(Wl,{className:"h-4 w-4"}),register_event:r.jsx(li,{className:"h-4 w-4"}),view_template:r.jsx(Yx,{className:"h-4 w-4"}),watch_academy:r.jsx(W0,{className:"h-4 w-4"}),use_toolbox:r.jsx(Iy,{className:"h-4 w-4"}),launch_app:r.jsx(sT,{className:"h-4 w-4"})};function Yut(){const{items:t,isDismissed:e,loading:n,completedCount:s,totalCount:i,isComplete:o,progressPercentage:c,isItemComplete:a,markComplete:f,dismiss:m}=Kut(),[y,v]=P.useState(!0);return n||e||i===0||o?null:r.jsxs(Ye,{className:"mb-6 border-primary/20 bg-gradient-to-r from-primary/5 to-transparent",children:[r.jsxs(Ht,{className:"pb-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(cg,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Yt,{className:"text-lg",children:"Get Started with LevelUp"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Complete these steps to make the most of your membership"})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>v(!y),className:"h-8 w-8 p-0",children:y?r.jsx(U0,{className:"h-4 w-4"}):r.jsx(uh,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"sm",onClick:m,className:"h-8 w-8 p-0 text-muted-foreground hover:text-foreground",children:r.jsx(Ms,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"mt-4",children:[r.jsxs("div",{className:"flex items-center justify-between text-sm mb-2",children:[r.jsx("span",{className:"text-muted-foreground",children:"Progress"}),r.jsxs("span",{className:"font-medium",children:[s," of ",i," complete"]})]}),r.jsx(zc,{value:c,className:"h-2"})]})]}),y&&r.jsx(Je,{className:"pt-0",children:r.jsx("div",{className:"space-y-3",children:t.map(w=>{const k=a(w.id);return r.jsxs("div",{className:zt("flex items-start gap-3 p-3 rounded-lg transition-colors",k?"bg-muted/50":"bg-background hover:bg-muted/30 cursor-pointer"),onClick:()=>!k&&f(w.id),children:[r.jsx("div",{className:"mt-0.5",children:k?r.jsx(io,{className:"h-5 w-5 text-primary"}):r.jsx(Mu,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-muted-foreground",children:Zut[w.action_type]||r.jsx(Mu,{className:"h-4 w-4"})}),r.jsx("span",{className:zt("font-medium",k&&"line-through text-muted-foreground"),children:w.title})]}),w.description&&r.jsx("p",{className:zt("text-sm text-muted-foreground mt-1",k&&"line-through"),children:w.description})]})]},w.id)})})})]})}const Ag=()=>rr({queryKey:["relationship-types"],queryFn:async()=>{const{data:t,error:e}=await ee.from("relationship_types").select("*").order("sort_order");if(e)throw e;return t}}),mm=t=>{const{user:e}=Fr(),n=1e3,s=async i=>{const o=[];let c=0;for(;;){const{data:a,error:f}=await i.range(c,c+n-1);if(f)throw f;const m=a??[];if(o.push(...m),m.length{let i=ee.from("innercircle_contacts").select(` *, tags:innercircle_contact_tags( id, contact_id, relationship_type_id, relationship_type:relationship_types(*) ) `).order("created_at",{ascending:!1}).order("first_name");return await s(i)},enabled:!!e})},Xut=t=>rr({queryKey:["innercircle-contact",t],queryFn:async()=>{const{data:e,error:n}=await ee.from("innercircle_contacts").select(` *, tags:innercircle_contact_tags( id, contact_id, relationship_type_id, relationship_type:relationship_types(*) ) `).eq("id",t).maybeSingle();if(n)throw n;return e},enabled:!!t}),BOe=()=>{const{user:t}=Fr();return rr({queryKey:["innercircle-contact-counts",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await ee.from("innercircle_contacts").select(` id, tags:innercircle_contact_tags(relationship_type_id) `);if(n)throw n;const s={};return e==null||e.forEach(i=>{var o;(o=i.tags)==null||o.forEach(c=>{s[c.relationship_type_id]=(s[c.relationship_type_id]||0)+1})}),s},enabled:!!t})},$Oe=()=>{const t=Xr(),{user:e}=Fr();return cr({mutationFn:async n=>{const{tagIds:s,...i}=n,o={...i,birthday:i.birthday||null,home_anniversary:i.home_anniversary||null,owner_user_id:e.id},{data:c,error:a}=await ee.from("innercircle_contacts").insert(o).select().single();if(a)throw a;if(s&&s.length>0){const{error:f}=await ee.from("innercircle_contact_tags").insert(s.map(m=>({contact_id:c.id,relationship_type_id:m})));if(f)throw f}return c},onSuccess:()=>{t.invalidateQueries({queryKey:["innercircle-contacts"]}),t.invalidateQueries({queryKey:["innercircle-contact-counts"]}),Wi({title:"Contact created successfully"})},onError:n=>{Wi({title:"Error creating contact",description:n.message,variant:"destructive"})}})},UOe=()=>{const t=Xr();return cr({mutationFn:async({id:e,...n})=>{const{tagIds:s,tags:i,...o}=n,c={...o,birthday:o.birthday||null,home_anniversary:o.home_anniversary||null},{data:a,error:f}=await ee.from("innercircle_contacts").update(c).eq("id",e).select().single();if(f)throw f;if(s!==void 0&&(await ee.from("innercircle_contact_tags").delete().eq("contact_id",e),s.length>0)){const{error:m}=await ee.from("innercircle_contact_tags").insert(s.map(y=>({contact_id:e,relationship_type_id:y})));if(m)throw m}return a},onSuccess:()=>{t.invalidateQueries({queryKey:["innercircle-contacts"]}),t.invalidateQueries({queryKey:["innercircle-contact"]}),t.invalidateQueries({queryKey:["innercircle-contact-counts"]}),Wi({title:"Contact updated successfully"})},onError:e=>{Wi({title:"Error updating contact",description:e.message,variant:"destructive"})}})},qOe=()=>{const t=Xr();return cr({mutationFn:async e=>{const{error:n}=await ee.from("innercircle_contacts").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["innercircle-contacts"]}),t.invalidateQueries({queryKey:["innercircle-contact-counts"]}),Wi({title:"Contact deleted successfully"})},onError:e=>{Wi({title:"Error deleting contact",description:e.message,variant:"destructive"})}})},iye=()=>rr({queryKey:["action-types"],queryFn:async()=>{const{data:t,error:e}=await ee.from("action_types").select("*").order("sort_order");if(e)throw e;return t}}),Qut=t=>rr({queryKey:["action-scripts",t],queryFn:async()=>{let e=ee.from("action_scripts").select("*, action_type:action_types(*)");const{data:n,error:s}=await e;if(s)throw s;return n}}),Jut=()=>rr({queryKey:["touchpoint-plans"],queryFn:async()=>{const{data:t,error:e}=await ee.from("touchpoint_plans").select(` *, items:touchpoint_plan_items( *, action_type:action_types(*), default_script:action_scripts(*) ) `).order("name");if(e)throw e;return t}}),eht=()=>{const t=Xr(),{user:e}=Fr();return cr({mutationFn:async({name:n,description:s})=>{const{data:i,error:o}=await ee.from("touchpoint_plans").insert({name:n,description:s,owner_user_id:e.id,active:!0,is_template:!1}).select().single();if(o)throw o;return i},onSuccess:()=>{t.invalidateQueries({queryKey:["touchpoint-plans"]}),Wi({title:"Plan created successfully"})},onError:n=>{Wi({title:"Error creating plan",description:n.message,variant:"destructive"})}})},tht=()=>{const t=Xr(),{user:e}=Fr();return cr({mutationFn:async({sourcePlanId:n,newName:s})=>{const{data:i,error:o}=await ee.from("touchpoint_plans").select(` *, items:touchpoint_plan_items(*) `).eq("id",n).single();if(o)throw o;if(!i)throw new Error("Source plan not found");const{data:c,error:a}=await ee.from("touchpoint_plans").insert({name:s,description:i.description,owner_user_id:e.id,active:!0,is_template:!1}).select().single();if(a)throw a;if(i.items&&i.items.length>0){const f=i.items.map(y=>({plan_id:c.id,month_number:y.month_number,action_type_id:y.action_type_id,default_script_id:y.default_script_id,notes:y.notes})),{error:m}=await ee.from("touchpoint_plan_items").insert(f);if(m)throw m}return c},onSuccess:()=>{t.invalidateQueries({queryKey:["touchpoint-plans"]}),Wi({title:"Plan duplicated successfully",description:"You can now edit your copy of this plan."})},onError:n=>{Wi({title:"Error duplicating plan",description:n.message,variant:"destructive"})}})},rht=()=>{const t=Xr();return cr({mutationFn:async({id:e,name:n,description:s})=>{const{data:i,error:o}=await ee.from("touchpoint_plans").update({name:n,description:s}).eq("id",e).select().single();if(o)throw o;return i},onSuccess:()=>{t.invalidateQueries({queryKey:["touchpoint-plans"]}),Wi({title:"Plan updated successfully"})}})},nht=()=>{const t=Xr();return cr({mutationFn:async e=>{const{error:n}=await ee.from("touchpoint_plans").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["touchpoint-plans"]}),Wi({title:"Plan deleted successfully"})}})},sht=()=>{const t=Xr();return cr({mutationFn:async({planId:e,items:n})=>{if(await ee.from("touchpoint_plan_items").delete().eq("plan_id",e),n.length>0){const{error:s}=await ee.from("touchpoint_plan_items").insert(n.map(i=>({plan_id:e,month_number:i.month_number,action_type_id:i.action_type_id,default_script_id:i.default_script_id||null,notes:i.notes})));if(s)throw s}},onSuccess:()=>{t.invalidateQueries({queryKey:["touchpoint-plans"]}),Wi({title:"Plan schedule updated"})}})},iht=()=>{const t=Xr();return cr({mutationFn:async({actionTypeId:e,title:n,scriptBody:s,emailSubject:i,tone:o})=>{const{data:c,error:a}=await ee.from("action_scripts").insert({action_type_id:e,title:n,script_body:s,email_subject:i||null,tone:o||null,active:!0}).select().single();if(a)throw a;return c},onSuccess:()=>{t.invalidateQueries({queryKey:["action-scripts"]}),Wi({title:"Script created successfully"})},onError:e=>{Wi({title:"Error creating script",description:e.message,variant:"destructive"})}})},aht=()=>{const{user:t}=Fr();return rr({queryKey:["user-plan-enrollments",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await ee.from("user_plan_enrollments").select(` *, plan:touchpoint_plans(*), relationship_type:relationship_types(*) `);if(n)throw n;return e},enabled:!!t})},oht=()=>{const t=Xr(),{user:e}=Fr();return cr({mutationFn:async({planId:n,relationshipTypeId:s,active:i})=>{const{data:o}=await ee.from("user_plan_enrollments").select("id").eq("plan_id",n).eq("relationship_type_id",s).maybeSingle();if(o){const{error:c}=await ee.from("user_plan_enrollments").update({active:i}).eq("id",o.id);if(c)throw c}else if(i){const{error:c}=await ee.from("user_plan_enrollments").insert({owner_user_id:e.id,plan_id:n,relationship_type_id:s,active:!0,start_date:new Date().toISOString().split("T")[0]});if(c)throw c}},onSuccess:()=>{t.invalidateQueries({queryKey:["user-plan-enrollments"]}),Wi({title:"Plan enrollment updated"})}})},use=(t=7)=>{const{user:e}=Fr();return rr({queryKey:["contact-touch-logs",e==null?void 0:e.id,t],queryFn:async()=>{const n=new Date;n.setDate(n.getDate()-t);const{data:s,error:i}=await ee.from("contact_touch_logs").select(` *, contact:innercircle_contacts(*), action_type:action_types(*) `).gte("completed_at",n.toISOString()).order("completed_at",{ascending:!1});if(i)throw i;return s},enabled:!!e})},VOe=()=>{const{user:t}=Fr();return rr({queryKey:["contacts-last-touch",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await ee.from("contact_touch_logs").select("contact_id, completed_at").order("completed_at",{ascending:!1});if(n)throw n;const s={};return e==null||e.forEach(i=>{s[i.contact_id]||(s[i.contact_id]=i.completed_at)}),s},enabled:!!t})},lht=(t=90)=>{const{data:e}=mm(),{data:n}=VOe();if(!e||!n)return{contacts:[],count:0};const s=new Date;s.setDate(s.getDate()-t);const i=e.filter(o=>{const c=n[o.id];return c?new Date(c){const t=Xr(),{user:e}=Fr();return cr({mutationFn:async({contactId:n,actionTypeId:s,scriptUsedId:i,notes:o})=>{const{data:c,error:a}=await ee.from("contact_touch_logs").insert({owner_user_id:e.id,contact_id:n,action_type_id:s,script_used_id:i,notes:o,completed_at:new Date().toISOString()}).select().single();if(a)throw a;return c},onSuccess:()=>{t.invalidateQueries({queryKey:["contact-touch-logs"]}),t.invalidateQueries({queryKey:["contacts-last-touch"]}),t.invalidateQueries({queryKey:["today-actions"]}),Wi({title:"Action completed!"})}})},WOe="agentos_weekly_touch_goal",tke=20,fte=()=>{if(typeof window>"u")return tke;const t=localStorage.getItem(WOe);if(t){const e=parseInt(t,10);if(!isNaN(e)&&e>0)return e}return tke},GOe=t=>{localStorage.setItem(WOe,t.toString())},KOe=()=>{const{data:t}=use(7),e=new Date;e.setHours(0,0,0,0);const n=new Date(e);n.setDate(e.getDate()-e.getDay());const s=(t==null?void 0:t.filter(c=>new Date(c.completed_at)>=n).length)||0;let i=0;if(t&&t.length>0){const c=new Set(t.map(f=>new Date(f.completed_at).toDateString()));let a=new Date(e);for(;c.has(a.toDateString());)i++,a.setDate(a.getDate()-1)}const o=fte();return{actionsThisWeek:s,weeklyGoal:o,streak:i,progress:Math.min(s/o*100,100)}},cht=()=>{const{user:t}=Fr();return rr({queryKey:["contact-plan-cycles",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await ee.from("contact_plan_cycles").select(` *, contact:innercircle_contacts(*), plan:touchpoint_plans( *, items:touchpoint_plan_items( *, action_type:action_types(*), default_script:action_scripts(*) ) ) `);if(n)throw n;return e},enabled:!!t})},dht=()=>{const t=Xr(),{user:e}=Fr();return cr({mutationFn:async()=>{const{data:n}=await ee.from("user_plan_enrollments").select("*").eq("active",!0);if(!n||n.length===0)return;const{data:s}=await ee.from("innercircle_contacts").select(` id, tags:innercircle_contact_tags(relationship_type_id) `);if(!s)return;const{data:i}=await ee.from("contact_plan_cycles").select("contact_id, plan_id"),o=new Set((i==null?void 0:i.map(a=>`${a.contact_id}-${a.plan_id}`))||[]),c=[];for(const a of s)for(const f of a.tags||[]){const m=n.find(y=>y.relationship_type_id===f.relationship_type_id);m&&!o.has(`${a.id}-${m.plan_id}`)&&c.push({contact_id:a.id,plan_id:m.plan_id,relationship_type_id:f.relationship_type_id})}if(c.length>0){const{error:a}=await ee.from("contact_plan_cycles").insert(c);if(a)throw a}return c.length},onSuccess:n=>{t.invalidateQueries({queryKey:["contact-plan-cycles"]}),n&&n>0&&Wi({title:`${n} contact(s) enrolled in plans`})}})},ZOe=()=>{const{user:t}=Fr(),{data:e}=cht(),{data:n}=use(30);return rr({queryKey:["today-actions",t==null?void 0:t.id,e==null?void 0:e.length,n==null?void 0:n.length],queryFn:async()=>{var w;if(!e||e.length===0)return[];const s=new Date,i=[],o=new Date(s.getFullYear(),s.getMonth(),1),c=new Set((n==null?void 0:n.filter(k=>new Date(k.completed_at)>=o).map(k=>`${k.contact_id}-${k.action_type_id}`))||[]);for(const k of e){if(!((w=k.plan)!=null&&w.items)||k.plan.items.length===0||!k.contact)continue;const C=new Date(k.cycle_start_date),T=Math.floor((s.getTime()-C.getTime())/(30.44*24*60*60*1e3))%12+1,I=k.plan.items.find(A=>A.month_number===T);if(I&&I.action_type){const A=`${k.contact_id}-${I.action_type_id}`;if(!c.has(A)){const{data:D}=await ee.from("relationship_types").select("name").eq("id",k.relationship_type_id).single();i.push({contact:k.contact,actionType:I.action_type,script:I.default_script||void 0,planName:k.plan.name,relationshipTypeName:(D==null?void 0:D.name)||"",monthNumber:T})}}}const a=5,f=s.getDate(),m=i.sort((k,C)=>k.contact.first_name.localeCompare(C.contact.first_name)),y=(f-1)%Math.max(1,m.length);return[...m.slice(y),...m.slice(0,y)].slice(0,a)},enabled:!!t&&!!e})};function uht(){const t=es(),{data:e,isLoading:n}=ZOe(),{data:s}=mm(),i=KOe(),[o,c]=P.useState(fte()),[a,f]=P.useState(""),[m,y]=P.useState(!1);P.useEffect(()=>{c(fte())},[]);const v=()=>{const q=parseInt(a,10);if(isNaN(q)||q<1){Wi({title:"Invalid goal",description:"Please enter a number greater than 0",variant:"destructive"});return}c(q),GOe(q),y(!1),Wi({title:"Goal updated",description:`Weekly touch goal set to ${q}`})},w=()=>{f(o.toString()),y(!0)},k=Kh(new Date),C=Rl(k,7),S=q=>{if(!q)return null;const W=new Date(q);return new Date(k.getFullYear(),W.getMonth(),W.getDate())},T=(s==null?void 0:s.map(q=>{const W=S(q.birthday),K=S(q.home_anniversary),Z=[];return W&&W>=k&&W<=C&&Z.push({contact:q,type:"birthday",date:W,isToday:Vl(W,k)}),K&&K>=k&&K<=C&&Z.push({contact:q,type:"anniversary",date:K,isToday:Vl(K,k)}),Z}).flat().sort((q,W)=>q.date.getTime()-W.date.getTime()).slice(0,3))||[],I=(s==null?void 0:s.filter(q=>{const W=S(q.birthday),K=S(q.home_anniversary);return W&&Vl(W,k)||K&&Vl(K,k)}).length)||0,A=(e==null?void 0:e.length)||0,D=I+A,$=(i==null?void 0:i.actionsThisWeek)||0,F=(i==null?void 0:i.streak)||0;return n?r.jsx(Ye,{className:"bg-gradient-to-br from-primary/5 via-primary/10 to-primary/5 border-primary/20",children:r.jsx(Je,{className:"p-4",children:r.jsxs("div",{className:"animate-pulse flex items-center gap-4",children:[r.jsx("div",{className:"h-12 w-12 bg-primary/20 rounded-lg"}),r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx("div",{className:"h-4 bg-primary/20 rounded w-1/3"}),r.jsx("div",{className:"h-3 bg-primary/10 rounded w-1/2"})]})]})})}):r.jsxs(Ye,{className:"bg-gradient-to-br from-primary/5 via-primary/10 to-primary/5 border-primary/20",children:[r.jsxs(Ht,{className:"pb-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Yt,{className:"text-lg flex items-center gap-2",children:[r.jsx(hs,{className:"h-5 w-5 text-primary"}),"Agent OS"]}),r.jsx("div",{className:"flex items-center gap-2",children:F>0&&r.jsxs(Rt,{variant:"secondary",className:"gap-1 bg-orange-500/10 text-orange-600 border-orange-200",children:[r.jsx(Df,{className:"h-3 w-3"}),F," day streak"]})})]}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[D>0?r.jsxs(r.Fragment,{children:[r.jsxs("span",{className:"text-primary font-medium",children:[D," tasks"]})," for today"]}):"No tasks for today",$>0&&r.jsxs("span",{className:"ml-2",children:["• ",r.jsx("span",{className:"text-emerald-600 font-medium",children:$})," touches this week"]})]})]}),r.jsxs(Je,{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(te,{size:"sm",variant:"outline",className:"gap-1.5",onClick:q=>{q.stopPropagation(),t("/innercircle/contacts?new=true")},children:[r.jsx(J0,{className:"h-3.5 w-3.5"}),"Add Contact"]}),r.jsxs(te,{size:"sm",variant:"outline",className:"gap-1.5",onClick:q=>{q.stopPropagation(),t("/innercircle")},children:[r.jsx(Wa,{className:"h-3.5 w-3.5"}),"Log Touch"]}),r.jsxs(te,{size:"sm",variant:"outline",className:"gap-1.5 border-emerald-200 text-emerald-700 hover:bg-emerald-50 hover:text-emerald-800",onClick:q=>{q.stopPropagation(),t("/innercircle/video/record")},children:[r.jsx(Gi,{className:"h-3.5 w-3.5"}),"Quick Video"]}),r.jsxs(te,{size:"sm",variant:"outline",className:"gap-1.5",onClick:q=>{q.stopPropagation(),t("/innercircle/popbys")},children:[r.jsx(yl,{className:"h-3.5 w-3.5"}),"Pop-by Map"]}),r.jsxs(te,{size:"sm",variant:"outline",className:"gap-1.5 border-purple-200 text-purple-700 hover:bg-purple-50 hover:text-purple-800",onClick:q=>{q.stopPropagation(),t("/innercircle/pipeline")},children:[r.jsx(G0,{className:"h-3.5 w-3.5"}),"Pipeline"]})]}),r.jsxs("div",{className:"pt-3 border-t border-border/50",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ey,{className:"h-4 w-4 text-primary"}),r.jsx("span",{className:"text-sm font-medium",children:"Weekly Goal"}),r.jsxs($r,{open:m,onOpenChange:y,children:[r.jsx(Lo,{asChild:!0,children:r.jsx("button",{onClick:w,className:"p-0.5 rounded hover:bg-muted transition-colors","aria-label":"Edit weekly goal",children:r.jsx(id,{className:"h-3.5 w-3.5 text-muted-foreground hover:text-primary"})})}),r.jsxs(zr,{className:"sm:max-w-[360px]",children:[r.jsxs(Zr,{children:[r.jsx(Kr,{children:"Set Weekly Goal"}),r.jsx(ls,{children:"How many touches do you want to complete each week?"})]}),r.jsxs("div",{className:"space-y-4 pt-2",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"weekly-goal",children:"Weekly touch goal"}),r.jsx(yt,{id:"weekly-goal",type:"number",min:"1",value:a,onChange:q=>f(q.target.value),placeholder:"20",onKeyDown:q=>{q.key==="Enter"&&v()}})]}),r.jsx(te,{onClick:v,className:"w-full",children:"Save Goal"})]})]})]})]}),r.jsxs("span",{className:"text-sm",children:[r.jsx("span",{className:"font-medium text-primary",children:$}),r.jsxs("span",{className:"text-muted-foreground",children:[" / ",o," touches"]})]})]}),r.jsx(zc,{value:Math.min($/o*100,100),className:"h-2 bg-muted [&>div]:bg-primary"}),$>=o&&r.jsxs("p",{className:"text-xs text-emerald-600 mt-1.5 flex items-center gap-1",children:[r.jsx("span",{children:"🎉"})," Goal achieved! Keep the momentum going."]}),$0&&r.jsxs("p",{className:"text-xs text-muted-foreground mt-1.5",children:[o-$," more to hit your weekly goal"]})]}),T.length>0&&r.jsxs("div",{className:"pt-3 border-t border-border/50",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(og,{className:"h-4 w-4 text-pink-500"}),r.jsx("span",{className:"text-sm font-medium",children:"Upcoming Milestones"})]}),r.jsx("div",{className:"space-y-2",children:T.map((q,W)=>r.jsxs("div",{className:`flex items-center justify-between p-2 rounded-lg cursor-pointer transition-colors ${q.isToday?"bg-pink-500/10 hover:bg-pink-500/15":"bg-muted/50 hover:bg-muted"}`,onClick:K=>{K.stopPropagation(),t(`/innercircle/contacts/${q.contact.id}`)},children:[r.jsxs("div",{className:"flex items-center gap-2",children:[q.type==="birthday"?r.jsx(og,{className:"h-3.5 w-3.5 text-pink-500"}):r.jsx(Hi,{className:"h-3.5 w-3.5 text-blue-500"}),r.jsxs("span",{className:"text-sm",children:[q.contact.first_name," ",q.contact.last_name]}),q.isToday&&r.jsx(Rt,{variant:"secondary",className:"text-[10px] px-1.5 py-0 bg-pink-500/20 text-pink-600",children:"Today!"})]}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("span",{children:q.isToday?q.type==="birthday"?"🎂":"🏠":un(q.date,"EEE, MMM d")}),r.jsx(Ha,{className:"h-3 w-3"})]})]},`${q.contact.id}-${q.type}-${W}`))})]}),r.jsxs(te,{variant:"ghost",size:"sm",className:"w-full gap-1 text-muted-foreground hover:text-primary",onClick:()=>t("/innercircle"),children:["Open Agent OS",r.jsx(Ho,{className:"h-4 w-4"})]})]})]})}const YOe=()=>rr({queryKey:["listing-exchange-enabled"],queryFn:async()=>{const{data:t,error:e}=await ee.from("feature_flags").select("enabled").eq("key","listing_exchange_enabled").maybeSingle();if(e)throw e;return(t==null?void 0:t.enabled)??!1}}),XOe=t=>{const{user:e,brokerageId:n}=Fr();return rr({queryKey:["listings",t,n],queryFn:async()=>{let s=ee.from("listings").select(` *, photos:listing_photos(*), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage_id, brokerage:brokerages(name)) `).eq("is_approved",!0).eq("is_public",!0);t!=null&&t.status&&(s=s.eq("status",t.status)),t!=null&&t.propertyType&&(s=s.eq("property_type",t.propertyType)),t!=null&&t.city&&(s=s.ilike("city",`%${t.city}%`)),t!=null&&t.minPrice&&(s=s.gte("price",t.minPrice)),t!=null&&t.maxPrice&&(s=s.lte("price",t.maxPrice)),t!=null&&t.openToReferrals&&(s=s.eq("open_to_referrals",!0));const{data:i,error:o}=await s;if(o)throw o;let c=i||[];if(n){const{data:a}=await ee.from("profiles").select("id").eq("brokerage_id",n);if(a&&a.length>0){const f=a.map(v=>v.id);let m=ee.from("listings").select(` *, photos:listing_photos(*), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage_id, brokerage:brokerages(name)) `).eq("is_approved",!0).eq("share_with_brokerage",!0).eq("is_public",!1).in("agent_id",f);t!=null&&t.status&&(m=m.eq("status",t.status)),t!=null&&t.propertyType&&(m=m.eq("property_type",t.propertyType)),t!=null&&t.city&&(m=m.ilike("city",`%${t.city}%`)),t!=null&&t.minPrice&&(m=m.gte("price",t.minPrice)),t!=null&&t.maxPrice&&(m=m.lte("price",t.maxPrice)),t!=null&&t.openToReferrals&&(m=m.eq("open_to_referrals",!0));const{data:y}=await m;if(y){const v=new Set(c.map(k=>k.id)),w=y.filter(k=>!v.has(k.id));c=[...c,...w]}}}switch(t==null?void 0:t.sortBy){case"updated":c.sort((a,f)=>new Date(f.updated_at).getTime()-new Date(a.updated_at).getTime());break;case"price_asc":c.sort((a,f)=>a.price-f.price);break;case"price_desc":c.sort((a,f)=>f.price-a.price);break;default:c.sort((a,f)=>new Date(f.created_at).getTime()-new Date(a.created_at).getTime())}return c}})},aye=()=>{const{user:t}=Fr();return rr({queryKey:["my-listings",t==null?void 0:t.id],queryFn:async()=>{if(!t)return[];const{data:e,error:n}=await ee.from("listings").select(` *, photos:listing_photos(*) `).eq("agent_id",t.id).order("created_at",{ascending:!1});if(n)throw n;return e},enabled:!!t})},QOe=t=>{const{user:e}=Fr();return rr({queryKey:["listing",t],queryFn:async()=>{const{data:n,error:s}=await ee.from("listings").select(` *, photos:listing_photos(*), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage_id, brokerage:brokerages(name)), video:agent_videos!listings_video_id_fkey(id, playback_url, thumbnail_url, title, duration_seconds) `).eq("id",t).single();if(s)throw s;return e&&await ee.from("listing_views").insert({listing_id:t,viewer_id:e.id}),n},enabled:!!t})},hht=()=>{const t=Xr(),{user:e}=Fr();return cr({mutationFn:async n=>{if(!e)throw new Error("Not authenticated");const{data:s,error:i}=await ee.from("listings").insert({...n,agent_id:e.id}).select().single();if(i)throw i;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["listings"]}),t.invalidateQueries({queryKey:["my-listings"]})}})},fht=()=>{const t=Xr();return cr({mutationFn:async({agentId:e,...n})=>{const{data:s,error:i}=await ee.from("listings").insert({...n,agent_id:e}).select().single();if(i)throw i;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["listings"]}),t.invalidateQueries({queryKey:["my-listings"]}),t.invalidateQueries({queryKey:["brokerage-listings"]})}})},pht=()=>{const t=Xr();return cr({mutationFn:async({id:e,...n})=>{const{data:s,error:i}=await ee.from("listings").update(n).eq("id",e).select().single();if(i)throw i;return s},onSuccess:e=>{t.invalidateQueries({queryKey:["listings"]}),t.invalidateQueries({queryKey:["my-listings"]}),t.invalidateQueries({queryKey:["listing",e.id]})}})},JOe=()=>{const t=Xr();return cr({mutationFn:async e=>{const{error:n}=await ee.from("listings").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["listings"]}),t.invalidateQueries({queryKey:["my-listings"]})}})},mht=()=>{const t=Xr();return cr({mutationFn:async({listingId:e,photoUrl:n,isPrimary:s=!1})=>{const{data:i,error:o}=await ee.from("listing_photos").insert({listing_id:e,photo_url:n,is_primary:s}).select().single();if(o)throw o;return i},onSuccess:e=>{t.invalidateQueries({queryKey:["listing",e.listing_id]}),t.invalidateQueries({queryKey:["my-listings"]})}})},ght=()=>{const t=Xr();return cr({mutationFn:async({photoId:e,listingId:n})=>{const{error:s}=await ee.from("listing_photos").delete().eq("id",e);if(s)throw s;return n},onSuccess:e=>{t.invalidateQueries({queryKey:["listing",e]}),t.invalidateQueries({queryKey:["my-listings"]})}})},yht=()=>{const{user:t}=Fr();return rr({queryKey:["saved-listings",t==null?void 0:t.id],queryFn:async()=>{if(!t)return[];const{data:e,error:n}=await ee.from("listing_saves").select(` *, listing:listings( *, photos:listing_photos(*), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage_id) ) `).eq("agent_id",t.id);if(n)throw n;return e},enabled:!!t})},eDe=()=>{const t=Xr(),{user:e}=Fr();return cr({mutationFn:async n=>{if(!e)throw new Error("Not authenticated");const{data:s}=await ee.from("listing_saves").select("id").eq("listing_id",n).eq("agent_id",e.id).maybeSingle();return s?(await ee.from("listing_saves").delete().eq("id",s.id),{saved:!1}):(await ee.from("listing_saves").insert({listing_id:n,agent_id:e.id}),{saved:!0})},onSuccess:()=>{t.invalidateQueries({queryKey:["saved-listings"]}),t.invalidateQueries({queryKey:["listings"]})}})},tDe=t=>{const{user:e}=Fr();return rr({queryKey:["listing-saved",t,e==null?void 0:e.id],queryFn:async()=>{if(!e)return!1;const{data:n}=await ee.from("listing_saves").select("id").eq("listing_id",t).eq("agent_id",e.id).maybeSingle();return!!n},enabled:!!e&&!!t})},xht=()=>{const t=Xr(),{user:e}=Fr();return cr({mutationFn:async n=>{if(!e)throw new Error("Not authenticated");const{data:s}=await ee.from("listing_follows").select("id").eq("listing_id",n).eq("agent_id",e.id).maybeSingle();return s?(await ee.from("listing_follows").delete().eq("id",s.id),{following:!1}):(await ee.from("listing_follows").insert({listing_id:n,agent_id:e.id}),{following:!0})},onSuccess:()=>{t.invalidateQueries({queryKey:["listing-following"]})}})},vht=t=>{const{user:e}=Fr();return rr({queryKey:["listing-following",t,e==null?void 0:e.id],queryFn:async()=>{if(!e)return!1;const{data:n}=await ee.from("listing_follows").select("id").eq("listing_id",t).eq("agent_id",e.id).maybeSingle();return!!n},enabled:!!e&&!!t})},_ht=()=>{const{user:t}=Fr();return cr({mutationFn:async({listingId:e,shareType:n})=>{if(!t)throw new Error("Not authenticated");const{error:s}=await ee.from("listing_shares").insert({listing_id:e,sharing_agent_id:t.id,share_type:n});if(s)throw s}})},bht=()=>{const{user:t}=Fr();return rr({queryKey:["my-referrals",t==null?void 0:t.id],queryFn:async()=>{if(!t)return{sent:[],received:[]};const[e,n]=await Promise.all([ee.from("listing_referrals").select(` *, listing:listings(*,photos:listing_photos(*)) `).eq("sender_agent_id",t.id).order("created_at",{ascending:!1}),ee.from("listing_referrals").select(` *, sender:profiles!listing_referrals_sender_agent_id_fkey(id, name, email), listing:listings(*,photos:listing_photos(*)) `).eq("listing_agent_id",t.id).order("created_at",{ascending:!1})]);return{sent:e.data||[],received:n.data||[]}},enabled:!!t})},wht=()=>{const t=Xr(),{user:e}=Fr();return cr({mutationFn:async({listingId:n,listingAgentId:s,buyerName:i,buyerType:o,notes:c})=>{if(!e)throw new Error("Not authenticated");const{data:a,error:f}=await ee.from("listing_referrals").insert({listing_id:n,sender_agent_id:e.id,listing_agent_id:s,buyer_name:i,buyer_type:o,notes:c}).select().single();if(f)throw f;return a},onSuccess:()=>{t.invalidateQueries({queryKey:["my-referrals"]})}})},jht=()=>rr({queryKey:["listing-leaderboard"],queryFn:async()=>{const{data:t}=await ee.from("listing_shares").select("sharing_agent_id, profiles!listing_shares_agent_id_fkey(name)").order("created_at",{ascending:!1}),e=new Map;t==null||t.forEach(c=>{var m;const a=c.sharing_agent_id;if(!a)return;const f=e.get(a);f?f.count++:e.set(a,{name:((m=c.profiles)==null?void 0:m.name)||"Unknown",count:1})});const n=Array.from(e.entries()).map(([c,a])=>({agentId:c,...a})).sort((c,a)=>a.count-c.count).slice(0,10),{data:s}=await ee.from("listings").select("agent_id, agent:profiles!listings_agent_id_fkey(name)").eq("is_approved",!0),i=new Map;s==null||s.forEach(c=>{var f;const a=i.get(c.agent_id);a?a.count++:i.set(c.agent_id,{name:((f=c.agent)==null?void 0:f.name)||"Unknown",count:1})});const o=Array.from(i.entries()).map(([c,a])=>({agentId:c,...a})).sort((c,a)=>a.count-c.count).slice(0,10);return{topSharers:n,topListers:o}}}),kht=({className:t,variant:e="default"})=>r.jsx(Rt,{variant:"outline",className:zt("text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0 h-4",e==="default"?"border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10":"border-muted-foreground/30 text-muted-foreground",t),children:"Beta"}),Nht={coming_soon:"bg-amber-500/10 text-amber-600 border-amber-200",active:"bg-emerald-500/10 text-emerald-600 border-emerald-200",under_contract:"bg-blue-500/10 text-blue-600 border-blue-200",sold:"bg-purple-500/10 text-purple-600 border-purple-200",withdrawn:"bg-muted text-muted-foreground border-border"},Sht={coming_soon:"Coming Soon",active:"Active",under_contract:"Under Contract",sold:"Sold",withdrawn:"Withdrawn"};function Cht(t){return t>=1e6?`$${(t/1e6).toFixed(1)}M`:`$${(t/1e3).toFixed(0)}K`}function Mht(){const t=es(),{data:e,isLoading:n}=YOe(),{data:s,isLoading:i}=XOe({status:void 0,propertyType:void 0,sortBy:"newest"}),o=(s==null?void 0:s.filter(y=>y.is_approved&&y.is_public))||[],c=o.filter(y=>y.is_featured),a=o.filter(y=>!y.is_featured),f=[...c,...a].slice(0,6),m=n||i;return!m&&!e?null:m?r.jsx(Ye,{className:"bg-gradient-to-br from-emerald-500/5 via-emerald-500/10 to-emerald-500/5 border-emerald-500/20",children:r.jsx(Je,{className:"p-4",children:r.jsxs("div",{className:"animate-pulse flex items-center gap-4",children:[r.jsx("div",{className:"h-12 w-12 bg-emerald-500/20 rounded-lg"}),r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx("div",{className:"h-4 bg-emerald-500/20 rounded w-1/3"}),r.jsx("div",{className:"h-3 bg-emerald-500/10 rounded w-1/2"})]})]})})}):r.jsxs("section",{className:"mb-10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Listing Exchange"}),r.jsx(kht,{})]}),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>t("/innercircle/listings"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(Ho,{className:"h-4 w-4"})]})]}),f.length===0?r.jsx(Ye,{className:"bg-muted/30 border-dashed",children:r.jsx(Je,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Hi,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"No listings available yet"}),r.jsx(te,{variant:"link",size:"sm",onClick:()=>t("/innercircle/listings/new"),className:"mt-2",children:"Add the first listing"})]})})}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3",children:f.map(y=>{var w,k;const v=((w=y.photos)==null?void 0:w.find(C=>C.is_primary))||((k=y.photos)==null?void 0:k[0]);return r.jsxs("div",{onClick:()=>t(`/innercircle/listings/${y.id}`),className:"group cursor-pointer bg-card rounded-xl border border-border overflow-hidden transition-all duration-200 hover:shadow-lg hover:border-primary/30",children:[r.jsxs("div",{className:"aspect-[4/3] bg-muted/50 overflow-hidden relative",children:[v!=null&&v.photo_url?r.jsx("img",{src:v.photo_url,alt:`${y.city}, ${y.state}`,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Hi,{className:"h-8 w-8 text-muted-foreground/50"})}),y.is_featured&&r.jsx("div",{className:"absolute top-1.5 left-1.5",children:r.jsxs(Rt,{className:"gap-1 bg-amber-500 text-white border-0 text-[10px] px-1.5 py-0.5",children:[r.jsx(Ca,{className:"h-2.5 w-2.5 fill-current"}),"Featured"]})}),r.jsx("div",{className:"absolute top-1.5 right-1.5",children:r.jsx(Rt,{className:`text-[10px] px-1.5 py-0.5 ${Nht[y.status]}`,children:Sht[y.status]})})]}),r.jsxs("div",{className:"p-2",children:[r.jsx("p",{className:"font-bold text-sm text-foreground",children:Cht(y.price)}),r.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[y.city,", ",y.state]}),(y.bedrooms||y.bathrooms)&&r.jsxs("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:[y.bedrooms&&`${y.bedrooms} bed`,y.bedrooms&&y.bathrooms&&" · ",y.bathrooms&&`${y.bathrooms} bath`]})]})]},y.id)})})]})}function rDe(t=10,e){return rr({queryKey:["event-leaderboard",t,e],queryFn:async()=>{const{data:n}=await ee.from("user_roles").select("user_id").eq("role","admin"),s=new Set((n==null?void 0:n.map(w=>w.user_id))||[]);let i=null;if(e){const{data:w}=await ee.from("profiles").select("id").eq("brokerage_id",e);i=new Set((w==null?void 0:w.map(k=>k.id))||[])}const{data:o,error:c}=await ee.from("agent_attendance_stats").select("user_id, total_points, total_events_attended, current_streak").order("total_points",{ascending:!1}).limit(t+s.size+50);if(c)throw c;if(!o||o.length===0)return[];let a=o.filter(w=>!s.has(w.user_id));i&&(a=a.filter(w=>i.has(w.user_id)));const f=a.slice(0,t),m=f.map(w=>w.user_id),{data:y}=await ee.from("profiles").select("id, name").in("id",m),v=new Map((y==null?void 0:y.map(w=>[w.id,{name:w.name}]))||[]);return f.map(w=>({user_id:w.user_id,total_points:w.total_points,total_events_attended:w.total_events_attended,current_streak:w.current_streak,profile:v.get(w.user_id)||null}))}})}function nDe(t){return rr({queryKey:["user-attendance-stats",t],queryFn:async()=>{if(!t)return null;const{data:e,error:n}=await ee.from("agent_attendance_stats").select("*").eq("user_id",t).single();if(n&&n.code!=="PGRST116")throw n;return e},enabled:!!t})}function sDe(t){return rr({queryKey:["user-badges",t],queryFn:async()=>{if(!t)return[];const{data:e,error:n}=await ee.from("agent_badges").select("*").eq("user_id",t).order("earned_at",{ascending:!1});if(n)throw n;return e},enabled:!!t})}function iDe(t,e){return rr({queryKey:["user-rank",t,e],queryFn:async()=>{if(!t)return null;const{data:n}=await ee.from("agent_attendance_stats").select("total_points").eq("user_id",t).single();if(!n)return null;const{data:s}=await ee.from("user_roles").select("user_id").eq("role","admin"),i=new Set((s==null?void 0:s.map(f=>f.user_id))||[]),{data:o,error:c}=await ee.from("agent_attendance_stats").select("user_id, total_points").gt("total_points",n.total_points);if(c)throw c;let a=(o==null?void 0:o.filter(f=>!i.has(f.user_id)))||[];if(e){const{data:f}=await ee.from("profiles").select("id").eq("brokerage_id",e),m=new Set((f==null?void 0:f.map(y=>y.id))||[]);a=a.filter(y=>m.has(y.user_id))}return a.length+1},enabled:!!t})}function Tht(){const{user:t,brokerageId:e,isAdmin:n}=Fr();es();const s=!!e,[i,o]=P.useState("brokerage"),c=()=>{if(n)return null;if(s)return i==="global"?null:e},{data:a,isLoading:f}=rDe(5,c()),{data:m}=nDe(t==null?void 0:t.id),{data:y}=iDe(t==null?void 0:t.id,c()),{data:v}=sDe(t==null?void 0:t.id),w=n||s,k=()=>n?"Agent Leaderboard":s?i==="global"?"All LevelUp":"My Brokerage":"My Points";if(f)return r.jsxs(Ye,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsxs(Yt,{className:"text-base flex items-center gap-2",children:[r.jsx(qa,{className:"h-4 w-4 text-yellow-500"}),k()]})}),r.jsx(Je,{children:r.jsx("div",{className:"space-y-2",children:[...Array(w?5:3)].map((S,T)=>r.jsx(Gr,{className:"h-10 w-full"},T))})})]});const C=S=>S===0?r.jsx(qa,{className:"h-4 w-4 text-yellow-500 mx-auto"}):S===1?r.jsx("span",{className:"text-sm font-medium text-gray-400",children:"2"}):S===2?r.jsx("span",{className:"text-sm font-medium text-amber-600",children:"3"}):r.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:S+1});if(w){const S=(a==null?void 0:a.slice(0,5))||[];return r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"pb-2",children:[r.jsxs(Yt,{className:"text-base flex items-center gap-2",children:[r.jsx(qa,{className:"h-4 w-4 text-yellow-500"}),k()]}),!n&&s&&r.jsxs("div",{className:"flex gap-1 mt-2",children:[r.jsx(te,{variant:i==="brokerage"?"default":"outline",size:"sm",className:"text-xs h-7 flex-1",onClick:()=>o("brokerage"),children:"My Brokerage"}),r.jsx(te,{variant:i==="global"?"default":"outline",size:"sm",className:"text-xs h-7 flex-1",onClick:()=>o("global"),children:"All LevelUp"})]})]}),r.jsxs(Je,{children:[!n&&m&&r.jsx("div",{className:"mb-3 p-2 rounded-lg bg-primary/5 border border-primary/10",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:"Your Rank:"}),r.jsxs("span",{className:"font-bold text-primary",children:["#",y||"-"]})]}),r.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[r.jsxs("span",{children:[r.jsx("strong",{className:"text-primary",children:m.total_points})," pts"]}),r.jsxs("span",{children:[r.jsx("strong",{children:m.total_events_attended})," events"]})]})]})}),r.jsxs("div",{className:"space-y-2",children:[S.map((T,I)=>{var A,D,$;return r.jsxs("div",{className:`flex items-center gap-2 p-2 rounded-lg ${T.user_id===(t==null?void 0:t.id)?"bg-primary/10 border border-primary/20":I===0?"bg-yellow-500/10":""}`,children:[r.jsx("div",{className:"w-5 text-center",children:C(I)}),r.jsx(Li,{className:"h-6 w-6",children:r.jsx(Oi,{className:"text-xs",children:((D=(A=T.profile)==null?void 0:A.name)==null?void 0:D.charAt(0))||"?"})}),r.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:(($=T.profile)==null?void 0:$.name)||"Unknown"}),r.jsx("span",{className:"text-sm font-bold text-primary",children:T.total_points})]},T.user_id)}),S.length===0&&r.jsx("div",{className:"text-center text-muted-foreground py-2 text-sm",children:"No data yet"})]}),r.jsxs(ao,{to:"/reward-store",className:"mt-3 flex items-center justify-center gap-2 p-2 rounded-lg bg-primary/5 hover:bg-primary/10 transition-colors text-sm font-medium text-primary",children:[r.jsx(Qa,{className:"h-4 w-4"}),"Spend Points in Reward Store",r.jsx(Ha,{className:"h-4 w-4"})]})]})]})}return r.jsxs(Ye,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsxs(Yt,{className:"text-base flex items-center gap-2",children:[r.jsx(qa,{className:"h-4 w-4 text-yellow-500"}),"My Points"]})}),r.jsx(Je,{children:m?r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{className:"p-3 rounded-lg bg-primary/5 border border-primary/10 text-center",children:[r.jsx("div",{className:"text-2xl font-bold text-primary",children:m.total_points}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Total Points"})]}),r.jsxs("div",{className:"p-3 rounded-lg bg-muted/50 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:m.total_events_attended}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Events Attended"})]})]}),r.jsxs("div",{className:"flex items-center justify-between p-2 rounded-lg bg-orange-500/10 border border-orange-500/20",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Df,{className:"h-4 w-4 text-orange-500"}),r.jsx("span",{className:"text-sm font-medium",children:"Current Streak"})]}),r.jsxs("span",{className:"font-bold text-orange-500",children:[m.current_streak," 🔥"]})]}),v&&v.length>0&&r.jsxs("div",{className:"pt-2 border-t",children:[r.jsxs("div",{className:"flex items-center gap-1 mb-2",children:[r.jsx(Cu,{className:"h-3 w-3 text-muted-foreground"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"Badges"})]}),r.jsxs("div",{className:"flex flex-wrap gap-1",children:[v.slice(0,4).map(S=>r.jsx("span",{className:"text-xs px-2 py-1 rounded-full bg-yellow-500/10 text-yellow-600 border border-yellow-500/20",children:S.badge_name},S.id)),v.length>4&&r.jsxs("span",{className:"text-xs text-muted-foreground px-2 py-1",children:["+",v.length-4," more"]})]})]}),r.jsxs(ao,{to:"/reward-store",className:"mt-3 flex items-center justify-center gap-2 p-2 rounded-lg bg-primary/5 hover:bg-primary/10 transition-colors text-sm font-medium text-primary",children:[r.jsx(Qa,{className:"h-4 w-4"}),"Spend Points in Reward Store",r.jsx(Ha,{className:"h-4 w-4"})]})]}):r.jsxs("div",{className:"text-center text-muted-foreground py-4 text-sm",children:[r.jsx(Ca,{className:"h-8 w-8 mx-auto mb-2 text-muted-foreground/50"}),r.jsx("p",{children:"Attend events to earn points!"}),r.jsxs(ao,{to:"/reward-store",className:"mt-3 inline-flex items-center gap-2 p-2 rounded-lg bg-primary/5 hover:bg-primary/10 transition-colors text-sm font-medium text-primary",children:[r.jsx(Qa,{className:"h-4 w-4"}),"Visit Reward Store",r.jsx(Ha,{className:"h-4 w-4"})]})]})})]})}const hse=()=>rr({queryKey:["lead-sources"],queryFn:async()=>{const{data:t,error:e}=await ee.from("lead_sources").select("*").eq("is_active",!0).order("sort_order");if(e)throw e;return t}}),Aht=()=>{const t=Xr(),{user:e}=Fr();return cr({mutationFn:async n=>{const{data:s,error:i}=await ee.from("lead_sources").insert({name:n,owner_user_id:e==null?void 0:e.id,sort_order:100}).select().single();if(i)throw i;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["lead-sources"]}),Ge.success("Lead source added")},onError:n=>{Ge.error("Failed to add lead source"),console.error(n)}})},oye=(t,e)=>{const{user:n,isAdmin:s}=Fr(),i=s&&e?e:n==null?void 0:n.id;return rr({queryKey:["scorecard-transactions",t,i],queryFn:async()=>{let o=ee.from("scorecard_transactions").select(` *, lead_source:lead_sources(id, name), client_type:relationship_types(id, name), contact:innercircle_contacts(id, first_name, last_name) `).eq("owner_user_id",i).order("close_date",{ascending:!1});t&&(o=o.gte("close_date",`${t}-01-01`).lte("close_date",`${t}-12-31`));const{data:c,error:a}=await o;if(a)throw a;return c},enabled:!!i})},aDe=t=>{const{user:e,isAdmin:n}=Fr(),s=n&&t?t:e==null?void 0:e.id;return rr({queryKey:["scorecard-transactions-all",s],queryFn:async()=>{const{data:i,error:o}=await ee.from("scorecard_transactions").select(` *, lead_source:lead_sources(id, name), client_type:relationship_types(id, name), contact:innercircle_contacts(id, first_name, last_name) `).eq("owner_user_id",s).order("close_date",{ascending:!1});if(o)throw o;return i},enabled:!!s})},fse=()=>{const t=Xr(),{user:e}=Fr();return cr({mutationFn:async n=>{const{data:s,error:i}=await ee.from("scorecard_transactions").insert({...n,owner_user_id:e.id}).select().single();if(i)throw i;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["scorecard-transactions"]}),t.invalidateQueries({queryKey:["scorecard-transactions-all"]}),Ge.success("Transaction added")},onError:n=>{Ge.error("Failed to add transaction"),console.error(n)}})},Eht=()=>{const t=Xr();return cr({mutationFn:async({id:e,...n})=>{const{data:s,error:i}=await ee.from("scorecard_transactions").update(n).eq("id",e).select().single();if(i)throw i;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["scorecard-transactions"]}),t.invalidateQueries({queryKey:["scorecard-transactions-all"]}),Ge.success("Transaction updated")},onError:e=>{Ge.error("Failed to update transaction"),console.error(e)}})},Iht=()=>{const t=Xr();return cr({mutationFn:async e=>{const{error:n}=await ee.from("scorecard_transactions").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["scorecard-transactions"]}),t.invalidateQueries({queryKey:["scorecard-transactions-all"]}),Ge.success("Transaction deleted")},onError:e=>{Ge.error("Failed to delete transaction"),console.error(e)}})},oDe=(t,e)=>{const{user:n,isAdmin:s}=Fr(),i=s&&e?e:n==null?void 0:n.id;return rr({queryKey:["scorecard-goals",t,i],queryFn:async()=>{const{data:o,error:c}=await ee.from("scorecard_goals").select("*").eq("owner_user_id",i).eq("year",t).maybeSingle();if(c)throw c;return o},enabled:!!i})},Pht=()=>{const t=Xr(),{user:e}=Fr();return cr({mutationFn:async n=>{const{data:s,error:i}=await ee.from("scorecard_goals").upsert({...n,owner_user_id:e.id},{onConflict:"owner_user_id,year"}).select().single();if(i)throw i;return s},onSuccess:(n,s)=>{t.invalidateQueries({queryKey:["scorecard-goals",s.year]}),Ge.success("Goals saved")},onError:n=>{Ge.error("Failed to save goals"),console.error(n)}})},pse=()=>{const{user:t}=Fr();return rr({queryKey:["scorecard-settings",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await ee.from("scorecard_settings").select("*").eq("user_id",t.id).maybeSingle();if(n)throw n;return e},enabled:!!(t!=null&&t.id)})},Lht=()=>{const t=Xr(),{user:e}=Fr();return cr({mutationFn:async n=>{const{data:s,error:i}=await ee.from("scorecard_settings").upsert({...n,user_id:e.id},{onConflict:"user_id"}).select().single();if(i)throw i;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["scorecard-settings"]}),Ge.success("Settings saved")},onError:n=>{Ge.error("Failed to save settings"),console.error(n)}})},lDe=(t,e)=>{const{data:n,isLoading:s}=oye(t,e),{data:i,isLoading:o}=aDe(e),{data:c}=pse(),a=(c==null?void 0:c.show_commission)??!0,f=m=>{if(!m||m.length===0)return{totalTransactions:0,buyerCount:0,sellerCount:0,totalVolume:0,averagePrice:0,totalCommission:0,topLeadSource:null,transactionsByMonth:[],leadSourceBreakdown:[]};const y=m.filter($=>$.transaction_type==="buyer").length,v=m.filter($=>$.transaction_type==="seller").length,w=m.reduce(($,F)=>$+Number(F.sale_price),0),k=m.reduce(($,F)=>$+(Number(F.commission_amount)||0),0),C={};m.forEach($=>{var q;const F=((q=$.lead_source)==null?void 0:q.name)||"Unknown";C[F]=(C[F]||0)+1});const S=Object.entries(C).map(([$,F])=>({name:$,count:F})).sort(($,F)=>F.count-$.count),T=S[0]||null,I={};m.forEach($=>{const F=new Date($.close_date).toLocaleString("default",{month:"short"});I[F]=(I[F]||0)+1});const D=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"].map($=>({month:$,count:I[$]||0}));return{totalTransactions:m.length,buyerCount:y,sellerCount:v,totalVolume:w,averagePrice:m.length>0?w/m.length:0,totalCommission:a?k:0,topLeadSource:T,transactionsByMonth:D,leadSourceBreakdown:S}};return{yearStats:f(n),lifetimeStats:f(i),isLoading:s||o,showCommission:a}},Oht=()=>{const{isAdmin:t}=Fr();return rr({queryKey:["agents-with-transactions"],queryFn:async()=>{const{data:e,error:n}=await ee.from("scorecard_transactions").select("owner_user_id").order("owner_user_id");if(n)throw n;const s=[...new Set(e.map(c=>c.owner_user_id))],{data:i,error:o}=await ee.from("profiles").select("id, name, email").in("id",s);if(o)throw o;return i},enabled:t})},e0={recency:40,touchpoints:30,transactions:20},rke={warm:70,cooling:40};function Dht(t){return t===null?0:t<=14?e0.recency:t<=30?e0.recency*.85:t<=60?e0.recency*.65:t<=90?e0.recency*.4:t<=180?e0.recency*.2:e0.recency*.05}function Rht(t){const e=Math.min(t/12,1);return Math.round(e0.touchpoints*e)}function Fht(t){return t?e0.transactions:0}function zht(){return 0}function Bht(t){return t>=rke.warm?"warm":t>=rke.cooling?"cooling":"at-risk"}function lye(){const{data:t,isLoading:e}=mm(),{data:n}=VOe(),{data:s}=use(365),{data:i}=aDe(),o=P.useMemo(()=>{if(!t)return[];const a=new Date,f=tdt(a),m={};s==null||s.forEach(v=>{new Date(v.completed_at)>=f&&(m[v.contact_id]=(m[v.contact_id]||0)+1)});const y=new Set((i==null?void 0:i.filter(v=>v.contact_id).map(v=>v.contact_id))||[]);return t.map(v=>{const w=(n==null?void 0:n[v.id])||null,k=w?G4(a,new Date(w)):null,C=m[v.id]||0,S=y.has(v.id),T=Dht(k),I=Rht(C),A=Fht(S),D=zht(),$=Math.round(T+I+A+D),F={score:$,status:Bht($),breakdown:{recency:Math.round(T),touchpoints:Math.round(I),transactions:Math.round(A),referrals:Math.round(D)},lastTouchDate:w,daysSinceTouch:k,touchCountLast12Months:C,hasTransaction:S};return{...v,relationshipScore:F}})},[t,n,s,i]),c=P.useMemo(()=>{const a=o.filter(w=>w.relationshipScore.status==="warm").length,f=o.filter(w=>w.relationshipScore.status==="cooling").length,m=o.filter(w=>w.relationshipScore.status==="at-risk").length,y=o.length,v=y>0?Math.round(o.reduce((w,k)=>w+k.relationshipScore.score,0)/y):0;return{warm:a,cooling:f,atRisk:m,total:y,averageScore:v}},[o]);return{contactsWithScores:o,stats:c,isLoading:e}}function cDe(){const t=es(),{stats:e,contactsWithScores:n,isLoading:s}=lye();if(s)return r.jsxs(Ye,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Gr,{className:"h-5 w-40"})}),r.jsxs(Je,{className:"space-y-4",children:[r.jsx(Gr,{className:"h-20 w-full"}),r.jsx(Gr,{className:"h-16 w-full"})]})]});if(e.total===0)return r.jsxs(Ye,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsxs(Yt,{className:"text-lg flex items-center gap-2",children:[r.jsx(hs,{className:"h-5 w-5"}),"Relationship Health"]})}),r.jsxs(Je,{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Add contacts to see your relationship health scores."}),r.jsx(te,{variant:"outline",size:"sm",className:"mt-3",onClick:()=>t("/innercircle/contacts?new=true"),children:"Add Your First Contact"})]})]});const i=Math.round(e.warm/e.total*100),o=Math.round(e.cooling/e.total*100),c=Math.round(e.atRisk/e.total*100),a=n.filter(f=>f.relationshipScore.status==="at-risk").sort((f,m)=>f.relationshipScore.score-m.relationshipScore.score).slice(0,3);return r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"pb-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Yt,{className:"text-lg flex items-center gap-2",children:[r.jsx(Bf,{className:"h-5 w-5 text-emerald-500"}),"Relationship Health"]}),r.jsx("span",{className:"text-2xl font-bold",children:e.averageScore})]}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Average score across ",e.total," contacts"]})]}),r.jsxs(Je,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"h-2.5 w-2.5 rounded-full bg-emerald-500"}),r.jsx("span",{children:"Warm"})]}),r.jsxs("span",{className:"font-medium",children:[e.warm," (",i,"%)"]})]}),r.jsx(zc,{value:i,className:"h-2 bg-muted [&>div]:bg-emerald-500"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"h-2.5 w-2.5 rounded-full bg-amber-500"}),r.jsx("span",{children:"Cooling Off"})]}),r.jsxs("span",{className:"font-medium",children:[e.cooling," (",o,"%)"]})]}),r.jsx(zc,{value:o,className:"h-2 bg-muted [&>div]:bg-amber-500"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"h-2.5 w-2.5 rounded-full bg-red-500"}),r.jsx("span",{children:"At Risk"})]}),r.jsxs("span",{className:"font-medium",children:[e.atRisk," (",c,"%)"]})]}),r.jsx(zc,{value:c,className:"h-2 bg-muted [&>div]:bg-red-500"})]})]}),a.length>0&&r.jsxs("div",{className:"pt-3 border-t",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(Kw,{className:"h-4 w-4 text-red-500"}),r.jsx("span",{className:"text-sm font-medium",children:"Needs Attention"})]}),r.jsx("div",{className:"space-y-2",children:a.map(f=>r.jsxs("div",{className:"flex items-center justify-between p-2 rounded-lg bg-red-500/5 hover:bg-red-500/10 cursor-pointer transition-colors",onClick:()=>t(`/innercircle/contacts/${f.id}`),children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"}),r.jsxs("span",{className:"text-sm",children:[f.first_name," ",f.last_name]})]}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("span",{children:f.relationshipScore.daysSinceTouch===null?"Never":`${f.relationshipScore.daysSinceTouch}d`}),r.jsx(Ha,{className:"h-3 w-3"})]})]},f.id))})]}),r.jsxs(te,{variant:"outline",size:"sm",className:"w-full",onClick:()=>t("/innercircle/contacts?filter=at-risk"),children:["View All At-Risk Contacts",r.jsx(Ha,{className:"h-4 w-4 ml-1"})]})]})]})}const $ht=()=>{var se,xe;const{user:t,isAdmin:e}=Fr(),n=es(),[s,i]=P.useState([]),[o,c]=P.useState([]),[a,f]=P.useState([]),[m,y]=P.useState([]),[v,w]=P.useState([]),[k,C]=P.useState([]),[S,T]=P.useState(new Set),[I,A]=P.useState([]),[D,$]=P.useState([]),[F,q]=P.useState([]),[W,K]=P.useState(!0);P.useEffect(()=>{Z()},[t]);const Z=async()=>{var ie,me,fe,ve;try{const[Ie,Se,oe,ae,je,Me,Ue,Re,$e,Pe]=await Promise.all([ee.from("user_tags").select("tag").eq("user_id",t==null?void 0:t.id),ee.from("app_tiles").select("*").order("name"),ee.from("user_favorites").select("app_id").eq("user_id",t==null?void 0:t.id),ee.from("events").select("*").order("event_date",{ascending:!0}),ee.from("event_registrations").select("event_id, zoom_join_url").eq("user_id",t==null?void 0:t.id),ee.from("canva_templates").select("id, name, preview_image_url, publish_date").order("publish_date",{ascending:!1}).limit(4),ee.from("resource_kits").select("id, name, description, featured_image_url, publish_date").eq("is_published",!0).order("publish_date",{ascending:!1}).limit(4),ee.from("academy_videos").select("id, title, description, thumbnail_url, duration, publish_date").eq("is_published",!0).order("publish_date",{ascending:!1}).limit(4),ee.from("additional_services").select("id, name, description, preview_image_url, signup_link_url, publish_date").eq("is_published",!0).order("publish_date",{ascending:!1}).limit(4),ee.from("dashboard_banners").select("id, title, description, image_url, link_url, link_text, placement, section_after").eq("is_active",!0).order("sort_order")]),Ae=((ie=Ie.data)==null?void 0:ie.map(rt=>rt.tag))||[],nt=new Set(((me=oe.data)==null?void 0:me.map(rt=>rt.app_id))||[]);T(nt);const Xe=(((fe=Se.data)==null?void 0:fe.filter(rt=>!rt.required_tags||rt.required_tags.length===0?!0:rt.required_tags.some(We=>Ae.includes(We))))||[]).sort((rt,We)=>rt.name==="LevelUp Members Portal"?-1:We.name==="LevelUp Members Portal"?1:0);i(Xe.slice(0,6));const ge=((ve=ae.data)==null?void 0:ve.filter(rt=>!ute(new Date(rt.event_date))))||[];c(ge.slice(0,4)),A(je.data||[]),f(Me.data||[]),y(Ue.data||[]),w(Re.data||[]),C($e.data||[]);const mt=Pe.data||[];$(mt.filter(rt=>rt.placement==="top")),q(mt.filter(rt=>rt.placement==="between"))}catch(Ie){console.error("Error loading dashboard:",Ie),Ge.error("Failed to load dashboard data")}finally{K(!1)}},re=async ie=>{var fe;const me=window.open("about:blank","_blank");try{await ee.from("activity_logs").insert({user_id:t==null?void 0:t.id,app_id:ie.app_id,app_name:ie.name,user_agent:navigator.userAgent});const{data:ve,error:Ie}=await ee.functions.invoke("sso-launch",{body:{app_id:ie.app_id}});if(Ie)throw Ie;ve!=null&&ve.redirect_url?me&&!me.closed?(me.location.href=ve.redirect_url,(fe=me.focus)==null||fe.call(me)):window.location.assign(ve.redirect_url):(me==null||me.close(),Ge.error("Launch link unavailable"))}catch(ve){me==null||me.close(),console.error("Error launching app:",ve),Ge.error("Failed to launch app")}},he=ie=>I==null?void 0:I.some(me=>me.event_id===ie),ue=ie=>{const me=I==null?void 0:I.find(fe=>fe.event_id===ie);return me==null?void 0:me.zoom_join_url};if(W)return r.jsx(Or,{title:"Dashboard",children:r.jsx("div",{className:"flex items-center justify-center py-16",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"Loading your dashboard..."})]})})});const Ne=ie=>F.filter(me=>me.section_after===ie);return r.jsxs(Or,{title:"Dashboard",children:[r.jsx(But,{events:o,registrations:I,onNavigateToEvents:()=>n("/events")}),D.length>0&&r.jsx("div",{className:"mb-8",children:r.jsx(y5,{banners:D})}),r.jsx(Yut,{}),r.jsxs("div",{className:"mb-6",children:[r.jsxs("h2",{className:"text-2xl font-bold text-foreground",children:["Welcome back, ",((xe=(se=t==null?void 0:t.user_metadata)==null?void 0:se.name)==null?void 0:xe.split(" ")[0])||"there","!"]}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Are you ready to LevelUp today?"})]}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4 mb-8",children:[r.jsx(uht,{}),r.jsx(cDe,{}),r.jsx(Tht,{})]}),r.jsxs("section",{className:"mb-10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Upcoming Events"}),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>n("/events"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(Ho,{className:"h-4 w-4"})]})]}),o.length===0?r.jsx(Ye,{className:"bg-muted/30 border-dashed",children:r.jsx(Je,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(li,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"No upcoming events"})]})})}):r.jsx("div",{className:"bg-card rounded-xl border border-border overflow-hidden divide-y divide-border max-w-full",children:o.map(ie=>{const me=he(ie.id),fe=ue(ie.id)||ie.zoom_link;return r.jsxs("div",{className:`flex items-start gap-3 sm:gap-4 p-3 sm:p-4 hover:bg-muted/50 transition-colors cursor-pointer group ${mhe(ie.event_date)?"bg-red-500/5 border-l-2 border-l-red-500":""}`,onClick:()=>n("/events"),children:[mhe(ie.event_date)?r.jsxs("div",{className:"flex-shrink-0 w-12 h-12 sm:w-14 sm:h-14 rounded-lg bg-red-500/10 flex flex-col items-center justify-center relative",children:[r.jsx("span",{className:"absolute inline-flex h-3 w-3 top-1 right-1 animate-ping rounded-full bg-red-500 opacity-75"}),r.jsx(Hw,{className:"h-5 w-5 text-red-500"}),r.jsx("span",{className:"text-[10px] font-bold text-red-500 uppercase mt-0.5",children:"Live"})]}):r.jsxs("div",{className:"flex-shrink-0 w-12 h-12 sm:w-14 sm:h-14 rounded-lg bg-primary/10 flex flex-col items-center justify-center",children:[r.jsx("span",{className:"text-[10px] sm:text-xs font-medium text-primary uppercase",children:un(new Date(ie.event_date),"MMM")}),r.jsx("span",{className:"text-lg sm:text-xl font-bold text-primary",children:un(new Date(ie.event_date),"d")})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h4",{className:"font-medium text-sm sm:text-base text-foreground group-hover:text-primary transition-colors line-clamp-2 sm:truncate",children:ie.title}),r.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground mt-0.5",children:[un(new Date(ie.event_date),"EEEE")," at ",un(new Date(ie.event_date),"h:mm a")," EST"]})]}),r.jsx("div",{className:"hidden sm:flex flex-shrink-0",children:me?r.jsxs(te,{size:"sm",variant:"default",className:"gap-1",onClick:ve=>{ve.stopPropagation(),window.open(fe,"_blank")},children:[r.jsx(Fs,{className:"h-3.5 w-3.5"}),"Join"]}):r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground group-hover:text-primary transition-colors",children:[r.jsx("span",{className:"text-sm",children:"Register"}),r.jsx(Ha,{className:"h-4 w-4"})]})})]},ie.id)})})]}),Ne("events").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(y5,{banners:Ne("events")})}),r.jsxs("section",{className:"mb-10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Academy Videos"}),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>n("/academy"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(Ho,{className:"h-4 w-4"})]})]}),v.length===0?r.jsx(Ye,{className:"bg-muted/30 border-dashed",children:r.jsx(Je,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Sf,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"No academy videos available"})]})})}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:v.map(ie=>r.jsxs("div",{onClick:()=>n(`/academy/${ie.id}`),className:"group cursor-pointer bg-card rounded-xl border border-border overflow-hidden transition-all duration-200 hover:shadow-lg hover:border-primary/30",children:[r.jsxs("div",{className:"aspect-[3/2] bg-muted/50 overflow-hidden relative",children:[ie.thumbnail_url?r.jsx("img",{src:ie.thumbnail_url,alt:ie.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Sf,{className:"h-8 w-8 text-muted-foreground/50"})}),ie.duration&&r.jsx("span",{className:"absolute bottom-2 right-2 bg-black/70 text-white text-xs px-1.5 py-0.5 rounded",children:ie.duration})]}),r.jsx("div",{className:"p-3",children:r.jsx("h4",{className:"font-medium text-sm text-foreground line-clamp-2 group-hover:text-primary transition-colors",children:ie.title})})]},ie.id))})]}),Ne("academy").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(y5,{banners:Ne("academy")})}),r.jsxs("section",{className:"mb-10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Resource Kits"}),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>n("/toolbox"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(Ho,{className:"h-4 w-4"})]})]}),m.length===0?r.jsx(Ye,{className:"bg-muted/30 border-dashed",children:r.jsx(Je,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(My,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"No resource kits available"})]})})}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:m.map(ie=>r.jsxs("div",{onClick:()=>n(`/toolbox/${ie.id}`),className:"group cursor-pointer bg-card rounded-xl border border-border overflow-hidden transition-all duration-200 hover:shadow-lg hover:border-primary/30",children:[r.jsx("div",{className:"aspect-[3/2] bg-muted/50 overflow-hidden",children:ie.featured_image_url?r.jsx("img",{src:ie.featured_image_url,alt:ie.name,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(My,{className:"h-8 w-8 text-muted-foreground/50"})})}),r.jsx("div",{className:"p-3",children:r.jsx("h4",{className:"font-medium text-sm text-foreground truncate group-hover:text-primary transition-colors",children:ie.name})})]},ie.id))})]}),Ne("toolbox").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(y5,{banners:Ne("toolbox")})}),r.jsxs("section",{className:"mb-10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"New Templates"}),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>n("/templates"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(Ho,{className:"h-4 w-4"})]})]}),a.length===0?r.jsx(Ye,{className:"bg-muted/30 border-dashed",children:r.jsx(Je,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(V0,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"No templates available"})]})})}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:a.map(ie=>r.jsxs("div",{onClick:()=>n("/templates"),className:"group cursor-pointer bg-card rounded-xl border border-border overflow-hidden transition-all duration-200 hover:shadow-lg hover:border-primary/30",children:[r.jsx("div",{className:"aspect-[3/2] bg-muted/50 overflow-hidden",children:ie.preview_image_url?r.jsx("img",{src:ie.preview_image_url,alt:ie.name,className:"w-full h-full object-contain group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(V0,{className:"h-8 w-8 text-muted-foreground/50"})})}),r.jsx("div",{className:"p-3",children:r.jsx("h4",{className:"font-medium text-sm text-foreground truncate group-hover:text-primary transition-colors",children:ie.name})})]},ie.id))})]}),Ne("templates").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(y5,{banners:Ne("templates")})}),r.jsx("div",{className:"mb-10",children:r.jsx(Mht,{})}),r.jsxs("section",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Your Apps"}),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>n("/apps"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(Ho,{className:"h-4 w-4"})]})]}),s.length===0?r.jsx(Ye,{className:"bg-muted/30 border-dashed",children:r.jsx(Je,{className:"flex items-center justify-center py-12",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Jp,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"No apps available"})]})})}):r.jsx("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:s.map(ie=>{const me=S.has(ie.id);return r.jsxs("div",{onClick:()=>re(ie),className:"group flex items-start gap-4 p-5 bg-card rounded-xl border border-border cursor-pointer transition-all duration-200 hover:shadow-lg hover:border-primary/30",children:[r.jsx("div",{className:"flex-shrink-0 w-14 h-14 rounded-xl bg-primary/10 flex items-center justify-center text-3xl",children:ie.icon}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-semibold text-foreground group-hover:text-primary transition-colors truncate",children:ie.name}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:ie.description})]}),me&&r.jsx(Jp,{className:"h-5 w-5 text-primary fill-current flex-shrink-0"})]},ie.id)})})]}),r.jsxs("section",{className:"mt-10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Additional Services"}),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>n("/additional-services"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(Ho,{className:"h-4 w-4"})]})]}),k.length===0?r.jsx(Ye,{className:"bg-muted/30 border-dashed",children:r.jsx(Je,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Mi,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"No additional services available"})]})})}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:k.map(ie=>r.jsxs("div",{onClick:()=>window.open(ie.signup_link_url,"_blank"),className:"group cursor-pointer bg-card rounded-xl border border-border overflow-hidden transition-all duration-200 hover:shadow-lg hover:border-primary/30",children:[r.jsx("div",{className:"aspect-[4/3] bg-muted/50 overflow-hidden",children:ie.preview_image_url?r.jsx("img",{src:ie.preview_image_url,alt:ie.name,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Mi,{className:"h-8 w-8 text-muted-foreground/50"})})}),r.jsxs("div",{className:"p-3",children:[r.jsx("h4",{className:"font-medium text-sm text-foreground truncate group-hover:text-primary transition-colors",children:ie.name}),ie.description&&r.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:ie.description})]})]},ie.id))})]})]})};var mse="Switch",[Uht]=Zl(mse),[qht,Vht]=Uht(mse),dDe=P.forwardRef((t,e)=>{const{__scopeSwitch:n,name:s,checked:i,defaultChecked:o,required:c,disabled:a,value:f="on",onCheckedChange:m,form:y,...v}=t,[w,k]=P.useState(null),C=Gs(e,D=>k(D)),S=P.useRef(!1),T=w?y||!!w.closest("form"):!0,[I,A]=Tu({prop:i,defaultProp:o??!1,onChange:m,caller:mse});return r.jsxs(qht,{scope:n,checked:I,disabled:a,children:[r.jsx(On.button,{type:"button",role:"switch","aria-checked":I,"aria-required":c,"data-state":pDe(I),"data-disabled":a?"":void 0,disabled:a,value:f,...v,ref:C,onClick:an(t.onClick,D=>{A($=>!$),T&&(S.current=D.isPropagationStopped(),S.current||D.stopPropagation())})}),T&&r.jsx(fDe,{control:w,bubbles:!S.current,name:s,value:f,checked:I,required:c,disabled:a,form:y,style:{transform:"translateX(-100%)"}})]})});dDe.displayName=mse;var uDe="SwitchThumb",hDe=P.forwardRef((t,e)=>{const{__scopeSwitch:n,...s}=t,i=Vht(uDe,n);return r.jsx(On.span,{"data-state":pDe(i.checked),"data-disabled":i.disabled?"":void 0,...s,ref:e})});hDe.displayName=uDe;var Hht="SwitchBubbleInput",fDe=P.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:s=!0,...i},o)=>{const c=P.useRef(null),a=Gs(c,o),f=eI(n),m=VE(e);return P.useEffect(()=>{const y=c.current;if(!y)return;const v=window.HTMLInputElement.prototype,k=Object.getOwnPropertyDescriptor(v,"checked").set;if(f!==n&&k){const C=new Event("click",{bubbles:s});k.call(y,n),y.dispatchEvent(C)}},[f,n,s]),r.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:a,style:{...i.style,...m,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});fDe.displayName=Hht;function pDe(t){return t?"checked":"unchecked"}var mDe=dDe,Wht=hDe;const Zs=P.forwardRef(({className:t,...e},n)=>r.jsx(mDe,{className:zt("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",t),...e,ref:n,children:r.jsx(Wht,{className:zt("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Zs.displayName=mDe.displayName;var Ght=Object.defineProperty,Kht=(t,e,n)=>e in t?Ght(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ul=(t,e,n)=>Kht(t,typeof e!="symbol"?e+"":e,n);const pte={x:0,y:0,width:0,height:0,unit:"px"},zN=(t,e,n)=>Math.min(Math.max(t,e),n),Zht=(...t)=>t.filter(e=>e&&typeof e=="string").join(" "),nke=(t,e)=>t===e||t.width===e.width&&t.height===e.height&&t.x===e.x&&t.y===e.y&&t.unit===e.unit;function Yht(t,e,n,s){const i=Um(t,n,s);return t.width&&(i.height=i.width/e),t.height&&(i.width=i.height*e),i.y+i.height>s&&(i.height=s-i.y,i.width=i.height*e),i.x+i.width>n&&(i.width=n-i.x,i.height=i.width/e),t.unit==="%"?t0(i,n,s):i}function Xht(t,e,n){const s=Um(t,e,n);return s.x=(e-s.width)/2,s.y=(n-s.height)/2,t.unit==="%"?t0(s,e,n):s}function t0(t,e,n){return t.unit==="%"?{...pte,...t,unit:"%"}:{unit:"%",x:t.x?t.x/e*100:0,y:t.y?t.y/n*100:0,width:t.width?t.width/e*100:0,height:t.height?t.height/n*100:0}}function Um(t,e,n){return t.unit?t.unit==="px"?{...pte,...t,unit:"px"}:{unit:"px",x:t.x?t.x*e/100:0,y:t.y?t.y*n/100:0,width:t.width?t.width*e/100:0,height:t.height?t.height*n/100:0}:{...pte,...t,unit:"px"}}function ske(t,e,n,s,i,o=0,c=0,a=s,f=i){const m={...t};let y=Math.min(o,s),v=Math.min(c,i),w=Math.min(a,s),k=Math.min(f,i);e&&(e>1?(y=c?c*e:y,v=y/e,w=a*e):(v=o?o/e:v,y=v*e,k=f/e)),m.y<0&&(m.height=Math.max(m.height+m.y,v),m.y=0),m.x<0&&(m.width=Math.max(m.width+m.x,y),m.x=0);const C=s-(m.x+m.width);C<0&&(m.x=Math.min(m.x,s-y),m.width+=C);const S=i-(m.y+m.height);if(S<0&&(m.y=Math.min(m.y,i-v),m.height+=S),m.widthw&&((n==="sw"||n=="nw")&&(m.x-=w-m.width),m.width=w),m.height>k&&((n==="nw"||n=="ne")&&(m.y-=k-m.height),m.height=k),e){const T=m.width/m.height;if(Te){const I=Math.max(m.height*e,y);(n==="sw"||n=="nw")&&(m.x-=I-m.width),m.width=I}}return m}function Qht(t,e,n,s){const i={...t};return e==="ArrowLeft"?s==="nw"?(i.x-=n,i.y-=n,i.width+=n,i.height+=n):s==="w"?(i.x-=n,i.width+=n):s==="sw"?(i.x-=n,i.width+=n,i.height+=n):s==="ne"?(i.y+=n,i.width-=n,i.height-=n):s==="e"?i.width-=n:s==="se"&&(i.width-=n,i.height-=n):e==="ArrowRight"&&(s==="nw"?(i.x+=n,i.y+=n,i.width-=n,i.height-=n):s==="w"?(i.x+=n,i.width-=n):s==="sw"?(i.x+=n,i.width-=n,i.height-=n):s==="ne"?(i.y-=n,i.width+=n,i.height+=n):s==="e"?i.width+=n:s==="se"&&(i.width+=n,i.height+=n)),e==="ArrowUp"?s==="nw"?(i.x-=n,i.y-=n,i.width+=n,i.height+=n):s==="n"?(i.y-=n,i.height+=n):s==="ne"?(i.y-=n,i.width+=n,i.height+=n):s==="sw"?(i.x+=n,i.width-=n,i.height-=n):s==="s"?i.height-=n:s==="se"&&(i.width-=n,i.height-=n):e==="ArrowDown"&&(s==="nw"?(i.x+=n,i.y+=n,i.width-=n,i.height-=n):s==="n"?(i.y+=n,i.height-=n):s==="ne"?(i.y+=n,i.width-=n,i.height-=n):s==="sw"?(i.x-=n,i.width+=n,i.height+=n):s==="s"?i.height+=n:s==="se"&&(i.width+=n,i.height+=n)),i}const BN={capture:!0,passive:!1};let Jht=0;const Wx=class Lp extends P.PureComponent{constructor(){super(...arguments),ul(this,"docMoveBound",!1),ul(this,"mouseDownOnCrop",!1),ul(this,"dragStarted",!1),ul(this,"evData",{startClientX:0,startClientY:0,startCropX:0,startCropY:0,clientX:0,clientY:0,isResize:!0}),ul(this,"componentRef",P.createRef()),ul(this,"mediaRef",P.createRef()),ul(this,"resizeObserver"),ul(this,"initChangeCalled",!1),ul(this,"instanceId",`rc-${Jht++}`),ul(this,"state",{cropIsActive:!1,newCropIsBeingDrawn:!1}),ul(this,"onCropPointerDown",e=>{const{crop:n,disabled:s}=this.props,i=this.getBox();if(!n)return;const o=Um(n,i.width,i.height);if(s)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});const c=e.target.dataset.ord,a=!!c;let f=e.clientX,m=e.clientY,y=o.x,v=o.y;if(c){const w=e.clientX-i.x,k=e.clientY-i.y;let C=0,S=0;c==="ne"||c=="e"?(C=w-(o.x+o.width),S=k-o.y,y=o.x,v=o.y+o.height):c==="se"||c==="s"?(C=w-(o.x+o.width),S=k-(o.y+o.height),y=o.x,v=o.y):c==="sw"||c=="w"?(C=w-o.x,S=k-(o.y+o.height),y=o.x+o.width,v=o.y):(c==="nw"||c=="n")&&(C=w-o.x,S=k-o.y,y=o.x+o.width,v=o.y+o.height),f=y+i.x+C,m=v+i.y+S}this.evData={startClientX:f,startClientY:m,startCropX:y,startCropY:v,clientX:e.clientX,clientY:e.clientY,isResize:a,ord:c},this.mouseDownOnCrop=!0,this.setState({cropIsActive:!0})}),ul(this,"onComponentPointerDown",e=>{const{crop:n,disabled:s,locked:i,keepSelection:o,onChange:c}=this.props,a=this.getBox();if(s||i||o&&n)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});const f=e.clientX-a.x,m=e.clientY-a.y,y={unit:"px",x:f,y:m,width:0,height:0};this.evData={startClientX:e.clientX,startClientY:e.clientY,startCropX:f,startCropY:m,clientX:e.clientX,clientY:e.clientY,isResize:!0},this.mouseDownOnCrop=!0,c(Um(y,a.width,a.height),t0(y,a.width,a.height)),this.setState({cropIsActive:!0,newCropIsBeingDrawn:!0})}),ul(this,"onDocPointerMove",e=>{const{crop:n,disabled:s,onChange:i,onDragStart:o}=this.props,c=this.getBox();if(s||!n||!this.mouseDownOnCrop)return;e.cancelable&&e.preventDefault(),this.dragStarted||(this.dragStarted=!0,o&&o(e));const{evData:a}=this;a.clientX=e.clientX,a.clientY=e.clientY;let f;a.isResize?f=this.resizeCrop():f=this.dragCrop(),nke(n,f)||i(Um(f,c.width,c.height),t0(f,c.width,c.height))}),ul(this,"onComponentKeyDown",e=>{const{crop:n,disabled:s,onChange:i,onComplete:o}=this.props;if(s)return;const c=e.key;let a=!1;if(!n)return;const f=this.getBox(),m=this.makePixelCrop(f),y=(navigator.platform.match("Mac")?e.metaKey:e.ctrlKey)?Lp.nudgeStepLarge:e.shiftKey?Lp.nudgeStepMedium:Lp.nudgeStep;if(c==="ArrowLeft"?(m.x-=y,a=!0):c==="ArrowRight"?(m.x+=y,a=!0):c==="ArrowUp"?(m.y-=y,a=!0):c==="ArrowDown"&&(m.y+=y,a=!0),a){e.cancelable&&e.preventDefault(),m.x=zN(m.x,0,f.width-m.width),m.y=zN(m.y,0,f.height-m.height);const v=Um(m,f.width,f.height),w=t0(m,f.width,f.height);i(v,w),o&&o(v,w)}}),ul(this,"onHandlerKeyDown",(e,n)=>{const{aspect:s=0,crop:i,disabled:o,minWidth:c=0,minHeight:a=0,maxWidth:f,maxHeight:m,onChange:y,onComplete:v}=this.props,w=this.getBox();if(o||!i)return;if(e.key==="ArrowUp"||e.key==="ArrowDown"||e.key==="ArrowLeft"||e.key==="ArrowRight")e.stopPropagation(),e.preventDefault();else return;const k=(navigator.platform.match("Mac")?e.metaKey:e.ctrlKey)?Lp.nudgeStepLarge:e.shiftKey?Lp.nudgeStepMedium:Lp.nudgeStep,C=Um(i,w.width,w.height),S=Qht(C,e.key,k,n),T=ske(S,s,n,w.width,w.height,c,a,f,m);if(!nke(i,T)){const I=t0(T,w.width,w.height);y(T,I),v&&v(T,I)}}),ul(this,"onDocPointerDone",e=>{const{crop:n,disabled:s,onComplete:i,onDragEnd:o}=this.props,c=this.getBox();this.unbindDocMove(),!(s||!n)&&this.mouseDownOnCrop&&(this.mouseDownOnCrop=!1,this.dragStarted=!1,o&&o(e),i&&i(Um(n,c.width,c.height),t0(n,c.width,c.height)),this.setState({cropIsActive:!1,newCropIsBeingDrawn:!1}))}),ul(this,"onDragFocus",()=>{var e;(e=this.componentRef.current)==null||e.scrollTo(0,0)})}get document(){return document}getBox(){const e=this.mediaRef.current;if(!e)return{x:0,y:0,width:0,height:0};const{x:n,y:s,width:i,height:o}=e.getBoundingClientRect();return{x:n,y:s,width:i,height:o}}componentDidUpdate(e){const{crop:n,onComplete:s}=this.props;if(s&&!e.crop&&n){const{width:i,height:o}=this.getBox();i&&o&&s(Um(n,i,o),t0(n,i,o))}}componentWillUnmount(){this.resizeObserver&&this.resizeObserver.disconnect(),this.unbindDocMove()}bindDocMove(){this.docMoveBound||(this.document.addEventListener("pointermove",this.onDocPointerMove,BN),this.document.addEventListener("pointerup",this.onDocPointerDone,BN),this.document.addEventListener("pointercancel",this.onDocPointerDone,BN),this.docMoveBound=!0)}unbindDocMove(){this.docMoveBound&&(this.document.removeEventListener("pointermove",this.onDocPointerMove,BN),this.document.removeEventListener("pointerup",this.onDocPointerDone,BN),this.document.removeEventListener("pointercancel",this.onDocPointerDone,BN),this.docMoveBound=!1)}getCropStyle(){const{crop:e}=this.props;if(e)return{top:`${e.y}${e.unit}`,left:`${e.x}${e.unit}`,width:`${e.width}${e.unit}`,height:`${e.height}${e.unit}`}}dragCrop(){const{evData:e}=this,n=this.getBox(),s=this.makePixelCrop(n),i=e.clientX-e.startClientX,o=e.clientY-e.startClientY;return s.x=zN(e.startCropX+i,0,n.width-s.width),s.y=zN(e.startCropY+o,0,n.height-s.height),s}getPointRegion(e,n,s,i){const{evData:o}=this,c=o.clientX-e.x,a=o.clientY-e.y;let f;i&&n?f=n==="nw"||n==="n"||n==="ne":f=a1?o?[o,o/n]:[c*n,c]:c?[c*n,c]:[o,o/n]}resizeCrop(){const{evData:e}=this,{aspect:n=0,maxWidth:s,maxHeight:i}=this.props,o=this.getBox(),[c,a]=this.resolveMinDimensions(o,n,this.props.minWidth,this.props.minHeight);let f=this.makePixelCrop(o);const m=this.getPointRegion(o,e.ord,c,a),y=e.ord||m;let v=e.clientX-e.startClientX,w=e.clientY-e.startClientY;(c&&y==="nw"||y==="w"||y==="sw")&&(v=Math.min(v,-c)),(a&&y==="nw"||y==="n"||y==="ne")&&(w=Math.min(w,-a));const k={unit:"px",x:0,y:0,width:0,height:0};m==="ne"?(k.x=e.startCropX,k.width=v,n?(k.height=k.width/n,k.y=e.startCropY-k.height):(k.height=Math.abs(w),k.y=e.startCropY-k.height)):m==="se"?(k.x=e.startCropX,k.y=e.startCropY,k.width=v,n?k.height=k.width/n:k.height=w):m==="sw"?(k.x=e.startCropX+v,k.y=e.startCropY,k.width=Math.abs(v),n?k.height=k.width/n:k.height=w):m==="nw"&&(k.x=e.startCropX+v,k.width=Math.abs(v),n?(k.height=k.width/n,k.y=e.startCropY-k.height):(k.height=Math.abs(w),k.y=e.startCropY+w));const C=ske(k,n,m,o.width,o.height,c,a,s,i);return n||Lp.xyOrds.indexOf(y)>-1?f=C:Lp.xOrds.indexOf(y)>-1?(f.x=C.x,f.width=C.width):Lp.yOrds.indexOf(y)>-1&&(f.y=C.y,f.height=C.height),f.x=zN(f.x,0,o.width-f.width),f.y=zN(f.y,0,o.height-f.height),f}renderCropSelection(){const{ariaLabels:e=Lp.defaultProps.ariaLabels,disabled:n,locked:s,renderSelectionAddon:i,ruleOfThirds:o,crop:c}=this.props,a=this.getCropStyle();if(c)return lt.createElement("div",{style:a,className:"ReactCrop__crop-selection",onPointerDown:this.onCropPointerDown,"aria-label":e.cropArea,tabIndex:0,onKeyDown:this.onComponentKeyDown,role:"group"},!n&&!s&<.createElement("div",{className:"ReactCrop__drag-elements",onFocus:this.onDragFocus},lt.createElement("div",{className:"ReactCrop__drag-bar ord-n","data-ord":"n"}),lt.createElement("div",{className:"ReactCrop__drag-bar ord-e","data-ord":"e"}),lt.createElement("div",{className:"ReactCrop__drag-bar ord-s","data-ord":"s"}),lt.createElement("div",{className:"ReactCrop__drag-bar ord-w","data-ord":"w"}),lt.createElement("div",{className:"ReactCrop__drag-handle ord-nw","data-ord":"nw",tabIndex:0,"aria-label":e.nwDragHandle,onKeyDown:f=>this.onHandlerKeyDown(f,"nw"),role:"button"}),lt.createElement("div",{className:"ReactCrop__drag-handle ord-n","data-ord":"n",tabIndex:0,"aria-label":e.nDragHandle,onKeyDown:f=>this.onHandlerKeyDown(f,"n"),role:"button"}),lt.createElement("div",{className:"ReactCrop__drag-handle ord-ne","data-ord":"ne",tabIndex:0,"aria-label":e.neDragHandle,onKeyDown:f=>this.onHandlerKeyDown(f,"ne"),role:"button"}),lt.createElement("div",{className:"ReactCrop__drag-handle ord-e","data-ord":"e",tabIndex:0,"aria-label":e.eDragHandle,onKeyDown:f=>this.onHandlerKeyDown(f,"e"),role:"button"}),lt.createElement("div",{className:"ReactCrop__drag-handle ord-se","data-ord":"se",tabIndex:0,"aria-label":e.seDragHandle,onKeyDown:f=>this.onHandlerKeyDown(f,"se"),role:"button"}),lt.createElement("div",{className:"ReactCrop__drag-handle ord-s","data-ord":"s",tabIndex:0,"aria-label":e.sDragHandle,onKeyDown:f=>this.onHandlerKeyDown(f,"s"),role:"button"}),lt.createElement("div",{className:"ReactCrop__drag-handle ord-sw","data-ord":"sw",tabIndex:0,"aria-label":e.swDragHandle,onKeyDown:f=>this.onHandlerKeyDown(f,"sw"),role:"button"}),lt.createElement("div",{className:"ReactCrop__drag-handle ord-w","data-ord":"w",tabIndex:0,"aria-label":e.wDragHandle,onKeyDown:f=>this.onHandlerKeyDown(f,"w"),role:"button"})),i&<.createElement("div",{className:"ReactCrop__selection-addon",onPointerDown:f=>f.stopPropagation()},i(this.state)),o&<.createElement(lt.Fragment,null,lt.createElement("div",{className:"ReactCrop__rule-of-thirds-hz"}),lt.createElement("div",{className:"ReactCrop__rule-of-thirds-vt"})))}makePixelCrop(e){const n={...pte,...this.props.crop||{}};return Um(n,e.width,e.height)}render(){const{aspect:e,children:n,circularCrop:s,className:i,crop:o,disabled:c,locked:a,style:f,ruleOfThirds:m}=this.props,{cropIsActive:y,newCropIsBeingDrawn:v}=this.state,w=o?this.renderCropSelection():null,k=Zht("ReactCrop",i,y&&"ReactCrop--active",c&&"ReactCrop--disabled",a&&"ReactCrop--locked",v&&"ReactCrop--new-crop",o&&e&&"ReactCrop--fixed-aspect",o&&s&&"ReactCrop--circular-crop",o&&m&&"ReactCrop--rule-of-thirds",!this.dragStarted&&o&&!o.width&&!o.height&&"ReactCrop--invisible-crop",s&&"ReactCrop--no-animate");return lt.createElement("div",{ref:this.componentRef,className:k,style:f},lt.createElement("div",{ref:this.mediaRef,className:"ReactCrop__child-wrapper",onPointerDown:this.onComponentPointerDown},n),o?lt.createElement("svg",{className:"ReactCrop__crop-mask",width:"100%",height:"100%"},lt.createElement("defs",null,lt.createElement("mask",{id:`hole-${this.instanceId}`},lt.createElement("rect",{width:"100%",height:"100%",fill:"white"}),s?lt.createElement("ellipse",{cx:`${o.x+o.width/2}${o.unit}`,cy:`${o.y+o.height/2}${o.unit}`,rx:`${o.width/2}${o.unit}`,ry:`${o.height/2}${o.unit}`,fill:"black"}):lt.createElement("rect",{x:`${o.x}${o.unit}`,y:`${o.y}${o.unit}`,width:`${o.width}${o.unit}`,height:`${o.height}${o.unit}`,fill:"black"}))),lt.createElement("rect",{fill:"black",fillOpacity:.5,width:"100%",height:"100%",mask:`url(#hole-${this.instanceId})`})):void 0,w)}};ul(Wx,"xOrds",["e","w"]),ul(Wx,"yOrds",["n","s"]),ul(Wx,"xyOrds",["nw","ne","se","sw"]),ul(Wx,"nudgeStep",1),ul(Wx,"nudgeStepMedium",10),ul(Wx,"nudgeStepLarge",100),ul(Wx,"defaultProps",{ariaLabels:{cropArea:"Use the arrow keys to move the crop selection area",nwDragHandle:"Use the arrow keys to move the north west drag handle to change the crop selection area",nDragHandle:"Use the up and down arrow keys to move the north drag handle to change the crop selection area",neDragHandle:"Use the arrow keys to move the north east drag handle to change the crop selection area",eDragHandle:"Use the up and down arrow keys to move the east drag handle to change the crop selection area",seDragHandle:"Use the arrow keys to move the south east drag handle to change the crop selection area",sDragHandle:"Use the up and down arrow keys to move the south drag handle to change the crop selection area",swDragHandle:"Use the arrow keys to move the south west drag handle to change the crop selection area",wDragHandle:"Use the up and down arrow keys to move the west drag handle to change the crop selection area"}});let eft=Wx;var gDe=["PageUp","PageDown"],yDe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],xDe={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},VC="Slider",[ghe,tft,rft]=$E(VC),[vDe]=Zl(VC,[rft]),[nft,gse]=vDe(VC),_De=P.forwardRef((t,e)=>{const{name:n,min:s=0,max:i=100,step:o=1,orientation:c="horizontal",disabled:a=!1,minStepsBetweenThumbs:f=0,defaultValue:m=[s],value:y,onValueChange:v=()=>{},onValueCommit:w=()=>{},inverted:k=!1,form:C,...S}=t,T=P.useRef(new Set),I=P.useRef(0),D=c==="horizontal"?sft:ift,[$=[],F]=Tu({prop:y,defaultProp:m,onChange:he=>{var Ne;(Ne=[...T.current][I.current])==null||Ne.focus(),v(he)}}),q=P.useRef($);function W(he){const ue=dft($,he);re(he,ue)}function K(he){re(he,I.current)}function Z(){const he=q.current[I.current];$[I.current]!==he&&w($)}function re(he,ue,{commit:Ne}={commit:!1}){const se=pft(o),xe=mft(Math.round((he-s)/o)*o+s,se),ie=LA(xe,[s,i]);F((me=[])=>{const fe=lft(me,ie,ue);if(fft(fe,f*o)){I.current=fe.indexOf(ie);const ve=String(fe)!==String(me);return ve&&Ne&&w(fe),ve?fe:me}else return me})}return r.jsx(nft,{scope:t.__scopeSlider,name:n,disabled:a,min:s,max:i,valueIndexToChangeRef:I,thumbs:T.current,values:$,orientation:c,form:C,children:r.jsx(ghe.Provider,{scope:t.__scopeSlider,children:r.jsx(ghe.Slot,{scope:t.__scopeSlider,children:r.jsx(D,{"aria-disabled":a,"data-disabled":a?"":void 0,...S,ref:e,onPointerDown:an(S.onPointerDown,()=>{a||(q.current=$)}),min:s,max:i,inverted:k,onSlideStart:a?void 0:W,onSlideMove:a?void 0:K,onSlideEnd:a?void 0:Z,onHomeKeyDown:()=>!a&&re(s,0,{commit:!0}),onEndKeyDown:()=>!a&&re(i,$.length-1,{commit:!0}),onStepKeyDown:({event:he,direction:ue})=>{if(!a){const xe=gDe.includes(he.key)||he.shiftKey&&yDe.includes(he.key)?10:1,ie=I.current,me=$[ie],fe=o*xe*ue;re(me+fe,ie,{commit:!0})}}})})})})});_De.displayName=VC;var[bDe,wDe]=vDe(VC,{startEdge:"left",endEdge:"right",size:"width",direction:1}),sft=P.forwardRef((t,e)=>{const{min:n,max:s,dir:i,inverted:o,onSlideStart:c,onSlideMove:a,onSlideEnd:f,onStepKeyDown:m,...y}=t,[v,w]=P.useState(null),k=Gs(e,D=>w(D)),C=P.useRef(void 0),S=Rj(i),T=S==="ltr",I=T&&!o||!T&&o;function A(D){const $=C.current||v.getBoundingClientRect(),F=[0,$.width],W=cye(F,I?[n,s]:[s,n]);return C.current=$,W(D-$.left)}return r.jsx(bDe,{scope:t.__scopeSlider,startEdge:I?"left":"right",endEdge:I?"right":"left",direction:I?1:-1,size:"width",children:r.jsx(jDe,{dir:S,"data-orientation":"horizontal",...y,ref:k,style:{...y.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:D=>{const $=A(D.clientX);c==null||c($)},onSlideMove:D=>{const $=A(D.clientX);a==null||a($)},onSlideEnd:()=>{C.current=void 0,f==null||f()},onStepKeyDown:D=>{const F=xDe[I?"from-left":"from-right"].includes(D.key);m==null||m({event:D,direction:F?-1:1})}})})}),ift=P.forwardRef((t,e)=>{const{min:n,max:s,inverted:i,onSlideStart:o,onSlideMove:c,onSlideEnd:a,onStepKeyDown:f,...m}=t,y=P.useRef(null),v=Gs(e,y),w=P.useRef(void 0),k=!i;function C(S){const T=w.current||y.current.getBoundingClientRect(),I=[0,T.height],D=cye(I,k?[s,n]:[n,s]);return w.current=T,D(S-T.top)}return r.jsx(bDe,{scope:t.__scopeSlider,startEdge:k?"bottom":"top",endEdge:k?"top":"bottom",size:"height",direction:k?1:-1,children:r.jsx(jDe,{"data-orientation":"vertical",...m,ref:v,style:{...m.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:S=>{const T=C(S.clientY);o==null||o(T)},onSlideMove:S=>{const T=C(S.clientY);c==null||c(T)},onSlideEnd:()=>{w.current=void 0,a==null||a()},onStepKeyDown:S=>{const I=xDe[k?"from-bottom":"from-top"].includes(S.key);f==null||f({event:S,direction:I?-1:1})}})})}),jDe=P.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:s,onSlideMove:i,onSlideEnd:o,onHomeKeyDown:c,onEndKeyDown:a,onStepKeyDown:f,...m}=t,y=gse(VC,n);return r.jsx(On.span,{...m,ref:e,onKeyDown:an(t.onKeyDown,v=>{v.key==="Home"?(c(v),v.preventDefault()):v.key==="End"?(a(v),v.preventDefault()):gDe.concat(yDe).includes(v.key)&&(f(v),v.preventDefault())}),onPointerDown:an(t.onPointerDown,v=>{const w=v.target;w.setPointerCapture(v.pointerId),v.preventDefault(),y.thumbs.has(w)?w.focus():s(v)}),onPointerMove:an(t.onPointerMove,v=>{v.target.hasPointerCapture(v.pointerId)&&i(v)}),onPointerUp:an(t.onPointerUp,v=>{const w=v.target;w.hasPointerCapture(v.pointerId)&&(w.releasePointerCapture(v.pointerId),o(v))})})}),kDe="SliderTrack",NDe=P.forwardRef((t,e)=>{const{__scopeSlider:n,...s}=t,i=gse(kDe,n);return r.jsx(On.span,{"data-disabled":i.disabled?"":void 0,"data-orientation":i.orientation,...s,ref:e})});NDe.displayName=kDe;var yhe="SliderRange",SDe=P.forwardRef((t,e)=>{const{__scopeSlider:n,...s}=t,i=gse(yhe,n),o=wDe(yhe,n),c=P.useRef(null),a=Gs(e,c),f=i.values.length,m=i.values.map(w=>TDe(w,i.min,i.max)),y=f>1?Math.min(...m):0,v=100-Math.max(...m);return r.jsx(On.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,...s,ref:a,style:{...t.style,[o.startEdge]:y+"%",[o.endEdge]:v+"%"}})});SDe.displayName=yhe;var xhe="SliderThumb",CDe=P.forwardRef((t,e)=>{const n=tft(t.__scopeSlider),[s,i]=P.useState(null),o=Gs(e,a=>i(a)),c=P.useMemo(()=>s?n().findIndex(a=>a.ref.current===s):-1,[n,s]);return r.jsx(aft,{...t,ref:o,index:c})}),aft=P.forwardRef((t,e)=>{const{__scopeSlider:n,index:s,name:i,...o}=t,c=gse(xhe,n),a=wDe(xhe,n),[f,m]=P.useState(null),y=Gs(e,A=>m(A)),v=f?c.form||!!f.closest("form"):!0,w=VE(f),k=c.values[s],C=k===void 0?0:TDe(k,c.min,c.max),S=cft(s,c.values.length),T=w==null?void 0:w[a.size],I=T?uft(T,C,a.direction):0;return P.useEffect(()=>{if(f)return c.thumbs.add(f),()=>{c.thumbs.delete(f)}},[f,c.thumbs]),r.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[a.startEdge]:`calc(${C}% + ${I}px)`},children:[r.jsx(ghe.ItemSlot,{scope:t.__scopeSlider,children:r.jsx(On.span,{role:"slider","aria-label":t["aria-label"]||S,"aria-valuemin":c.min,"aria-valuenow":k,"aria-valuemax":c.max,"aria-orientation":c.orientation,"data-orientation":c.orientation,"data-disabled":c.disabled?"":void 0,tabIndex:c.disabled?void 0:0,...o,ref:y,style:k===void 0?{display:"none"}:t.style,onFocus:an(t.onFocus,()=>{c.valueIndexToChangeRef.current=s})})}),v&&r.jsx(MDe,{name:i??(c.name?c.name+(c.values.length>1?"[]":""):void 0),form:c.form,value:k},s)]})});CDe.displayName=xhe;var oft="RadioBubbleInput",MDe=P.forwardRef(({__scopeSlider:t,value:e,...n},s)=>{const i=P.useRef(null),o=Gs(i,s),c=eI(e);return P.useEffect(()=>{const a=i.current;if(!a)return;const f=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(f,"value").set;if(c!==e&&y){const v=new Event("input",{bubbles:!0});y.call(a,e),a.dispatchEvent(v)}},[c,e]),r.jsx(On.input,{style:{display:"none"},...n,ref:o,defaultValue:e})});MDe.displayName=oft;function lft(t=[],e,n){const s=[...t];return s[n]=e,s.sort((i,o)=>i-o)}function TDe(t,e,n){const o=100/(n-e)*(t-e);return LA(o,[0,100])}function cft(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function dft(t,e){if(t.length===1)return 0;const n=t.map(i=>Math.abs(i-e)),s=Math.min(...n);return n.indexOf(s)}function uft(t,e,n){const s=t/2,o=cye([0,50],[0,s]);return(s-o(e)*n)*n}function hft(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function fft(t,e){if(e>0){const n=hft(t);return Math.min(...n)>=e}return!0}function cye(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const s=(e[1]-e[0])/(t[1]-t[0]);return e[0]+s*(n-t[0])}}function pft(t){return(String(t).split(".")[1]||"").length}function mft(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var ADe=_De,gft=NDe,yft=SDe,xft=CDe;const pw=P.forwardRef(({className:t,...e},n)=>r.jsxs(ADe,{ref:n,className:zt("relative flex w-full touch-none select-none items-center",t),...e,children:[r.jsx(gft,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:r.jsx(yft,{className:"absolute h-full bg-primary"})}),r.jsx(xft,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));pw.displayName=ADe.displayName;function vft(t,e,n){return Xht(Yht({unit:"%",width:90},n,t,e),t,e)}const _ft=({open:t,onClose:e,imageSrc:n,onCropComplete:s,aspectRatio:i=1})=>{const o=P.useRef(null),[c,a]=P.useState(),[f,m]=P.useState(),[y,v]=P.useState(1),[w,k]=P.useState(0),C=P.useCallback(I=>{const{width:A,height:D}=I.currentTarget;a(vft(A,D,i))},[i]),S=P.useCallback(async()=>{const I=o.current;if(!I||!f)return;const A=document.createElement("canvas"),D=A.getContext("2d");if(!D)return;const $=I.naturalWidth/I.width,F=I.naturalHeight/I.height,q=400;A.width=q,A.height=q,D.imageSmoothingQuality="high";const W=f.x*$,K=f.y*F,Z=f.width*$,re=f.height*F,he=w*Math.PI/180,ue=A.width/2,Ne=A.height/2;return D.save(),D.translate(ue,Ne),D.rotate(he),D.scale(y,y),D.translate(-ue,-Ne),D.drawImage(I,W,K,Z,re,0,0,q,q),D.restore(),new Promise((se,xe)=>{A.toBlob(ie=>{ie?se(ie):xe(new Error("Canvas is empty"))},"image/jpeg",.95)})},[f,y,w]),T=async()=>{try{const I=await S();I&&(s(I),e())}catch(I){console.error("Error cropping image:",I)}};return r.jsx($r,{open:t,onOpenChange:e,children:r.jsxs(zr,{className:"max-w-lg",children:[r.jsx(Zr,{children:r.jsx(Kr,{children:"Crop Your Photo"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"relative max-h-[400px] overflow-hidden rounded-lg bg-muted flex items-center justify-center",children:r.jsx(eft,{crop:c,onChange:(I,A)=>a(A),onComplete:I=>m(I),aspect:i,circularCrop:!0,className:"max-h-[400px]",children:r.jsx("img",{ref:o,src:n,alt:"Crop preview",style:{transform:`scale(${y}) rotate(${w}deg)`,maxHeight:"400px",width:"auto"},onLoad:C})})}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(e4,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(pw,{value:[y],min:.5,max:3,step:.1,onValueChange:([I])=>v(I),className:"flex-1"}),r.jsx(JS,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(bT,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(pw,{value:[w],min:-180,max:180,step:1,onValueChange:([I])=>k(I),className:"flex-1"}),r.jsxs("span",{className:"text-sm text-muted-foreground w-12",children:[w,"°"]})]})]})]}),r.jsxs(ni,{children:[r.jsx(te,{variant:"outline",onClick:e,children:"Cancel"}),r.jsx(te,{onClick:T,children:"Save Photo"})]})]})})},bft=()=>{const{user:t}=Fr(),{toast:e}=la(),[n,s]=P.useState(!1),[i,o]=P.useState(!1),[c,a]=P.useState(null);P.useEffect(()=>{t&&f()},[t]);const f=async()=>{s(!0);try{const{data:v}=await ee.from("profiles").select("subscription_status, subscription_product_id, subscription_end_date, is_grandfathered").eq("id",t==null?void 0:t.id).single();v&&a({status:v.subscription_status||"none",productId:v.subscription_product_id,endDate:v.subscription_end_date,isGrandfathered:v.is_grandfathered||!1})}catch(v){console.error("Error loading subscription:",v)}finally{s(!1)}},m=async()=>{o(!0);try{const{data:{session:v}}=await ee.auth.getSession();if(!v)throw new Error("Not authenticated");const{data:w,error:k}=await ee.functions.invoke("customer-portal",{headers:{Authorization:`Bearer ${v.access_token}`}});if(k)throw k;w!=null&&w.url&&window.open(w.url,"_blank")}catch(v){console.error("Error opening customer portal:",v),e({title:"Error",description:v.message||"Failed to open billing portal",variant:"destructive"})}finally{o(!1)}},y=()=>{if(c!=null&&c.isGrandfathered)return r.jsx(Rt,{className:"bg-amber-500",children:"Grandfathered"});switch(c==null?void 0:c.status){case"active":return r.jsx(Rt,{className:"bg-green-500",children:"Active"});case"trialing":return r.jsx(Rt,{className:"bg-blue-500",children:"Trial"});case"past_due":return r.jsx(Rt,{variant:"destructive",children:"Past Due"});case"canceled":return r.jsx(Rt,{variant:"secondary",children:"Canceled"});default:return r.jsx(Rt,{variant:"outline",children:"No Subscription"})}};return n?r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(q0,{className:"h-5 w-5"}),"Subscription"]})}),r.jsx(Je,{children:r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(sn,{className:"h-6 w-6 animate-spin text-muted-foreground"})})})]}):r.jsxs(Ye,{children:[r.jsxs(Ht,{children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(q0,{className:"h-5 w-5"}),"Subscription"]}),r.jsx(An,{children:"Manage your subscription and billing"})]}),r.jsxs(Je,{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Status"}),r.jsx("div",{className:"mt-1",children:y()})]}),(c==null?void 0:c.endDate)&&c.status==="active"&&r.jsxs("div",{className:"text-right",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Next billing date"}),r.jsx("p",{className:"font-medium",children:new Date(c.endDate).toLocaleDateString()})]})]}),c!=null&&c.isGrandfathered?r.jsx("p",{className:"text-sm text-muted-foreground",children:"Your account was upgraded from LevelUp 1.0. To update/manage your subscription please reach out to support."}):(c==null?void 0:c.status)==="active"||(c==null?void 0:c.status)==="trialing"?r.jsxs(r.Fragment,{children:[(c==null?void 0:c.status)==="trialing"&&(c==null?void 0:c.endDate)&&r.jsxs("p",{className:"text-sm text-muted-foreground mb-3",children:["Your trial ends on ",new Date(c.endDate).toLocaleDateString(),". After the trial, you'll be charged automatically."]}),r.jsxs(te,{onClick:m,variant:"outline",disabled:i,children:[i?r.jsx(sn,{className:"mr-2 h-4 w-4 animate-spin"}):r.jsx(Fs,{className:"mr-2 h-4 w-4"}),"Manage Billing"]})]}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"You don't have an active subscription."})]})]})},wft=()=>{const{user:t}=Fr(),e=es(),{toast:n}=la(),[s]=Ed(),i=s.get("setup")==="true",o=s.get("reset")==="true",{isSupported:c,isSubscribed:a,isLoading:f,subscribe:m,unsubscribe:y}=IOe(),[v,w]=P.useState(!1),[k,C]=P.useState(""),[S,T]=P.useState(!1),[I,A]=P.useState(!1),[D,$]=P.useState(""),[F,q]=P.useState({name:"",email:"",title:"",bio:"",areas_served:"",years_experience:"",instagram_url:"",facebook_url:"",linkedin_url:""}),[W,K]=P.useState(!1),[Z,re]=P.useState(!1),[he,ue]=P.useState({newPassword:"",confirmPassword:""});P.useEffect(()=>{t&&Ne()},[t]),P.useEffect(()=>{o&&t&&setTimeout(()=>{var fe;(fe=document.getElementById("change-password-section"))==null||fe.scrollIntoView({behavior:"smooth",block:"center"})},500)},[o,t]);const Ne=async()=>{var fe,ve,Ie;if(!(t!=null&&t.id)){console.log("No user ID available yet");return}try{console.log("Loading profile for user:",t.id);const{data:Se,error:oe}=await ee.from("profiles").select("name, email, digest_opt_out, title, bio, areas_served, years_experience, instagram_url, facebook_url, linkedin_url").eq("id",t.id).maybeSingle();if(oe)throw console.error("Profile query error:",oe),oe;Se?(console.log("Profile loaded successfully:",Se),q({name:Se.name||"",email:Se.email||"",title:Se.title||"",bio:Se.bio||"",areas_served:Se.areas_served||"",years_experience:((fe=Se.years_experience)==null?void 0:fe.toString())||"",instagram_url:Se.instagram_url||"",facebook_url:Se.facebook_url||"",linkedin_url:Se.linkedin_url||""}),K(Se.digest_opt_out||!1)):(console.warn("No profile found for user"),q({name:((ve=t.user_metadata)==null?void 0:ve.name)||((Ie=t.email)==null?void 0:Ie.split("@")[0])||"",email:t.email||"",title:"",bio:"",areas_served:"",years_experience:"",instagram_url:"",facebook_url:"",linkedin_url:""}));const{data:ae}=await ee.storage.from("avatars").list(`${t.id}`);if(ae&&ae.length>0){const{data:je}=ee.storage.from("avatars").getPublicUrl(`${t.id}/${ae[0].name}`);C(je.publicUrl)}}catch(Se){console.error("Error loading profile:",Se),n({title:"Error",description:Se.message||"Failed to load profile",variant:"destructive"})}},se=fe=>{var Se;const ve=(Se=fe.target.files)==null?void 0:Se[0];if(!ve)return;const Ie=new FileReader;Ie.onloadend=()=>{$(Ie.result),A(!0)},Ie.readAsDataURL(ve),fe.target.value=""},xe=async fe=>{if(t){T(!0);try{const{data:ve}=await ee.storage.from("avatars").list(`${t.id}`);ve&&ve.length>0&&await ee.storage.from("avatars").remove(ve.map(je=>`${t.id}/${je.name}`));const Se=`${t.id}/avatar.jpg`,{error:oe}=await ee.storage.from("avatars").upload(Se,fe,{upsert:!0,contentType:"image/jpeg"});if(oe)throw oe;const{data:ae}=ee.storage.from("avatars").getPublicUrl(Se);C(`${ae.publicUrl}?t=${Date.now()}`),n({title:"Success",description:"Profile photo updated successfully"})}catch(ve){console.error("Error uploading avatar:",ve),n({title:"Error",description:ve.message||"Failed to upload photo",variant:"destructive"})}finally{T(!1)}}},ie=async()=>{if(!F.name.trim()||!F.email.trim()){n({title:"Error",description:"Name and email are required",variant:"destructive"});return}w(!0);try{const{error:fe}=await ee.from("profiles").update({name:F.name.trim(),email:F.email.trim(),title:F.title.trim()||null,bio:F.bio.trim()||null,areas_served:F.areas_served.trim()||null,years_experience:F.years_experience?parseInt(F.years_experience):null,instagram_url:F.instagram_url.trim()||null,facebook_url:F.facebook_url.trim()||null,linkedin_url:F.linkedin_url.trim()||null}).eq("id",t==null?void 0:t.id);if(fe)throw fe;n({title:"Success",description:"Profile updated successfully"})}catch(fe){console.error("Error updating profile:",fe),n({title:"Error",description:fe.message||"Failed to update profile",variant:"destructive"})}finally{w(!1)}},me=async()=>{if(!he.newPassword){n({title:"Error",description:"Please enter a new password",variant:"destructive"});return}if(he.newPassword.length<6){n({title:"Error",description:"Password must be at least 6 characters",variant:"destructive"});return}if(he.newPassword!==he.confirmPassword){n({title:"Error",description:"Passwords do not match",variant:"destructive"});return}w(!0);try{const{error:fe}=await ee.auth.updateUser({password:he.newPassword});if(fe)throw fe;n({title:"Success",description:"Password updated successfully"}),ue({newPassword:"",confirmPassword:""}),i&&setTimeout(()=>e("/dashboard"),1e3)}catch(fe){console.error("Error updating password:",fe),n({title:"Error",description:fe.message||"Failed to update password",variant:"destructive"})}finally{w(!1)}};return r.jsx(Or,{title:i?"Complete Your Profile":o?"Reset Your Password":"Profile Settings",description:i?"Welcome! Please complete your profile setup":o?"Please set a new password for your account":"Manage your account information and password",children:r.jsxs("div",{className:"mx-auto max-w-4xl",children:[!i&&!o&&r.jsx("div",{className:"mb-6",children:r.jsxs(te,{variant:"outline",onClick:()=>{var fe;(fe=document.getElementById("change-password-section"))==null||fe.scrollIntoView({behavior:"smooth",block:"center"})},className:"gap-2",children:[r.jsx(Vw,{className:"h-4 w-4"}),"Change Password"]})}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ye,{children:[r.jsxs(Ht,{children:[r.jsx(Yt,{children:"Profile Photo"}),r.jsx(An,{children:"Upload a professional photo for your profile"})]}),r.jsxs(Je,{className:"flex items-center gap-6",children:[r.jsxs(Li,{className:"h-24 w-24",children:[r.jsx(Io,{src:k}),r.jsx(Oi,{className:"text-2xl",children:F.name.split(" ").map(fe=>fe[0]).join("").toUpperCase()||"U"})]}),r.jsxs("div",{className:"flex-1",children:[r.jsx("input",{type:"file",id:"avatar-upload",accept:"image/*",className:"hidden",onChange:se,disabled:S}),r.jsxs(te,{variant:"outline",onClick:()=>{var fe;return(fe=document.getElementById("avatar-upload"))==null?void 0:fe.click()},disabled:S,children:[r.jsx(Ao,{className:"mr-2 h-4 w-4"}),S?"Uploading...":"Upload Photo"]}),r.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"Upload an image and crop it to your liking."})]})]})]}),r.jsxs(Ye,{children:[r.jsxs(Ht,{children:[r.jsx(Yt,{children:"Personal Information"}),r.jsx(An,{children:"Update your profile details"})]}),r.jsxs(Je,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"name",children:"Name"}),r.jsx(yt,{id:"name",value:F.name,onChange:fe=>q({...F,name:fe.target.value}),maxLength:100})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"email",children:"Email"}),r.jsx(yt,{id:"email",type:"email",value:F.email,onChange:fe=>q({...F,email:fe.target.value}),maxLength:255})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"title",children:"Job Title"}),r.jsx(yt,{id:"title",value:F.title,onChange:fe=>q({...F,title:fe.target.value}),placeholder:"e.g., Broker Associate, Team Lead",maxLength:100})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"bio",children:"Bio"}),r.jsx(yt,{id:"bio",value:F.bio,onChange:fe=>q({...F,bio:fe.target.value}),placeholder:"A short description about yourself",maxLength:500})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"areas_served",children:"Areas Served"}),r.jsx(yt,{id:"areas_served",value:F.areas_served,onChange:fe=>q({...F,areas_served:fe.target.value}),placeholder:"e.g., Downtown, Suburbs"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"years_experience",children:"Years Experience"}),r.jsx(yt,{id:"years_experience",type:"number",min:"0",value:F.years_experience,onChange:fe=>q({...F,years_experience:fe.target.value}),placeholder:"e.g., 5"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Social Links"}),r.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[r.jsx(yt,{value:F.linkedin_url,onChange:fe=>q({...F,linkedin_url:fe.target.value}),placeholder:"LinkedIn URL"}),r.jsx(yt,{value:F.instagram_url,onChange:fe=>q({...F,instagram_url:fe.target.value}),placeholder:"Instagram URL"}),r.jsx(yt,{value:F.facebook_url,onChange:fe=>q({...F,facebook_url:fe.target.value}),placeholder:"Facebook URL"})]})]}),r.jsxs(te,{onClick:ie,disabled:v,children:[r.jsx(dg,{className:"mr-2 h-4 w-4"}),"Save Changes"]})]})]}),r.jsxs(Ye,{id:"change-password-section",children:[r.jsxs(Ht,{children:[r.jsx(Yt,{children:i?"Set Your Password":"Change Password"}),r.jsx(An,{children:i?"Create a secure password for your account":"Update your password to keep your account secure"})]}),r.jsxs(Je,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"newPassword",children:"New Password"}),r.jsx(yt,{id:"newPassword",type:"password",value:he.newPassword,onChange:fe=>ue({...he,newPassword:fe.target.value}),placeholder:"Min 6 characters"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"confirmPassword",children:"Confirm Password"}),r.jsx(yt,{id:"confirmPassword",type:"password",value:he.confirmPassword,onChange:fe=>ue({...he,confirmPassword:fe.target.value}),placeholder:"Re-enter your new password"})]}),r.jsxs(te,{onClick:me,disabled:v,children:[r.jsx(dg,{className:"mr-2 h-4 w-4"}),i?"Complete Setup":"Update Password"]}),i&&r.jsx(te,{variant:"outline",onClick:()=>e("/dashboard"),className:"ml-2",children:"Skip for Now"})]})]}),r.jsxs(Ye,{children:[r.jsxs(Ht,{children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[a?r.jsx(ag,{className:"h-5 w-5"}):r.jsx(Ow,{className:"h-5 w-5"}),"Push Notifications"]}),r.jsx(An,{children:"Receive browser notifications when new content is added"})]}),r.jsx(Je,{children:c?r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:a?"Notifications enabled":"Notifications disabled"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:a?"You'll receive notifications about new templates, videos, and events":"Enable to get notified about new content"})]}),r.jsx(Zs,{checked:a,onCheckedChange:fe=>{fe?m():y()},disabled:f})]}):r.jsxs("div",{className:"text-sm text-muted-foreground space-y-2",children:[r.jsx("p",{children:"Push notifications are not supported in this browser."}),r.jsxs("p",{className:"text-xs",children:[r.jsx("strong",{children:"Desktop:"})," Use Chrome, Firefox, or Edge.",r.jsx("br",{}),r.jsx("strong",{children:"iPhone/iPad:"}),' Open this site in Safari, tap the Share button, then "Add to Home Screen". Push notifications will work from the installed app.']})]})})]}),r.jsxs(Ye,{children:[r.jsxs(Ht,{children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[W?r.jsx(pT,{className:"h-5 w-5"}):r.jsx(di,{className:"h-5 w-5"}),"Email Preferences"]}),r.jsx(An,{children:"Manage your email subscription settings"})]}),r.jsx(Je,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Weekly Digest"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:W?"You won't receive weekly digest emails":"Receive a weekly summary of new content, events, and your progress"})]}),r.jsx(Zs,{checked:!W,onCheckedChange:async fe=>{re(!0);try{const{error:ve}=await ee.from("profiles").update({digest_opt_out:!fe}).eq("id",t==null?void 0:t.id);if(ve)throw ve;K(!fe),n({title:fe?"Subscribed":"Unsubscribed",description:fe?"You will now receive weekly digest emails":"You will no longer receive weekly digest emails"})}catch(ve){n({title:"Error",description:ve.message||"Failed to update preference",variant:"destructive"})}finally{re(!1)}},disabled:Z})]})})]}),r.jsx(bft,{})]}),r.jsx(_ft,{open:I,onClose:()=>A(!1),imageSrc:D,onCropComplete:xe,aspectRatio:1})]})})};var jft="AspectRatio",EDe=P.forwardRef((t,e)=>{const{ratio:n=1/1,style:s,...i}=t;return r.jsx("div",{style:{position:"relative",width:"100%",paddingBottom:`${100/n}%`},"data-radix-aspect-ratio-wrapper":"",children:r.jsx(On.div,{...i,ref:e,style:{...s,position:"absolute",top:0,right:0,bottom:0,left:0}})})});EDe.displayName=jft;var kft=EDe;const Nft=kft;function Sft(){const{user:t}=Fr(),e=Xr(),[n,s]=P.useState(!1),[i,o]=P.useState(!1),{data:c,isLoading:a}=rr({queryKey:["calendar-token",t==null?void 0:t.id],queryFn:async()=>{const{data:C,error:S}=await ee.from("profiles").select("calendar_token").eq("id",t==null?void 0:t.id).single();if(S)throw S;return C},enabled:!!t&&i}),f=cr({mutationFn:async()=>{const C=new Uint8Array(12);crypto.getRandomValues(C);const S=btoa(String.fromCharCode(...C)).replace(/\+/g,"x").replace(/\//g,"y").replace(/=/g,"").substring(0,16),{error:T}=await ee.from("profiles").update({calendar_token:S}).eq("id",t==null?void 0:t.id);if(T)throw T;return S},onSuccess:()=>{e.invalidateQueries({queryKey:["calendar-token",t==null?void 0:t.id]}),Ge.success("Calendar subscription URL generated!")},onError:C=>{Ge.error("Failed to generate calendar URL: "+C.message)}}),m=c!=null&&c.calendar_token?`https://dashboard.relevelup.com/api/calendar/${c.calendar_token}.ics`:null,y=async()=>{m&&(await navigator.clipboard.writeText(m),s(!0),Ge.success("Calendar URL copied to clipboard!"),setTimeout(()=>s(!1),2e3))},v=()=>{m&&(window.location.href=m.replace("https://","webcal://"))},w=()=>{if(m){const C=m.replace("https://","webcal://"),S=`https://calendar.google.com/calendar/r?cid=${encodeURIComponent(C)}`;window.open(S,"_blank")}},k=()=>{if(m){const C=`https://outlook.live.com/calendar/0/addfromweb?url=${encodeURIComponent(m)}&name=Level%20Up%20Events`;window.open(C,"_blank")}};return r.jsxs($r,{open:i,onOpenChange:o,children:[r.jsx(Lo,{asChild:!0,children:r.jsxs(te,{variant:"outline",className:"gap-2",children:[r.jsx(li,{className:"h-4 w-4"}),"Subscribe to Calendar"]})}),r.jsxs(zr,{className:"sm:max-w-md",children:[r.jsxs(Zr,{children:[r.jsxs(Kr,{className:"flex items-center gap-2",children:[r.jsx(li,{className:"h-5 w-5 text-primary"}),"Subscribe to Events Calendar"]}),r.jsx(ls,{children:"Add all Level Up events to your personal calendar. Events will sync automatically and update when we add or change events."})]}),r.jsx("div",{className:"space-y-4 py-4",children:a?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(sn,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):m?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-sm font-medium",children:"Your Calendar URL"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(yt,{value:m,readOnly:!0,className:"text-xs font-mono"}),r.jsx(te,{variant:"outline",size:"icon",onClick:y,children:n?r.jsx(Ba,{className:"h-4 w-4 text-green-500"}):r.jsx(Ul,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-sm font-medium",children:"Quick Add"}),r.jsxs("div",{className:"grid gap-2",children:[r.jsxs(te,{variant:"outline",className:"w-full justify-start gap-2",onClick:v,children:[r.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"currentColor",children:r.jsx("path",{d:"M18.71 19.5c-.83 1.24-1.71 2.45-3.05 2.47-1.34.03-1.77-.79-3.29-.79-1.53 0-2 .77-3.27.82-1.31.05-2.3-1.32-3.14-2.53C4.25 17 2.94 12.45 4.7 9.39c.87-1.52 2.43-2.48 4.12-2.51 1.28-.02 2.5.87 3.29.87.78 0 2.26-1.07 3.81-.91.65.03 2.47.26 3.64 1.98-.09.06-2.17 1.28-2.15 3.81.03 3.02 2.65 4.03 2.68 4.04-.03.07-.42 1.44-1.38 2.83M13 3.5c.73-.83 1.94-1.46 2.94-1.5.13 1.17-.34 2.35-1.04 3.19-.69.85-1.83 1.51-2.95 1.42-.15-1.15.41-2.35 1.05-3.11z"})}),"Add to Apple Calendar",r.jsx(Fs,{className:"h-3 w-3 ml-auto opacity-50"})]}),r.jsxs(te,{variant:"outline",className:"w-full justify-start gap-2",onClick:w,children:[r.jsxs("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"currentColor",children:[r.jsx("path",{d:"M19.5 22h-15A2.5 2.5 0 0 1 2 19.5v-15A2.5 2.5 0 0 1 4.5 2H9v2H4.5a.5.5 0 0 0-.5.5v15a.5.5 0 0 0 .5.5h15a.5.5 0 0 0 .5-.5V15h2v4.5a2.5 2.5 0 0 1-2.5 2.5z"}),r.jsx("path",{d:"M12 2v8.5a1.5 1.5 0 0 0 1.5 1.5H22V2h-10z",fill:"#4285F4"}),r.jsx("path",{d:"M12 12V2H4.5A2.5 2.5 0 0 0 2 4.5V12h10z",fill:"#34A853"}),r.jsx("path",{d:"M2 12v7.5A2.5 2.5 0 0 0 4.5 22H12v-10H2z",fill:"#FBBC05"}),r.jsx("path",{d:"M12 22h7.5a2.5 2.5 0 0 0 2.5-2.5V12h-10v10z",fill:"#EA4335"})]}),"Add to Google Calendar",r.jsx(Fs,{className:"h-3 w-3 ml-auto opacity-50"})]}),r.jsxs(te,{variant:"outline",className:"w-full justify-start gap-2",onClick:k,children:[r.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"currentColor",children:r.jsx("path",{d:"M7.88 12.04q0 .45-.11.87-.1.41-.33.74-.22.33-.58.52-.37.2-.87.2t-.85-.2q-.35-.21-.57-.55-.22-.33-.33-.75-.1-.42-.1-.86t.1-.87q.1-.43.34-.76.22-.34.59-.54.36-.2.87-.2t.86.2q.35.21.57.55.22.34.31.77.1.43.1.88zM24 12v9.38q0 .46-.33.8-.33.32-.8.32H7.13q-.46 0-.8-.33-.32-.33-.32-.8V18H1q-.41 0-.7-.3-.3-.29-.3-.7V7q0-.41.3-.7Q.58 6 1 6h6.5V2.55q0-.44.3-.75.3-.3.75-.3h12.9q.44 0 .75.3.3.3.3.75V12zm-6-8.25v3h3v-3zm0 4.5v3h3v-3zm0 4.5v1.83l3.05-1.83zm-5.25-9v3h3.75v-3zm0 4.5v3h3.75v-3zm0 4.5v2.03l2.41 1.5 1.34-.81v-2.72zM9 3.75V6h2l.13.01.12.04v-2.3zM5.98 15.98q.9 0 1.6-.3.7-.32 1.19-.86.48-.55.73-1.28.25-.74.25-1.61 0-.83-.25-1.55-.24-.71-.71-1.24t-1.15-.83q-.68-.3-1.55-.3-.92 0-1.64.3-.71.3-1.2.85-.5.54-.75 1.3-.25.74-.25 1.63 0 .85.26 1.56.26.72.74 1.23.48.52 1.17.81.69.3 1.56.3zM7.5 21h12.39L12 16.08V17q0 .41-.3.7-.29.3-.7.3H7.5zm15-.13v-7.24l-5.9 3.54Z"})}),"Add to Outlook",r.jsx(Fs,{className:"h-3 w-3 ml-auto opacity-50"})]})]})]}),r.jsx("p",{className:"text-xs text-muted-foreground text-center pt-2",children:"Events sync automatically. If your membership expires, the calendar will show as empty."})]}):r.jsxs("div",{className:"text-center space-y-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Generate your personal calendar subscription URL to get started."}),r.jsx(te,{onClick:()=>f.mutate(),disabled:f.isPending,className:"w-full",children:f.isPending?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),"Generating..."]}):r.jsxs(r.Fragment,{children:[r.jsx(li,{className:"h-4 w-4 mr-2"}),"Generate Calendar URL"]})})]})})]})]})}var yse="Tabs",[Cft]=Zl(yse,[qC]),IDe=qC(),[Mft,dye]=Cft(yse),PDe=P.forwardRef((t,e)=>{const{__scopeTabs:n,value:s,onValueChange:i,defaultValue:o,orientation:c="horizontal",dir:a,activationMode:f="automatic",...m}=t,y=Rj(a),[v,w]=Tu({prop:s,onChange:i,defaultProp:o??"",caller:yse});return r.jsx(Mft,{scope:n,baseId:Fc(),value:v,onValueChange:w,orientation:c,dir:y,activationMode:f,children:r.jsx(On.div,{dir:y,"data-orientation":c,...m,ref:e})})});PDe.displayName=yse;var LDe="TabsList",ODe=P.forwardRef((t,e)=>{const{__scopeTabs:n,loop:s=!0,...i}=t,o=dye(LDe,n),c=IDe(n);return r.jsx(jge,{asChild:!0,...c,orientation:o.orientation,dir:o.dir,loop:s,children:r.jsx(On.div,{role:"tablist","aria-orientation":o.orientation,...i,ref:e})})});ODe.displayName=LDe;var DDe="TabsTrigger",RDe=P.forwardRef((t,e)=>{const{__scopeTabs:n,value:s,disabled:i=!1,...o}=t,c=dye(DDe,n),a=IDe(n),f=BDe(c.baseId,s),m=$De(c.baseId,s),y=s===c.value;return r.jsx(kge,{asChild:!0,...a,focusable:!i,active:y,children:r.jsx(On.button,{type:"button",role:"tab","aria-selected":y,"aria-controls":m,"data-state":y?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:f,...o,ref:e,onMouseDown:an(t.onMouseDown,v=>{!i&&v.button===0&&v.ctrlKey===!1?c.onValueChange(s):v.preventDefault()}),onKeyDown:an(t.onKeyDown,v=>{[" ","Enter"].includes(v.key)&&c.onValueChange(s)}),onFocus:an(t.onFocus,()=>{const v=c.activationMode!=="manual";!y&&!i&&v&&c.onValueChange(s)})})})});RDe.displayName=DDe;var FDe="TabsContent",zDe=P.forwardRef((t,e)=>{const{__scopeTabs:n,value:s,forceMount:i,children:o,...c}=t,a=dye(FDe,n),f=BDe(a.baseId,s),m=$De(a.baseId,s),y=s===a.value,v=P.useRef(y);return P.useEffect(()=>{const w=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(w)},[]),r.jsx(oc,{present:i||y,children:({present:w})=>r.jsx(On.div,{"data-state":y?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":f,hidden:!w,id:m,tabIndex:0,...c,ref:e,style:{...t.style,animationDuration:v.current?"0s":void 0},children:w&&o})})});zDe.displayName=FDe;function BDe(t,e){return`${t}-trigger-${e}`}function $De(t,e){return`${t}-content-${e}`}var Tft=PDe,UDe=ODe,qDe=RDe,VDe=zDe;const La=Tft,Ma=P.forwardRef(({className:t,...e},n)=>r.jsx(UDe,{ref:n,className:zt("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...e}));Ma.displayName=UDe.displayName;const yn=P.forwardRef(({className:t,...e},n)=>r.jsx(qDe,{ref:n,className:zt("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",t),...e}));yn.displayName=qDe.displayName;const $n=P.forwardRef(({className:t,...e},n)=>r.jsx(VDe,{ref:n,className:zt("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));$n.displayName=VDe.displayName;const Aft={first_timer:Ca,regular:Ty,dedicated:Cu,veteran:qa,streak_master:Df,century:qa},Eft={first_timer:"bg-green-500/10 text-green-500 border-green-500/20",regular:"bg-blue-500/10 text-blue-500 border-blue-500/20",dedicated:"bg-purple-500/10 text-purple-500 border-purple-500/20",veteran:"bg-amber-500/10 text-amber-500 border-amber-500/20",streak_master:"bg-orange-500/10 text-orange-500 border-orange-500/20",century:"bg-yellow-500/10 text-yellow-500 border-yellow-500/20"};function ike(t){return t===1?r.jsx(qa,{className:"h-5 w-5 text-yellow-500"}):t===2?r.jsx(Ty,{className:"h-5 w-5 text-gray-400"}):t===3?r.jsx(Cu,{className:"h-5 w-5 text-amber-600"}):r.jsx("span",{className:"w-5 text-center text-sm font-medium text-muted-foreground",children:t})}function HDe({showUserStats:t=!0,compact:e=!1,brokerageId:n,title:s="Event Leaderboard"}){const{user:i}=Fr(),{data:o,isLoading:c}=rDe(e?5:10,n),{data:a}=nDe(i==null?void 0:i.id),{data:f}=iDe(i==null?void 0:i.id),{data:m}=sDe(i==null?void 0:i.id);return c?r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(qa,{className:"h-5 w-5 text-yellow-500"}),s]})}),r.jsx(Je,{children:r.jsx("div",{className:"space-y-3",children:[...Array(5)].map((y,v)=>r.jsx(Gr,{className:"h-12 w-full"},v))})})]}):r.jsxs(Ye,{children:[r.jsx(Ht,{className:"pb-3",children:r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(qa,{className:"h-5 w-5 text-yellow-500"}),s]})}),r.jsxs(Je,{children:[t&&a&&r.jsxs("div",{className:"mb-4 p-3 rounded-lg bg-primary/5 border border-primary/10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("span",{className:"text-sm font-medium",children:"Your Stats"}),f&&r.jsxs(Rt,{variant:"secondary",className:"text-xs",children:["Rank #",f]})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-2 text-center",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-lg font-bold text-primary",children:a.total_points}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Points"})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-lg font-bold",children:a.total_events_attended}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Events"})]}),r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[r.jsx(Df,{className:"h-4 w-4 text-orange-500"}),r.jsx("div",{className:"text-lg font-bold",children:a.current_streak}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Streak"})]})]}),m&&m.length>0&&r.jsxs("div",{className:"mt-3 flex flex-wrap gap-1",children:[m.slice(0,4).map(y=>{const v=Aft[y.badge_type]||Ca;return r.jsxs(Rt,{variant:"outline",className:`text-xs ${Eft[y.badge_type]||""}`,title:y.badge_description||"",children:[r.jsx(v,{className:"h-3 w-3 mr-1"}),y.badge_name]},y.id)}),m.length>4&&r.jsxs(Rt,{variant:"outline",className:"text-xs",children:["+",m.length-4," more"]})]})]}),r.jsxs(La,{defaultValue:"points",className:"w-full",children:[r.jsxs(Ma,{className:"w-full mb-3",children:[r.jsx(yn,{value:"points",className:"flex-1",children:"By Points"}),r.jsx(yn,{value:"events",className:"flex-1",children:"By Events"})]}),r.jsx($n,{value:"points",className:"mt-0",children:r.jsxs("div",{className:"space-y-2",children:[o==null?void 0:o.map((y,v)=>{var w,k,C;return r.jsxs("div",{className:`flex items-center gap-3 p-2 rounded-lg ${y.user_id===(i==null?void 0:i.id)?"bg-primary/5 border border-primary/10":""} ${v===0?"bg-yellow-500/5":""}`,children:[r.jsx("div",{className:"w-6 flex justify-center",children:ike(v+1)}),r.jsx(Li,{className:"h-8 w-8",children:r.jsx(Oi,{className:"text-xs",children:((k=(w=y.profile)==null?void 0:w.name)==null?void 0:k.charAt(0))||"?"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"font-medium text-sm truncate",children:[((C=y.profile)==null?void 0:C.name)||"Unknown",y.user_id===(i==null?void 0:i.id)&&r.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(You)"})]}),r.jsxs("div",{className:"text-xs text-muted-foreground",children:[y.total_events_attended," events"]})]}),r.jsxs("div",{className:"text-right",children:[r.jsx("div",{className:"font-bold text-primary",children:y.total_points}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"pts"})]})]},y.user_id)}),(!o||o.length===0)&&r.jsx("div",{className:"text-center text-muted-foreground py-4 text-sm",children:"No attendance data yet. Attend an event to get on the leaderboard!"})]})}),r.jsx($n,{value:"events",className:"mt-0",children:r.jsx("div",{className:"space-y-2",children:[...o||[]].sort((y,v)=>v.total_events_attended-y.total_events_attended).map((y,v)=>{var w,k,C;return r.jsxs("div",{className:`flex items-center gap-3 p-2 rounded-lg ${y.user_id===(i==null?void 0:i.id)?"bg-primary/5 border border-primary/10":""} ${v===0?"bg-yellow-500/5":""}`,children:[r.jsx("div",{className:"w-6 flex justify-center",children:ike(v+1)}),r.jsx(Li,{className:"h-8 w-8",children:r.jsx(Oi,{className:"text-xs",children:((k=(w=y.profile)==null?void 0:w.name)==null?void 0:k.charAt(0))||"?"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"font-medium text-sm truncate",children:[((C=y.profile)==null?void 0:C.name)||"Unknown",y.user_id===(i==null?void 0:i.id)&&r.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(You)"})]}),r.jsxs("div",{className:"text-xs text-muted-foreground",children:[y.total_points," points"]})]}),r.jsxs("div",{className:"text-right",children:[r.jsx("div",{className:"font-bold",children:y.total_events_attended}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"events"})]})]},y.user_id)})})})]})]})]})}const ake=t=>{const e=new Date,n=new Date(t),s=$Le(n,-15),i=lte(n,1);return XLe(e,{start:s,end:i})};function Ift(){const t=es(),{user:e,isAdmin:n}=Fr(),s=Xr(),{data:i,isLoading:o}=rr({queryKey:["public-events"],queryFn:async()=>{const{data:S,error:T}=await ee.from("events").select("*").order("event_date",{ascending:!0});if(T)throw T;return S}}),{data:c}=rr({queryKey:["my-registrations"],queryFn:async()=>{if(!e)return[];const{data:S,error:T}=await ee.from("event_registrations").select("event_id, zoom_join_url").eq("user_id",e.id);if(T)throw T;return S},enabled:!!e}),{data:a}=rr({queryKey:["event-registration-counts"],queryFn:async()=>{const{data:S,error:T}=await ee.from("event_registrations").select("event_id");if(T)throw T;const I={};return S.forEach(A=>{I[A.event_id]=(I[A.event_id]||0)+1}),I}}),f=cr({mutationFn:async S=>{const{data:T,error:I}=await ee.functions.invoke("zoom-register",{body:{event_id:S}});if(I)throw I;if(T!=null&&T.error)throw new Error(T.error);return T},onSuccess:S=>{s.invalidateQueries({queryKey:["my-registrations"]}),s.invalidateQueries({queryKey:["event-registration-counts"]}),S!=null&&S.join_url?Ge.success("Successfully registered! You'll receive a Zoom confirmation email."):Ge.success("Successfully registered for the event!")},onError:S=>{Ge.error("Failed to register: "+S.message)}}),m=cr({mutationFn:async S=>{const{data:T,error:I}=await ee.functions.invoke("zoom-unregister",{body:{event_id:S}});if(I)throw I;if(T!=null&&T.error)throw new Error(T.error);return T},onSuccess:()=>{s.invalidateQueries({queryKey:["my-registrations"]}),s.invalidateQueries({queryKey:["event-registration-counts"]}),Ge.success("Registration cancelled and removed from Zoom")},onError:S=>{Ge.error("Failed to cancel: "+S.message)}}),y=S=>c==null?void 0:c.some(T=>T.event_id===S),v=S=>{const T=c==null?void 0:c.find(I=>I.event_id===S);return T==null?void 0:T.zoom_join_url},w=S=>S.capacity?((a==null?void 0:a[S.id])||0)>=S.capacity:!1,k=(i==null?void 0:i.filter(S=>!ute(new Date(S.event_date))))||[],C=(i==null?void 0:i.filter(S=>ute(new Date(S.event_date))))||[];return r.jsx(Or,{title:"Events",children:r.jsxs("div",{className:"max-w-6xl mx-auto",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-2xl font-bold text-foreground",children:"Events"}),r.jsx("p",{className:"text-muted-foreground",children:"Browse and register for upcoming events"})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Sft,{}),n&&r.jsx(te,{variant:"outline",onClick:()=>t("/admin/events"),children:"Manage Events"})]})]}),r.jsxs("div",{className:`grid grid-cols-1 ${n?"lg:grid-cols-3":""} gap-6`,children:[r.jsxs("div",{className:n?"lg:col-span-2":"",children:[o?r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading events..."}):k.length===0?r.jsx(Ye,{className:"text-center py-12",children:r.jsx(Je,{children:r.jsx("p",{className:"text-muted-foreground",children:"No upcoming events at the moment. Check back soon!"})})}):r.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:k.map(S=>r.jsxs(Ye,{className:`flex flex-col overflow-hidden cursor-pointer hover:shadow-lg transition-all ${ake(S.event_date)?"border-red-500 ring-2 ring-red-500/20":"hover:border-primary/50"}`,onClick:()=>t(`/events/${S.id}`),children:[ake(S.event_date)&&r.jsxs("div",{className:"bg-red-500 text-white px-3 py-1.5 flex items-center gap-2 text-sm font-medium",children:[r.jsxs("span",{className:"relative flex h-2 w-2",children:[r.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-white opacity-75"}),r.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-white"})]}),r.jsx(Hw,{className:"h-3.5 w-3.5"}),"LIVE NOW"]}),S.image_url&&r.jsx(Nft,{ratio:3/2,className:"overflow-hidden",children:r.jsx("img",{src:S.image_url,alt:S.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform"})}),r.jsxs(Ht,{children:[r.jsx(Yt,{className:"line-clamp-2",children:S.title}),S.description&&r.jsx(An,{className:"line-clamp-2",children:S.description.replace(/<[^>]*>/g,"")})]}),r.jsxs(Je,{className:"flex-1 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(li,{className:"h-4 w-4"}),un(new Date(S.event_date),"EEEE, MMMM d, yyyy")]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Xi,{className:"h-4 w-4"}),rye(new Date(S.event_date))]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(hs,{className:"h-4 w-4"}),(a==null?void 0:a[S.id])||0," registered",S.capacity&&` / ${S.capacity} spots`]})]}),r.jsx(OT,{className:"flex gap-2",onClick:T=>T.stopPropagation(),children:y(S.id)?r.jsxs(r.Fragment,{children:[r.jsxs(te,{variant:"outline",className:"flex-1",onClick:()=>m.mutate(S.id),disabled:m.isPending,children:[r.jsx(Ms,{className:"h-4 w-4 mr-2"}),"Cancel"]}),r.jsxs(te,{className:"flex-1",onClick:()=>window.open(v(S.id)||S.zoom_link,"_blank"),children:[r.jsx(Fs,{className:"h-4 w-4 mr-2"}),"Join Zoom"]})]}):r.jsx(te,{className:"w-full",onClick:()=>f.mutate(S.id),disabled:f.isPending||w(S),children:w(S)?"Event Full":r.jsxs(r.Fragment,{children:[r.jsx(Ba,{className:"h-4 w-4 mr-2"}),"Register"]})})})]},S.id))}),C.length>0&&r.jsxs("div",{className:"mt-12",children:[r.jsx("h3",{className:"text-xl font-semibold mb-4 text-muted-foreground",children:"Past Events"}),r.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:C.map(S=>r.jsx(Ye,{className:"opacity-60 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>t(`/events/${S.id}`),children:r.jsxs(Ht,{children:[r.jsx(Yt,{className:"text-base line-clamp-1",children:S.title}),r.jsx(An,{children:un(new Date(S.event_date),"MMMM d, yyyy")})]})},S.id))})]})]}),n&&r.jsx("div",{className:"lg:col-span-1",children:r.jsx(HDe,{showUserStats:!0})})]})]})})}const Ule=[{value:"all",label:"All Roles",icon:hs},{value:"brokerage_manager",label:"Brokerage Managers",icon:AT},{value:"admin",label:"Admins",icon:sm}];function Pft({open:t,onOpenChange:e,resourceType:n,resourceId:s,resourceTitle:i}){var Ae,nt;const{user:o,isAdmin:c,isBrokerageManager:a}=Fr(),[f,m]=P.useState([]),[y,v]=P.useState([]),[w,k]=P.useState([]),[C,S]=P.useState([]),[T,I]=P.useState(""),[A,D]=P.useState(""),[$,F]=P.useState(""),[q,W]=P.useState(!1),[K,Z]=P.useState(!1),[re,he]=P.useState("agents"),[ue,Ne]=P.useState("all"),[se,xe]=P.useState({}),ie=c||a;P.useEffect(()=>{t&&o&&(c?me():fe())},[t,o,c]),P.useEffect(()=>{t||(k([]),S([]),I(""),D(""),F(""),he("agents"),Ne("all"))},[t]);const me=async()=>{if(o){W(!0);try{const{data:Te,error:Xe}=await ee.from("brokerages").select("id, name").order("name");if(Xe)throw Xe;const ge=1e3,mt={};let rt=0,We=!0;for(;We;){const{data:Fe,error:Ke}=await ee.from("profiles").select("brokerage_id").range(rt*ge,(rt+1)*ge-1);if(Ke)throw Ke;Fe==null||Fe.forEach(Le=>{Le.brokerage_id&&(mt[Le.brokerage_id]=(mt[Le.brokerage_id]||0)+1)}),We=(Fe==null?void 0:Fe.length)===ge,rt++}v((Te==null?void 0:Te.map(Fe=>({...Fe,agent_count:mt[Fe.id]||0})))||[]);const Ce=[];for(rt=0,We=!0;We;){const{data:Fe,error:Ke}=await ee.from("profiles").select("id, name, email, brokerage_id, brokerages(name)").neq("id",o.id).order("name").range(rt*ge,(rt+1)*ge-1);if(Ke)throw Ke;Fe&&Ce.push(...Fe),We=(Fe==null?void 0:Fe.length)===ge,rt++}const et={};for(rt=0,We=!0;We;){const{data:Fe,error:Ke}=await ee.from("user_roles").select("user_id, role").range(rt*ge,(rt+1)*ge-1);if(Ke)throw Ke;Fe==null||Fe.forEach(Le=>{et[Le.user_id]||(et[Le.user_id]=[]),et[Le.user_id].push(Le.role)}),We=(Fe==null?void 0:Fe.length)===ge,rt++}xe(et),m(Ce.map(Fe=>{var Ke;return{id:Fe.id,name:Fe.name,email:Fe.email,brokerage_name:((Ke=Fe.brokerages)==null?void 0:Ke.name)||"No Brokerage",roles:et[Fe.id]||[]}}))}catch(Te){console.error("Error loading data:",Te),Ge.error("Failed to load agents and brokerages")}finally{W(!1)}}},fe=async()=>{if(o){W(!0);try{const{data:Te}=await ee.from("profiles").select("brokerage_id").eq("id",o.id).single();if(!(Te!=null&&Te.brokerage_id)){Ge.error("You must be part of a brokerage to share resources"),e(!1);return}const{data:Xe,error:ge}=await ee.from("profiles").select("id, name, email").eq("brokerage_id",Te.brokerage_id).neq("id",o.id).order("name");if(ge)throw ge;m(Xe||[])}catch(Te){console.error("Error loading agents:",Te),Ge.error("Failed to load agents")}finally{W(!1)}}},ve=f.filter(Te=>{var ge;const Xe=Te.name.toLowerCase().includes(T.toLowerCase())||Te.email.toLowerCase().includes(T.toLowerCase())||((ge=Te.brokerage_name)==null?void 0:ge.toLowerCase().includes(T.toLowerCase()));if(c&&ue!=="all"){const mt=se[Te.id]||[];return Xe&&mt.includes(ue)}return Xe}),Ie=y.filter(Te=>Te.name.toLowerCase().includes(A.toLowerCase())),Se=()=>{w.length===ve.length?k([]):k(ve.map(Te=>Te.id))},oe=()=>{C.length===Ie.length?S([]):S(Ie.map(Te=>Te.id))},ae=Te=>{if(!ie){k([Te]);return}k(Xe=>Xe.includes(Te)?Xe.filter(ge=>ge!==Te):[...Xe,Te])},je=Te=>{S(Xe=>Xe.includes(Te)?Xe.filter(ge=>ge!==Te):[...Xe,Te])},Me=async()=>{if(!(w.length>0||C.length>0)){Ge.error("Please select at least one agent or brokerage to share with");return}Z(!0);try{const{data:Xe,error:ge}=await ee.functions.invoke("send-share-notification",{body:{recipientIds:w,brokerageIds:C,resourceType:n,resourceId:s,resourceTitle:i,message:$.trim()||void 0}});if(ge)throw ge;const mt=(Xe==null?void 0:Xe.sharesCreated)||w.length;Ge.success(`Shared with ${mt} agent${mt!==1?"s":""}`),e(!1)}catch(Xe){console.error("Error sharing resource:",Xe),Ge.error("Failed to share resource")}finally{Z(!1)}},Ue=Te=>Te.split(" ").map(Xe=>Xe[0]).join("").toUpperCase().slice(0,2),Re=Te=>{const Xe=se[Te]||[];return Xe.includes("admin")?r.jsx(Rt,{variant:"secondary",className:"text-[10px] px-1.5 py-0",children:"Admin"}):Xe.includes("brokerage_manager")?r.jsx(Rt,{variant:"outline",className:"text-[10px] px-1.5 py-0",children:"Manager"}):null},$e=w.length+C.length,Pe=ue!=="all"?ve.length:null;return r.jsx($r,{open:t,onOpenChange:e,children:r.jsxs(zr,{className:"sm:max-w-lg max-h-[90vh] overflow-hidden flex flex-col",children:[r.jsxs(Zr,{className:"flex-shrink-0",children:[r.jsxs(Kr,{className:"flex items-center gap-2",children:[r.jsx(To,{className:"h-5 w-5 text-primary"}),"Share Resource"]}),r.jsxs(ls,{className:"line-clamp-2",children:['Share "',i,'" with ',c?"agents or brokerages":"agents in your brokerage"]})]}),r.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col space-y-4",children:[c?r.jsxs(La,{value:re,onValueChange:he,className:"flex-1 flex flex-col overflow-hidden",children:[r.jsxs(Ma,{className:"grid w-full grid-cols-2 flex-shrink-0",children:[r.jsxs(yn,{value:"agents",className:"flex items-center gap-2",children:[r.jsx(hs,{className:"h-4 w-4"}),r.jsx("span",{children:"Agents"}),w.length>0&&r.jsx(Rt,{variant:"default",className:"h-5 min-w-5 px-1.5 text-xs",children:w.length})]}),r.jsxs(yn,{value:"brokerages",className:"flex items-center gap-2",children:[r.jsx(ra,{className:"h-4 w-4"}),r.jsx("span",{children:"Brokerages"}),C.length>0&&r.jsx(Rt,{variant:"default",className:"h-5 min-w-5 px-1.5 text-xs",children:C.length})]})]}),r.jsxs($n,{value:"agents",className:"flex-1 flex flex-col space-y-3 mt-3 overflow-hidden",children:[r.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Ti,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(yt,{placeholder:"Search by name, email, or brokerage...",value:T,onChange:Te=>I(Te.target.value),className:"pl-9"})]}),r.jsxs(_n,{value:ue,onValueChange:Ne,children:[r.jsxs(xn,{className:"w-[180px]",children:[r.jsx(Uw,{className:"h-4 w-4 mr-2 text-muted-foreground"}),r.jsx(bn,{placeholder:"Filter by role"})]}),r.jsx(vn,{children:Ule.map(Te=>r.jsx(er,{value:Te.value,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Te.icon,{className:"h-4 w-4"}),r.jsx("span",{children:Te.label})]})},Te.value))})]})]}),r.jsxs("div",{className:"flex items-center justify-between px-1 flex-shrink-0",children:[r.jsxs(te,{variant:"ghost",size:"sm",onClick:Se,className:"text-xs h-8",disabled:ve.length===0,children:[r.jsx(hs,{className:"h-3.5 w-3.5 mr-1.5"}),w.length===ve.length&&ve.length>0?"Deselect All":"Select All"]}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[Pe!==null&&r.jsxs("span",{className:"text-primary font-medium",children:[Pe," ",(Ae=Ule.find(Te=>Te.value===ue))==null?void 0:Ae.label]}),r.jsxs("span",{className:"font-medium",children:[w.length," selected"]})]})]}),r.jsx(xl,{className:"flex-1 border rounded-lg min-h-0",children:q?r.jsx("div",{className:"flex items-center justify-center h-[200px]",children:r.jsx(sn,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):ve.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center h-[200px] text-muted-foreground",children:[r.jsx(hs,{className:"h-8 w-8 mb-2 opacity-50"}),r.jsx("p",{className:"text-sm",children:ue!=="all"?`No ${(nt=Ule.find(Te=>Te.value===ue))==null?void 0:nt.label.toLowerCase()} found`:"No agents found"})]}):r.jsx("div",{className:"p-2 space-y-1",children:ve.map(Te=>r.jsxs("div",{className:`flex items-center gap-3 p-2.5 rounded-lg cursor-pointer hover:bg-accent/50 transition-colors ${w.includes(Te.id)?"bg-accent":""}`,onClick:()=>ae(Te.id),children:[r.jsx(_c,{checked:w.includes(Te.id),onCheckedChange:()=>ae(Te.id),className:"flex-shrink-0"}),r.jsx(Li,{className:"h-9 w-9 flex-shrink-0",children:r.jsx(Oi,{className:"text-xs bg-primary/10 text-primary",children:Ue(Te.name)})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:Te.name}),Re(Te.id)]}),r.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[Te.email,Te.brokerage_name&&r.jsxs("span",{className:"ml-1 opacity-75",children:["• ",Te.brokerage_name]})]})]})]},Te.id))})})]}),r.jsxs($n,{value:"brokerages",className:"flex-1 flex flex-col space-y-3 mt-3 overflow-hidden",children:[r.jsxs("div",{className:"relative flex-shrink-0",children:[r.jsx(Ti,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(yt,{placeholder:"Search brokerages...",value:A,onChange:Te=>D(Te.target.value),className:"pl-9"})]}),r.jsxs("div",{className:"flex items-center justify-between px-1 flex-shrink-0",children:[r.jsxs(te,{variant:"ghost",size:"sm",onClick:oe,className:"text-xs h-8",disabled:Ie.length===0,children:[r.jsx(ra,{className:"h-3.5 w-3.5 mr-1.5"}),C.length===Ie.length&&Ie.length>0?"Deselect All":"Select All"]}),r.jsxs("span",{className:"text-xs text-muted-foreground font-medium",children:[C.length," selected"]})]}),r.jsx("p",{className:"text-xs text-muted-foreground px-1 flex-shrink-0",children:"Selecting a brokerage will send to all agents in that brokerage."}),r.jsx(xl,{className:"flex-1 border rounded-lg min-h-0",children:q?r.jsx("div",{className:"flex items-center justify-center h-[180px]",children:r.jsx(sn,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):Ie.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center h-[180px] text-muted-foreground",children:[r.jsx(ra,{className:"h-8 w-8 mb-2 opacity-50"}),r.jsx("p",{className:"text-sm",children:"No brokerages found"})]}):r.jsx("div",{className:"p-2 space-y-1",children:Ie.map(Te=>r.jsxs("div",{className:`flex items-center gap-3 p-2.5 rounded-lg cursor-pointer hover:bg-accent/50 transition-colors ${C.includes(Te.id)?"bg-accent":""}`,onClick:()=>je(Te.id),children:[r.jsx(_c,{checked:C.includes(Te.id),onCheckedChange:()=>je(Te.id),className:"flex-shrink-0"}),r.jsx("div",{className:"h-9 w-9 rounded-lg bg-primary/10 flex items-center justify-center flex-shrink-0",children:r.jsx(ra,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:Te.name}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[Te.agent_count," agent",Te.agent_count!==1?"s":""]})]})]},Te.id))})})]})]}):r.jsxs("div",{className:"flex-1 flex flex-col space-y-3 overflow-hidden",children:[r.jsxs("div",{className:"relative flex-shrink-0",children:[r.jsx(Ti,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(yt,{placeholder:"Search agents...",value:T,onChange:Te=>I(Te.target.value),className:"pl-9"})]}),ie&&r.jsxs("div",{className:"flex items-center justify-between px-1 flex-shrink-0",children:[r.jsxs(te,{variant:"ghost",size:"sm",onClick:Se,className:"text-xs h-8",disabled:ve.length===0,children:[r.jsx(hs,{className:"h-3.5 w-3.5 mr-1.5"}),w.length===ve.length&&ve.length>0?"Deselect All":"Select All"]}),r.jsxs("span",{className:"text-xs text-muted-foreground font-medium",children:[w.length," selected"]})]}),r.jsx(xl,{className:"flex-1 border rounded-lg min-h-0",children:q?r.jsx("div",{className:"flex items-center justify-center h-[200px]",children:r.jsx(sn,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):ve.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center h-[200px] text-muted-foreground",children:[r.jsx(hs,{className:"h-8 w-8 mb-2 opacity-50"}),r.jsx("p",{className:"text-sm",children:"No agents found"})]}):r.jsx("div",{className:"p-2 space-y-1",children:ve.map(Te=>r.jsxs("div",{className:`flex items-center gap-3 p-2.5 rounded-lg cursor-pointer hover:bg-accent/50 transition-colors ${w.includes(Te.id)?"bg-accent":""}`,onClick:()=>ae(Te.id),children:[r.jsx(_c,{checked:w.includes(Te.id),onCheckedChange:()=>ae(Te.id),className:"flex-shrink-0"}),r.jsx(Li,{className:"h-9 w-9 flex-shrink-0",children:r.jsx(Oi,{className:"text-xs bg-primary/10 text-primary",children:Ue(Te.name)})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:Te.name}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:Te.email})]})]},Te.id))})})]}),r.jsxs("div",{className:"space-y-2 flex-shrink-0",children:[r.jsx(Qe,{htmlFor:"message",className:"text-sm font-medium",children:"Add a message (optional)"}),r.jsx(ps,{id:"message",placeholder:"I thought you might find this useful...",value:$,onChange:Te=>F(Te.target.value),rows:2,className:"resize-none"})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-2 flex-shrink-0",children:[r.jsx(te,{variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsx(te,{onClick:Me,disabled:$e===0||K,children:K?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),"Sharing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(To,{className:"h-4 w-4 mr-2"}),"Share"]})})]})]})]})})}function HC({resourceType:t,resourceId:e,resourceTitle:n,variant:s="outline",size:i="sm",className:o=""}){const[c,a]=P.useState(!1),{user:f}=Fr();return f?r.jsxs(r.Fragment,{children:[r.jsxs(te,{variant:s,size:i,onClick:()=>a(!0),className:o,children:[r.jsx(Kd,{className:"h-4 w-4 mr-2"}),"Share"]}),r.jsx(Pft,{open:c,onOpenChange:a,resourceType:t,resourceId:e,resourceTitle:n})]}):null}function Lft(){const{eventId:t}=dd(),e=es(),{user:n}=Fr(),[s,i]=P.useState(null),[o,c]=P.useState(null),[a,f]=P.useState(0),[m,y]=P.useState(!0),[v,w]=P.useState(!1);P.useEffect(()=>{t&&k()},[t,n]);const k=async()=>{try{const{data:D,error:$}=await ee.from("events").select("*").eq("id",t).single();if($)throw $;i(D);const{count:F}=await ee.from("event_registrations").select("*",{count:"exact",head:!0}).eq("event_id",t);if(f(F||0),n){const{data:q}=await ee.from("event_registrations").select("id, zoom_join_url").eq("event_id",t).eq("user_id",n.id).maybeSingle();c(q)}}catch(D){console.error("Error loading event:",D),Ge.error("Failed to load event"),e("/events")}finally{y(!1)}},C=async()=>{if(!(!n||!s)){w(!0);try{if(o){const{error:D}=await ee.functions.invoke("zoom-unregister",{body:{event_id:s.id}});if(D)throw D;Ge.success("Successfully cancelled registration"),c(null),f($=>$-1)}else{const{data:D,error:$}=await ee.functions.invoke("zoom-register",{body:{event_id:s.id}});if($)throw $;Ge.success("Successfully registered for event!"),c({id:D.registration_id,zoom_join_url:D.zoom_join_url}),f(F=>F+1)}}catch(D){console.error("Registration error:",D),Ge.error(o?"Failed to cancel registration":"Failed to register for event")}finally{w(!1)}}},S=D=>{var $,F,q;if(D.includes("iframe.mediadelivery.net")||D.includes("video.bunnycdn.com")){const W=D.match(/embed\/(\d+)\/([a-f0-9-]+)/);if(W)return`https://iframe.mediadelivery.net/embed/${W[1]}/${W[2]}?autoplay=false&preload=true`}if(D.includes("youtube.com")||D.includes("youtu.be")){const W=D.includes("youtu.be")?($=D.split("youtu.be/")[1])==null?void 0:$.split("?")[0]:(F=D.split("v=")[1])==null?void 0:F.split("&")[0];if(W)return`https://www.youtube.com/embed/${W}`}if(D.includes("vimeo.com")){const W=(q=D.split("vimeo.com/")[1])==null?void 0:q.split("?")[0];if(W)return`https://player.vimeo.com/video/${W}`}return D};if(m)return r.jsx(Or,{title:"Event",children:r.jsx("div",{className:"flex items-center justify-center py-16",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"Loading event..."})]})})});if(!s)return r.jsx(Or,{title:"Event Not Found",children:r.jsxs("div",{className:"text-center py-16",children:[r.jsx("p",{className:"text-muted-foreground",children:"Event not found"}),r.jsx(te,{onClick:()=>e("/events"),className:"mt-4",children:"Back to Events"})]})});const T=ute(new Date(s.event_date)),I=s.capacity&&a>=s.capacity,A=(o==null?void 0:o.zoom_join_url)||s.zoom_link;return r.jsx(Or,{title:s.title,children:r.jsxs("div",{className:"max-w-4xl mx-auto",children:[r.jsxs(te,{variant:"ghost",className:"mb-6 gap-2",onClick:()=>e("/events"),children:[r.jsx(Va,{className:"h-4 w-4"}),"Back to Events"]}),s.image_url&&r.jsxs("div",{className:"relative aspect-video rounded-xl overflow-hidden mb-6",children:[r.jsx("img",{src:s.image_url,alt:s.title,className:"w-full h-full object-cover"}),T&&r.jsx("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:r.jsx(Rt,{variant:"secondary",className:"text-lg px-4 py-2",children:"Event Ended"})})]}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-start justify-between gap-4 mb-4",children:[r.jsx("h1",{className:"text-3xl font-bold text-foreground",children:s.title}),r.jsx(HC,{resourceType:"event",resourceId:s.id,resourceTitle:s.title})]}),s.description&&r.jsx("div",{className:"prose prose-sm max-w-none text-muted-foreground dark:prose-invert",dangerouslySetInnerHTML:{__html:s.description}})]}),s.video_url&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[r.jsx(Sf,{className:"h-5 w-5"}),"Event Preview"]}),r.jsx("div",{className:"relative w-full aspect-video rounded-xl overflow-hidden border bg-muted",children:r.jsx("iframe",{src:S(s.video_url),className:"absolute inset-0 w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,title:"Event Preview Video"})})]})]}),r.jsx("div",{className:"space-y-4",children:r.jsx(Ye,{children:r.jsxs(Je,{className:"p-6 space-y-4",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(li,{className:"h-5 w-5 text-primary mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:un(new Date(s.event_date),"EEEE, MMMM d, yyyy")}),r.jsx("p",{className:"text-sm text-muted-foreground",children:rye(new Date(s.event_date))})]})]}),s.capacity&&r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(hs,{className:"h-5 w-5 text-primary mt-0.5"}),r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium",children:[a," / ",s.capacity]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Registered"})]})]}),o&&r.jsxs("div",{className:"flex items-center gap-2 p-3 bg-green-500/10 rounded-lg",children:[r.jsx(za,{className:"h-5 w-5 text-green-600"}),r.jsx("span",{className:"text-sm font-medium text-green-700",children:"You're registered!"})]}),r.jsxs("div",{className:"space-y-2 pt-2",children:[!T&&r.jsx(r.Fragment,{children:o?r.jsxs(r.Fragment,{children:[r.jsxs(te,{className:"w-full gap-2",onClick:()=>window.open(A,"_blank"),children:[r.jsx(Fs,{className:"h-4 w-4"}),"Join Event"]}),r.jsxs(te,{variant:"outline",className:"w-full",onClick:C,disabled:v,children:[v?r.jsx(sn,{className:"h-4 w-4 animate-spin mr-2"}):null,"Cancel Registration"]})]}):r.jsx(te,{className:"w-full gap-2",onClick:C,disabled:v||(I??!1),children:v?r.jsx(sn,{className:"h-4 w-4 animate-spin"}):I?"Event Full":"Register Now"})}),T&&o&&r.jsxs(te,{variant:"outline",className:"w-full gap-2",onClick:()=>window.open(s.zoom_link,"_blank"),children:[r.jsx(Fs,{className:"h-4 w-4"}),"View Recording"]})]})]})})})]})]})})}const Oft=()=>{const{user:t,isAdmin:e}=Fr(),n=es(),[s,i]=P.useState([]),[o,c]=P.useState(!0),[a,f]=P.useState(""),[m,y]=P.useState("all"),[v,w]=P.useState(new Set);P.useEffect(()=>{k()},[t]);const k=async()=>{try{const{data:A}=await ee.from("user_tags").select("tag").eq("user_id",t==null?void 0:t.id),D=(A==null?void 0:A.map(re=>re.tag))||[],{data:$,error:F}=await ee.from("app_tiles").select("*").order("name");if(F)throw F;const{data:q}=await ee.from("user_favorites").select("app_id").eq("user_id",t==null?void 0:t.id),W=new Set((q==null?void 0:q.map(re=>re.app_id))||[]);w(W);const Z=(($==null?void 0:$.filter(re=>!re.required_tags||re.required_tags.length===0?!0:re.required_tags.some(he=>D.includes(he))))||[]).sort((re,he)=>re.name==="LevelUp Members Portal"?-1:he.name==="LevelUp Members Portal"?1:0);i(Z)}catch(A){console.error("Error loading apps:",A),Ge.error("Failed to load apps")}finally{c(!1)}},C=async A=>{var $;const D=window.open("about:blank","_blank");try{const{data:F,error:q}=await ee.auth.getSession();if(q||!F.session){D==null||D.close(),Ge.error("Session expired. Please refresh the page and try again.");return}const W=F.session.access_token;await ee.from("activity_logs").insert({user_id:t==null?void 0:t.id,app_id:A.app_id,app_name:A.name,user_agent:navigator.userAgent});const{data:K,error:Z}=await ee.functions.invoke("sso-launch",{body:{app_id:A.app_id},headers:{Authorization:`Bearer ${W}`}});if(Z)throw Z;K!=null&&K.redirect_url?D&&!D.closed?(D.location.href=K.redirect_url,($=D.focus)==null||$.call(D)):window.location.assign(K.redirect_url):(D==null||D.close(),Ge.error("Launch link unavailable"))}catch(F){D==null||D.close(),console.error("Error launching app:",F),Ge.error("Failed to launch app. Please try again.")}},S=async(A,D)=>{A.stopPropagation();const $=v.has(D);try{if($){const{error:F}=await ee.from("user_favorites").delete().eq("user_id",t==null?void 0:t.id).eq("app_id",D);if(F)throw F;w(q=>{const W=new Set(q);return W.delete(D),W}),Ge.success("Removed from favorites")}else{const{error:F}=await ee.from("user_favorites").insert({user_id:t==null?void 0:t.id,app_id:D});if(F)throw F;w(q=>new Set(q).add(D)),Ge.success("Added to favorites")}}catch(F){console.error("Error toggling favorite:",F),Ge.error("Failed to update favorites")}},T=s.filter(A=>{var $;const D=A.name.toLowerCase().includes(a.toLowerCase())||(($=A.description)==null?void 0:$.toLowerCase().includes(a.toLowerCase()));return m==="favorites"?D&&v.has(A.id):D}),I=[{id:"all",label:"All"},{id:"favorites",label:"Favorites"}];return o?r.jsx(Or,{title:"Apps & Tools",children:r.jsx("div",{className:"flex items-center justify-center py-16",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"Loading apps..."})]})})}):r.jsxs(Or,{title:"Apps & Tools",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 mb-6",children:[r.jsx("h2",{className:"text-2xl font-bold text-foreground",children:"Apps & Tools"}),r.jsxs("div",{className:"relative max-w-sm w-full",children:[r.jsx(Ti,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(yt,{placeholder:"Search apps...",className:"pl-10 bg-muted/50 border-0 focus-visible:ring-1",value:a,onChange:A=>f(A.target.value)})]})]}),r.jsx("div",{className:"flex gap-6 border-b border-border mb-8",children:I.map(A=>r.jsxs("button",{onClick:()=>y(A.id),className:zt("pb-3 text-sm font-medium transition-colors relative",m===A.id?"text-primary":"text-muted-foreground hover:text-foreground"),children:[A.label,m===A.id&&r.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]},A.id))}),T.length===0?r.jsx("div",{className:"flex flex-col items-center justify-center py-16 bg-card rounded-xl border border-border",children:m==="favorites"?r.jsxs(r.Fragment,{children:[r.jsx(Jp,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("p",{className:"text-lg font-medium mb-2 text-foreground",children:"No favorites yet"}),r.jsx("p",{className:"text-sm text-muted-foreground text-center max-w-md",children:"Click the bookmark icon on any app to add it to your favorites"})]}):r.jsxs(r.Fragment,{children:[r.jsx(Ff,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("p",{className:"text-lg font-medium mb-2 text-foreground",children:"No apps available"}),r.jsx("p",{className:"text-sm text-muted-foreground text-center max-w-md",children:e?"Get started by adding apps in the admin panel":"Contact your administrator to get access to apps"}),e&&r.jsx(te,{className:"mt-4",onClick:()=>n("/admin/apps"),children:"Add Apps"})]})}):r.jsx("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:T.map(A=>{const D=v.has(A.id),$=A.name.toLowerCase().includes("agent review")||A.app_id==="agent_review";return r.jsxs("div",{className:"group flex flex-col p-5 bg-card rounded-xl border border-border transition-all duration-200 hover:shadow-lg hover:border-primary/30",children:[r.jsxs("div",{className:"flex items-start gap-4 cursor-pointer",onClick:()=>C(A),children:[r.jsx("div",{className:"flex-shrink-0 w-14 h-14 rounded-xl bg-primary/10 flex items-center justify-center text-3xl",children:A.icon}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-semibold text-foreground group-hover:text-primary transition-colors truncate",children:A.name}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:A.description})]}),r.jsx("button",{className:zt("flex-shrink-0 p-1 transition-colors",D?"text-primary":"text-muted-foreground/50 hover:text-primary"),onClick:F=>S(F,A.id),children:r.jsx(Jp,{className:zt("h-5 w-5",D&&"fill-current")})})]}),$&&r.jsx("a",{href:"https://forms.gle/vXnrzgSnPbw7CKPV6",target:"_blank",rel:"noopener noreferrer",onClick:F=>F.stopPropagation(),className:"mt-3 text-sm text-primary hover:underline flex items-center gap-1",children:"Create your account with this link →"})]},A.id)})})]})},Dft=()=>{const t=es(),[e,n]=P.useState(""),[s,i]=P.useState("all"),[o,c]=P.useState("all"),[a,f]=P.useState("grid"),{data:m=[]}=rr({queryKey:["template-categories"],queryFn:async()=>{const{data:I,error:A}=await ee.from("template_categories").select("*").order("name");if(A)throw A;return I}}),{data:y=[]}=rr({queryKey:["template-types"],queryFn:async()=>{const{data:I,error:A}=await ee.from("template_types").select("*").order("name");if(A)throw A;return I}}),{data:v=[],isLoading:w}=rr({queryKey:["canva-templates"],queryFn:async()=>{const{data:I,error:A}=await ee.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).order("publish_date",{ascending:!1});if(A)throw A;const{data:D,error:$}=await ee.from("template_links").select("*").order("sort_order");if($)throw $;const{data:F}=await ee.from("template_likes").select("template_id"),{data:q}=await ee.from("template_comments").select("template_id"),W=new Map;F==null||F.forEach(re=>{W.set(re.template_id,(W.get(re.template_id)||0)+1)});const K=new Map;return q==null||q.forEach(re=>{K.set(re.template_id,(K.get(re.template_id)||0)+1)}),(I||[]).map(re=>({...re,links:(D||[]).filter(he=>he.template_id===re.id)||[],likesCount:W.get(re.id)||0,commentsCount:K.get(re.id)||0}))}}),k=v.filter(I=>{var F;const A=I.name.toLowerCase().includes(e.toLowerCase())||((F=I.description)==null?void 0:F.toLowerCase().includes(e.toLowerCase())),D=s==="all"||I.category_id===s,$=o==="all"||I.type_id===o;return A&&D&&$}),C=()=>{n(""),i("all"),c("all")},S=e||s!=="all"||o!=="all",T=I=>{t(`/templates/${I}`)};return r.jsx(Or,{title:"Canva Templates",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"font-bold text-foreground text-5xl",children:"Canva Templates"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Browse and use our collection of professionally designed templates"})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(Ti,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(yt,{placeholder:"Search templates...",value:e,onChange:I=>n(I.target.value),className:"pl-9"})]}),r.jsxs(_n,{value:s,onValueChange:i,children:[r.jsx(xn,{className:"w-full sm:w-48",children:r.jsx(bn,{placeholder:"All Categories"})}),r.jsxs(vn,{children:[r.jsx(er,{value:"all",children:"All Categories"}),m.map(I=>r.jsx(er,{value:I.id,children:I.name},I.id))]})]}),r.jsxs(_n,{value:o,onValueChange:c,children:[r.jsx(xn,{className:"w-full sm:w-48",children:r.jsx(bn,{placeholder:"All Types"})}),r.jsxs(vn,{children:[r.jsx(er,{value:"all",children:"All Types"}),y.map(I=>r.jsx(er,{value:I.id,children:I.name},I.id))]})]}),r.jsxs("div",{className:"flex gap-2",children:[S&&r.jsx(te,{variant:"outline",size:"sm",onClick:C,children:"Clear Filters"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(te,{variant:a==="grid"?"secondary":"outline",size:"icon",onClick:()=>f("grid"),className:"rounded-full",children:r.jsx(lg,{className:"h-4 w-4"})}),r.jsx(te,{variant:a==="list"?"secondary":"outline",size:"icon",onClick:()=>f("list"),className:"rounded-full",children:r.jsx(rm,{className:"h-4 w-4"})})]})]})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[k.length," template",k.length!==1?"s":""," found"]}),w&&r.jsx("div",{className:a==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:[...Array(8)].map((I,A)=>r.jsx(Ye,{children:r.jsxs(Je,{className:"p-4",children:[r.jsx(Gr,{className:"aspect-[4/3] w-full rounded-lg mb-4"}),r.jsx(Gr,{className:"h-5 w-3/4 mb-2"}),r.jsx(Gr,{className:"h-4 w-full mb-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Gr,{className:"h-5 w-16"}),r.jsx(Gr,{className:"h-5 w-20"})]})]})},A))}),!w&&k.length===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx("div",{className:"text-muted-foreground mb-4",children:S?"No templates match your filters":"No templates available yet"}),S&&r.jsx(te,{variant:"outline",onClick:C,children:"Clear Filters"})]}),!w&&k.length>0&&r.jsx("div",{className:a==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:k.map(I=>r.jsxs(Ye,{className:`group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer ${a==="list"?"flex flex-row":""}`,onClick:()=>T(I.id),children:[r.jsxs("div",{className:`relative overflow-hidden bg-muted ${a==="list"?"w-48 shrink-0":"aspect-[3/2]"}`,children:[I.preview_image_url?r.jsx("img",{src:I.preview_image_url,alt:I.name,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:"No Preview"}),I.links.length>1&&r.jsx("div",{className:"absolute top-2 right-2",children:r.jsxs(Rt,{variant:"secondary",className:"gap-1 bg-background/90 backdrop-blur-sm !text-secondary",children:[r.jsx(bo,{className:"h-3 w-3"}),I.links.length]})})]}),r.jsxs(Je,{className:`p-4 flex flex-col ${a==="list"?"flex-1":""}`,children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:I.name}),I.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3 flex-1",children:jne(I.description)}),r.jsxs("div",{className:"flex flex-wrap gap-2 mb-3",children:[I.category&&r.jsx(Rt,{variant:"secondary",className:"text-xs",children:I.category.name}),I.type&&r.jsx(Rt,{variant:"outline",className:"text-xs",children:I.type.name})]}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground mb-3",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Zd,{className:"h-3.5 w-3.5"}),I.likesCount]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Hl,{className:"h-3.5 w-3.5"}),I.commentsCount]})]}),r.jsxs(te,{size:"sm",className:"w-full gap-2",onClick:A=>{A.stopPropagation(),T(I.id)},children:[r.jsx(Fs,{className:"h-4 w-4"}),"View Template"]})]})]},I.id))})]})})};var Rft="Separator",oke="horizontal",Fft=["horizontal","vertical"],WDe=P.forwardRef((t,e)=>{const{decorative:n,orientation:s=oke,...i}=t,o=zft(s)?s:oke,a=n?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return r.jsx(On.div,{"data-orientation":o,...a,...i,ref:e})});WDe.displayName=Rft;function zft(t){return Fft.includes(t)}var GDe=WDe;const Vd=P.forwardRef(({className:t,orientation:e="horizontal",decorative:n=!0,...s},i)=>r.jsx(GDe,{ref:i,decorative:n,orientation:e,className:zt("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...s}));Vd.displayName=GDe.displayName;const oI=()=>({trackEngagement:P.useCallback(async(e,n,s,i="view")=>{try{const{data:{user:o}}=await ee.auth.getUser();if(!o)return;await ee.from("content_engagement_logs").insert({user_id:o.id,resource_type:e,resource_id:n,resource_title:s,action_type:i})}catch(o){console.error("Error tracking engagement:",o)}},[])}),Bft=()=>{const{templateId:t}=dd(),{user:e,isAdmin:n}=Fr(),{toast:s}=la(),i=Xr(),{trackEngagement:o}=oI(),[c,a]=P.useState(""),{data:f,isLoading:m}=rr({queryKey:["template-detail",t],queryFn:async()=>{const{data:A,error:D}=await ee.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).eq("id",t).single();if(D)throw D;const{data:$}=await ee.from("template_links").select("*").eq("template_id",t).order("sort_order"),{data:F}=await ee.from("template_guides").select("*").eq("template_id",t).order("sort_order");return{...A,links:$||[],guides:F||[]}},enabled:!!t});P.useEffect(()=>{f&&o("template",f.id,f.name,"view")},[f==null?void 0:f.id]);const{data:y=[]}=rr({queryKey:["template-likes",t],queryFn:async()=>{const{data:A,error:D}=await ee.from("template_likes").select("*").eq("template_id",t);if(D)throw D;return A},enabled:!!t}),{data:v=[]}=rr({queryKey:["template-comments",t],queryFn:async()=>{const{data:A,error:D}=await ee.from("template_comments").select("*").eq("template_id",t).order("created_at",{ascending:!1});if(D)throw D;const $=[...new Set(A.map(W=>W.user_id))],{data:F}=await ee.from("profiles").select("id, name").in("id",$),q=new Map((F==null?void 0:F.map(W=>[W.id,W.name]))||[]);return A.map(W=>({...W,user_name:q.get(W.user_id)||"Unknown User"}))},enabled:!!t}),w=cr({mutationFn:async A=>{const{error:D}=await ee.from("template_comments").insert({template_id:t,user_id:e.id,content:A});if(D)throw D},onSuccess:()=>{i.invalidateQueries({queryKey:["template-comments",t]}),a(""),s({title:"Comment added!"})},onError:A=>{s({title:"Error adding comment",description:A.message,variant:"destructive"})}}),k=cr({mutationFn:async A=>{const{error:D}=await ee.from("template_comments").delete().eq("id",A);if(D)throw D},onSuccess:()=>{i.invalidateQueries({queryKey:["template-comments",t]}),s({title:"Comment deleted"})}}),C=cr({mutationFn:async()=>{const A=y.find(D=>D.user_id===(e==null?void 0:e.id));if(A){const{error:D}=await ee.from("template_likes").delete().eq("id",A.id);if(D)throw D}else{const{error:D}=await ee.from("template_likes").insert({template_id:t,user_id:e.id});if(D)throw D}},onSuccess:()=>{i.invalidateQueries({queryKey:["template-likes",t]})}}),S=y.some(A=>A.user_id===(e==null?void 0:e.id)),T=A=>A.split(" ").map(D=>D[0]).join("").toUpperCase().slice(0,2),I=A=>{A.preventDefault(),!(!c.trim()||!e)&&w.mutate(c.trim())};return m?r.jsx(Or,{title:"Templates",children:r.jsx("div",{className:"flex justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):f?r.jsx(Or,{title:f.name,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(te,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(ao,{to:"/templates",children:[r.jsx(Va,{className:"h-4 w-4"}),"Back to Templates"]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:f.name}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[f.category&&r.jsx(Rt,{variant:"secondary",children:f.category.name}),f.type&&r.jsx(Rt,{variant:"outline",children:f.type.name})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[n&&r.jsx(te,{variant:"outline",className:"gap-2 rounded-full",asChild:!0,children:r.jsxs(ao,{to:`/admin/templates?edit=${f.id}`,children:[r.jsx(ma,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit"})]})}),r.jsx(HC,{resourceType:"template",resourceId:f.id,resourceTitle:f.name,size:"default",className:"rounded-full"}),r.jsxs(te,{variant:S?"default":"outline",className:"gap-2 rounded-full",onClick:()=>C.mutate(),disabled:!e||C.isPending,children:[r.jsx(Zd,{className:`h-4 w-4 ${S?"fill-current":""}`}),y.length," ",y.length===1?"Like":"Likes"]})]})]}),f.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert [&>p]:mb-4 [&>p:last-child]:mb-0 whitespace-pre-line",dangerouslySetInnerHTML:{__html:f.description}})]}),r.jsx(Ye,{children:r.jsxs(Je,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(bo,{className:"h-4 w-4"}),f.links.length===1?"Template Link":"Template Links"]}),r.jsx("div",{className:"grid gap-2",children:f.links.map(A=>r.jsxs(te,{variant:"outline",className:"w-full justify-between gap-2 h-auto py-3",onClick:()=>{o("template",f.id,f.name,"click_canva"),window.open(A.canva_share_link,"_blank")},children:[r.jsx("span",{className:"font-medium",children:A.title}),r.jsx(Fs,{className:"h-4 w-4 text-muted-foreground"})]},A.id))})]})}),f.video_url&&r.jsx(Ye,{children:r.jsx(Je,{className:"pt-6",children:r.jsx("div",{className:"aspect-video w-full rounded-lg overflow-hidden",children:r.jsx("iframe",{src:f.video_url,className:"w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})})}),f.guides&&f.guides.length>0&&r.jsx(Ye,{children:r.jsxs(Je,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Ai,{className:"h-4 w-4"}),"Guide Files"]}),r.jsx("div",{className:"grid gap-2",children:f.guides.map(A=>r.jsxs(te,{variant:"outline",className:"w-full justify-between gap-2 h-auto py-3",onClick:()=>{o("template",f.id,f.name,"click_pdf"),window.open(A.file_url,"_blank")},children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ai,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"font-medium",children:A.name}),A.file_size&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",(A.file_size/1024).toFixed(0)," KB)"]})]}),r.jsx(Mo,{className:"h-4 w-4 text-muted-foreground"})]},A.id))})]})}),r.jsx(Vd,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(Hl,{className:"h-5 w-5"}),"Comments (",v.length,")"]}),e?r.jsxs("form",{onSubmit:I,className:"flex gap-2",children:[r.jsx(ps,{placeholder:"Add a comment...",value:c,onChange:A=>a(A.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(te,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!c.trim()||w.isPending,children:r.jsx(To,{className:"h-4 w-4"})})]}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"Log in to add a comment"}),r.jsx("div",{className:"space-y-4",children:v.length===0?r.jsx(Ye,{children:r.jsx(Je,{className:"py-8 text-center",children:r.jsx("p",{className:"text-muted-foreground",children:"No comments yet. Be the first to share your thoughts!"})})}):v.map(A=>r.jsx(Ye,{children:r.jsx(Je,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Li,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(Oi,{className:"text-sm",children:T(A.user_name||"U")})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"font-medium",children:A.user_name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:Yd(new Date(A.created_at),{addSuffix:!0})}),A.user_id===(e==null?void 0:e.id)&&r.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>k.mutate(A.id),children:r.jsx(Xn,{className:"h-3 w-3 text-muted-foreground"})})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:A.content})]})]})})},A.id))})]})]})}):r.jsx(Or,{title:"Templates",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(bo,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Template not found"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"This template may have been removed or is not available."}),r.jsx(te,{asChild:!0,className:"mt-4",children:r.jsx(ao,{to:"/templates",children:"Back to Templates"})})]})})},$ft=()=>{const{user:t}=Fr(),[e,n]=P.useState(""),[s,i]=P.useState("all"),{data:o=[]}=rr({queryKey:["academy-categories"],queryFn:async()=>{const{data:w,error:k}=await ee.from("academy_categories").select("*").order("sort_order",{ascending:!0});if(k)throw k;return w}}),{data:c=[],isLoading:a}=rr({queryKey:["academy-videos"],queryFn:async()=>{const{data:w,error:k}=await ee.from("academy_videos").select(` *, category:academy_categories(id, name) `).eq("is_published",!0).order("publish_date",{ascending:!1});if(k)throw k;const{data:C,error:S}=await ee.from("academy_resources").select("*").order("sort_order");if(S)throw S;return w.map(I=>({...I,resources:(C==null?void 0:C.filter(A=>A.video_id===I.id))||[]}))}}),{data:f=[]}=rr({queryKey:["academy-video-likes"],queryFn:async()=>{const{data:w,error:k}=await ee.from("academy_video_likes").select("video_id, user_id");if(k)throw k;return w}}),m=c.filter(w=>{var S;const k=e===""||w.title.toLowerCase().includes(e.toLowerCase())||((S=w.description)==null?void 0:S.toLowerCase().includes(e.toLowerCase())),C=s==="all"||w.category_id===s;return k&&C}),y=w=>f.filter(k=>k.video_id===w).length,v=w=>f.some(k=>k.video_id===w&&k.user_id===(t==null?void 0:t.id));return r.jsx(Or,{title:"Academy",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-5xl font-bold text-foreground",children:"Academy"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"On-demand training videos and resources"})]}),r.jsx("div",{className:"flex flex-col sm:flex-row gap-4",children:r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Ti,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(yt,{placeholder:"Search videos...",value:e,onChange:w=>n(w.target.value),className:"pl-10"})]})}),r.jsx(La,{value:s,onValueChange:i,children:r.jsxs(Ma,{className:"w-full justify-start flex-wrap h-auto gap-2 bg-transparent p-0",children:[r.jsx(yn,{value:"all",className:"data-[state=active]:bg-primary data-[state=active]:text-primary-foreground",children:"All Videos"}),o.map(w=>r.jsx(yn,{value:w.id,className:"data-[state=active]:bg-primary data-[state=active]:text-primary-foreground",children:w.name},w.id))]})}),a?r.jsx("div",{className:"flex justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):m.length===0?r.jsx(Ye,{children:r.jsxs(Je,{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Gi,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"No videos found"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:e?"Try adjusting your search terms":"Check back soon for new content"})]})}):r.jsx("div",{className:"grid gap-6 sm:grid-cols-2 lg:grid-cols-3",children:m.map(w=>r.jsx(ao,{to:`/academy/${w.id}`,children:r.jsxs(Ye,{className:"overflow-hidden cursor-pointer hover:shadow-lg transition-shadow group h-full",children:[r.jsxs("div",{className:"relative aspect-video bg-muted",children:[w.thumbnail_url?r.jsx("img",{src:w.thumbnail_url,alt:w.title,className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Gi,{className:"h-12 w-12 text-muted-foreground"})}),r.jsx("div",{className:"absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:r.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/90 flex items-center justify-center",children:r.jsx(wc,{className:"h-8 w-8 text-primary-foreground ml-1"})})}),w.duration&&r.jsxs("div",{className:"absolute bottom-2 right-2 bg-black/70 text-white text-xs px-2 py-1 rounded flex items-center gap-1",children:[r.jsx(Xi,{className:"h-3 w-3"}),w.duration]})]}),r.jsxs(Ht,{className:"pb-2",children:[r.jsx("div",{className:"flex items-start justify-between gap-2",children:r.jsx(Yt,{className:"text-lg line-clamp-2",children:w.title})}),w.category&&r.jsx(Rt,{variant:"secondary",className:"w-fit",children:w.category.name})]}),r.jsxs(Je,{className:"pt-0",children:[w.description&&r.jsx(An,{className:"line-clamp-2",children:w.description.replace(/<[^>]*>/g,"")}),r.jsxs("div",{className:"flex items-center gap-4 mt-3 text-sm text-muted-foreground",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Zd,{className:`h-4 w-4 ${v(w.id)?"fill-primary text-primary":""}`}),y(w.id)]}),w.resources&&w.resources.length>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ai,{className:"h-4 w-4"}),w.resources.length]})]})]})]})},w.id))})]})})},Uft=(t,e)=>{if(e==="bunny_stream"){let n=t.replace("iframe.mediadelivery.net","player.mediadelivery.net");return n.includes("?")||(n+="?autoplay=false&loop=false&muted=false&preload=true&responsive=true"),n}if(e==="youtube"){const n=/(?:youtube\.com\/(?:watch\?v=|embed\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})/,s=t.match(n);if(s)return`https://www.youtube.com/embed/${s[1]}`}if(e==="vimeo"){const n=/vimeo\.com\/(?:video\/)?(\d+)/,s=t.match(n);if(s)return`https://player.vimeo.com/video/${s[1]}`}if(e==="loom"){const n=/loom\.com\/share\/([a-zA-Z0-9]+)/,s=t.match(n);if(s)return`https://www.loom.com/embed/${s[1]}`}return t},qft=()=>{const{videoId:t}=dd();es();const{user:e}=Fr(),{toast:n}=la(),s=Xr(),{trackEngagement:i}=oI(),[o,c]=P.useState(""),{data:a,isLoading:f}=rr({queryKey:["academy-video",t],queryFn:async()=>{const{data:A,error:D}=await ee.from("academy_videos").select(` *, category:academy_categories(id, name) `).eq("id",t).eq("is_published",!0).single();if(D)throw D;const{data:$}=await ee.from("academy_resources").select("*").eq("video_id",t).order("sort_order");return{...A,resources:$||[]}},enabled:!!t});P.useEffect(()=>{a&&i("academy_video",a.id,a.title,"view")},[a==null?void 0:a.id]);const{data:m=[]}=rr({queryKey:["academy-video-likes",t],queryFn:async()=>{const{data:A,error:D}=await ee.from("academy_video_likes").select("*").eq("video_id",t);if(D)throw D;return A},enabled:!!t}),{data:y=[]}=rr({queryKey:["academy-video-comments",t],queryFn:async()=>{const{data:A,error:D}=await ee.from("academy_video_comments").select("*").eq("video_id",t).order("created_at",{ascending:!1});if(D)throw D;const $=[...new Set(A.map(W=>W.user_id))],{data:F}=await ee.from("profiles").select("id, name").in("id",$),q=new Map((F==null?void 0:F.map(W=>[W.id,W.name]))||[]);return A.map(W=>({...W,user_name:q.get(W.user_id)||"Unknown User"}))},enabled:!!t}),v=cr({mutationFn:async A=>{const{error:D}=await ee.from("academy_video_comments").insert({video_id:t,user_id:e.id,content:A});if(D)throw D},onSuccess:()=>{s.invalidateQueries({queryKey:["academy-video-comments",t]}),c(""),n({title:"Comment added!"})},onError:A=>{n({title:"Error adding comment",description:A.message,variant:"destructive"})}}),w=cr({mutationFn:async A=>{const{error:D}=await ee.from("academy_video_comments").delete().eq("id",A);if(D)throw D},onSuccess:()=>{s.invalidateQueries({queryKey:["academy-video-comments",t]}),n({title:"Comment deleted"})}}),k=cr({mutationFn:async()=>{const A=m.find(D=>D.user_id===(e==null?void 0:e.id));if(A){const{error:D}=await ee.from("academy_video_likes").delete().eq("id",A.id);if(D)throw D}else{const{error:D}=await ee.from("academy_video_likes").insert({video_id:t,user_id:e.id});if(D)throw D}},onSuccess:()=>{s.invalidateQueries({queryKey:["academy-video-likes",t]})}}),C=m.some(A=>A.user_id===(e==null?void 0:e.id)),S=A=>{switch(A==null?void 0:A.toLowerCase()){case"pdf":return"📄";case"pptx":case"ppt":return"📊";case"xlsx":case"xls":return"📈";case"docx":case"doc":return"📝";case"zip":return"📦";default:return"📁"}},T=A=>A.split(" ").map(D=>D[0]).join("").toUpperCase().slice(0,2),I=A=>{A.preventDefault(),!(!o.trim()||!e)&&v.mutate(o.trim())};return f?r.jsx(Or,{title:"Academy",children:r.jsx("div",{className:"flex justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):a?r.jsx(Or,{title:a.title,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(te,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(ao,{to:"/academy",children:[r.jsx(Va,{className:"h-4 w-4"}),"Back to Academy"]})}),r.jsx("div",{className:"relative w-full rounded-lg overflow-hidden bg-black",style:{paddingTop:"56.25%"},children:["youtube","vimeo","loom","bunny_stream"].includes(a.video_type)?r.jsx("iframe",{src:Uft(a.video_url,a.video_type),loading:"lazy",style:{border:0,position:"absolute",top:0,left:0,height:"100%",width:"100%"},allow:"accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0}):r.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-white gap-4",children:[r.jsx(Gi,{className:"h-16 w-16 opacity-50"}),r.jsx(te,{variant:"secondary",asChild:!0,children:r.jsxs("a",{href:a.video_url,target:"_blank",rel:"noopener noreferrer",className:"gap-2",children:[r.jsx(Fs,{className:"h-4 w-4"}),"Open Video"]})})]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:a.title}),a.category&&r.jsx(Rt,{variant:"secondary",children:a.category.name})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(HC,{resourceType:"academy_video",resourceId:a.id,resourceTitle:a.title}),r.jsxs(te,{variant:C?"default":"outline",className:"gap-2 w-fit",onClick:()=>k.mutate(),disabled:!e||k.isPending,children:[r.jsx(Zd,{className:`h-4 w-4 ${C?"fill-current":""}`}),m.length," ",m.length===1?"Like":"Likes"]})]})]}),a.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:a.description}})]}),a.resources&&a.resources.length>0&&r.jsx(Ye,{children:r.jsxs(Je,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Ai,{className:"h-4 w-4"}),"Resources"]}),r.jsx("div",{className:"grid gap-2",children:a.resources.map(A=>r.jsxs("a",{href:A.file_url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-3 p-3 rounded-lg border hover:bg-muted transition-colors",children:[r.jsx("span",{className:"text-2xl",children:S(A.file_type)}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium truncate",children:A.title}),r.jsx("p",{className:"text-xs text-muted-foreground uppercase",children:A.file_type})]}),r.jsx(Mo,{className:"h-4 w-4 text-muted-foreground"})]},A.id))})]})}),r.jsx(Vd,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(Hl,{className:"h-5 w-5"}),"Comments (",y.length,")"]}),e?r.jsxs("form",{onSubmit:I,className:"flex gap-2",children:[r.jsx(ps,{placeholder:"Add a comment...",value:o,onChange:A=>c(A.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(te,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!o.trim()||v.isPending,children:r.jsx(To,{className:"h-4 w-4"})})]}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"Log in to add a comment"}),r.jsx("div",{className:"space-y-4",children:y.length===0?r.jsx(Ye,{children:r.jsx(Je,{className:"py-8 text-center",children:r.jsx("p",{className:"text-muted-foreground",children:"No comments yet. Be the first to share your thoughts!"})})}):y.map(A=>r.jsx(Ye,{children:r.jsx(Je,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Li,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(Oi,{className:"text-sm",children:T(A.user_name||"U")})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"font-medium",children:A.user_name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:Yd(new Date(A.created_at),{addSuffix:!0})}),A.user_id===(e==null?void 0:e.id)&&r.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>w.mutate(A.id),children:r.jsx(Xn,{className:"h-3 w-3 text-muted-foreground"})})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:A.content})]})]})})},A.id))})]})]})}):r.jsx(Or,{title:"Academy",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Gi,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Video not found"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"This video may have been removed or is not available."}),r.jsx(te,{asChild:!0,className:"mt-4",children:r.jsx(ao,{to:"/academy",children:"Back to Academy"})})]})})};function Vft(){const t=es(),[e,n]=P.useState(""),{data:s,isLoading:i}=rr({queryKey:["resource-kits-published"],queryFn:async()=>{const{data:k,error:C}=await ee.from("resource_kits").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(C)throw C;return k}}),{data:o}=rr({queryKey:["resource-kit-files-all"],queryFn:async()=>{const{data:k,error:C}=await ee.from("resource_kit_files").select("*").order("sort_order",{ascending:!0});if(C)throw C;return k}}),{data:c}=rr({queryKey:["resource-kit-likes-all"],queryFn:async()=>{const{data:k,error:C}=await ee.from("resource_kit_likes").select("kit_id");if(C)throw C;return k}}),{data:a}=rr({queryKey:["resource-kit-comments-all"],queryFn:async()=>{const{data:k,error:C}=await ee.from("resource_kit_comments").select("kit_id");if(C)throw C;return k}}),f=s==null?void 0:s.filter(k=>{var C;return k.name.toLowerCase().includes(e.toLowerCase())||((C=k.description)==null?void 0:C.toLowerCase().includes(e.toLowerCase()))}),m=k=>(o==null?void 0:o.filter(C=>C.kit_id===k))||[],y=k=>(c==null?void 0:c.filter(C=>C.kit_id===k).length)||0,v=k=>(a==null?void 0:a.filter(C=>C.kit_id===k).length)||0,w=k=>{t(`/toolbox/${k}`)};return r.jsx(Or,{title:"Toolbox",description:"Download resource kits and tools to help grow your business",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-5xl font-bold text-foreground",children:"Toolbox"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Download resource kits and tools to help grow your business"})]}),r.jsxs("div",{className:"relative max-w-md",children:[r.jsx(Ti,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(yt,{placeholder:"Search resource kits...",value:e,onChange:k=>n(k.target.value),className:"pl-10"})]}),!i&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[(f==null?void 0:f.length)||0," resource kit",(f==null?void 0:f.length)!==1?"s":""," available"]}),i?r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:[...Array(8)].map((k,C)=>r.jsx(Ye,{children:r.jsxs(Je,{className:"p-4",children:[r.jsx(Gr,{className:"aspect-[4/3] w-full rounded-lg mb-4"}),r.jsx(Gr,{className:"h-5 w-3/4 mb-2"}),r.jsx(Gr,{className:"h-4 w-full mb-4"}),r.jsx(Gr,{className:"h-4 w-2/3"})]})},C))}):(f==null?void 0:f.length)===0?r.jsxs(Ye,{className:"p-12 text-center",children:[r.jsx(Tl,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No resource kits found"}),r.jsx("p",{className:"text-muted-foreground",children:e?"Try adjusting your search terms":"Check back later for new resources"})]}):r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:f==null?void 0:f.map(k=>{const C=m(k.id).length,S=y(k.id),T=v(k.id);return r.jsxs(Ye,{className:"group overflow-hidden cursor-pointer hover:shadow-lg transition-all duration-200",onClick:()=>w(k.id),children:[r.jsx("div",{className:"relative overflow-hidden bg-muted aspect-[3/2]",children:k.featured_image_url?r.jsx("img",{src:k.featured_image_url,alt:k.name,className:"w-full h-full object-contain group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Tl,{className:"h-16 w-16 text-muted-foreground"})})}),r.jsxs(Je,{className:"p-4",children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:k.name}),k.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:jne(k.description)}),r.jsxs("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ai,{className:"h-4 w-4"}),C," file",C!==1?"s":""]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Zd,{className:"h-3.5 w-3.5"}),S]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Hl,{className:"h-3.5 w-3.5"}),T]})]})]})]})]},k.id)})})]})})}const Hft=()=>{const{kitId:t}=dd(),{user:e,isAdmin:n}=Fr(),{toast:s}=la(),i=Xr(),{trackEngagement:o}=oI(),[c,a]=P.useState(""),{data:f,isLoading:m}=rr({queryKey:["resource-kit-detail",t],queryFn:async()=>{const{data:D,error:$}=await ee.from("resource_kits").select("*").eq("id",t).eq("is_published",!0).single();if($)throw $;const{data:F}=await ee.from("resource_kit_files").select("*").eq("kit_id",t).order("sort_order"),{data:q}=await ee.from("resource_kit_links").select("*").eq("kit_id",t).order("sort_order");return{...D,files:F||[],links:q||[]}},enabled:!!t});P.useEffect(()=>{f&&o("toolbox",f.id,f.name,"view")},[f==null?void 0:f.id]);const{data:y=[]}=rr({queryKey:["resource-kit-likes",t],queryFn:async()=>{const{data:D,error:$}=await ee.from("resource_kit_likes").select("*").eq("kit_id",t);if($)throw $;return D},enabled:!!t}),{data:v=[]}=rr({queryKey:["resource-kit-comments",t],queryFn:async()=>{const{data:D,error:$}=await ee.from("resource_kit_comments").select("*").eq("kit_id",t).order("created_at",{ascending:!1});if($)throw $;const F=[...new Set(D.map(K=>K.user_id))],{data:q}=await ee.from("profiles").select("id, name").in("id",F),W=new Map((q==null?void 0:q.map(K=>[K.id,K.name]))||[]);return D.map(K=>({...K,user_name:W.get(K.user_id)||"Unknown User"}))},enabled:!!t}),w=cr({mutationFn:async D=>{const{error:$}=await ee.from("resource_kit_comments").insert({kit_id:t,user_id:e.id,content:D});if($)throw $},onSuccess:()=>{i.invalidateQueries({queryKey:["resource-kit-comments",t]}),a(""),s({title:"Comment added!"})},onError:D=>{s({title:"Error adding comment",description:D.message,variant:"destructive"})}}),k=cr({mutationFn:async D=>{const{error:$}=await ee.from("resource_kit_comments").delete().eq("id",D);if($)throw $},onSuccess:()=>{i.invalidateQueries({queryKey:["resource-kit-comments",t]}),s({title:"Comment deleted"})}}),C=cr({mutationFn:async()=>{const D=y.find($=>$.user_id===(e==null?void 0:e.id));if(D){const{error:$}=await ee.from("resource_kit_likes").delete().eq("id",D.id);if($)throw $}else{const{error:$}=await ee.from("resource_kit_likes").insert({kit_id:t,user_id:e.id});if($)throw $}},onSuccess:()=>{i.invalidateQueries({queryKey:["resource-kit-likes",t]})}}),S=y.some(D=>D.user_id===(e==null?void 0:e.id)),T=D=>D.split(" ").map($=>$[0]).join("").toUpperCase().slice(0,2),I=D=>D?D<1024?D+" B":D<1024*1024?(D/1024).toFixed(1)+" KB":(D/(1024*1024)).toFixed(1)+" MB":"",A=D=>{D.preventDefault(),!(!c.trim()||!e)&&w.mutate(c.trim())};return m?r.jsx(Or,{title:"Toolbox",children:r.jsx("div",{className:"flex justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):f?r.jsx(Or,{title:f.name,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(te,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(ao,{to:"/toolbox",children:[r.jsx(Va,{className:"h-4 w-4"}),"Back to Toolbox"]})}),f.featured_image_url&&r.jsx("div",{className:"relative w-full rounded-lg overflow-hidden bg-muted",children:r.jsx("img",{src:f.featured_image_url,alt:f.name,className:"w-full max-h-[400px] object-cover"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[r.jsx("div",{className:"space-y-2",children:r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:f.name})}),r.jsxs("div",{className:"flex items-center gap-2",children:[n&&r.jsx(te,{variant:"outline",className:"gap-2 rounded-full",asChild:!0,children:r.jsxs(ao,{to:`/admin/toolbox?edit=${f.id}`,children:[r.jsx(ma,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit"})]})}),r.jsx(HC,{resourceType:"resource_kit",resourceId:f.id,resourceTitle:f.name,size:"default",className:"rounded-full"}),r.jsxs(te,{variant:S?"default":"outline",className:"gap-2 rounded-full",onClick:()=>C.mutate(),disabled:!e||C.isPending,children:[r.jsx(Zd,{className:`h-4 w-4 ${S?"fill-current":""}`}),y.length," ",y.length===1?"Like":"Likes"]})]})]}),f.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:f.description}})]}),f.files&&f.files.length>0&&r.jsx(Ye,{children:r.jsxs(Je,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Ai,{className:"h-4 w-4"}),"Included Resources (",f.files.length,")"]}),r.jsx("div",{className:"grid gap-2",children:f.files.map(D=>r.jsxs("a",{href:D.file_url,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("toolbox",f.id,f.name,"click_pdf"),className:"flex items-center justify-between p-3 rounded-lg border hover:bg-muted transition-colors group",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 rounded-md bg-primary/10",children:r.jsx(Ai,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-sm",children:D.name}),D.file_size&&r.jsx("div",{className:"text-xs text-muted-foreground",children:I(D.file_size)})]})]}),r.jsx(Mo,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors"})]},D.id))})]})}),f.links&&f.links.length>0&&r.jsx(Ye,{children:r.jsxs(Je,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Fs,{className:"h-4 w-4"}),"Canva Templates (",f.links.length,")"]}),r.jsx("div",{className:"grid gap-2",children:f.links.map(D=>r.jsxs("a",{href:D.canva_share_link,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("toolbox",f.id,f.name,"click_canva"),className:"flex items-center justify-between p-3 rounded-lg border hover:bg-muted transition-colors group",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 rounded-md bg-purple-500/10",children:r.jsx(Fs,{className:"h-4 w-4 text-purple-600"})}),r.jsx("div",{className:"font-medium text-sm",children:D.title})]}),r.jsx("span",{className:"text-xs text-muted-foreground group-hover:text-primary transition-colors",children:"Open in Canva"})]},D.id))})]})}),r.jsx(Vd,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(Hl,{className:"h-5 w-5"}),"Comments (",v.length,")"]}),e?r.jsxs("form",{onSubmit:A,className:"flex gap-2",children:[r.jsx(ps,{placeholder:"Add a comment...",value:c,onChange:D=>a(D.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(te,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!c.trim()||w.isPending,children:r.jsx(To,{className:"h-4 w-4"})})]}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"Log in to add a comment"}),r.jsx("div",{className:"space-y-4",children:v.length===0?r.jsx(Ye,{children:r.jsx(Je,{className:"py-8 text-center",children:r.jsx("p",{className:"text-muted-foreground",children:"No comments yet. Be the first to share your thoughts!"})})}):v.map(D=>r.jsx(Ye,{children:r.jsx(Je,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Li,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(Oi,{className:"text-sm",children:T(D.user_name||"U")})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"font-medium",children:D.user_name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:Yd(new Date(D.created_at),{addSuffix:!0})}),D.user_id===(e==null?void 0:e.id)&&r.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>k.mutate(D.id),children:r.jsx(Xn,{className:"h-3 w-3 text-muted-foreground"})})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:D.content})]})]})})},D.id))})]})]})}):r.jsx(Or,{title:"Toolbox",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Tl,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Resource kit not found"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"This resource kit may have been removed or is not available."}),r.jsx(te,{asChild:!0,className:"mt-4",children:r.jsx(ao,{to:"/toolbox",children:"Back to Toolbox"})})]})})},Wft=()=>{const t=es(),[e,n]=P.useState(""),[s,i]=P.useState("grid"),{data:o=[],isLoading:c}=rr({queryKey:["social-swag"],queryFn:async()=>{const{data:m,error:y}=await ee.from("social_swag").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(y)throw y;const{data:v,error:w}=await ee.from("social_swag_links").select("*").order("sort_order");if(w)throw w;const{data:k}=await ee.from("social_swag_likes").select("swag_id"),{data:C}=await ee.from("social_swag_comments").select("swag_id"),S=new Map;k==null||k.forEach(A=>{S.set(A.swag_id,(S.get(A.swag_id)||0)+1)});const T=new Map;return C==null||C.forEach(A=>{T.set(A.swag_id,(T.get(A.swag_id)||0)+1)}),(m||[]).map(A=>({...A,links:(v||[]).filter(D=>D.swag_id===A.id)||[],likesCount:S.get(A.id)||0,commentsCount:T.get(A.id)||0}))}}),a=o.filter(m=>{var v;return m.title.toLowerCase().includes(e.toLowerCase())||((v=m.description)==null?void 0:v.toLowerCase().includes(e.toLowerCase()))}),f=m=>{t(`/social-swag/${m}`)};return r.jsx(Or,{title:"Social Swag",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Social Swag"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Browse our collection of social media content and graphics"})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(Ti,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(yt,{placeholder:"Search social swag...",value:e,onChange:m=>n(m.target.value),className:"pl-9"})]}),r.jsxs("div",{className:"flex gap-2",children:[e&&r.jsx(te,{variant:"outline",size:"sm",onClick:()=>n(""),children:"Clear"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(te,{variant:s==="grid"?"secondary":"outline",size:"icon",onClick:()=>i("grid"),className:"rounded-full",children:r.jsx(lg,{className:"h-4 w-4"})}),r.jsx(te,{variant:s==="list"?"secondary":"outline",size:"icon",onClick:()=>i("list"),className:"rounded-full",children:r.jsx(rm,{className:"h-4 w-4"})})]})]})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[a.length," item",a.length!==1?"s":""," found"]}),c&&r.jsx("div",{className:s==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:[...Array(8)].map((m,y)=>r.jsx(Ye,{children:r.jsxs(Je,{className:"p-4",children:[r.jsx(Gr,{className:"aspect-[4/3] w-full rounded-lg mb-4"}),r.jsx(Gr,{className:"h-5 w-3/4 mb-2"}),r.jsx(Gr,{className:"h-4 w-full mb-4"})]})},y))}),!c&&a.length===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx("div",{className:"text-muted-foreground mb-4",children:e?"No items match your search":"No social swag available yet"}),e&&r.jsx(te,{variant:"outline",onClick:()=>n(""),children:"Clear Search"})]}),!c&&a.length>0&&r.jsx("div",{className:s==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:a.map(m=>r.jsxs(Ye,{className:`group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer ${s==="list"?"flex flex-row":""}`,onClick:()=>f(m.id),children:[r.jsxs("div",{className:`relative overflow-hidden bg-muted ${s==="list"?"w-48 shrink-0":"aspect-[3/2]"}`,children:[m.preview_image_url?r.jsx("img",{src:m.preview_image_url,alt:m.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:"No Preview"}),m.links.length>1&&r.jsx("div",{className:"absolute top-2 right-2",children:r.jsxs(Rt,{variant:"secondary",className:"gap-1 bg-background/90 backdrop-blur-sm",children:[r.jsx(bo,{className:"h-3 w-3"}),m.links.length]})})]}),r.jsxs(Je,{className:`p-4 flex flex-col ${s==="list"?"flex-1":""}`,children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:m.title}),m.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3 flex-1",children:m.description.replace(/<[^>]*>/g,"")}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground mb-3",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Zd,{className:"h-3.5 w-3.5"}),m.likesCount]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Hl,{className:"h-3.5 w-3.5"}),m.commentsCount]})]}),r.jsxs(te,{size:"sm",className:"w-full gap-2",onClick:y=>{y.stopPropagation(),f(m.id)},children:[r.jsx(Fs,{className:"h-4 w-4"}),"View Details"]})]})]},m.id))})]})})};var ji=function(){return ji=Object.assign||function(e){for(var n,s=1,i=arguments.length;s1&&(f||!m),v=e>1&&(m||!f),w=function(){s&&o(s)},k=function(){i&&o(i)};return r.jsx(Npt,{displayMonth:t.displayMonth,hideNext:y,hidePrevious:v,nextMonth:i,previousMonth:s,onPreviousClick:w,onNextClick:k})}function Spt(t){var e,n=Zo(),s=n.classNames,i=n.disableNavigation,o=n.styles,c=n.captionLayout,a=n.components,f=(e=a==null?void 0:a.CaptionLabel)!==null&&e!==void 0?e:YDe,m;return i?m=r.jsx(f,{id:t.id,displayMonth:t.displayMonth}):c==="dropdown"?m=r.jsx(lke,{displayMonth:t.displayMonth,id:t.id}):c==="dropdown-buttons"?m=r.jsxs(r.Fragment,{children:[r.jsx(lke,{displayMonth:t.displayMonth,displayIndex:t.displayIndex,id:t.id}),r.jsx(cke,{displayMonth:t.displayMonth,displayIndex:t.displayIndex,id:t.id})]}):m=r.jsxs(r.Fragment,{children:[r.jsx(f,{id:t.id,displayMonth:t.displayMonth,displayIndex:t.displayIndex}),r.jsx(cke,{displayMonth:t.displayMonth,id:t.id})]}),r.jsx("div",{className:s.caption,style:o.caption,children:m})}function Cpt(t){var e=Zo(),n=e.footer,s=e.styles,i=e.classNames.tfoot;return n?r.jsx("tfoot",{className:i,style:s.tfoot,children:r.jsx("tr",{children:r.jsx("td",{colSpan:8,children:n})})}):r.jsx(r.Fragment,{})}function Mpt(t,e,n){for(var s=n?Hy(new Date):Gh(new Date,{locale:t,weekStartsOn:e}),i=[],o=0;o<7;o++){var c=Rl(s,o);i.push(c)}return i}function Tpt(){var t=Zo(),e=t.classNames,n=t.styles,s=t.showWeekNumber,i=t.locale,o=t.weekStartsOn,c=t.ISOWeek,a=t.formatters.formatWeekdayName,f=t.labels.labelWeekday,m=Mpt(i,o,c);return r.jsxs("tr",{style:n.head_row,className:e.head_row,children:[s&&r.jsx("td",{style:n.head_cell,className:e.head_cell}),m.map(function(y,v){return r.jsx("th",{scope:"col",className:e.head_cell,style:n.head_cell,"aria-label":f(y,{locale:i}),children:a(y,{locale:i})},v)})]})}function Apt(){var t,e=Zo(),n=e.classNames,s=e.styles,i=e.components,o=(t=i==null?void 0:i.HeadRow)!==null&&t!==void 0?t:Tpt;return r.jsx("thead",{style:s.head,className:n.head,children:r.jsx(o,{})})}function Ept(t){var e=Zo(),n=e.locale,s=e.formatters.formatDay;return r.jsx(r.Fragment,{children:s(t.date,{locale:n})})}var uye=P.createContext(void 0);function Ipt(t){if(!lI(t.initialProps)){var e={selected:void 0,modifiers:{disabled:[]}};return r.jsx(uye.Provider,{value:e,children:t.children})}return r.jsx(Ppt,{initialProps:t.initialProps,children:t.children})}function Ppt(t){var e=t.initialProps,n=t.children,s=e.selected,i=e.min,o=e.max,c=function(m,y,v){var w,k;(w=e.onDayClick)===null||w===void 0||w.call(e,m,y,v);var C=!!(y.selected&&i&&(s==null?void 0:s.length)===i);if(!C){var S=!!(!y.selected&&o&&(s==null?void 0:s.length)===o);if(!S){var T=s?KDe([],s):[];if(y.selected){var I=T.findIndex(function(A){return Vl(m,A)});T.splice(I,1)}else T.push(m);(k=e.onSelect)===null||k===void 0||k.call(e,T,m,y,v)}}},a={disabled:[]};s&&a.disabled.push(function(m){var y=o&&s.length>o-1,v=s.some(function(w){return Vl(w,m)});return!!(y&&!v)});var f={selected:s,onDayClick:c,modifiers:a};return r.jsx(uye.Provider,{value:f,children:n})}function hye(){var t=P.useContext(uye);if(!t)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return t}function Lpt(t,e){var n=e||{},s=n.from,i=n.to;return s&&i?Vl(i,t)&&Vl(s,t)?void 0:Vl(i,t)?{from:i,to:void 0}:Vl(s,t)?void 0:cte(s,t)?{from:t,to:i}:{from:s,to:t}:i?cte(t,i)?{from:i,to:t}:{from:t,to:i}:s?ase(t,s)?{from:t,to:s}:{from:s,to:t}:{from:t,to:void 0}}var fye=P.createContext(void 0);function Opt(t){if(!cI(t.initialProps)){var e={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return r.jsx(fye.Provider,{value:e,children:t.children})}return r.jsx(Dpt,{initialProps:t.initialProps,children:t.children})}function Dpt(t){var e=t.initialProps,n=t.children,s=e.selected,i=s||{},o=i.from,c=i.to,a=e.min,f=e.max,m=function(k,C,S){var T,I;(T=e.onDayClick)===null||T===void 0||T.call(e,k,C,S);var A=Lpt(k,s);(I=e.onSelect)===null||I===void 0||I.call(e,A,k,C,S)},y={range_start:[],range_end:[],range_middle:[],disabled:[]};if(o?(y.range_start=[o],c?(y.range_end=[c],Vl(o,c)||(y.range_middle=[{after:o,before:c}])):y.range_end=[o]):c&&(y.range_start=[c],y.range_end=[c]),a&&(o&&!c&&y.disabled.push({after:Rle(o,a-1),before:Rl(o,a-1)}),o&&c&&y.disabled.push({after:o,before:Rl(o,a-1)}),!o&&c&&y.disabled.push({after:Rle(c,a-1),before:Rl(c,a-1)})),f){if(o&&!c&&(y.disabled.push({before:Rl(o,-f+1)}),y.disabled.push({after:Rl(o,f-1)})),o&&c){var v=Yp(c,o)+1,w=f-v;y.disabled.push({before:Rle(o,w)}),y.disabled.push({after:Rl(c,w)})}!o&&c&&(y.disabled.push({before:Rl(c,-f+1)}),y.disabled.push({after:Rl(c,f-1)}))}return r.jsx(fye.Provider,{value:{selected:s,onDayClick:m,modifiers:y},children:n})}function pye(){var t=P.useContext(fye);if(!t)throw new Error("useSelectRange must be used within a SelectRangeProvider");return t}function nee(t){return Array.isArray(t)?KDe([],t):t!==void 0?[t]:[]}function Rpt(t){var e={};return Object.entries(t).forEach(function(n){var s=n[0],i=n[1];e[s]=nee(i)}),e}var um;(function(t){t.Outside="outside",t.Disabled="disabled",t.Selected="selected",t.Hidden="hidden",t.Today="today",t.RangeStart="range_start",t.RangeEnd="range_end",t.RangeMiddle="range_middle"})(um||(um={}));var Fpt=um.Selected,ny=um.Disabled,zpt=um.Hidden,Bpt=um.Today,qle=um.RangeEnd,Vle=um.RangeMiddle,Hle=um.RangeStart,$pt=um.Outside;function Upt(t,e,n){var s,i=(s={},s[Fpt]=nee(t.selected),s[ny]=nee(t.disabled),s[zpt]=nee(t.hidden),s[Bpt]=[t.today],s[qle]=[],s[Vle]=[],s[Hle]=[],s[$pt]=[],s);return t.fromDate&&i[ny].push({before:t.fromDate}),t.toDate&&i[ny].push({after:t.toDate}),lI(t)?i[ny]=i[ny].concat(e.modifiers[ny]):cI(t)&&(i[ny]=i[ny].concat(n.modifiers[ny]),i[Hle]=n.modifiers[Hle],i[Vle]=n.modifiers[Vle],i[qle]=n.modifiers[qle]),i}var JDe=P.createContext(void 0);function qpt(t){var e=Zo(),n=hye(),s=pye(),i=Upt(e,n,s),o=Rpt(e.modifiers),c=ji(ji({},i),o);return r.jsx(JDe.Provider,{value:c,children:t.children})}function e8e(){var t=P.useContext(JDe);if(!t)throw new Error("useModifiers must be used within a ModifiersProvider");return t}function Vpt(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function Hpt(t){return!!(t&&typeof t=="object"&&"from"in t)}function Wpt(t){return!!(t&&typeof t=="object"&&"after"in t)}function Gpt(t){return!!(t&&typeof t=="object"&&"before"in t)}function Kpt(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function Zpt(t,e){var n,s=e.from,i=e.to;if(s&&i){var o=Yp(i,s)<0;o&&(n=[i,s],s=n[0],i=n[1]);var c=Yp(t,s)>=0&&Yp(i,t)>=0;return c}return i?Vl(i,t):s?Vl(s,t):!1}function Ypt(t){return qge(t)}function Xpt(t){return Array.isArray(t)&&t.every(qge)}function Qpt(t,e){return e.some(function(n){if(typeof n=="boolean")return n;if(Ypt(n))return Vl(t,n);if(Xpt(n))return n.includes(t);if(Hpt(n))return Zpt(t,n);if(Kpt(n))return n.dayOfWeek.includes(t.getDay());if(Vpt(n)){var s=Yp(n.before,t),i=Yp(n.after,t),o=s>0,c=i<0,a=cte(n.before,n.after);return a?c&&o:o||c}return Wpt(n)?Yp(t,n.after)>0:Gpt(n)?Yp(n.before,t)>0:typeof n=="function"?n(t):!1})}function mye(t,e,n){var s=Object.keys(e).reduce(function(o,c){var a=e[c];return Qpt(t,a)&&o.push(c),o},[]),i={};return s.forEach(function(o){return i[o]=!0}),n&&!Xge(t,n)&&(i.outside=!0),i}function Jpt(t,e){for(var n=hh(t[0]),s=sse(t[t.length-1]),i,o,c=n;c<=s;){var a=mye(c,e),f=!a.disabled&&!a.hidden;if(!f){c=Rl(c,1);continue}if(a.selected)return c;a.today&&!o&&(o=c),i||(i=c),c=Rl(c,1)}return o||i}var emt=365;function t8e(t,e){var n=e.moveBy,s=e.direction,i=e.context,o=e.modifiers,c=e.retry,a=c===void 0?{count:0,lastFocused:t}:c,f=i.weekStartsOn,m=i.fromDate,y=i.toDate,v=i.locale,w={day:Rl,week:ohe,month:Gf,year:Yot,startOfWeek:function(T){return i.ISOWeek?Hy(T):Gh(T,{locale:v,weekStartsOn:f})},endOfWeek:function(T){return i.ISOWeek?qLe(T):Vge(T,{locale:v,weekStartsOn:f})}},k=w[n](t,s==="after"?1:-1);s==="before"&&m?k=Xot([m,k]):s==="after"&&y&&(k=Qot([y,k]));var C=!0;if(o){var S=mye(k,o);C=!S.disabled&&!S.hidden}return C?k:a.count>emt?a.lastFocused:t8e(k,{moveBy:n,direction:s,context:i,modifiers:o,retry:ji(ji({},a),{count:a.count+1})})}var r8e=P.createContext(void 0);function tmt(t){var e=dI(),n=e8e(),s=P.useState(),i=s[0],o=s[1],c=P.useState(),a=c[0],f=c[1],m=Jpt(e.displayMonths,n),y=i??(a&&e.isDateDisplayed(a))?a:m,v=function(){f(i),o(void 0)},w=function(T){o(T)},k=Zo(),C=function(T,I){if(i){var A=t8e(i,{moveBy:T,direction:I,context:k,modifiers:n});Vl(i,A)||(e.goToDate(A,i),w(A))}},S={focusedDay:i,focusTarget:y,blur:v,focus:w,focusDayAfter:function(){return C("day","after")},focusDayBefore:function(){return C("day","before")},focusWeekAfter:function(){return C("week","after")},focusWeekBefore:function(){return C("week","before")},focusMonthBefore:function(){return C("month","before")},focusMonthAfter:function(){return C("month","after")},focusYearBefore:function(){return C("year","before")},focusYearAfter:function(){return C("year","after")},focusStartOfWeek:function(){return C("startOfWeek","before")},focusEndOfWeek:function(){return C("endOfWeek","after")}};return r.jsx(r8e.Provider,{value:S,children:t.children})}function gye(){var t=P.useContext(r8e);if(!t)throw new Error("useFocusContext must be used within a FocusProvider");return t}function rmt(t,e){var n=e8e(),s=mye(t,n,e);return s}var yye=P.createContext(void 0);function nmt(t){if(!xse(t.initialProps)){var e={selected:void 0};return r.jsx(yye.Provider,{value:e,children:t.children})}return r.jsx(smt,{initialProps:t.initialProps,children:t.children})}function smt(t){var e=t.initialProps,n=t.children,s=function(o,c,a){var f,m,y;if((f=e.onDayClick)===null||f===void 0||f.call(e,o,c,a),c.selected&&!e.required){(m=e.onSelect)===null||m===void 0||m.call(e,void 0,o,c,a);return}(y=e.onSelect)===null||y===void 0||y.call(e,o,o,c,a)},i={selected:e.selected,onDayClick:s};return r.jsx(yye.Provider,{value:i,children:n})}function n8e(){var t=P.useContext(yye);if(!t)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return t}function imt(t,e){var n=Zo(),s=n8e(),i=hye(),o=pye(),c=gye(),a=c.focusDayAfter,f=c.focusDayBefore,m=c.focusWeekAfter,y=c.focusWeekBefore,v=c.blur,w=c.focus,k=c.focusMonthBefore,C=c.focusMonthAfter,S=c.focusYearBefore,T=c.focusYearAfter,I=c.focusStartOfWeek,A=c.focusEndOfWeek,D=function(me){var fe,ve,Ie,Se;xse(n)?(fe=s.onDayClick)===null||fe===void 0||fe.call(s,t,e,me):lI(n)?(ve=i.onDayClick)===null||ve===void 0||ve.call(i,t,e,me):cI(n)?(Ie=o.onDayClick)===null||Ie===void 0||Ie.call(o,t,e,me):(Se=n.onDayClick)===null||Se===void 0||Se.call(n,t,e,me)},$=function(me){var fe;w(t),(fe=n.onDayFocus)===null||fe===void 0||fe.call(n,t,e,me)},F=function(me){var fe;v(),(fe=n.onDayBlur)===null||fe===void 0||fe.call(n,t,e,me)},q=function(me){var fe;(fe=n.onDayMouseEnter)===null||fe===void 0||fe.call(n,t,e,me)},W=function(me){var fe;(fe=n.onDayMouseLeave)===null||fe===void 0||fe.call(n,t,e,me)},K=function(me){var fe;(fe=n.onDayPointerEnter)===null||fe===void 0||fe.call(n,t,e,me)},Z=function(me){var fe;(fe=n.onDayPointerLeave)===null||fe===void 0||fe.call(n,t,e,me)},re=function(me){var fe;(fe=n.onDayTouchCancel)===null||fe===void 0||fe.call(n,t,e,me)},he=function(me){var fe;(fe=n.onDayTouchEnd)===null||fe===void 0||fe.call(n,t,e,me)},ue=function(me){var fe;(fe=n.onDayTouchMove)===null||fe===void 0||fe.call(n,t,e,me)},Ne=function(me){var fe;(fe=n.onDayTouchStart)===null||fe===void 0||fe.call(n,t,e,me)},se=function(me){var fe;(fe=n.onDayKeyUp)===null||fe===void 0||fe.call(n,t,e,me)},xe=function(me){var fe;switch(me.key){case"ArrowLeft":me.preventDefault(),me.stopPropagation(),n.dir==="rtl"?a():f();break;case"ArrowRight":me.preventDefault(),me.stopPropagation(),n.dir==="rtl"?f():a();break;case"ArrowDown":me.preventDefault(),me.stopPropagation(),m();break;case"ArrowUp":me.preventDefault(),me.stopPropagation(),y();break;case"PageUp":me.preventDefault(),me.stopPropagation(),me.shiftKey?S():k();break;case"PageDown":me.preventDefault(),me.stopPropagation(),me.shiftKey?T():C();break;case"Home":me.preventDefault(),me.stopPropagation(),I();break;case"End":me.preventDefault(),me.stopPropagation(),A();break}(fe=n.onDayKeyDown)===null||fe===void 0||fe.call(n,t,e,me)},ie={onClick:D,onFocus:$,onBlur:F,onKeyDown:xe,onKeyUp:se,onMouseEnter:q,onMouseLeave:W,onPointerEnter:K,onPointerLeave:Z,onTouchCancel:re,onTouchEnd:he,onTouchMove:ue,onTouchStart:Ne};return ie}function amt(){var t=Zo(),e=n8e(),n=hye(),s=pye(),i=xse(t)?e.selected:lI(t)?n.selected:cI(t)?s.selected:void 0;return i}function omt(t){return Object.values(um).includes(t)}function lmt(t,e){var n=[t.classNames.day];return Object.keys(e).forEach(function(s){var i=t.modifiersClassNames[s];if(i)n.push(i);else if(omt(s)){var o=t.classNames["day_".concat(s)];o&&n.push(o)}}),n}function cmt(t,e){var n=ji({},t.styles.day);return Object.keys(e).forEach(function(s){var i;n=ji(ji({},n),(i=t.modifiersStyles)===null||i===void 0?void 0:i[s])}),n}function dmt(t,e,n){var s,i,o,c=Zo(),a=gye(),f=rmt(t,e),m=imt(t,f),y=amt(),v=!!(c.onDayClick||c.mode!=="default");P.useEffect(function(){var q;f.outside||a.focusedDay&&v&&Vl(a.focusedDay,t)&&((q=n.current)===null||q===void 0||q.focus())},[a.focusedDay,t,n,v,f.outside]);var w=lmt(c,f).join(" "),k=cmt(c,f),C=!!(f.outside&&!c.showOutsideDays||f.hidden),S=(o=(i=c.components)===null||i===void 0?void 0:i.DayContent)!==null&&o!==void 0?o:Ept,T=r.jsx(S,{date:t,displayMonth:e,activeModifiers:f}),I={style:k,className:w,children:T,role:"gridcell"},A=a.focusTarget&&Vl(a.focusTarget,t)&&!f.outside,D=a.focusedDay&&Vl(a.focusedDay,t),$=ji(ji(ji({},I),(s={disabled:f.disabled,role:"gridcell"},s["aria-selected"]=f.selected,s.tabIndex=D||A?0:-1,s)),m),F={isButton:v,isHidden:C,activeModifiers:f,selectedDays:y,buttonProps:$,divProps:I};return F}function umt(t){var e=P.useRef(null),n=dmt(t.date,t.displayMonth,e);return n.isHidden?r.jsx("div",{role:"gridcell"}):n.isButton?r.jsx(mte,ji({name:"day",ref:e},n.buttonProps)):r.jsx("div",ji({},n.divProps))}function hmt(t){var e=t.number,n=t.dates,s=Zo(),i=s.onWeekNumberClick,o=s.styles,c=s.classNames,a=s.locale,f=s.labels.labelWeekNumber,m=s.formatters.formatWeekNumber,y=m(Number(e),{locale:a});if(!i)return r.jsx("span",{className:c.weeknumber,style:o.weeknumber,children:y});var v=f(Number(e),{locale:a}),w=function(k){i(e,n,k)};return r.jsx(mte,{name:"week-number","aria-label":v,className:c.weeknumber,style:o.weeknumber,onClick:w,children:y})}function fmt(t){var e,n,s=Zo(),i=s.styles,o=s.classNames,c=s.showWeekNumber,a=s.components,f=(e=a==null?void 0:a.Day)!==null&&e!==void 0?e:umt,m=(n=a==null?void 0:a.WeekNumber)!==null&&n!==void 0?n:hmt,y;return c&&(y=r.jsx("td",{className:o.cell,style:i.cell,children:r.jsx(m,{number:t.weekNumber,dates:t.dates})})),r.jsxs("tr",{className:o.row,style:i.row,children:[y,t.dates.map(function(v){return r.jsx("td",{className:o.cell,style:i.cell,role:"presentation",children:r.jsx(f,{displayMonth:t.displayMonth,date:v})},rct(v))})]})}function dke(t,e,n){for(var s=n!=null&&n.ISOWeek?qLe(e):Vge(e,n),i=n!=null&&n.ISOWeek?Hy(t):Gh(t,n),o=Yp(s,i),c=[],a=0;a<=o;a++)c.push(Rl(i,a));var f=c.reduce(function(m,y){var v=n!=null&&n.ISOWeek?Hge(y):Gge(y,n),w=m.find(function(k){return k.weekNumber===v});return w?(w.dates.push(y),m):(m.push({weekNumber:v,dates:[y]}),m)},[]);return f}function pmt(t,e){var n=dke(hh(t),sse(t),e);if(e!=null&&e.useFixedWeeks){var s=sct(t,e);if(s<6){var i=n[n.length-1],o=i.dates[i.dates.length-1],c=ohe(o,6-s),a=dke(ohe(o,1),c,e);n.push.apply(n,a)}}return n}function mmt(t){var e,n,s,i=Zo(),o=i.locale,c=i.classNames,a=i.styles,f=i.hideHead,m=i.fixedWeeks,y=i.components,v=i.weekStartsOn,w=i.firstWeekContainsDate,k=i.ISOWeek,C=pmt(t.displayMonth,{useFixedWeeks:!!m,ISOWeek:k,locale:o,weekStartsOn:v,firstWeekContainsDate:w}),S=(e=y==null?void 0:y.Head)!==null&&e!==void 0?e:Apt,T=(n=y==null?void 0:y.Row)!==null&&n!==void 0?n:fmt,I=(s=y==null?void 0:y.Footer)!==null&&s!==void 0?s:Cpt;return r.jsxs("table",{id:t.id,className:c.table,style:a.table,role:"grid","aria-labelledby":t["aria-labelledby"],children:[!f&&r.jsx(S,{}),r.jsx("tbody",{className:c.tbody,style:a.tbody,children:C.map(function(A){return r.jsx(T,{displayMonth:t.displayMonth,dates:A.dates,weekNumber:A.weekNumber},A.weekNumber)})}),r.jsx(I,{displayMonth:t.displayMonth})]})}function gmt(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var ymt=gmt()?P.useLayoutEffect:P.useEffect,Wle=!1,xmt=0;function uke(){return"react-day-picker-".concat(++xmt)}function vmt(t){var e,n=t??(Wle?uke():null),s=P.useState(n),i=s[0],o=s[1];return ymt(function(){i===null&&o(uke())},[]),P.useEffect(function(){Wle===!1&&(Wle=!0)},[]),(e=t??i)!==null&&e!==void 0?e:void 0}function _mt(t){var e,n,s=Zo(),i=s.dir,o=s.classNames,c=s.styles,a=s.components,f=dI().displayMonths,m=vmt(s.id?"".concat(s.id,"-").concat(t.displayIndex):void 0),y=s.id?"".concat(s.id,"-grid-").concat(t.displayIndex):void 0,v=[o.month],w=c.month,k=t.displayIndex===0,C=t.displayIndex===f.length-1,S=!k&&!C;i==="rtl"&&(e=[k,C],C=e[0],k=e[1]),k&&(v.push(o.caption_start),w=ji(ji({},w),c.caption_start)),C&&(v.push(o.caption_end),w=ji(ji({},w),c.caption_end)),S&&(v.push(o.caption_between),w=ji(ji({},w),c.caption_between));var T=(n=a==null?void 0:a.Caption)!==null&&n!==void 0?n:Spt;return r.jsxs("div",{className:v.join(" "),style:w,children:[r.jsx(T,{id:m,displayMonth:t.displayMonth,displayIndex:t.displayIndex}),r.jsx(mmt,{id:y,"aria-labelledby":m,displayMonth:t.displayMonth})]},t.displayIndex)}function bmt(t){var e=Zo(),n=e.classNames,s=e.styles;return r.jsx("div",{className:n.months,style:s.months,children:t.children})}function wmt(t){var e,n,s=t.initialProps,i=Zo(),o=gye(),c=dI(),a=P.useState(!1),f=a[0],m=a[1];P.useEffect(function(){i.initialFocus&&o.focusTarget&&(f||(o.focus(o.focusTarget),m(!0)))},[i.initialFocus,f,o.focus,o.focusTarget,o]);var y=[i.classNames.root,i.className];i.numberOfMonths>1&&y.push(i.classNames.multiple_months),i.showWeekNumber&&y.push(i.classNames.with_weeknumber);var v=ji(ji({},i.styles.root),i.style),w=Object.keys(s).filter(function(C){return C.startsWith("data-")}).reduce(function(C,S){var T;return ji(ji({},C),(T={},T[S]=s[S],T))},{}),k=(n=(e=s.components)===null||e===void 0?void 0:e.Months)!==null&&n!==void 0?n:bmt;return r.jsx("div",ji({className:y.join(" "),style:v,dir:i.dir,id:i.id,nonce:s.nonce,title:s.title,lang:s.lang},w,{children:r.jsx(k,{children:c.displayMonths.map(function(C,S){return r.jsx(_mt,{displayIndex:S,displayMonth:C},S)})})}))}function jmt(t){var e=t.children,n=Gft(t,["children"]);return r.jsx(hpt,{initialProps:n,children:r.jsx(wpt,{children:r.jsx(nmt,{initialProps:n,children:r.jsx(Ipt,{initialProps:n,children:r.jsx(Opt,{initialProps:n,children:r.jsx(qpt,{children:r.jsx(tmt,{children:e})})})})})})})}function kmt(t){return r.jsx(jmt,ji({},t,{children:r.jsx(wmt,{initialProps:t})}))}function wj({className:t,classNames:e,showOutsideDays:n=!0,...s}){return r.jsx(kmt,{showOutsideDays:n,className:zt("p-3",t),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:zt(IA({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",day:zt(IA({variant:"ghost"}),"h-9 w-9 p-0 font-normal aria-selected:opacity-100"),day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...e},components:{IconLeft:({...i})=>r.jsx(sd,{className:"h-4 w-4"}),IconRight:({...i})=>r.jsx(Ha,{className:"h-4 w-4"})},...s})}wj.displayName="Calendar";var vse="Popover",[s8e]=Zl(vse,[Ng]),uI=Ng(),[Nmt,P1]=s8e(vse),i8e=t=>{const{__scopePopover:e,children:n,open:s,defaultOpen:i,onOpenChange:o,modal:c=!1}=t,a=uI(e),f=P.useRef(null),[m,y]=P.useState(!1),[v,w]=Tu({prop:s,defaultProp:i??!1,onChange:o,caller:vse});return r.jsx(HE,{...a,children:r.jsx(Nmt,{scope:e,contentId:Fc(),triggerRef:f,open:v,onOpenChange:w,onOpenToggle:P.useCallback(()=>w(k=>!k),[w]),hasCustomAnchor:m,onCustomAnchorAdd:P.useCallback(()=>y(!0),[]),onCustomAnchorRemove:P.useCallback(()=>y(!1),[]),modal:c,children:n})})};i8e.displayName=vse;var a8e="PopoverAnchor",Smt=P.forwardRef((t,e)=>{const{__scopePopover:n,...s}=t,i=P1(a8e,n),o=uI(n),{onCustomAnchorAdd:c,onCustomAnchorRemove:a}=i;return P.useEffect(()=>(c(),()=>a()),[c,a]),r.jsx(IC,{...o,...s,ref:e})});Smt.displayName=a8e;var o8e="PopoverTrigger",l8e=P.forwardRef((t,e)=>{const{__scopePopover:n,...s}=t,i=P1(o8e,n),o=uI(n),c=Gs(e,i.triggerRef),a=r.jsx(On.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":f8e(i.open),...s,ref:c,onClick:an(t.onClick,i.onOpenToggle)});return i.hasCustomAnchor?a:r.jsx(IC,{asChild:!0,...o,children:a})});l8e.displayName=o8e;var xye="PopoverPortal",[Cmt,Mmt]=s8e(xye,{forceMount:void 0}),c8e=t=>{const{__scopePopover:e,forceMount:n,children:s,container:i}=t,o=P1(xye,e);return r.jsx(Cmt,{scope:e,forceMount:n,children:r.jsx(oc,{present:n||o.open,children:r.jsx(CC,{asChild:!0,container:i,children:s})})})};c8e.displayName=xye;var K4="PopoverContent",d8e=P.forwardRef((t,e)=>{const n=Mmt(K4,t.__scopePopover),{forceMount:s=n.forceMount,...i}=t,o=P1(K4,t.__scopePopover);return r.jsx(oc,{present:s||o.open,children:o.modal?r.jsx(Amt,{...i,ref:e}):r.jsx(Emt,{...i,ref:e})})});d8e.displayName=K4;var Tmt=p1("PopoverContent.RemoveScroll"),Amt=P.forwardRef((t,e)=>{const n=P1(K4,t.__scopePopover),s=P.useRef(null),i=Gs(e,s),o=P.useRef(!1);return P.useEffect(()=>{const c=s.current;if(c)return One(c)},[]),r.jsx(XE,{as:Tmt,allowPinchZoom:!0,children:r.jsx(u8e,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:an(t.onCloseAutoFocus,c=>{var a;c.preventDefault(),o.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:an(t.onPointerDownOutside,c=>{const a=c.detail.originalEvent,f=a.button===0&&a.ctrlKey===!0,m=a.button===2||f;o.current=m},{checkForDefaultPrevented:!1}),onFocusOutside:an(t.onFocusOutside,c=>c.preventDefault(),{checkForDefaultPrevented:!1})})})}),Emt=P.forwardRef((t,e)=>{const n=P1(K4,t.__scopePopover),s=P.useRef(!1),i=P.useRef(!1);return r.jsx(u8e,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var c,a;(c=t.onCloseAutoFocus)==null||c.call(t,o),o.defaultPrevented||(s.current||(a=n.triggerRef.current)==null||a.focus(),o.preventDefault()),s.current=!1,i.current=!1},onInteractOutside:o=>{var f,m;(f=t.onInteractOutside)==null||f.call(t,o),o.defaultPrevented||(s.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const c=o.target;((m=n.triggerRef.current)==null?void 0:m.contains(c))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),u8e=P.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:c,onEscapeKeyDown:a,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:y,...v}=t,w=P1(K4,n),k=uI(n);return Pne(),r.jsx(YE,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:i,onUnmountAutoFocus:o,children:r.jsx(S1,{asChild:!0,disableOutsidePointerEvents:c,onInteractOutside:y,onEscapeKeyDown:a,onPointerDownOutside:f,onFocusOutside:m,onDismiss:()=>w.onOpenChange(!1),children:r.jsx(WE,{"data-state":f8e(w.open),role:"dialog",id:w.contentId,...k,...v,ref:e,style:{...v.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),h8e="PopoverClose",Imt=P.forwardRef((t,e)=>{const{__scopePopover:n,...s}=t,i=P1(h8e,n);return r.jsx(On.button,{type:"button",...s,ref:e,onClick:an(t.onClick,()=>i.onOpenChange(!1))})});Imt.displayName=h8e;var Pmt="PopoverArrow",Lmt=P.forwardRef((t,e)=>{const{__scopePopover:n,...s}=t,i=uI(n);return r.jsx(GE,{...i,...s,ref:e})});Lmt.displayName=Pmt;function f8e(t){return t?"open":"closed"}var Omt=i8e,Dmt=l8e,Rmt=c8e,p8e=d8e;const Zh=Omt,Yh=Dmt,mh=P.forwardRef(({className:t,align:e="center",sideOffset:n=4,...s},i)=>r.jsx(Rmt,{children:r.jsx(p8e,{ref:i,align:e,sideOffset:n,className:zt("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...s})}));mh.displayName=p8e.displayName;const Fmt=MC("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),vye=P.forwardRef(({className:t,variant:e,...n},s)=>r.jsx("div",{ref:s,role:"alert",className:zt(Fmt({variant:e}),t),...n}));vye.displayName="Alert";const zmt=P.forwardRef(({className:t,...e},n)=>r.jsx("h5",{ref:n,className:zt("mb-1 font-medium leading-none tracking-tight",t),...e}));zmt.displayName="AlertTitle";const _ye=P.forwardRef(({className:t,...e},n)=>r.jsx("div",{ref:n,className:zt("text-sm [&_p]:leading-relaxed",t),...e}));_ye.displayName="AlertDescription";function Bmt({open:t,onOpenChange:e,imageUrl:n,imageId:s,defaultCaption:i="",swagItemId:o,reelId:c}){const a=Xr(),[f,m]=P.useState(i),[y,v]=P.useState([]),[w,k]=P.useState(null),[C,S]=P.useState("now"),[T,I]=P.useState(lte(qje(new Date),1)),[A,D]=P.useState("12"),[$,F]=P.useState("00"),[q,W]=P.useState("PM");P.useEffect(()=>{if(t){m(i),S("now"),v([]);const ae=lte(qje(new Date),1);I(ae);const je=ae.getHours();D(String(je>12?je-12:je===0?12:je)),F("00"),W(je>=12?"PM":"AM")}},[t,i]);const K=()=>{if(!T)return null;let ae=parseInt(A);const je=parseInt($);return q==="PM"&&ae!==12&&(ae+=12),q==="AM"&&ae===12&&(ae=0),JLe(QLe(T,ae),je)},{data:Z,isLoading:re}=rr({queryKey:["social-accounts-for-post"],queryFn:async()=>{const{data:{user:ae}}=await ee.auth.getUser();if(!ae)return[];const{data:je,error:Me}=await ee.from("social_accounts").select("*").eq("user_id",ae.id).eq("is_active",!0).order("platform",{ascending:!0});if(Me)throw Me;return console.log("Fetched social accounts for posting:",je),je},enabled:t,staleTime:0}),he=cr({mutationFn:async({accountId:ae,platform:je})=>{k(ae);const{data:Me,error:Ue}=await ee.functions.invoke("social-post",{body:{platform:je,accountId:ae,imageUrl:n,caption:f}});if(Ue)throw Ue;if(Me!=null&&Me.error)throw new Error(Me.error);return Me},onSuccess:ae=>{const je=ae.platform==="facebook"?"Facebook":ae.platform==="instagram"?"Instagram":ae.platform==="linkedin"?"LinkedIn":"Google Business";Ge.success(`Posted to ${je}!`)},onError:ae=>{Ge.error(`Failed to post: ${ae.message}`)},onSettled:()=>{k(null)}}),ue=cr({mutationFn:async({accountId:ae,platform:je,scheduledFor:Me})=>{const{data:{user:Ue}}=await ee.auth.getUser();if(!Ue)throw new Error("Not authenticated");const{error:Re}=await ee.from("scheduled_posts").insert({user_id:Ue.id,social_account_id:ae,platform:je,image_url:n,caption:f,swag_item_id:o||null,reel_id:c||null,scheduled_for:Me.toISOString(),status:"scheduled"});if(Re)throw Re;return{platform:je}},onSuccess:ae=>{const je=ae.platform==="facebook"?"Facebook":ae.platform==="instagram"?"Instagram":"LinkedIn";Ge.success(`Post scheduled for ${je}!`)},onError:ae=>{Ge.error(`Failed to schedule: ${ae.message}`)}}),Ne=async()=>{if(y.length===0){Ge.error("Please select at least one account");return}if(C==="schedule"){const ae=K();if(!ae||ae<=new Date){Ge.error("Please select a future date and time");return}for(const je of y){const Me=Z==null?void 0:Z.find(Ue=>Ue.id===je);Me&&await ue.mutateAsync({accountId:je,platform:Me.platform,scheduledFor:ae})}a.invalidateQueries({queryKey:["scheduled-posts"]}),Ge.success(`${y.length} post(s) scheduled for ${un(ae,"PPp")}`)}else for(const ae of y){const je=Z==null?void 0:Z.find(Me=>Me.id===ae);je&&await he.mutateAsync({accountId:ae,platform:je.platform})}a.invalidateQueries({queryKey:["scheduled-posts"]}),m(""),v([]),e(!1)},se=ae=>{v(je=>je.includes(ae)?je.filter(Me=>Me!==ae):[...je,ae])},xe=(Z==null?void 0:Z.filter(ae=>ae.platform==="facebook"))||[],ie=(Z==null?void 0:Z.filter(ae=>ae.platform==="instagram"))||[],me=(Z==null?void 0:Z.filter(ae=>ae.platform==="linkedin"))||[],fe=(Z==null?void 0:Z.filter(ae=>ae.platform==="google_business"))||[],ve=((Z==null?void 0:Z.length)||0)>0,Ie=he.isPending||ue.isPending,Se=Array.from({length:12},(ae,je)=>String(je+1)),oe=["00","15","30","45"];return r.jsx($r,{open:t,onOpenChange:e,children:r.jsxs(zr,{className:"sm:max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsxs(Zr,{children:[r.jsx(Kr,{children:"Create Social Post"}),r.jsx(ls,{children:"Share this image to your connected social accounts"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsx("div",{className:"aspect-square w-full max-w-[200px] mx-auto overflow-hidden rounded-lg border",children:r.jsx("img",{src:n,alt:"Post preview",className:"h-full w-full object-cover"})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"caption",children:"Caption"}),r.jsx(ps,{id:"caption",placeholder:"Write a caption for your post...",value:f,onChange:ae=>m(ae.target.value),rows:3}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[f.length,"/2200 characters"]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Qe,{children:"Publish Time"}),r.jsxs("div",{className:"flex items-center gap-1 p-1 bg-muted rounded-lg",children:[r.jsx("button",{type:"button",onClick:()=>S("now"),className:zt("flex-1 px-4 py-2 rounded-md text-sm font-medium transition-all",C==="now"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Post Now"}),r.jsx("button",{type:"button",onClick:()=>S("schedule"),className:zt("flex-1 px-4 py-2 rounded-md text-sm font-medium transition-all",C==="schedule"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Schedule"})]})]}),C==="schedule"&&r.jsxs("div",{className:"space-y-3 p-4 border rounded-lg bg-muted/30",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[r.jsx(Xi,{className:"h-4 w-4"}),"Schedule for"]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(Zh,{children:[r.jsx(Yh,{asChild:!0,children:r.jsxs(te,{variant:"outline",className:zt("justify-start text-left font-normal flex-1",!T&&"text-muted-foreground"),children:[r.jsx(li,{className:"mr-2 h-4 w-4"}),T?un(T,"PPP"):r.jsx("span",{children:"Pick a date"})]})}),r.jsx(mh,{className:"w-auto p-0",align:"start",children:r.jsx(wj,{mode:"single",selected:T,onSelect:I,disabled:ae=>aer.jsx(er,{value:ae,children:ae},ae))})]}),r.jsx("span",{className:"text-muted-foreground",children:":"}),r.jsxs(_n,{value:$,onValueChange:F,children:[r.jsx(xn,{className:"w-[70px]",children:r.jsx(bn,{})}),r.jsx(vn,{children:oe.map(ae=>r.jsx(er,{value:ae,children:ae},ae))})]}),r.jsxs(_n,{value:q,onValueChange:ae=>W(ae),children:[r.jsx(xn,{className:"w-[70px]",children:r.jsx(bn,{})}),r.jsxs(vn,{children:[r.jsx(er,{value:"AM",children:"AM"}),r.jsx(er,{value:"PM",children:"PM"})]})]})]})]}),T&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Post will be published on ",un(K()||new Date,"PPP 'at' p")]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Qe,{children:"Post to"}),re&&r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(sn,{className:"h-6 w-6 animate-spin"})}),!re&&!ve&&r.jsxs(vye,{children:[r.jsx(Bl,{className:"h-4 w-4"}),r.jsxs(_ye,{className:"flex flex-col gap-2",children:[r.jsx("span",{children:"No social accounts connected yet."}),r.jsxs(ao,{to:"/social-connections",className:"inline-flex items-center gap-1.5 text-primary hover:underline font-medium",children:[r.jsx(id,{className:"h-3.5 w-3.5"}),"Connect your Facebook, Instagram & LinkedIn"]})]})]}),xe.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("p",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[r.jsx(Md,{className:"h-4 w-4 text-blue-600"})," Facebook"]}),xe.map(ae=>r.jsxs("label",{className:"flex items-center gap-3 rounded-lg border p-3 cursor-pointer hover:bg-muted/50 transition-colors",children:[r.jsx(_c,{checked:y.includes(ae.id),onCheckedChange:()=>se(ae.id),disabled:w===ae.id}),r.jsxs(Li,{className:"h-8 w-8",children:[r.jsx(Io,{src:ae.profile_picture_url||""}),r.jsx(Oi,{children:r.jsx(Md,{className:"h-4 w-4"})})]}),r.jsx("span",{className:"flex-1 text-sm font-medium",children:ae.page_name||ae.platform_username}),w===ae.id&&r.jsx(sn,{className:"h-4 w-4 animate-spin"})]},ae.id))]}),ie.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("p",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[r.jsx(Wd,{className:"h-4 w-4 text-pink-600"})," Instagram"]}),ie.map(ae=>r.jsxs("label",{className:"flex items-center gap-3 rounded-lg border p-3 cursor-pointer hover:bg-muted/50 transition-colors",children:[r.jsx(_c,{checked:y.includes(ae.id),onCheckedChange:()=>se(ae.id),disabled:w===ae.id}),r.jsxs(Li,{className:"h-8 w-8",children:[r.jsx(Io,{src:ae.profile_picture_url||""}),r.jsx(Oi,{children:r.jsx(Wd,{className:"h-4 w-4"})})]}),r.jsxs("span",{className:"flex-1 text-sm font-medium",children:["@",ae.platform_username]}),w===ae.id&&r.jsx(sn,{className:"h-4 w-4 animate-spin"})]},ae.id))]}),me.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("p",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[r.jsx(tm,{className:"h-4 w-4 text-blue-700"})," LinkedIn"]}),me.map(ae=>r.jsxs("label",{className:"flex items-center gap-3 rounded-lg border p-3 cursor-pointer hover:bg-muted/50 transition-colors",children:[r.jsx(_c,{checked:y.includes(ae.id),onCheckedChange:()=>se(ae.id),disabled:w===ae.id}),r.jsxs(Li,{className:"h-8 w-8",children:[r.jsx(Io,{src:ae.profile_picture_url||""}),r.jsx(Oi,{children:r.jsx(tm,{className:"h-4 w-4"})})]}),r.jsx("span",{className:"flex-1 text-sm font-medium",children:ae.platform_username}),w===ae.id&&r.jsx(sn,{className:"h-4 w-4 animate-spin"})]},ae.id))]}),fe.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("p",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[r.jsx(yl,{className:"h-4 w-4 text-red-600"})," Google Business"]}),fe.map(ae=>r.jsxs("label",{className:"flex items-center gap-3 rounded-lg border p-3 cursor-pointer hover:bg-muted/50 transition-colors",children:[r.jsx(_c,{checked:y.includes(ae.id),onCheckedChange:()=>se(ae.id),disabled:w===ae.id}),r.jsxs(Li,{className:"h-8 w-8",children:[r.jsx(Io,{src:ae.profile_picture_url||""}),r.jsx(Oi,{children:r.jsx(yl,{className:"h-4 w-4"})})]}),r.jsx("span",{className:"flex-1 text-sm font-medium",children:ae.page_name||ae.platform_username}),w===ae.id&&r.jsx(sn,{className:"h-4 w-4 animate-spin"})]},ae.id))]})]})]}),r.jsxs(ni,{children:[r.jsx(te,{variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsxs(te,{onClick:Ne,disabled:y.length===0||Ie,className:"gap-2",children:[Ie?r.jsx(sn,{className:"h-4 w-4 animate-spin"}):C==="schedule"?r.jsx(li,{className:"h-4 w-4"}):r.jsx(To,{className:"h-4 w-4"}),C==="schedule"?`Schedule ${y.length} post${y.length!==1?"s":""}`:`Post to ${y.length} account${y.length!==1?"s":""}`]})]})]})})}var m8e="AlertDialog",[$mt]=Zl(m8e,[zIe]),Xy=zIe(),g8e=t=>{const{__scopeAlertDialog:e,...n}=t,s=Xy(e);return r.jsx(Rne,{...s,...n,modal:!0})};g8e.displayName=m8e;var Umt="AlertDialogTrigger",y8e=P.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...s}=t,i=Xy(n);return r.jsx(uge,{...i,...s,ref:e})});y8e.displayName=Umt;var qmt="AlertDialogPortal",x8e=t=>{const{__scopeAlertDialog:e,...n}=t,s=Xy(e);return r.jsx(Fne,{...s,...n})};x8e.displayName=qmt;var Vmt="AlertDialogOverlay",v8e=P.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...s}=t,i=Xy(n);return r.jsx(zC,{...i,...s,ref:e})});v8e.displayName=Vmt;var o4="AlertDialogContent",[Hmt,Wmt]=$mt(o4),Gmt=LTe("AlertDialogContent"),_8e=P.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:s,...i}=t,o=Xy(n),c=P.useRef(null),a=Gs(e,c),f=P.useRef(null);return r.jsx(Cnt,{contentName:o4,titleName:b8e,docsSlug:"alert-dialog",children:r.jsx(Hmt,{scope:n,cancelRef:f,children:r.jsxs(BC,{role:"alertdialog",...o,...i,ref:a,onOpenAutoFocus:an(i.onOpenAutoFocus,m=>{var y;m.preventDefault(),(y=f.current)==null||y.focus({preventScroll:!0})}),onPointerDownOutside:m=>m.preventDefault(),onInteractOutside:m=>m.preventDefault(),children:[r.jsx(Gmt,{children:s}),r.jsx(Zmt,{contentRef:c})]})})})});_8e.displayName=o4;var b8e="AlertDialogTitle",w8e=P.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...s}=t,i=Xy(n);return r.jsx(QE,{...i,...s,ref:e})});w8e.displayName=b8e;var j8e="AlertDialogDescription",k8e=P.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...s}=t,i=Xy(n);return r.jsx(JE,{...i,...s,ref:e})});k8e.displayName=j8e;var Kmt="AlertDialogAction",N8e=P.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...s}=t,i=Xy(n);return r.jsx(zne,{...i,...s,ref:e})});N8e.displayName=Kmt;var S8e="AlertDialogCancel",C8e=P.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...s}=t,{cancelRef:i}=Wmt(S8e,n),o=Xy(n),c=Gs(e,i);return r.jsx(zne,{...o,...s,ref:c})});C8e.displayName=S8e;var Zmt=({contentRef:t})=>{const e=`\`${o4}\` requires a description for the component to be accessible for screen reader users. You can add a description to the \`${o4}\` by passing a \`${j8e}\` component as a child, which also benefits sighted users by adding visible context to the dialog. Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${o4}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return P.useEffect(()=>{var s;document.getElementById((s=t.current)==null?void 0:s.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},Ymt=g8e,Xmt=y8e,Qmt=x8e,M8e=v8e,T8e=_8e,A8e=N8e,E8e=C8e,I8e=w8e,P8e=k8e;const ih=Ymt,C0=Xmt,Jmt=Qmt,L8e=P.forwardRef(({className:t,...e},n)=>r.jsx(M8e,{className:zt("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:n}));L8e.displayName=M8e.displayName;const yu=P.forwardRef(({className:t,...e},n)=>r.jsxs(Jmt,{children:[r.jsx(L8e,{}),r.jsx(T8e,{ref:n,className:zt("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...e})]}));yu.displayName=T8e.displayName;const xu=({className:t,...e})=>r.jsx("div",{className:zt("flex flex-col space-y-2 text-center sm:text-left",t),...e});xu.displayName="AlertDialogHeader";const vu=({className:t,...e})=>r.jsx("div",{className:zt("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});vu.displayName="AlertDialogFooter";const _u=P.forwardRef(({className:t,...e},n)=>r.jsx(I8e,{ref:n,className:zt("text-lg font-semibold",t),...e}));_u.displayName=I8e.displayName;const bu=P.forwardRef(({className:t,...e},n)=>r.jsx(P8e,{ref:n,className:zt("text-sm text-muted-foreground",t),...e}));bu.displayName=P8e.displayName;const Hd=P.forwardRef(({className:t,...e},n)=>r.jsx(A8e,{ref:n,className:zt(IA(),t),...e}));Hd.displayName=A8e.displayName;const wu=P.forwardRef(({className:t,...e},n)=>r.jsx(E8e,{ref:n,className:zt(IA({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));wu.displayName=E8e.displayName;function egt(){const t=Xr(),[e,n]=P.useState(void 0),[s,i]=P.useState("all"),[o,c]=P.useState(null),[a,f]=P.useState(""),[m,y]=P.useState(void 0),[v,w]=P.useState("12"),[k,C]=P.useState("00"),[S,T]=P.useState("PM"),{data:I=[],isLoading:A}=rr({queryKey:["scheduled-posts"],queryFn:async()=>{const{data:fe,error:ve}=await ee.from("scheduled_posts").select(` *, social_accounts ( page_name, platform_username, profile_picture_url ) `).order("scheduled_for",{ascending:!1});if(ve)throw ve;return fe}}),D=I.filter(fe=>{if(s!=="all"&&fe.status!==s)return!1;if(e&&fe.scheduled_for){const ve=new Date(fe.scheduled_for);if(!Vl(ve,e))return!1}return!0}),$=I.filter(fe=>fe.scheduled_for).map(fe=>Kh(new Date(fe.scheduled_for))),F=cr({mutationFn:async fe=>{const{error:ve}=await ee.from("scheduled_posts").update({caption:fe.caption,scheduled_for:fe.scheduled_for}).eq("id",fe.id);if(ve)throw ve},onSuccess:()=>{Ge.success("Post updated!"),t.invalidateQueries({queryKey:["scheduled-posts"]}),c(null)},onError:fe=>{Ge.error(`Failed to update: ${fe.message}`)}}),q=cr({mutationFn:async fe=>{const{error:ve}=await ee.from("scheduled_posts").update({status:"cancelled"}).eq("id",fe);if(ve)throw ve},onSuccess:()=>{Ge.success("Post cancelled"),t.invalidateQueries({queryKey:["scheduled-posts"]})},onError:fe=>{Ge.error(`Failed to cancel: ${fe.message}`)}}),W=cr({mutationFn:async fe=>{const{error:ve}=await ee.from("scheduled_posts").delete().eq("id",fe);if(ve)throw ve},onSuccess:()=>{Ge.success("Post deleted"),t.invalidateQueries({queryKey:["scheduled-posts"]})},onError:fe=>{Ge.error(`Failed to delete: ${fe.message}`)}}),K=cr({mutationFn:async fe=>{const{data:ve,error:Ie}=await ee.functions.invoke("social-post",{body:{platform:fe.platform,accountId:fe.social_account_id,imageUrl:fe.image_url,caption:fe.caption}});if(Ie)throw Ie;if(ve!=null&&ve.error)throw new Error(ve.error);return await ee.from("scheduled_posts").update({status:"posted",posted_at:new Date().toISOString(),post_id:ve.postId}).eq("id",fe.id),ve},onSuccess:fe=>{const ve=fe.platform==="facebook"?"Facebook":fe.platform==="instagram"?"Instagram":"LinkedIn";Ge.success(`Posted to ${ve}!`),t.invalidateQueries({queryKey:["scheduled-posts"]})},onError:fe=>{Ge.error(`Failed to post: ${fe.message}`)}}),Z=fe=>{if(c(fe),f(fe.caption||""),fe.scheduled_for){const ve=new Date(fe.scheduled_for);y(ve);const Ie=ve.getHours();w(String(Ie>12?Ie-12:Ie===0?12:Ie)),C(String(ve.getMinutes()).padStart(2,"0")),T(Ie>=12?"PM":"AM")}},re=()=>{if(!o||!m)return;let fe=parseInt(v);const ve=parseInt(k);S==="PM"&&fe!==12&&(fe+=12),S==="AM"&&fe===12&&(fe=0);const Ie=JLe(QLe(m,fe),ve);F.mutate({id:o.id,caption:a,scheduled_for:Ie.toISOString()})},he=fe=>{switch(fe){case"facebook":return r.jsx(Md,{className:"h-4 w-4 text-blue-600"});case"instagram":return r.jsx(Wd,{className:"h-4 w-4 text-pink-600"});case"linkedin":return r.jsx(tm,{className:"h-4 w-4 text-blue-700"});default:return null}},ue=fe=>{switch(fe){case"scheduled":return r.jsxs(Rt,{variant:"secondary",className:"gap-1",children:[r.jsx(Xi,{className:"h-3 w-3"}),"Scheduled"]});case"posted":return r.jsxs(Rt,{variant:"default",className:"gap-1 bg-green-600",children:[r.jsx(za,{className:"h-3 w-3"}),"Posted"]});case"failed":return r.jsxs(Rt,{variant:"destructive",className:"gap-1",children:[r.jsx(Lc,{className:"h-3 w-3"}),"Failed"]});case"cancelled":return r.jsxs(Rt,{variant:"outline",className:"gap-1 text-muted-foreground",children:[r.jsx(Bl,{className:"h-3 w-3"}),"Cancelled"]});default:return r.jsx(Rt,{variant:"outline",children:fe})}},Ne=Array.from({length:12},(fe,ve)=>String(ve+1)),se=["00","15","30","45"],xe=I.filter(fe=>fe.status==="scheduled").length,ie=I.filter(fe=>fe.status==="posted").length,me=I.filter(fe=>fe.status==="scheduled"&&fe.scheduled_for&&ict(new Date(fe.scheduled_for))).length;return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsxs(Ye,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:xe}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Scheduled"})]}),r.jsxs(Ye,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:me}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Upcoming"})]}),r.jsxs(Ye,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:ie}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Posted"})]}),r.jsxs(Ye,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:I.length}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Total"})]})]}),r.jsxs("div",{className:"flex flex-col lg:flex-row gap-6",children:[r.jsxs(Ye,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx(em,{className:"h-5 w-5"}),r.jsx("h3",{className:"font-semibold",children:"Calendar"})]}),r.jsx(wj,{mode:"single",selected:e,onSelect:n,className:zt("pointer-events-auto"),modifiers:{hasPost:$},modifiersStyles:{hasPost:{fontWeight:"bold",backgroundColor:"hsl(var(--primary) / 0.1)",borderRadius:"50%"}}}),e&&r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>n(void 0),className:"w-full mt-2",children:"Clear date filter"})]}),r.jsxs("div",{className:"flex-1 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Uw,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("div",{className:"flex flex-wrap gap-1",children:["all","scheduled","posted","failed","cancelled"].map(fe=>r.jsx(te,{variant:s===fe?"default":"outline",size:"sm",onClick:()=>i(fe),className:"capitalize",children:fe},fe))})]}),A&&r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(sn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}),!A&&D.length===0&&r.jsxs(Ye,{className:"p-8 text-center",children:[r.jsx(li,{className:"h-12 w-12 mx-auto text-muted-foreground/50 mb-4"}),r.jsx("h3",{className:"font-medium mb-2",children:"No posts found"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:e?`No posts scheduled for ${un(e,"PPP")}`:"Schedule a post from Social Swag to get started!"})]}),r.jsx("div",{className:"space-y-4",children:D.map(fe=>{var ve,Ie;return r.jsx(Ye,{className:"overflow-hidden",children:r.jsxs("div",{className:"flex flex-col sm:flex-row",children:[r.jsx("div",{className:"sm:w-32 h-32 sm:h-auto bg-muted flex-shrink-0",children:r.jsx("img",{src:fe.image_url,alt:"Post preview",className:"w-full h-full object-cover"})}),r.jsxs(Je,{className:"flex-1 p-4",children:[r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2 mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[he(fe.platform),r.jsx("span",{className:"font-medium",children:((ve=fe.social_accounts)==null?void 0:ve.page_name)||((Ie=fe.social_accounts)==null?void 0:Ie.platform_username)||"Unknown"}),ue(fe.status)]}),r.jsxs("div",{className:"flex items-center gap-1",children:[fe.status==="scheduled"&&r.jsxs(KE,{children:[r.jsxs(fg,{children:[r.jsx(pg,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>Z(fe),children:r.jsx(ma,{className:"h-4 w-4"})})}),r.jsx(am,{children:"Edit post"})]}),r.jsxs(fg,{children:[r.jsx(pg,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>K.mutate(fe),disabled:K.isPending,children:K.isPending?r.jsx(sn,{className:"h-4 w-4 animate-spin"}):r.jsx(To,{className:"h-4 w-4"})})}),r.jsx(am,{children:"Post now"})]}),r.jsxs(ih,{children:[r.jsx(C0,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",className:"text-destructive",children:r.jsx(Xn,{className:"h-4 w-4"})})}),r.jsxs(yu,{children:[r.jsxs(xu,{children:[r.jsx(_u,{children:"Cancel this scheduled post?"}),r.jsx(bu,{children:"This will cancel the post. You can delete it entirely or keep it in your history."})]}),r.jsxs(vu,{children:[r.jsx(wu,{children:"Keep"}),r.jsx(Hd,{onClick:()=>q.mutate(fe.id),className:"bg-amber-600 hover:bg-amber-700",children:"Cancel Post"}),r.jsx(Hd,{onClick:()=>W.mutate(fe.id),className:"bg-destructive hover:bg-destructive/90",children:"Delete"})]})]})]})]}),(fe.status==="posted"||fe.status==="cancelled"||fe.status==="failed")&&r.jsxs(ih,{children:[r.jsx(C0,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",className:"text-destructive",children:r.jsx(Xn,{className:"h-4 w-4"})})}),r.jsxs(yu,{children:[r.jsxs(xu,{children:[r.jsx(_u,{children:"Delete this post?"}),r.jsx(bu,{children:"This will permanently remove this post from your history."})]}),r.jsxs(vu,{children:[r.jsx(wu,{children:"Cancel"}),r.jsx(Hd,{onClick:()=>W.mutate(fe.id),className:"bg-destructive hover:bg-destructive/90",children:"Delete"})]})]})]})]})]}),fe.caption&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-2",children:fe.caption}),r.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[r.jsx(Xi,{className:"h-3 w-3"}),fe.status==="posted"&&fe.posted_at?`Posted ${un(new Date(fe.posted_at),"PPp")}`:fe.scheduled_for?`Scheduled for ${un(new Date(fe.scheduled_for),"PPp")}`:"Not scheduled"]}),fe.status==="failed"&&fe.error_message&&r.jsxs("p",{className:"text-xs text-destructive mt-2",children:["Error: ",fe.error_message]})]})]})},fe.id)})})]})]}),r.jsx($r,{open:!!o,onOpenChange:fe=>!fe&&c(null),children:r.jsxs(zr,{className:"max-w-lg",children:[r.jsxs(Zr,{children:[r.jsx(Kr,{children:"Edit Scheduled Post"}),r.jsx(ls,{children:"Update the caption or reschedule this post"})]}),o&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsx("div",{className:"aspect-square w-32 mx-auto overflow-hidden rounded-lg border",children:r.jsx("img",{src:o.image_url,alt:"Post preview",className:"h-full w-full object-cover"})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Caption"}),r.jsx(ps,{value:a,onChange:fe=>f(fe.target.value),rows:3})]}),r.jsxs("div",{className:"space-y-3 p-4 border rounded-lg",children:[r.jsx(Qe,{children:"Schedule for"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(Zh,{children:[r.jsx(Yh,{asChild:!0,children:r.jsxs(te,{variant:"outline",className:zt("justify-start text-left font-normal flex-1",!m&&"text-muted-foreground"),children:[r.jsx(li,{className:"mr-2 h-4 w-4"}),m?un(m,"PPP"):"Pick a date"]})}),r.jsx(mh,{className:"w-auto p-0",align:"start",children:r.jsx(wj,{mode:"single",selected:m,onSelect:y,disabled:fe=>fer.jsx(er,{value:fe,children:fe},fe))})]}),r.jsx("span",{className:"text-muted-foreground",children:":"}),r.jsxs(_n,{value:k,onValueChange:C,children:[r.jsx(xn,{className:"w-[70px]",children:r.jsx(bn,{})}),r.jsx(vn,{children:se.map(fe=>r.jsx(er,{value:fe,children:fe},fe))})]}),r.jsxs(_n,{value:S,onValueChange:fe=>T(fe),children:[r.jsx(xn,{className:"w-[70px]",children:r.jsx(bn,{})}),r.jsxs(vn,{children:[r.jsx(er,{value:"AM",children:"AM"}),r.jsx(er,{value:"PM",children:"PM"})]})]})]})]})]})]}),r.jsxs(ni,{children:[r.jsx(te,{variant:"outline",onClick:()=>c(null),children:"Cancel"}),r.jsxs(te,{onClick:re,disabled:F.isPending,children:[F.isPending?r.jsx(sn,{className:"h-4 w-4 animate-spin mr-2"}):null,"Save Changes"]})]})]})})]})}function nL(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var O8e={exports:{}};/*! JSZip v3.10.1 - A JavaScript class for generating and reading zip files (c) 2009-2016 Stuart Knightley Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown. JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/main/LICENSE */(function(t,e){(function(n){t.exports=n()})(function(){return function n(s,i,o){function c(m,y){if(!i[m]){if(!s[m]){var v=typeof nL=="function"&&nL;if(!y&&v)return v(m,!0);if(a)return a(m,!0);var w=new Error("Cannot find module '"+m+"'");throw w.code="MODULE_NOT_FOUND",w}var k=i[m]={exports:{}};s[m][0].call(k.exports,function(C){var S=s[m][1][C];return c(S||C)},k,k.exports,n,s,i,o)}return i[m].exports}for(var a=typeof nL=="function"&&nL,f=0;f>2,k=(3&m)<<4|y>>4,C=1>6:64,S=2>4,y=(15&w)<<4|(k=a.indexOf(f.charAt(S++)))>>2,v=(3&k)<<6|(C=a.indexOf(f.charAt(S++))),A[T++]=m,k!==64&&(A[T++]=y),C!==64&&(A[T++]=v);return A}},{"./support":30,"./utils":32}],2:[function(n,s,i){var o=n("./external"),c=n("./stream/DataWorker"),a=n("./stream/Crc32Probe"),f=n("./stream/DataLengthProbe");function m(y,v,w,k,C){this.compressedSize=y,this.uncompressedSize=v,this.crc32=w,this.compression=k,this.compressedContent=C}m.prototype={getContentWorker:function(){var y=new c(o.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new f("data_length")),v=this;return y.on("end",function(){if(this.streamInfo.data_length!==v.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),y},getCompressedWorker:function(){return new c(o.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},m.createWorkerFrom=function(y,v,w){return y.pipe(new a).pipe(new f("uncompressedSize")).pipe(v.compressWorker(w)).pipe(new f("compressedSize")).withStreamInfo("compression",v)},s.exports=m},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,s,i){var o=n("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new o("STORE compression")},uncompressWorker:function(){return new o("STORE decompression")}},i.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,s,i){var o=n("./utils"),c=function(){for(var a,f=[],m=0;m<256;m++){a=m;for(var y=0;y<8;y++)a=1&a?3988292384^a>>>1:a>>>1;f[m]=a}return f}();s.exports=function(a,f){return a!==void 0&&a.length?o.getTypeOf(a)!=="string"?function(m,y,v,w){var k=c,C=w+v;m^=-1;for(var S=w;S>>8^k[255&(m^y[S])];return-1^m}(0|f,a,a.length,0):function(m,y,v,w){var k=c,C=w+v;m^=-1;for(var S=w;S>>8^k[255&(m^y.charCodeAt(S))];return-1^m}(0|f,a,a.length,0):0}},{"./utils":32}],5:[function(n,s,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(n,s,i){var o=null;o=typeof Promise<"u"?Promise:n("lie"),s.exports={Promise:o}},{lie:37}],7:[function(n,s,i){var o=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",c=n("pako"),a=n("./utils"),f=n("./stream/GenericWorker"),m=o?"uint8array":"array";function y(v,w){f.call(this,"FlateWorker/"+v),this._pako=null,this._pakoAction=v,this._pakoOptions=w,this.meta={}}i.magic="\b\0",a.inherits(y,f),y.prototype.processChunk=function(v){this.meta=v.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(m,v.data),!1)},y.prototype.flush=function(){f.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},y.prototype.cleanUp=function(){f.prototype.cleanUp.call(this),this._pako=null},y.prototype._createPako=function(){this._pako=new c[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var v=this;this._pako.onData=function(w){v.push({data:w,meta:v.meta})}},i.compressWorker=function(v){return new y("Deflate",v)},i.uncompressWorker=function(){return new y("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,s,i){function o(k,C){var S,T="";for(S=0;S>>=8;return T}function c(k,C,S,T,I,A){var D,$,F=k.file,q=k.compression,W=A!==m.utf8encode,K=a.transformTo("string",A(F.name)),Z=a.transformTo("string",m.utf8encode(F.name)),re=F.comment,he=a.transformTo("string",A(re)),ue=a.transformTo("string",m.utf8encode(re)),Ne=Z.length!==F.name.length,se=ue.length!==re.length,xe="",ie="",me="",fe=F.dir,ve=F.date,Ie={crc32:0,compressedSize:0,uncompressedSize:0};C&&!S||(Ie.crc32=k.crc32,Ie.compressedSize=k.compressedSize,Ie.uncompressedSize=k.uncompressedSize);var Se=0;C&&(Se|=8),W||!Ne&&!se||(Se|=2048);var oe=0,ae=0;fe&&(oe|=16),I==="UNIX"?(ae=798,oe|=function(Me,Ue){var Re=Me;return Me||(Re=Ue?16893:33204),(65535&Re)<<16}(F.unixPermissions,fe)):(ae=20,oe|=function(Me){return 63&(Me||0)}(F.dosPermissions)),D=ve.getUTCHours(),D<<=6,D|=ve.getUTCMinutes(),D<<=5,D|=ve.getUTCSeconds()/2,$=ve.getUTCFullYear()-1980,$<<=4,$|=ve.getUTCMonth()+1,$<<=5,$|=ve.getUTCDate(),Ne&&(ie=o(1,1)+o(y(K),4)+Z,xe+="up"+o(ie.length,2)+ie),se&&(me=o(1,1)+o(y(he),4)+ue,xe+="uc"+o(me.length,2)+me);var je="";return je+=` \0`,je+=o(Se,2),je+=q.magic,je+=o(D,2),je+=o($,2),je+=o(Ie.crc32,4),je+=o(Ie.compressedSize,4),je+=o(Ie.uncompressedSize,4),je+=o(K.length,2),je+=o(xe.length,2),{fileRecord:v.LOCAL_FILE_HEADER+je+K+xe,dirRecord:v.CENTRAL_FILE_HEADER+o(ae,2)+je+o(he.length,2)+"\0\0\0\0"+o(oe,4)+o(T,4)+K+xe+he}}var a=n("../utils"),f=n("../stream/GenericWorker"),m=n("../utf8"),y=n("../crc32"),v=n("../signature");function w(k,C,S,T){f.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=C,this.zipPlatform=S,this.encodeFileName=T,this.streamFiles=k,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(w,f),w.prototype.push=function(k){var C=k.meta.percent||0,S=this.entriesCount,T=this._sources.length;this.accumulate?this.contentBuffer.push(k):(this.bytesWritten+=k.data.length,f.prototype.push.call(this,{data:k.data,meta:{currentFile:this.currentFile,percent:S?(C+100*(S-T-1))/S:100}}))},w.prototype.openedSource=function(k){this.currentSourceOffset=this.bytesWritten,this.currentFile=k.file.name;var C=this.streamFiles&&!k.file.dir;if(C){var S=c(k,C,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:S.fileRecord,meta:{percent:0}})}else this.accumulate=!0},w.prototype.closedSource=function(k){this.accumulate=!1;var C=this.streamFiles&&!k.file.dir,S=c(k,C,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(S.dirRecord),C)this.push({data:function(T){return v.DATA_DESCRIPTOR+o(T.crc32,4)+o(T.compressedSize,4)+o(T.uncompressedSize,4)}(k),meta:{percent:100}});else for(this.push({data:S.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},w.prototype.flush=function(){for(var k=this.bytesWritten,C=0;C=this.index;f--)m=(m<<8)+this.byteAt(f);return this.index+=a,m},readString:function(a){return o.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},s.exports=c},{"../utils":32}],19:[function(n,s,i){var o=n("./Uint8ArrayReader");function c(a){o.call(this,a)}n("../utils").inherits(c,o),c.prototype.readData=function(a){this.checkOffset(a);var f=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,f},s.exports=c},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,s,i){var o=n("./DataReader");function c(a){o.call(this,a)}n("../utils").inherits(c,o),c.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},c.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},c.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},c.prototype.readData=function(a){this.checkOffset(a);var f=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,f},s.exports=c},{"../utils":32,"./DataReader":18}],21:[function(n,s,i){var o=n("./ArrayReader");function c(a){o.call(this,a)}n("../utils").inherits(c,o),c.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var f=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,f},s.exports=c},{"../utils":32,"./ArrayReader":17}],22:[function(n,s,i){var o=n("../utils"),c=n("../support"),a=n("./ArrayReader"),f=n("./StringReader"),m=n("./NodeBufferReader"),y=n("./Uint8ArrayReader");s.exports=function(v){var w=o.getTypeOf(v);return o.checkSupport(w),w!=="string"||c.uint8array?w==="nodebuffer"?new m(v):c.uint8array?new y(o.transformTo("uint8array",v)):new a(o.transformTo("array",v)):new f(v)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,s,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,s,i){var o=n("./GenericWorker"),c=n("../utils");function a(f){o.call(this,"ConvertWorker to "+f),this.destType=f}c.inherits(a,o),a.prototype.processChunk=function(f){this.push({data:c.transformTo(this.destType,f.data),meta:f.meta})},s.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(n,s,i){var o=n("./GenericWorker"),c=n("../crc32");function a(){o.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(a,o),a.prototype.processChunk=function(f){this.streamInfo.crc32=c(f.data,this.streamInfo.crc32||0),this.push(f)},s.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,s,i){var o=n("../utils"),c=n("./GenericWorker");function a(f){c.call(this,"DataLengthProbe for "+f),this.propName=f,this.withStreamInfo(f,0)}o.inherits(a,c),a.prototype.processChunk=function(f){if(f){var m=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=m+f.data.length}c.prototype.processChunk.call(this,f)},s.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(n,s,i){var o=n("../utils"),c=n("./GenericWorker");function a(f){c.call(this,"DataWorker");var m=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,f.then(function(y){m.dataIsReady=!0,m.data=y,m.max=y&&y.length||0,m.type=o.getTypeOf(y),m.isPaused||m._tickAndRepeat()},function(y){m.error(y)})}o.inherits(a,c),a.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!c.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,o.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(o.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var f=null,m=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":f=this.data.substring(this.index,m);break;case"uint8array":f=this.data.subarray(this.index,m);break;case"array":case"nodebuffer":f=this.data.slice(this.index,m)}return this.index=m,this.push({data:f,meta:{percent:this.max?this.index/this.max*100:0}})},s.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(n,s,i){function o(c){this.name=c||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}o.prototype={push:function(c){this.emit("data",c)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(c){this.emit("error",c)}return!0},error:function(c){return!this.isFinished&&(this.isPaused?this.generatedError=c:(this.isFinished=!0,this.emit("error",c),this.previous&&this.previous.error(c),this.cleanUp()),!0)},on:function(c,a){return this._listeners[c].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(c,a){if(this._listeners[c])for(var f=0;f "+c:c}},s.exports=o},{}],29:[function(n,s,i){var o=n("../utils"),c=n("./ConvertWorker"),a=n("./GenericWorker"),f=n("../base64"),m=n("../support"),y=n("../external"),v=null;if(m.nodestream)try{v=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function w(C,S){return new y.Promise(function(T,I){var A=[],D=C._internalType,$=C._outputType,F=C._mimeType;C.on("data",function(q,W){A.push(q),S&&S(W)}).on("error",function(q){A=[],I(q)}).on("end",function(){try{var q=function(W,K,Z){switch(W){case"blob":return o.newBlob(o.transformTo("arraybuffer",K),Z);case"base64":return f.encode(K);default:return o.transformTo(W,K)}}($,function(W,K){var Z,re=0,he=null,ue=0;for(Z=0;Z"u")i.blob=!1;else{var o=new ArrayBuffer(0);try{i.blob=new Blob([o],{type:"application/zip"}).size===0}catch{try{var c=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);c.append(o),i.blob=c.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!n("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(n,s,i){for(var o=n("./utils"),c=n("./support"),a=n("./nodejsUtils"),f=n("./stream/GenericWorker"),m=new Array(256),y=0;y<256;y++)m[y]=252<=y?6:248<=y?5:240<=y?4:224<=y?3:192<=y?2:1;m[254]=m[254]=1;function v(){f.call(this,"utf-8 decode"),this.leftOver=null}function w(){f.call(this,"utf-8 encode")}i.utf8encode=function(k){return c.nodebuffer?a.newBufferFrom(k,"utf-8"):function(C){var S,T,I,A,D,$=C.length,F=0;for(A=0;A<$;A++)(64512&(T=C.charCodeAt(A)))==55296&&A+1<$&&(64512&(I=C.charCodeAt(A+1)))==56320&&(T=65536+(T-55296<<10)+(I-56320),A++),F+=T<128?1:T<2048?2:T<65536?3:4;for(S=c.uint8array?new Uint8Array(F):new Array(F),A=D=0;D>>6:(T<65536?S[D++]=224|T>>>12:(S[D++]=240|T>>>18,S[D++]=128|T>>>12&63),S[D++]=128|T>>>6&63),S[D++]=128|63&T);return S}(k)},i.utf8decode=function(k){return c.nodebuffer?o.transformTo("nodebuffer",k).toString("utf-8"):function(C){var S,T,I,A,D=C.length,$=new Array(2*D);for(S=T=0;S>10&1023,$[T++]=56320|1023&I)}return $.length!==T&&($.subarray?$=$.subarray(0,T):$.length=T),o.applyFromCharCode($)}(k=o.transformTo(c.uint8array?"uint8array":"array",k))},o.inherits(v,f),v.prototype.processChunk=function(k){var C=o.transformTo(c.uint8array?"uint8array":"array",k.data);if(this.leftOver&&this.leftOver.length){if(c.uint8array){var S=C;(C=new Uint8Array(S.length+this.leftOver.length)).set(this.leftOver,0),C.set(S,this.leftOver.length)}else C=this.leftOver.concat(C);this.leftOver=null}var T=function(A,D){var $;for((D=D||A.length)>A.length&&(D=A.length),$=D-1;0<=$&&(192&A[$])==128;)$--;return $<0||$===0?D:$+m[A[$]]>D?$:D}(C),I=C;T!==C.length&&(c.uint8array?(I=C.subarray(0,T),this.leftOver=C.subarray(T,C.length)):(I=C.slice(0,T),this.leftOver=C.slice(T,C.length))),this.push({data:i.utf8decode(I),meta:k.meta})},v.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=v,o.inherits(w,f),w.prototype.processChunk=function(k){this.push({data:i.utf8encode(k.data),meta:k.meta})},i.Utf8EncodeWorker=w},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,s,i){var o=n("./support"),c=n("./base64"),a=n("./nodejsUtils"),f=n("./external");function m(S){return S}function y(S,T){for(var I=0;I>8;this.dir=!!(16&this.externalFileAttributes),k==0&&(this.dosPermissions=63&this.externalFileAttributes),k==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var k=o(this.extraFields[1].value);this.uncompressedSize===c.MAX_VALUE_32BITS&&(this.uncompressedSize=k.readInt(8)),this.compressedSize===c.MAX_VALUE_32BITS&&(this.compressedSize=k.readInt(8)),this.localHeaderOffset===c.MAX_VALUE_32BITS&&(this.localHeaderOffset=k.readInt(8)),this.diskNumberStart===c.MAX_VALUE_32BITS&&(this.diskNumberStart=k.readInt(4))}},readExtraFields:function(k){var C,S,T,I=k.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});k.index+4>>6:(k<65536?w[T++]=224|k>>>12:(w[T++]=240|k>>>18,w[T++]=128|k>>>12&63),w[T++]=128|k>>>6&63),w[T++]=128|63&k);return w},i.buf2binstring=function(v){return y(v,v.length)},i.binstring2buf=function(v){for(var w=new o.Buf8(v.length),k=0,C=w.length;k>10&1023,A[C++]=56320|1023&S)}return y(A,C)},i.utf8border=function(v,w){var k;for((w=w||v.length)>v.length&&(w=v.length),k=w-1;0<=k&&(192&v[k])==128;)k--;return k<0||k===0?w:k+f[v[k]]>w?k:w}},{"./common":41}],43:[function(n,s,i){s.exports=function(o,c,a,f){for(var m=65535&o|0,y=o>>>16&65535|0,v=0;a!==0;){for(a-=v=2e3>>1:c>>>1;a[f]=c}return a}();s.exports=function(c,a,f,m){var y=o,v=m+f;c^=-1;for(var w=m;w>>8^y[255&(c^a[w])];return-1^c}},{}],46:[function(n,s,i){var o,c=n("../utils/common"),a=n("./trees"),f=n("./adler32"),m=n("./crc32"),y=n("./messages"),v=0,w=4,k=0,C=-2,S=-1,T=4,I=2,A=8,D=9,$=286,F=30,q=19,W=2*$+1,K=15,Z=3,re=258,he=re+Z+1,ue=42,Ne=113,se=1,xe=2,ie=3,me=4;function fe(ge,mt){return ge.msg=y[mt],mt}function ve(ge){return(ge<<1)-(4ge.avail_out&&(rt=ge.avail_out),rt!==0&&(c.arraySet(ge.output,mt.pending_buf,mt.pending_out,rt,ge.next_out),ge.next_out+=rt,mt.pending_out+=rt,ge.total_out+=rt,ge.avail_out-=rt,mt.pending-=rt,mt.pending===0&&(mt.pending_out=0))}function oe(ge,mt){a._tr_flush_block(ge,0<=ge.block_start?ge.block_start:-1,ge.strstart-ge.block_start,mt),ge.block_start=ge.strstart,Se(ge.strm)}function ae(ge,mt){ge.pending_buf[ge.pending++]=mt}function je(ge,mt){ge.pending_buf[ge.pending++]=mt>>>8&255,ge.pending_buf[ge.pending++]=255&mt}function Me(ge,mt){var rt,We,Ce=ge.max_chain_length,et=ge.strstart,Fe=ge.prev_length,Ke=ge.nice_match,Le=ge.strstart>ge.w_size-he?ge.strstart-(ge.w_size-he):0,ft=ge.window,Nt=ge.w_mask,Mt=ge.prev,It=ge.strstart+re,tr=ft[et+Fe-1],Mr=ft[et+Fe];ge.prev_length>=ge.good_match&&(Ce>>=2),Ke>ge.lookahead&&(Ke=ge.lookahead);do if(ft[(rt=mt)+Fe]===Mr&&ft[rt+Fe-1]===tr&&ft[rt]===ft[et]&&ft[++rt]===ft[et+1]){et+=2,rt++;do;while(ft[++et]===ft[++rt]&&ft[++et]===ft[++rt]&&ft[++et]===ft[++rt]&&ft[++et]===ft[++rt]&&ft[++et]===ft[++rt]&&ft[++et]===ft[++rt]&&ft[++et]===ft[++rt]&&ft[++et]===ft[++rt]&&etLe&&--Ce!=0);return Fe<=ge.lookahead?Fe:ge.lookahead}function Ue(ge){var mt,rt,We,Ce,et,Fe,Ke,Le,ft,Nt,Mt=ge.w_size;do{if(Ce=ge.window_size-ge.lookahead-ge.strstart,ge.strstart>=Mt+(Mt-he)){for(c.arraySet(ge.window,ge.window,Mt,Mt,0),ge.match_start-=Mt,ge.strstart-=Mt,ge.block_start-=Mt,mt=rt=ge.hash_size;We=ge.head[--mt],ge.head[mt]=Mt<=We?We-Mt:0,--rt;);for(mt=rt=Mt;We=ge.prev[--mt],ge.prev[mt]=Mt<=We?We-Mt:0,--rt;);Ce+=Mt}if(ge.strm.avail_in===0)break;if(Fe=ge.strm,Ke=ge.window,Le=ge.strstart+ge.lookahead,ft=Ce,Nt=void 0,Nt=Fe.avail_in,ft=Z)for(et=ge.strstart-ge.insert,ge.ins_h=ge.window[et],ge.ins_h=(ge.ins_h<=Z&&(ge.ins_h=(ge.ins_h<=Z)if(We=a._tr_tally(ge,ge.strstart-ge.match_start,ge.match_length-Z),ge.lookahead-=ge.match_length,ge.match_length<=ge.max_lazy_match&&ge.lookahead>=Z){for(ge.match_length--;ge.strstart++,ge.ins_h=(ge.ins_h<=Z&&(ge.ins_h=(ge.ins_h<=Z&&ge.match_length<=ge.prev_length){for(Ce=ge.strstart+ge.lookahead-Z,We=a._tr_tally(ge,ge.strstart-1-ge.prev_match,ge.prev_length-Z),ge.lookahead-=ge.prev_length-1,ge.prev_length-=2;++ge.strstart<=Ce&&(ge.ins_h=(ge.ins_h<ge.pending_buf_size-5&&(rt=ge.pending_buf_size-5);;){if(ge.lookahead<=1){if(Ue(ge),ge.lookahead===0&&mt===v)return se;if(ge.lookahead===0)break}ge.strstart+=ge.lookahead,ge.lookahead=0;var We=ge.block_start+rt;if((ge.strstart===0||ge.strstart>=We)&&(ge.lookahead=ge.strstart-We,ge.strstart=We,oe(ge,!1),ge.strm.avail_out===0)||ge.strstart-ge.block_start>=ge.w_size-he&&(oe(ge,!1),ge.strm.avail_out===0))return se}return ge.insert=0,mt===w?(oe(ge,!0),ge.strm.avail_out===0?ie:me):(ge.strstart>ge.block_start&&(oe(ge,!1),ge.strm.avail_out),se)}),new Pe(4,4,8,4,Re),new Pe(4,5,16,8,Re),new Pe(4,6,32,32,Re),new Pe(4,4,16,16,$e),new Pe(8,16,32,32,$e),new Pe(8,16,128,128,$e),new Pe(8,32,128,256,$e),new Pe(32,128,258,1024,$e),new Pe(32,258,258,4096,$e)],i.deflateInit=function(ge,mt){return Xe(ge,mt,A,15,8,0)},i.deflateInit2=Xe,i.deflateReset=Te,i.deflateResetKeep=nt,i.deflateSetHeader=function(ge,mt){return ge&&ge.state?ge.state.wrap!==2?C:(ge.state.gzhead=mt,k):C},i.deflate=function(ge,mt){var rt,We,Ce,et;if(!ge||!ge.state||5>8&255),ae(We,We.gzhead.time>>16&255),ae(We,We.gzhead.time>>24&255),ae(We,We.level===9?2:2<=We.strategy||We.level<2?4:0),ae(We,255&We.gzhead.os),We.gzhead.extra&&We.gzhead.extra.length&&(ae(We,255&We.gzhead.extra.length),ae(We,We.gzhead.extra.length>>8&255)),We.gzhead.hcrc&&(ge.adler=m(ge.adler,We.pending_buf,We.pending,0)),We.gzindex=0,We.status=69):(ae(We,0),ae(We,0),ae(We,0),ae(We,0),ae(We,0),ae(We,We.level===9?2:2<=We.strategy||We.level<2?4:0),ae(We,3),We.status=Ne);else{var Fe=A+(We.w_bits-8<<4)<<8;Fe|=(2<=We.strategy||We.level<2?0:We.level<6?1:We.level===6?2:3)<<6,We.strstart!==0&&(Fe|=32),Fe+=31-Fe%31,We.status=Ne,je(We,Fe),We.strstart!==0&&(je(We,ge.adler>>>16),je(We,65535&ge.adler)),ge.adler=1}if(We.status===69)if(We.gzhead.extra){for(Ce=We.pending;We.gzindex<(65535&We.gzhead.extra.length)&&(We.pending!==We.pending_buf_size||(We.gzhead.hcrc&&We.pending>Ce&&(ge.adler=m(ge.adler,We.pending_buf,We.pending-Ce,Ce)),Se(ge),Ce=We.pending,We.pending!==We.pending_buf_size));)ae(We,255&We.gzhead.extra[We.gzindex]),We.gzindex++;We.gzhead.hcrc&&We.pending>Ce&&(ge.adler=m(ge.adler,We.pending_buf,We.pending-Ce,Ce)),We.gzindex===We.gzhead.extra.length&&(We.gzindex=0,We.status=73)}else We.status=73;if(We.status===73)if(We.gzhead.name){Ce=We.pending;do{if(We.pending===We.pending_buf_size&&(We.gzhead.hcrc&&We.pending>Ce&&(ge.adler=m(ge.adler,We.pending_buf,We.pending-Ce,Ce)),Se(ge),Ce=We.pending,We.pending===We.pending_buf_size)){et=1;break}et=We.gzindexCe&&(ge.adler=m(ge.adler,We.pending_buf,We.pending-Ce,Ce)),et===0&&(We.gzindex=0,We.status=91)}else We.status=91;if(We.status===91)if(We.gzhead.comment){Ce=We.pending;do{if(We.pending===We.pending_buf_size&&(We.gzhead.hcrc&&We.pending>Ce&&(ge.adler=m(ge.adler,We.pending_buf,We.pending-Ce,Ce)),Se(ge),Ce=We.pending,We.pending===We.pending_buf_size)){et=1;break}et=We.gzindexCe&&(ge.adler=m(ge.adler,We.pending_buf,We.pending-Ce,Ce)),et===0&&(We.status=103)}else We.status=103;if(We.status===103&&(We.gzhead.hcrc?(We.pending+2>We.pending_buf_size&&Se(ge),We.pending+2<=We.pending_buf_size&&(ae(We,255&ge.adler),ae(We,ge.adler>>8&255),ge.adler=0,We.status=Ne)):We.status=Ne),We.pending!==0){if(Se(ge),ge.avail_out===0)return We.last_flush=-1,k}else if(ge.avail_in===0&&ve(mt)<=ve(rt)&&mt!==w)return fe(ge,-5);if(We.status===666&&ge.avail_in!==0)return fe(ge,-5);if(ge.avail_in!==0||We.lookahead!==0||mt!==v&&We.status!==666){var Ke=We.strategy===2?function(Le,ft){for(var Nt;;){if(Le.lookahead===0&&(Ue(Le),Le.lookahead===0)){if(ft===v)return se;break}if(Le.match_length=0,Nt=a._tr_tally(Le,0,Le.window[Le.strstart]),Le.lookahead--,Le.strstart++,Nt&&(oe(Le,!1),Le.strm.avail_out===0))return se}return Le.insert=0,ft===w?(oe(Le,!0),Le.strm.avail_out===0?ie:me):Le.last_lit&&(oe(Le,!1),Le.strm.avail_out===0)?se:xe}(We,mt):We.strategy===3?function(Le,ft){for(var Nt,Mt,It,tr,Mr=Le.window;;){if(Le.lookahead<=re){if(Ue(Le),Le.lookahead<=re&&ft===v)return se;if(Le.lookahead===0)break}if(Le.match_length=0,Le.lookahead>=Z&&0Le.lookahead&&(Le.match_length=Le.lookahead)}if(Le.match_length>=Z?(Nt=a._tr_tally(Le,1,Le.match_length-Z),Le.lookahead-=Le.match_length,Le.strstart+=Le.match_length,Le.match_length=0):(Nt=a._tr_tally(Le,0,Le.window[Le.strstart]),Le.lookahead--,Le.strstart++),Nt&&(oe(Le,!1),Le.strm.avail_out===0))return se}return Le.insert=0,ft===w?(oe(Le,!0),Le.strm.avail_out===0?ie:me):Le.last_lit&&(oe(Le,!1),Le.strm.avail_out===0)?se:xe}(We,mt):o[We.level].func(We,mt);if(Ke!==ie&&Ke!==me||(We.status=666),Ke===se||Ke===ie)return ge.avail_out===0&&(We.last_flush=-1),k;if(Ke===xe&&(mt===1?a._tr_align(We):mt!==5&&(a._tr_stored_block(We,0,0,!1),mt===3&&(Ie(We.head),We.lookahead===0&&(We.strstart=0,We.block_start=0,We.insert=0))),Se(ge),ge.avail_out===0))return We.last_flush=-1,k}return mt!==w?k:We.wrap<=0?1:(We.wrap===2?(ae(We,255&ge.adler),ae(We,ge.adler>>8&255),ae(We,ge.adler>>16&255),ae(We,ge.adler>>24&255),ae(We,255&ge.total_in),ae(We,ge.total_in>>8&255),ae(We,ge.total_in>>16&255),ae(We,ge.total_in>>24&255)):(je(We,ge.adler>>>16),je(We,65535&ge.adler)),Se(ge),0=rt.w_size&&(et===0&&(Ie(rt.head),rt.strstart=0,rt.block_start=0,rt.insert=0),ft=new c.Buf8(rt.w_size),c.arraySet(ft,mt,Nt-rt.w_size,rt.w_size,0),mt=ft,Nt=rt.w_size),Fe=ge.avail_in,Ke=ge.next_in,Le=ge.input,ge.avail_in=Nt,ge.next_in=0,ge.input=mt,Ue(rt);rt.lookahead>=Z;){for(We=rt.strstart,Ce=rt.lookahead-(Z-1);rt.ins_h=(rt.ins_h<>>=Z=K>>>24,D-=Z,(Z=K>>>16&255)===0)xe[y++]=65535&K;else{if(!(16&Z)){if(!(64&Z)){K=$[(65535&K)+(A&(1<>>=Z,D-=Z),D<15&&(A+=se[f++]<>>=Z=K>>>24,D-=Z,!(16&(Z=K>>>16&255))){if(!(64&Z)){K=F[(65535&K)+(A&(1<>>=Z,D-=Z,(Z=y-v)>3,A&=(1<<(D-=re<<3))-1,o.next_in=f,o.next_out=y,o.avail_in=f>>24&255)+(ue>>>8&65280)+((65280&ue)<<8)+((255&ue)<<24)}function A(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new o.Buf16(320),this.work=new o.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function D(ue){var Ne;return ue&&ue.state?(Ne=ue.state,ue.total_in=ue.total_out=Ne.total=0,ue.msg="",Ne.wrap&&(ue.adler=1&Ne.wrap),Ne.mode=C,Ne.last=0,Ne.havedict=0,Ne.dmax=32768,Ne.head=null,Ne.hold=0,Ne.bits=0,Ne.lencode=Ne.lendyn=new o.Buf32(S),Ne.distcode=Ne.distdyn=new o.Buf32(T),Ne.sane=1,Ne.back=-1,w):k}function $(ue){var Ne;return ue&&ue.state?((Ne=ue.state).wsize=0,Ne.whave=0,Ne.wnext=0,D(ue)):k}function F(ue,Ne){var se,xe;return ue&&ue.state?(xe=ue.state,Ne<0?(se=0,Ne=-Ne):(se=1+(Ne>>4),Ne<48&&(Ne&=15)),Ne&&(Ne<8||15=me.wsize?(o.arraySet(me.window,Ne,se-me.wsize,me.wsize,0),me.wnext=0,me.whave=me.wsize):(xe<(ie=me.wsize-me.wnext)&&(ie=xe),o.arraySet(me.window,Ne,se-xe,ie,me.wnext),(xe-=ie)?(o.arraySet(me.window,Ne,se-xe,xe,0),me.wnext=xe,me.whave=me.wsize):(me.wnext+=ie,me.wnext===me.wsize&&(me.wnext=0),me.whave>>8&255,se.check=a(se.check,et,2,0),oe=Se=0,se.mode=2;break}if(se.flags=0,se.head&&(se.head.done=!1),!(1&se.wrap)||(((255&Se)<<8)+(Se>>8))%31){ue.msg="incorrect header check",se.mode=30;break}if((15&Se)!=8){ue.msg="unknown compression method",se.mode=30;break}if(oe-=4,ge=8+(15&(Se>>>=4)),se.wbits===0)se.wbits=ge;else if(ge>se.wbits){ue.msg="invalid window size",se.mode=30;break}se.dmax=1<>8&1),512&se.flags&&(et[0]=255&Se,et[1]=Se>>>8&255,se.check=a(se.check,et,2,0)),oe=Se=0,se.mode=3;case 3:for(;oe<32;){if(ve===0)break e;ve--,Se+=xe[me++]<>>8&255,et[2]=Se>>>16&255,et[3]=Se>>>24&255,se.check=a(se.check,et,4,0)),oe=Se=0,se.mode=4;case 4:for(;oe<16;){if(ve===0)break e;ve--,Se+=xe[me++]<>8),512&se.flags&&(et[0]=255&Se,et[1]=Se>>>8&255,se.check=a(se.check,et,2,0)),oe=Se=0,se.mode=5;case 5:if(1024&se.flags){for(;oe<16;){if(ve===0)break e;ve--,Se+=xe[me++]<>>8&255,se.check=a(se.check,et,2,0)),oe=Se=0}else se.head&&(se.head.extra=null);se.mode=6;case 6:if(1024&se.flags&&(ve<(Me=se.length)&&(Me=ve),Me&&(se.head&&(ge=se.head.extra_len-se.length,se.head.extra||(se.head.extra=new Array(se.head.extra_len)),o.arraySet(se.head.extra,xe,me,Me,ge)),512&se.flags&&(se.check=a(se.check,xe,Me,me)),ve-=Me,me+=Me,se.length-=Me),se.length))break e;se.length=0,se.mode=7;case 7:if(2048&se.flags){if(ve===0)break e;for(Me=0;ge=xe[me+Me++],se.head&&ge&&se.length<65536&&(se.head.name+=String.fromCharCode(ge)),ge&&Me>9&1,se.head.done=!0),ue.adler=se.check=0,se.mode=12;break;case 10:for(;oe<32;){if(ve===0)break e;ve--,Se+=xe[me++]<>>=7&oe,oe-=7&oe,se.mode=27;break}for(;oe<3;){if(ve===0)break e;ve--,Se+=xe[me++]<>>=1)){case 0:se.mode=14;break;case 1:if(re(se),se.mode=20,Ne!==6)break;Se>>>=2,oe-=2;break e;case 2:se.mode=17;break;case 3:ue.msg="invalid block type",se.mode=30}Se>>>=2,oe-=2;break;case 14:for(Se>>>=7&oe,oe-=7&oe;oe<32;){if(ve===0)break e;ve--,Se+=xe[me++]<>>16^65535)){ue.msg="invalid stored block lengths",se.mode=30;break}if(se.length=65535&Se,oe=Se=0,se.mode=15,Ne===6)break e;case 15:se.mode=16;case 16:if(Me=se.length){if(ve>>=5,oe-=5,se.ndist=1+(31&Se),Se>>>=5,oe-=5,se.ncode=4+(15&Se),Se>>>=4,oe-=4,286>>=3,oe-=3}for(;se.have<19;)se.lens[Fe[se.have++]]=0;if(se.lencode=se.lendyn,se.lenbits=7,rt={bits:se.lenbits},mt=m(0,se.lens,0,19,se.lencode,0,se.work,rt),se.lenbits=rt.bits,mt){ue.msg="invalid code lengths set",se.mode=30;break}se.have=0,se.mode=19;case 19:for(;se.have>>16&255,Ae=65535&Ce,!(($e=Ce>>>24)<=oe);){if(ve===0)break e;ve--,Se+=xe[me++]<>>=$e,oe-=$e,se.lens[se.have++]=Ae;else{if(Ae===16){for(We=$e+2;oe>>=$e,oe-=$e,se.have===0){ue.msg="invalid bit length repeat",se.mode=30;break}ge=se.lens[se.have-1],Me=3+(3&Se),Se>>>=2,oe-=2}else if(Ae===17){for(We=$e+3;oe>>=$e)),Se>>>=3,oe-=3}else{for(We=$e+7;oe>>=$e)),Se>>>=7,oe-=7}if(se.have+Me>se.nlen+se.ndist){ue.msg="invalid bit length repeat",se.mode=30;break}for(;Me--;)se.lens[se.have++]=ge}}if(se.mode===30)break;if(se.lens[256]===0){ue.msg="invalid code -- missing end-of-block",se.mode=30;break}if(se.lenbits=9,rt={bits:se.lenbits},mt=m(y,se.lens,0,se.nlen,se.lencode,0,se.work,rt),se.lenbits=rt.bits,mt){ue.msg="invalid literal/lengths set",se.mode=30;break}if(se.distbits=6,se.distcode=se.distdyn,rt={bits:se.distbits},mt=m(v,se.lens,se.nlen,se.ndist,se.distcode,0,se.work,rt),se.distbits=rt.bits,mt){ue.msg="invalid distances set",se.mode=30;break}if(se.mode=20,Ne===6)break e;case 20:se.mode=21;case 21:if(6<=ve&&258<=Ie){ue.next_out=fe,ue.avail_out=Ie,ue.next_in=me,ue.avail_in=ve,se.hold=Se,se.bits=oe,f(ue,je),fe=ue.next_out,ie=ue.output,Ie=ue.avail_out,me=ue.next_in,xe=ue.input,ve=ue.avail_in,Se=se.hold,oe=se.bits,se.mode===12&&(se.back=-1);break}for(se.back=0;Pe=(Ce=se.lencode[Se&(1<>>16&255,Ae=65535&Ce,!(($e=Ce>>>24)<=oe);){if(ve===0)break e;ve--,Se+=xe[me++]<>nt)])>>>16&255,Ae=65535&Ce,!(nt+($e=Ce>>>24)<=oe);){if(ve===0)break e;ve--,Se+=xe[me++]<>>=nt,oe-=nt,se.back+=nt}if(Se>>>=$e,oe-=$e,se.back+=$e,se.length=Ae,Pe===0){se.mode=26;break}if(32&Pe){se.back=-1,se.mode=12;break}if(64&Pe){ue.msg="invalid literal/length code",se.mode=30;break}se.extra=15&Pe,se.mode=22;case 22:if(se.extra){for(We=se.extra;oe>>=se.extra,oe-=se.extra,se.back+=se.extra}se.was=se.length,se.mode=23;case 23:for(;Pe=(Ce=se.distcode[Se&(1<>>16&255,Ae=65535&Ce,!(($e=Ce>>>24)<=oe);){if(ve===0)break e;ve--,Se+=xe[me++]<>nt)])>>>16&255,Ae=65535&Ce,!(nt+($e=Ce>>>24)<=oe);){if(ve===0)break e;ve--,Se+=xe[me++]<>>=nt,oe-=nt,se.back+=nt}if(Se>>>=$e,oe-=$e,se.back+=$e,64&Pe){ue.msg="invalid distance code",se.mode=30;break}se.offset=Ae,se.extra=15&Pe,se.mode=24;case 24:if(se.extra){for(We=se.extra;oe>>=se.extra,oe-=se.extra,se.back+=se.extra}if(se.offset>se.dmax){ue.msg="invalid distance too far back",se.mode=30;break}se.mode=25;case 25:if(Ie===0)break e;if(Me=je-Ie,se.offset>Me){if((Me=se.offset-Me)>se.whave&&se.sane){ue.msg="invalid distance too far back",se.mode=30;break}Ue=Me>se.wnext?(Me-=se.wnext,se.wsize-Me):se.wnext-Me,Me>se.length&&(Me=se.length),Re=se.window}else Re=ie,Ue=fe-se.offset,Me=se.length;for(IeW?(Z=Ue[Re+T[Ne]],oe[ae+T[Ne]]):(Z=96,0),A=1<>fe)+(D-=A)]=K<<24|Z<<16|re|0,D!==0;);for(A=1<>=1;if(A!==0?(Se&=A-1,Se+=A):Se=0,Ne++,--je[ue]==0){if(ue===xe)break;ue=v[w+T[Ne]]}if(ie>>7)]}function ae(Ce,et){Ce.pending_buf[Ce.pending++]=255&et,Ce.pending_buf[Ce.pending++]=et>>>8&255}function je(Ce,et,Fe){Ce.bi_valid>I-Fe?(Ce.bi_buf|=et<>I-Ce.bi_valid,Ce.bi_valid+=Fe-I):(Ce.bi_buf|=et<>>=1,Fe<<=1,0<--et;);return Fe>>>1}function Re(Ce,et,Fe){var Ke,Le,ft=new Array(T+1),Nt=0;for(Ke=1;Ke<=T;Ke++)ft[Ke]=Nt=Nt+Fe[Ke-1]<<1;for(Le=0;Le<=et;Le++){var Mt=Ce[2*Le+1];Mt!==0&&(Ce[2*Le]=Ue(ft[Mt]++,Mt))}}function $e(Ce){var et;for(et=0;et>1;1<=Fe;Fe--)nt(Ce,ft,Fe);for(Le=It;Fe=Ce.heap[1],Ce.heap[1]=Ce.heap[Ce.heap_len--],nt(Ce,ft,1),Ke=Ce.heap[1],Ce.heap[--Ce.heap_max]=Fe,Ce.heap[--Ce.heap_max]=Ke,ft[2*Le]=ft[2*Fe]+ft[2*Ke],Ce.depth[Le]=(Ce.depth[Fe]>=Ce.depth[Ke]?Ce.depth[Fe]:Ce.depth[Ke])+1,ft[2*Fe+1]=ft[2*Ke+1]=Le,Ce.heap[1]=Le++,nt(Ce,ft,1),2<=Ce.heap_len;);Ce.heap[--Ce.heap_max]=Ce.heap[1],function(Mr,pn){var fs,Qn,js,Qs,si,wr,Ts=pn.dyn_tree,ii=pn.max_code,mi=pn.stat_desc.static_tree,Ta=pn.stat_desc.has_stree,ga=pn.stat_desc.extra_bits,vl=pn.stat_desc.extra_base,Yo=pn.stat_desc.max_length,Ds=0;for(Qs=0;Qs<=T;Qs++)Mr.bl_count[Qs]=0;for(Ts[2*Mr.heap[Mr.heap_max]+1]=0,fs=Mr.heap_max+1;fs>=7;Le>>=1)if(1&tr&&Mt.dyn_ltree[2*It]!==0)return c;if(Mt.dyn_ltree[18]!==0||Mt.dyn_ltree[20]!==0||Mt.dyn_ltree[26]!==0)return a;for(It=32;It>>3,(ft=Ce.static_len+3+7>>>3)<=Le&&(Le=ft)):Le=ft=Fe+5,Fe+4<=Le&&et!==-1?We(Ce,et,Fe,Ke):Ce.strategy===4||ft===Le?(je(Ce,2+(Ke?1:0),3),Te(Ce,he,ue)):(je(Ce,4+(Ke?1:0),3),function(Mt,It,tr,Mr){var pn;for(je(Mt,It-257,5),je(Mt,tr-1,5),je(Mt,Mr-4,4),pn=0;pn>>8&255,Ce.pending_buf[Ce.d_buf+2*Ce.last_lit+1]=255&et,Ce.pending_buf[Ce.l_buf+Ce.last_lit]=255&Fe,Ce.last_lit++,et===0?Ce.dyn_ltree[2*Fe]++:(Ce.matches++,et--,Ce.dyn_ltree[2*(se[Fe]+v+1)]++,Ce.dyn_dtree[2*oe(et)]++),Ce.last_lit===Ce.lit_bufsize-1},i._tr_align=function(Ce){je(Ce,2,3),Me(Ce,D,he),function(et){et.bi_valid===16?(ae(et,et.bi_buf),et.bi_buf=0,et.bi_valid=0):8<=et.bi_valid&&(et.pending_buf[et.pending++]=255&et.bi_buf,et.bi_buf>>=8,et.bi_valid-=8)}(Ce)}},{"../utils/common":41}],53:[function(n,s,i){s.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,s,i){(function(o){(function(c,a){if(!c.setImmediate){var f,m,y,v,w=1,k={},C=!1,S=c.document,T=Object.getPrototypeOf&&Object.getPrototypeOf(c);T=T&&T.setTimeout?T:c,f={}.toString.call(c.process)==="[object process]"?function($){process.nextTick(function(){A($)})}:function(){if(c.postMessage&&!c.importScripts){var $=!0,F=c.onmessage;return c.onmessage=function(){$=!1},c.postMessage("","*"),c.onmessage=F,$}}()?(v="setImmediate$"+Math.random()+"$",c.addEventListener?c.addEventListener("message",D,!1):c.attachEvent("onmessage",D),function($){c.postMessage(v+$,"*")}):c.MessageChannel?((y=new MessageChannel).port1.onmessage=function($){A($.data)},function($){y.port2.postMessage($)}):S&&"onreadystatechange"in S.createElement("script")?(m=S.documentElement,function($){var F=S.createElement("script");F.onreadystatechange=function(){A($),F.onreadystatechange=null,m.removeChild(F),F=null},m.appendChild(F)}):function($){setTimeout(A,0,$)},T.setImmediate=function($){typeof $!="function"&&($=new Function(""+$));for(var F=new Array(arguments.length-1),q=0;q"u"?o===void 0?this:o:self)}).call(this,typeof _y<"u"?_y:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(O8e);var tgt=O8e.exports;const rgt=Oa(tgt),ngt=()=>{const{isAdmin:t}=Fr(),[e,n]=P.useState(null),[s,i]=P.useState(null),[o,c]=P.useState("all"),[a,f]=P.useState(new Set),[m,y]=P.useState(!1),[v,w]=P.useState(!1),[k,C]=P.useState("images"),[S,T]=P.useState(null),{data:I=[],isLoading:A}=rr({queryKey:["social-swag-2"],queryFn:async()=>{const{data:ve,error:Ie}=await ee.from("social_swag_2").select("*").order("month",{ascending:!1}).order("sort_order");if(Ie)throw Ie;return ve}}),{data:D=[]}=rr({queryKey:["social-swag-2-months"],queryFn:async()=>{const{data:ve,error:Ie}=await ee.from("social_swag_2_months").select("*").order("month",{ascending:!1});if(Ie)throw Ie;return ve}}),{data:$=[]}=rr({queryKey:["social-swag-2-reels"],queryFn:async()=>{const{data:ve,error:Ie}=await ee.from("social_swag_2_reels").select("*").order("month",{ascending:!1});if(Ie)throw Ie;return ve}}),{data:F=[]}=rr({queryKey:["my-social-accounts-count"],queryFn:async()=>{const{data:ve,error:Ie}=await ee.from("social_accounts").select("id, platform").eq("is_active",!0);if(Ie)throw Ie;return ve||[]}}),q=F.length>0,W=P.useMemo(()=>o==="all"?null:$.find(ve=>ve.month===o)||null,[o,$]),K=P.useMemo(()=>[...new Set(I.map(Ie=>Ie.month))].sort((Ie,Se)=>Se.localeCompare(Ie)),[I]);P.useEffect(()=>{K.length>0&&o==="all"&&c(K[0])},[K,o]);const Z=ve=>{try{const Ie=Yge(ve,"yyyy-MM",new Date);return un(Ie,"MMMM yyyy")}catch{return ve}},re=P.useMemo(()=>o==="all"?I:I.filter(ve=>ve.month===o),[o,I]),he=P.useMemo(()=>{var ve;return o==="all"?null:((ve=D.find(Ie=>Ie.month===o))==null?void 0:ve.canva_link)||null},[o,D]),ue=async ve=>{try{await navigator.clipboard.writeText(ve),Ge.success("Caption copied to clipboard!")}catch{Ge.error("Failed to copy caption")}},Ne=async(ve,Ie)=>{try{const oe=await(await fetch(ve)).blob(),ae=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent),je=navigator.canShare&&navigator.canShare({files:[new File([oe],"test.jpg",{type:"image/jpeg"})]});if(ae&&je){const Me=new File([oe],`social-swag-${Ie}.jpg`,{type:"image/jpeg"});await navigator.share({files:[Me],title:"Social Swag Image"}),Ge.success("Image ready to save!")}else{const Me=window.URL.createObjectURL(oe),Ue=document.createElement("a");Ue.href=Me,Ue.download=`social-swag-${Ie}.jpg`,document.body.appendChild(Ue),Ue.click(),document.body.removeChild(Ue),window.URL.revokeObjectURL(Me),Ge.success("Image downloaded!")}}catch(Se){Se.name!=="AbortError"&&Ge.error("Failed to download image")}},se=ve=>{f(Ie=>{const Se=new Set(Ie);return Se.has(ve)?Se.delete(ve):Se.add(ve),Se})},xe=()=>{f(new Set(re.map(ve=>ve.id)))},ie=()=>{f(new Set),y(!1)},me=async()=>{const ve=re.filter(Ie=>a.has(Ie.id));if(ve.length===0){Ge.error("No images selected");return}w(!0),Ge.info(`Preparing ${ve.length} images for download...`);try{const Ie=new rgt,Se=[...ve].sort((Ue,Re)=>Ue.sort_order-Re.sort_order);for(let Ue=0;Ue{m?se(ve.id):n(ve)};return r.jsx(Or,{title:"Social Swag 2.0",children:r.jsxs("div",{className:"space-y-8",children:[r.jsxs("div",{className:"relative overflow-hidden rounded-2xl bg-gradient-to-br from-primary via-primary/80 to-info p-8 text-primary-foreground",children:[r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmYiIGZpbGwtb3BhY2l0eT0iMC4xIj48cGF0aCBkPSJNMzYgMzRjMC0yIDItNCAyLTRzMiAyIDIgNC0yIDQtMiA0LTItMi0yLTR6Ii8+PC9nPjwvZz48L3N2Zz4=')] opacity-30"}),r.jsxs("div",{className:"relative",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3 mb-4",children:[r.jsxs(Rt,{variant:"secondary",className:"bg-white/20 text-white border-0 backdrop-blur-sm",children:[r.jsx(Mi,{className:"h-3 w-3 mr-1"}),"New content monthly"]}),r.jsxs(Rt,{variant:"secondary",className:"bg-white/20 text-white border-0 backdrop-blur-sm",children:[r.jsx(Wo,{className:"h-3 w-3 mr-1"}),I.length," images"]})]}),r.jsx("h1",{className:"text-3xl md:text-4xl font-bold mb-3",children:"Social Swag 📸"}),r.jsx("p",{className:"text-lg text-primary-foreground/90 max-w-2xl",children:"Ready-to-post social media images delivered to you monthly. Just download, copy the caption, and share with your audience!"})]})]}),t?r.jsxs(La,{defaultValue:"gallery",className:"space-y-6",children:[r.jsxs(Ma,{className:"grid w-full max-w-md grid-cols-2",children:[r.jsxs(yn,{value:"gallery",className:"gap-2",children:[r.jsx(Wo,{className:"h-4 w-4"}),"Gallery"]}),r.jsxs(yn,{value:"scheduled",className:"gap-2",children:[r.jsx(em,{className:"h-4 w-4"}),"Scheduled"]})]}),r.jsxs($n,{value:"gallery",className:"space-y-6",children:[t?q?r.jsx(Ye,{className:"border rounded-xl",children:r.jsx(Je,{className:"p-6",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx("div",{className:"p-3 rounded-full bg-muted text-2xl",children:"📸"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"font-semibold text-foreground mb-1",children:"Ready to post!"}),r.jsx("p",{className:"text-muted-foreground",children:'Click any image and use "Create Post" to share directly to your connected accounts.'})]}),r.jsx(te,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:r.jsx(ao,{to:"/social-connections",children:"Manage Accounts"})})]})})}):r.jsx(Ye,{className:"border-2 border-dashed border-primary/30 bg-gradient-to-r from-pink-500/5 via-purple-500/5 to-blue-500/5 rounded-xl",children:r.jsx(Je,{className:"p-6",children:r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"p-2 rounded-full bg-blue-500/10",children:r.jsx(Md,{className:"h-5 w-5 text-blue-600"})}),r.jsx("div",{className:"p-2 rounded-full bg-pink-500/10",children:r.jsx(Wd,{className:"h-5 w-5 text-pink-600"})})]}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"font-semibold text-foreground mb-1",children:"Post directly to social media"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Connect your Facebook & Instagram accounts to post images with one click!"})]}),r.jsx(te,{asChild:!0,className:"gap-2 bg-gradient-to-r from-pink-500 via-purple-500 to-blue-500 hover:from-pink-600 hover:via-purple-600 hover:to-blue-600",children:r.jsxs(ao,{to:"/social-connections",children:[r.jsx(Rf,{className:"h-4 w-4"}),"Connect Accounts"]})})]})})}):r.jsx(Ye,{className:"border-2 border-dashed border-muted-foreground/20 bg-muted/30 rounded-xl",children:r.jsx(Je,{className:"p-6",children:r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"p-2 rounded-full bg-muted",children:r.jsx(Xi,{className:"h-5 w-5 text-muted-foreground"})}),r.jsx("div",{className:"p-2 rounded-full bg-blue-500/10",children:r.jsx(Md,{className:"h-5 w-5 text-blue-400"})}),r.jsx("div",{className:"p-2 rounded-full bg-pink-500/10",children:r.jsx(Wd,{className:"h-5 w-5 text-pink-400"})})]}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:"Post directly to social media"}),r.jsx(Rt,{variant:"secondary",className:"text-xs",children:"Coming Soon"})]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Soon you'll be able to connect your Facebook & Instagram accounts to post images with one click!"})]})]})})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"flex flex-wrap gap-2",children:K.map(ve=>r.jsx("button",{onClick:()=>c(ve),className:zt("px-4 py-2 rounded-full text-sm font-medium transition-all",o===ve?"bg-primary text-primary-foreground shadow-sm":"bg-muted text-muted-foreground hover:text-foreground"),children:Z(ve)},ve))}),o!=="all"&&(he?r.jsxs("a",{href:he,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[r.jsx("span",{className:"text-base",children:"🎨"}),"Edit ",Z(o)," Images in Canva"]}):r.jsxs("span",{className:"inline-flex items-center gap-2 text-sm text-muted-foreground/50",children:[r.jsx("span",{className:"text-base",children:"🎨"}),"Edit ",Z(o)," Images in Canva"]}))]}),r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-1 p-1 bg-muted rounded-full",children:[r.jsxs("button",{onClick:()=>{C("images"),ie()},className:zt("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all",k==="images"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(Wo,{className:"h-4 w-4"}),"Images"]}),r.jsxs("button",{onClick:()=>{C("reels"),ie()},className:zt("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all",k==="reels"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(wd,{className:"h-4 w-4"}),"Reels"]})]}),k==="images"&&r.jsx("div",{className:"flex flex-wrap items-center gap-3",children:m?r.jsxs(r.Fragment,{children:[r.jsxs(te,{variant:"outline",size:"sm",onClick:xe,className:"gap-2",children:["Select All (",re.length,")"]}),r.jsxs(te,{variant:"outline",size:"sm",onClick:ie,className:"gap-2",children:[r.jsx(Ms,{className:"h-4 w-4"}),"Cancel"]}),a.size>0&&r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(te,{size:"sm",onClick:me,disabled:v,className:"gap-2",children:[r.jsx(Mo,{className:"h-4 w-4"}),v?"Downloading...":`Download ${a.size} Selected`]}),r.jsx("span",{className:"text-xs text-muted-foreground hidden sm:inline",children:"Please ensure your browser allows downloads from the LevelUp Dashboard."})]})]}):r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>y(!0),className:"gap-2",children:[r.jsx(Ba,{className:"h-4 w-4"}),"Select Images"]})})]}),A&&r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading..."}),!A&&k==="images"&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:re.map(ve=>{const Ie=a.has(ve.id);return r.jsx(Ye,{className:zt("group cursor-pointer overflow-hidden border-0 shadow-md hover:shadow-xl transition-all duration-300 rounded-2xl",m&&Ie&&"ring-2 ring-primary ring-offset-2"),onClick:()=>fe(ve),children:r.jsxs("div",{className:"relative aspect-[4/5] overflow-hidden",children:[r.jsx("img",{src:ve.image_url,alt:"Social swag",className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-110"}),m&&r.jsx("div",{className:zt("absolute top-2 right-2 w-6 h-6 rounded-full border-2 flex items-center justify-center transition-all",Ie?"bg-primary border-primary text-primary-foreground":"bg-white/80 border-muted-foreground/50"),children:Ie&&r.jsx(Ba,{className:"h-4 w-4"})}),!m&&r.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-colors duration-300 flex items-center justify-center",children:r.jsx("span",{className:"text-white font-medium opacity-0 group-hover:opacity-100 transition-opacity duration-300 bg-primary px-4 py-2 rounded-full text-sm",children:"View Details"})})]})},ve.id)})}),re.length===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Wo,{className:"h-12 w-12 text-muted-foreground/50 mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"No images available for this month yet."})]})]}),!A&&k==="reels"&&r.jsx(r.Fragment,{children:W?r.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-4",children:r.jsx(Ye,{className:"group overflow-hidden rounded-2xl cursor-pointer transition-all duration-300 hover:shadow-xl hover:scale-[1.02]",onClick:()=>i(W),children:r.jsxs("div",{className:"relative aspect-[9/16] overflow-hidden",children:[r.jsx("img",{src:W.image_url,alt:"Reel preview",className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-105"}),r.jsx("div",{className:"absolute top-2 left-2",children:r.jsxs(Rt,{variant:"secondary",className:"bg-black/50 text-white border-0 backdrop-blur-sm text-xs",children:[r.jsx(wd,{className:"h-3 w-3 mr-1"}),"Reel"]})}),r.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-colors duration-300 flex items-center justify-center",children:r.jsx("span",{className:"text-white font-medium opacity-0 group-hover:opacity-100 transition-opacity duration-300 bg-primary px-4 py-2 rounded-full text-sm",children:"View Details"})})]})})}):r.jsxs("div",{className:"text-center py-12",children:[r.jsx(wd,{className:"h-12 w-12 text-muted-foreground/50 mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"No reel available for this month yet."})]})})]}),r.jsx($r,{open:!!e,onOpenChange:()=>n(null),children:r.jsx(zr,{className:"max-w-4xl max-h-[90vh] overflow-hidden p-0",children:r.jsx("div",{className:"max-h-[90vh] overflow-y-auto touch-pan-y",style:{WebkitOverflowScrolling:"touch"},children:e&&r.jsxs("div",{className:"flex flex-col md:flex-row",children:[r.jsx("div",{className:"md:w-1/2 bg-muted",children:r.jsx("div",{className:"aspect-[4/5]",children:r.jsx("img",{src:e.image_url,alt:"Social swag",className:"w-full h-full object-cover"})})}),r.jsxs("div",{className:"md:w-1/2 p-6 flex flex-col",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-4",children:[r.jsx(li,{className:"h-4 w-4"}),un(new Date(e.created_at),"MMMM d, yyyy")]}),r.jsxs("div",{className:"flex-1 min-h-0",children:[r.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:"Caption"}),r.jsx("div",{className:"bg-muted/50 rounded-lg p-4 max-h-64 overflow-y-auto",children:r.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:e.caption})})]}),r.jsxs("div",{className:"flex flex-col gap-3 mt-6",children:[t&&r.jsxs(te,{onClick:()=>{T({imageUrl:e.image_url,imageId:e.id,caption:e.caption})},className:"w-full gap-2 bg-gradient-to-r from-pink-500 via-purple-500 to-blue-500 hover:from-pink-600 hover:via-purple-600 hover:to-blue-600 text-white",children:[r.jsx(To,{className:"h-4 w-4"}),"Create Post"]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(te,{variant:"outline",onClick:()=>ue(e.caption),className:"flex-1 gap-2",children:[r.jsx(Ul,{className:"h-4 w-4"}),"Copy Caption"]}),r.jsxs(te,{variant:"outline",onClick:()=>Ne(e.image_url,e.id),className:"flex-1 gap-2",children:[r.jsx(Mo,{className:"h-4 w-4"}),"Download"]})]})]})]})]})})})}),r.jsx($r,{open:!!s,onOpenChange:()=>i(null),children:r.jsx(zr,{className:"max-w-4xl max-h-[90vh] overflow-hidden p-0",children:r.jsx("div",{className:"max-h-[90vh] overflow-y-auto touch-pan-y",style:{WebkitOverflowScrolling:"touch"},children:s&&r.jsxs("div",{className:"flex flex-col md:flex-row",children:[r.jsx("div",{className:"md:w-1/2 bg-black flex items-center justify-center",children:r.jsx("div",{className:"aspect-[9/16] max-h-[70vh]",children:r.jsx("img",{src:s.image_url,alt:"Reel preview",className:"w-full h-full object-contain"})})}),r.jsxs("div",{className:"md:w-1/2 p-6 flex flex-col",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-4",children:[r.jsx(wd,{className:"h-4 w-4"}),"Monthly Reel"]}),s.caption&&r.jsxs("div",{className:"flex-1 min-h-0",children:[r.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:"Caption"}),r.jsx("div",{className:"bg-muted/50 rounded-lg p-4 max-h-64 overflow-y-auto",children:r.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:s.caption})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-6",children:[s.caption&&r.jsxs(te,{onClick:()=>ue(s.caption||""),className:"flex-1 gap-2",children:[r.jsx(Ul,{className:"h-4 w-4"}),"Copy Caption"]}),s.canva_link&&r.jsxs(te,{variant:"outline",onClick:()=>window.open(s.canva_link,"_blank"),className:"flex-1 gap-2",children:[r.jsx(Fs,{className:"h-4 w-4"}),"Open in Canva"]})]})]})]})})})}),r.jsx(Bmt,{open:!!S,onOpenChange:ve=>!ve&&T(null),imageUrl:(S==null?void 0:S.imageUrl)||"",imageId:(S==null?void 0:S.imageId)||"",defaultCaption:(S==null?void 0:S.caption)||"",swagItemId:S==null?void 0:S.imageId})]}),r.jsx($n,{value:"scheduled",children:r.jsx(egt,{})})]}):r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ye,{className:"border-2 border-dashed border-muted-foreground/20 bg-muted/30 rounded-xl",children:r.jsx(Je,{className:"p-6",children:r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"p-2 rounded-full bg-muted",children:r.jsx(Xi,{className:"h-5 w-5 text-muted-foreground"})}),r.jsx("div",{className:"p-2 rounded-full bg-blue-500/10",children:r.jsx(Md,{className:"h-5 w-5 text-blue-400"})}),r.jsx("div",{className:"p-2 rounded-full bg-pink-500/10",children:r.jsx(Wd,{className:"h-5 w-5 text-pink-400"})})]}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:"Post directly to social media"}),r.jsx(Rt,{variant:"secondary",className:"text-xs",children:"Coming Soon"})]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Soon you'll be able to connect your Facebook & Instagram accounts to post images with one click!"})]})]})})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"flex flex-wrap gap-2",children:K.map(ve=>r.jsx("button",{onClick:()=>c(ve),className:zt("px-4 py-2 rounded-full text-sm font-medium transition-all",o===ve?"bg-primary text-primary-foreground shadow-sm":"bg-muted text-muted-foreground hover:text-foreground"),children:Z(ve)},ve))}),o!=="all"&&(he?r.jsxs("a",{href:he,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[r.jsx("span",{className:"text-base",children:"🎨"}),"Edit ",Z(o)," Images in Canva"]}):r.jsxs("span",{className:"inline-flex items-center gap-2 text-sm text-muted-foreground/50",children:[r.jsx("span",{className:"text-base",children:"🎨"}),"Edit ",Z(o)," Images in Canva"]}))]}),r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-1 p-1 bg-muted rounded-full",children:[r.jsxs("button",{onClick:()=>{C("images"),ie()},className:zt("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all",k==="images"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(Wo,{className:"h-4 w-4"}),"Images"]}),r.jsxs("button",{onClick:()=>{C("reels"),ie()},className:zt("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all",k==="reels"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(wd,{className:"h-4 w-4"}),"Reels"]})]}),k==="images"&&r.jsx("div",{className:"flex flex-wrap items-center gap-3",children:m?r.jsxs(r.Fragment,{children:[r.jsxs(te,{variant:"outline",size:"sm",onClick:xe,className:"gap-2",children:["Select All (",re.length,")"]}),r.jsxs(te,{variant:"outline",size:"sm",onClick:ie,className:"gap-2",children:[r.jsx(Ms,{className:"h-4 w-4"}),"Cancel"]}),a.size>0&&r.jsxs(te,{size:"sm",onClick:me,disabled:v,className:"gap-2",children:[r.jsx(Mo,{className:"h-4 w-4"}),v?"Downloading...":`Download ${a.size} Selected`]})]}):r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>y(!0),className:"gap-2",children:[r.jsx(Ba,{className:"h-4 w-4"}),"Select Images"]})})]}),A&&r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading..."}),!A&&k==="images"&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:re.map(ve=>{const Ie=a.has(ve.id);return r.jsx(Ye,{className:zt("group cursor-pointer overflow-hidden border-0 shadow-md hover:shadow-xl transition-all duration-300 rounded-2xl",m&&Ie&&"ring-2 ring-primary ring-offset-2"),onClick:()=>fe(ve),children:r.jsxs("div",{className:"relative aspect-[4/5] overflow-hidden",children:[r.jsx("img",{src:ve.image_url,alt:"Social swag",className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-110"}),m&&r.jsx("div",{className:zt("absolute top-2 right-2 w-6 h-6 rounded-full border-2 flex items-center justify-center transition-all",Ie?"bg-primary border-primary text-primary-foreground":"bg-white/80 border-muted-foreground/50"),children:Ie&&r.jsx(Ba,{className:"h-4 w-4"})}),!m&&r.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-colors duration-300 flex items-center justify-center",children:r.jsx("span",{className:"text-white font-medium opacity-0 group-hover:opacity-100 transition-opacity duration-300 bg-primary px-4 py-2 rounded-full text-sm",children:"View Details"})})]})},ve.id)})}),re.length===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Wo,{className:"h-12 w-12 text-muted-foreground/50 mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"No images available for this month yet."})]})]}),!A&&k==="reels"&&r.jsx(r.Fragment,{children:W?r.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-4",children:r.jsx(Ye,{className:"group overflow-hidden rounded-2xl cursor-pointer transition-all duration-300 hover:shadow-xl hover:scale-[1.02]",onClick:()=>i(W),children:r.jsxs("div",{className:"relative aspect-[9/16] overflow-hidden",children:[r.jsx("img",{src:W.image_url,alt:"Reel preview",className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-105"}),r.jsx("div",{className:"absolute top-2 left-2",children:r.jsxs(Rt,{variant:"secondary",className:"bg-black/50 text-white border-0 backdrop-blur-sm text-xs",children:[r.jsx(wd,{className:"h-3 w-3 mr-1"}),"Reel"]})}),r.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-colors duration-300 flex items-center justify-center",children:r.jsx("span",{className:"text-white font-medium opacity-0 group-hover:opacity-100 transition-opacity duration-300 bg-primary px-4 py-2 rounded-full text-sm",children:"View Details"})})]})})}):r.jsxs("div",{className:"text-center py-12",children:[r.jsx(wd,{className:"h-12 w-12 text-muted-foreground/50 mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"No reel available for this month yet."})]})})]}),r.jsx($r,{open:!!e,onOpenChange:()=>n(null),children:r.jsx(zr,{className:"max-w-4xl max-h-[90vh] overflow-hidden p-0",children:r.jsx("div",{className:"max-h-[90vh] overflow-y-auto touch-pan-y",style:{WebkitOverflowScrolling:"touch"},children:e&&r.jsxs("div",{className:"flex flex-col md:flex-row",children:[r.jsx("div",{className:"md:w-1/2 bg-muted",children:r.jsx("div",{className:"aspect-[4/5]",children:r.jsx("img",{src:e.image_url,alt:"Social swag",className:"w-full h-full object-cover"})})}),r.jsxs("div",{className:"md:w-1/2 p-6 flex flex-col",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-4",children:[r.jsx(li,{className:"h-4 w-4"}),un(new Date(e.created_at),"MMMM d, yyyy")]}),r.jsxs("div",{className:"flex-1 min-h-0",children:[r.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:"Caption"}),r.jsx("div",{className:"bg-muted/50 rounded-lg p-4 max-h-64 overflow-y-auto",children:r.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:e.caption})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-6",children:[r.jsxs(te,{variant:"outline",onClick:()=>ue(e.caption),className:"flex-1 gap-2",children:[r.jsx(Ul,{className:"h-4 w-4"}),"Copy Caption"]}),r.jsxs(te,{variant:"outline",onClick:()=>Ne(e.image_url,e.id),className:"flex-1 gap-2",children:[r.jsx(Mo,{className:"h-4 w-4"}),"Download"]})]})]})]})})})}),r.jsx($r,{open:!!s,onOpenChange:()=>i(null),children:r.jsx(zr,{className:"max-w-4xl max-h-[90vh] overflow-hidden p-0",children:r.jsx("div",{className:"max-h-[90vh] overflow-y-auto touch-pan-y",style:{WebkitOverflowScrolling:"touch"},children:s&&r.jsxs("div",{className:"flex flex-col md:flex-row",children:[r.jsx("div",{className:"md:w-1/2 bg-black flex items-center justify-center",children:r.jsx("div",{className:"aspect-[9/16] max-h-[70vh]",children:r.jsx("img",{src:s.image_url,alt:"Reel preview",className:"w-full h-full object-contain"})})}),r.jsxs("div",{className:"md:w-1/2 p-6 flex flex-col",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-4",children:[r.jsx(wd,{className:"h-4 w-4"}),"Monthly Reel"]}),s.caption&&r.jsxs("div",{className:"flex-1 min-h-0",children:[r.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:"Caption"}),r.jsx("div",{className:"bg-muted/50 rounded-lg p-4 max-h-64 overflow-y-auto",children:r.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:s.caption})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-6",children:[s.caption&&r.jsxs(te,{onClick:()=>ue(s.caption||""),className:"flex-1 gap-2",children:[r.jsx(Ul,{className:"h-4 w-4"}),"Copy Caption"]}),s.canva_link&&r.jsxs(te,{variant:"outline",onClick:()=>window.open(s.canva_link,"_blank"),className:"flex-1 gap-2",children:[r.jsx(Fs,{className:"h-4 w-4"}),"Open in Canva"]})]})]})]})})})})]})]})})},sgt=()=>{const{swagId:t}=dd(),{user:e}=Fr(),{toast:n}=la(),s=Xr(),{trackEngagement:i}=oI(),[o,c]=P.useState(""),{data:a,isLoading:f}=rr({queryKey:["social-swag-detail",t],queryFn:async()=>{const{data:I,error:A}=await ee.from("social_swag").select("*").eq("id",t).single();if(A)throw A;const{data:D}=await ee.from("social_swag_links").select("*").eq("swag_id",t).order("sort_order");return{...I,links:D||[]}},enabled:!!t});P.useEffect(()=>{a&&i("social_swag",a.id,a.title,"view")},[a==null?void 0:a.id]);const{data:m=[]}=rr({queryKey:["social-swag-likes",t],queryFn:async()=>{const{data:I,error:A}=await ee.from("social_swag_likes").select("*").eq("swag_id",t);if(A)throw A;return I},enabled:!!t}),{data:y=[]}=rr({queryKey:["social-swag-comments",t],queryFn:async()=>{const{data:I,error:A}=await ee.from("social_swag_comments").select("*").eq("swag_id",t).order("created_at",{ascending:!1});if(A)throw A;const D=[...new Set(I.map(q=>q.user_id))],{data:$}=await ee.from("profiles").select("id, name").in("id",D),F=new Map(($==null?void 0:$.map(q=>[q.id,q.name]))||[]);return I.map(q=>({...q,user_name:F.get(q.user_id)||"Unknown User"}))},enabled:!!t}),v=cr({mutationFn:async I=>{const{error:A}=await ee.from("social_swag_comments").insert({swag_id:t,user_id:e.id,content:I});if(A)throw A},onSuccess:()=>{s.invalidateQueries({queryKey:["social-swag-comments",t]}),c(""),n({title:"Comment added!"})},onError:I=>{n({title:"Error adding comment",description:I.message,variant:"destructive"})}}),w=cr({mutationFn:async I=>{const{error:A}=await ee.from("social_swag_comments").delete().eq("id",I);if(A)throw A},onSuccess:()=>{s.invalidateQueries({queryKey:["social-swag-comments",t]}),n({title:"Comment deleted"})}}),k=cr({mutationFn:async()=>{const I=m.find(A=>A.user_id===(e==null?void 0:e.id));if(I){const{error:A}=await ee.from("social_swag_likes").delete().eq("id",I.id);if(A)throw A}else{const{error:A}=await ee.from("social_swag_likes").insert({swag_id:t,user_id:e.id});if(A)throw A}},onSuccess:()=>{s.invalidateQueries({queryKey:["social-swag-likes",t]})}}),C=m.some(I=>I.user_id===(e==null?void 0:e.id)),S=I=>I.split(" ").map(A=>A[0]).join("").toUpperCase().slice(0,2),T=I=>{I.preventDefault(),!(!o.trim()||!e)&&v.mutate(o.trim())};return f?r.jsx(Or,{title:"Social Swag",children:r.jsx("div",{className:"flex justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):a?r.jsx(Or,{title:a.title,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(te,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(ao,{to:"/social-swag",children:[r.jsx(Va,{className:"h-4 w-4"}),"Back to Social Swag"]})}),a.preview_image_url&&r.jsx("div",{className:"relative w-full rounded-lg overflow-hidden bg-muted",children:r.jsx("img",{src:a.preview_image_url,alt:a.title,className:"w-full max-h-[500px] object-contain"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[r.jsx("div",{className:"space-y-2",children:r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:a.title})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(HC,{resourceType:"social_swag",resourceId:a.id,resourceTitle:a.title}),r.jsxs(te,{variant:C?"default":"outline",className:"gap-2 w-fit",onClick:()=>k.mutate(),disabled:!e||k.isPending,children:[r.jsx(Zd,{className:`h-4 w-4 ${C?"fill-current":""}`}),m.length," ",m.length===1?"Like":"Likes"]})]})]}),a.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:a.description}})]}),a.links.length>0&&r.jsx(Ye,{children:r.jsxs(Je,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(bo,{className:"h-4 w-4"}),a.links.length===1?"Canva Link":"Canva Links"]}),r.jsx("div",{className:"grid gap-2",children:a.links.map(I=>r.jsxs(te,{variant:"outline",className:"w-full justify-between gap-2 h-auto py-3",onClick:()=>{i("social_swag",a.id,a.title,"click_canva"),window.open(I.canva_share_link,"_blank")},children:[r.jsx("span",{className:"font-medium",children:I.title}),r.jsx(Fs,{className:"h-4 w-4 text-muted-foreground"})]},I.id))})]})}),r.jsx(Vd,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(Hl,{className:"h-5 w-5"}),"Comments (",y.length,")"]}),e?r.jsxs("form",{onSubmit:T,className:"flex gap-2",children:[r.jsx(ps,{placeholder:"Add a comment...",value:o,onChange:I=>c(I.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(te,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!o.trim()||v.isPending,children:r.jsx(To,{className:"h-4 w-4"})})]}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"Log in to add a comment"}),r.jsx("div",{className:"space-y-4",children:y.length===0?r.jsx(Ye,{children:r.jsx(Je,{className:"py-8 text-center",children:r.jsx("p",{className:"text-muted-foreground",children:"No comments yet. Be the first to share your thoughts!"})})}):y.map(I=>r.jsx(Ye,{children:r.jsx(Je,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Li,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(Oi,{className:"text-sm",children:S(I.user_name||"U")})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"font-medium",children:I.user_name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:Yd(new Date(I.created_at),{addSuffix:!0})}),I.user_id===(e==null?void 0:e.id)&&r.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>w.mutate(I.id),children:r.jsx(Xn,{className:"h-3 w-3 text-muted-foreground"})})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:I.content})]})]})})},I.id))})]})]})}):r.jsx(Or,{title:"Social Swag",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(bo,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Item not found"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"This item may have been removed or is not available."}),r.jsx(te,{asChild:!0,className:"mt-4",children:r.jsx(ao,{to:"/social-swag",children:"Back to Social Swag"})})]})})},igt=({categories:t,privateGroups:e,selectedFilter:n,onFilterChange:s,onlineUsers:i})=>{const[o,c]=P.useState(!0),[a,f]=P.useState(!0),[m,y]=P.useState(!0),v=w=>w.split(" ").map(k=>k[0]).join("").toUpperCase().slice(0,2);return r.jsx("aside",{className:"w-64 shrink-0 hidden lg:block",children:r.jsx("div",{className:"sticky top-4 space-y-4 max-h-[calc(100vh-8rem)] overflow-y-auto",children:r.jsxs("div",{className:"space-y-2 pr-4",children:[r.jsxs(te,{variant:n==="all"?"secondary":"ghost",className:"w-full justify-start",onClick:()=>s("all"),children:[r.jsx(RS,{className:"h-4 w-4 mr-2"}),"All Posts"]}),r.jsxs(RT,{open:o,onOpenChange:c,children:[r.jsx(FT,{asChild:!0,children:r.jsxs(te,{variant:"ghost",className:"w-full justify-between text-muted-foreground hover:text-foreground",children:[r.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider",children:"Categories"}),o?r.jsx(uh,{className:"h-4 w-4"}):r.jsx(Ha,{className:"h-4 w-4"})]})}),r.jsx(zT,{className:"space-y-1 pl-2",children:t.map(w=>r.jsxs(te,{variant:n===w.id?"secondary":"ghost",size:"sm",className:"w-full justify-start h-9",onClick:()=>s(w.id),children:[r.jsx("span",{className:"mr-2",children:w.icon||"📂"}),r.jsx("span",{className:"truncate",children:w.name})]},w.id))})]}),e.length>0&&r.jsxs(RT,{open:a,onOpenChange:f,children:[r.jsx(FT,{asChild:!0,children:r.jsxs(te,{variant:"ghost",className:"w-full justify-between text-muted-foreground hover:text-foreground",children:[r.jsxs("span",{className:"text-xs font-semibold uppercase tracking-wider flex items-center gap-1",children:[r.jsx(Ff,{className:"h-3 w-3"}),"Your Groups"]}),a?r.jsx(uh,{className:"h-4 w-4"}):r.jsx(Ha,{className:"h-4 w-4"})]})}),r.jsx(zT,{className:"space-y-1 pl-2",children:e.map(w=>r.jsxs(te,{variant:n===`group:${w.id}`?"secondary":"ghost",size:"sm",className:"w-full justify-start h-9",onClick:()=>s(`group:${w.id}`),children:[r.jsx("span",{className:"mr-2",children:w.icon||"🔒"}),r.jsx("span",{className:"truncate",children:w.name})]},w.id))})]}),r.jsxs(RT,{open:m,onOpenChange:y,children:[r.jsx(FT,{asChild:!0,children:r.jsxs(te,{variant:"ghost",className:"w-full justify-between text-muted-foreground hover:text-foreground",children:[r.jsxs("span",{className:"text-xs font-semibold uppercase tracking-wider flex items-center gap-1",children:[r.jsx(hs,{className:"h-3 w-3"}),"Online Now",i.length>0&&r.jsx("span",{className:"ml-1 bg-green-500 text-white text-xs rounded-full px-1.5 py-0.5 min-w-[20px] text-center",children:i.length})]}),m?r.jsx(uh,{className:"h-4 w-4"}):r.jsx(Ha,{className:"h-4 w-4"})]})}),r.jsx(zT,{className:"pl-2 space-y-1",children:i.length===0?r.jsx("p",{className:"text-sm text-muted-foreground py-2 px-2",children:"No one else online right now"}):i.map(w=>r.jsxs("div",{className:"flex items-center gap-2 py-1.5 px-2 rounded-md hover:bg-muted transition-colors",children:[r.jsxs("div",{className:"relative",children:[r.jsxs(Li,{className:"h-7 w-7",children:[r.jsx(Io,{src:w.avatarUrl}),r.jsx(Oi,{className:"text-xs",children:v(w.name)})]}),r.jsx(Mu,{className:"h-2.5 w-2.5 fill-green-500 text-green-500 absolute -bottom-0.5 -right-0.5"})]}),r.jsx("span",{className:"text-sm truncate",children:w.name})]},w.id))})]})]})})})},agt=({categories:t,privateGroups:e,selectedFilter:n,onFilterChange:s,onlineUsers:i})=>{const[o,c]=P.useState(!1),a=m=>m.split(" ").map(y=>y[0]).join("").toUpperCase().slice(0,2),f=()=>{if(n==="all")return"All Posts";if(n.startsWith("group:")){const y=n.replace("group:",""),v=e.find(w=>w.id===y);return v?`🔒 ${v.name}`:"Private Group"}const m=t.find(y=>y.id===n);return m?`${m.icon||"📂"} ${m.name}`:"Category"};return r.jsxs("div",{className:"lg:hidden flex items-center gap-2 mb-4",children:[r.jsxs(fm,{children:[r.jsx(pm,{asChild:!0,children:r.jsxs(te,{variant:"outline",className:"flex-1 justify-between",children:[r.jsx("span",{className:"truncate",children:f()}),r.jsx(uh,{className:"h-4 w-4 ml-2 shrink-0"})]})}),r.jsxs(Xf,{className:"w-56 bg-background border",children:[r.jsxs(uo,{onClick:()=>s("all"),children:[r.jsx(RS,{className:"h-4 w-4 mr-2"}),"All Posts"]}),r.jsx(H4,{}),r.jsx(she,{className:"text-xs text-muted-foreground",children:"Categories"}),t.map(m=>r.jsxs(uo,{onClick:()=>s(m.id),children:[r.jsx("span",{className:"mr-2",children:m.icon||"📂"}),m.name]},m.id)),e.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(H4,{}),r.jsxs(she,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[r.jsx(Ff,{className:"h-3 w-3"}),"Your Groups"]}),e.map(m=>r.jsxs(uo,{onClick:()=>s(`group:${m.id}`),children:[r.jsx("span",{className:"mr-2",children:m.icon||"🔒"}),m.name]},m.id))]})]})]}),r.jsxs(qne,{open:o,onOpenChange:c,children:[r.jsx(yge,{asChild:!0,children:r.jsxs(te,{variant:"outline",size:"icon",className:"relative",children:[r.jsx(hs,{className:"h-4 w-4"}),i.length>0&&r.jsx("span",{className:"absolute -top-1 -right-1 bg-green-500 text-white text-xs rounded-full h-4 w-4 flex items-center justify-center",children:i.length})]})}),r.jsxs(tI,{children:[r.jsx(Vne,{children:r.jsxs(Hne,{className:"flex items-center gap-2",children:[r.jsx(hs,{className:"h-5 w-5"}),"Online Now (",i.length,")"]})}),r.jsx(xl,{className:"h-[calc(100vh-8rem)] mt-4",children:i.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No one else online right now"}):r.jsx("div",{className:"space-y-2",children:i.map(m=>r.jsxs("div",{className:"flex items-center gap-3 py-2 px-3 rounded-lg hover:bg-muted transition-colors",children:[r.jsxs("div",{className:"relative",children:[r.jsxs(Li,{className:"h-10 w-10",children:[r.jsx(Io,{src:m.avatarUrl}),r.jsx(Oi,{children:a(m.name)})]}),r.jsx(Mu,{className:"h-3 w-3 fill-green-500 text-green-500 absolute -bottom-0.5 -right-0.5"})]}),r.jsx("span",{className:"font-medium",children:m.name})]},m.id))})})]})]})]})};var Gle,_se="HoverCard",[D8e]=Zl(_se,[Ng]),bse=Ng(),[ogt,bye]=D8e(_se),R8e=t=>{const{__scopeHoverCard:e,children:n,open:s,defaultOpen:i,onOpenChange:o,openDelay:c=700,closeDelay:a=300}=t,f=bse(e),m=P.useRef(0),y=P.useRef(0),v=P.useRef(!1),w=P.useRef(!1),[k,C]=Tu({prop:s,defaultProp:i??!1,onChange:o,caller:_se}),S=P.useCallback(()=>{clearTimeout(y.current),m.current=window.setTimeout(()=>C(!0),c)},[c,C]),T=P.useCallback(()=>{clearTimeout(m.current),!v.current&&!w.current&&(y.current=window.setTimeout(()=>C(!1),a))},[a,C]),I=P.useCallback(()=>C(!1),[C]);return P.useEffect(()=>()=>{clearTimeout(m.current),clearTimeout(y.current)},[]),r.jsx(ogt,{scope:e,open:k,onOpenChange:C,onOpen:S,onClose:T,onDismiss:I,hasSelectionRef:v,isPointerDownOnContentRef:w,children:r.jsx(HE,{...f,children:n})})};R8e.displayName=_se;var F8e="HoverCardTrigger",z8e=P.forwardRef((t,e)=>{const{__scopeHoverCard:n,...s}=t,i=bye(F8e,n),o=bse(n);return r.jsx(IC,{asChild:!0,...o,children:r.jsx(On.a,{"data-state":i.open?"open":"closed",...s,ref:e,onPointerEnter:an(t.onPointerEnter,yte(i.onOpen)),onPointerLeave:an(t.onPointerLeave,yte(i.onClose)),onFocus:an(t.onFocus,i.onOpen),onBlur:an(t.onBlur,i.onClose),onTouchStart:an(t.onTouchStart,c=>c.preventDefault())})})});z8e.displayName=F8e;var lgt="HoverCardPortal",[TGt,cgt]=D8e(lgt,{forceMount:void 0}),gte="HoverCardContent",B8e=P.forwardRef((t,e)=>{const n=cgt(gte,t.__scopeHoverCard),{forceMount:s=n.forceMount,...i}=t,o=bye(gte,t.__scopeHoverCard);return r.jsx(oc,{present:s||o.open,children:r.jsx(dgt,{"data-state":o.open?"open":"closed",...i,onPointerEnter:an(t.onPointerEnter,yte(o.onOpen)),onPointerLeave:an(t.onPointerLeave,yte(o.onClose)),ref:e})})});B8e.displayName=gte;var dgt=P.forwardRef((t,e)=>{const{__scopeHoverCard:n,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:c,...a}=t,f=bye(gte,n),m=bse(n),y=P.useRef(null),v=Gs(e,y),[w,k]=P.useState(!1);return P.useEffect(()=>{if(w){const C=document.body;return Gle=C.style.userSelect||C.style.webkitUserSelect,C.style.userSelect="none",C.style.webkitUserSelect="none",()=>{C.style.userSelect=Gle,C.style.webkitUserSelect=Gle}}},[w]),P.useEffect(()=>{if(y.current){const C=()=>{k(!1),f.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var T;((T=document.getSelection())==null?void 0:T.toString())!==""&&(f.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",C),()=>{document.removeEventListener("pointerup",C),f.hasSelectionRef.current=!1,f.isPointerDownOnContentRef.current=!1}}},[f.isPointerDownOnContentRef,f.hasSelectionRef]),P.useEffect(()=>{y.current&&fgt(y.current).forEach(S=>S.setAttribute("tabindex","-1"))}),r.jsx(S1,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:c,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:an(o,C=>{C.preventDefault()}),onDismiss:f.onDismiss,children:r.jsx(WE,{...m,...a,onPointerDown:an(a.onPointerDown,C=>{C.currentTarget.contains(C.target)&&k(!0),f.hasSelectionRef.current=!1,f.isPointerDownOnContentRef.current=!0}),ref:v,style:{...a.style,userSelect:w?"text":void 0,WebkitUserSelect:w?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})}),ugt="HoverCardArrow",hgt=P.forwardRef((t,e)=>{const{__scopeHoverCard:n,...s}=t,i=bse(n);return r.jsx(GE,{...i,...s,ref:e})});hgt.displayName=ugt;function yte(t){return e=>e.pointerType==="touch"?void 0:t()}function fgt(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;n.nextNode();)e.push(n.currentNode);return e}var pgt=R8e,mgt=z8e,$8e=B8e;const ggt=pgt,ygt=mgt,U8e=P.forwardRef(({className:t,align:e="center",sideOffset:n=4,...s},i)=>r.jsx($8e,{ref:i,align:e,sideOffset:n,className:zt("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...s}));U8e.displayName=$8e.displayName;const xgt=[{type:"like",emoji:"👍",label:"Like"},{type:"love",emoji:"❤️",label:"Love"},{type:"laugh",emoji:"😂",label:"Haha"},{type:"wow",emoji:"😮",label:"Wow"},{type:"sad",emoji:"😢",label:"Sad"},{type:"angry",emoji:"😠",label:"Angry"}],vgt=t=>t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2),q8e=({reactions:t,children:e})=>{if(t.length===0)return r.jsx(r.Fragment,{children:e});const n={};return t.forEach(s=>{n[s.reaction_type]||(n[s.reaction_type]=[]),n[s.reaction_type].push(s)}),r.jsxs(ggt,{openDelay:200,closeDelay:100,children:[r.jsx(ygt,{asChild:!0,children:r.jsx("div",{className:"cursor-pointer",children:e})}),r.jsx(U8e,{className:"w-64 p-3 bg-popover border shadow-lg z-50",side:"top",align:"start",children:r.jsx("div",{className:"space-y-3",children:Object.entries(n).map(([s,i])=>{const o=xgt.find(c=>c.type===s);return r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("span",{className:"text-lg",children:o==null?void 0:o.emoji}),r.jsxs("span",{className:"text-sm font-medium text-foreground",children:[o==null?void 0:o.label," (",i.length,")"]})]}),r.jsxs("div",{className:"space-y-1.5",children:[i.slice(0,10).map(c=>r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(Li,{className:"h-6 w-6",children:[r.jsx(Io,{src:c.user_avatar||void 0}),r.jsx(Oi,{className:"text-[10px]",children:vgt(c.user_name||"U")})]}),r.jsx("span",{className:"text-sm text-foreground truncate",children:c.user_name||"Unknown User"})]},c.id)),i.length>10&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:["+",i.length-10," more"]})]})]},s)})})})]})};function _gt({images:t,initialIndex:e=0,open:n,onOpenChange:s}){const[i,o]=P.useState(e),[c,a]=P.useState(!1);P.useEffect(()=>{n&&(o(e),a(!1))},[n,e]);const f=()=>{o(w=>w>0?w-1:t.length-1),a(!1)},m=()=>{o(w=>w{n&&(w.key==="ArrowLeft"&&f(),w.key==="ArrowRight"&&m(),w.key==="Escape"&&s(!1))},[n,t.length]);P.useEffect(()=>(window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)),[y]);const v=t[i];return r.jsx($r,{open:n,onOpenChange:s,children:r.jsxs(zr,{className:"max-w-[95vw] max-h-[95vh] w-auto h-auto p-0 border-none bg-black/95 overflow-hidden",children:[r.jsx(te,{variant:"ghost",size:"icon",className:"absolute top-2 right-2 z-50 text-white hover:bg-white/20 h-10 w-10",onClick:()=>s(!1),children:r.jsx(Ms,{className:"h-6 w-6"})}),t.length>1&&r.jsxs(r.Fragment,{children:[r.jsx(te,{variant:"ghost",size:"icon",className:"absolute left-2 top-1/2 -translate-y-1/2 z-50 text-white hover:bg-white/20 h-12 w-12",onClick:f,children:r.jsx(sd,{className:"h-8 w-8"})}),r.jsx(te,{variant:"ghost",size:"icon",className:"absolute right-2 top-1/2 -translate-y-1/2 z-50 text-white hover:bg-white/20 h-12 w-12",onClick:m,children:r.jsx(Ha,{className:"h-8 w-8"})})]}),t.length>1&&r.jsxs("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-50 text-white text-sm bg-black/50 px-3 py-1 rounded-full",children:[i+1," / ",t.length]}),(v==null?void 0:v.type)==="image"&&r.jsx(te,{variant:"ghost",size:"icon",className:"absolute top-2 left-2 z-50 text-white hover:bg-white/20 h-10 w-10",onClick:()=>a(!c),children:c?r.jsx(e4,{className:"h-5 w-5"}):r.jsx(JS,{className:"h-5 w-5"})}),r.jsx("div",{className:zt("flex items-center justify-center w-full h-full min-h-[50vh] p-4",c?"cursor-zoom-out overflow-auto":"cursor-zoom-in"),onClick:()=>(v==null?void 0:v.type)==="image"&&a(!c),children:(v==null?void 0:v.type)==="video"?r.jsx("video",{src:v.url,controls:!0,autoPlay:!0,className:"max-w-full max-h-[85vh] object-contain",onClick:w=>w.stopPropagation()}):r.jsx("img",{src:v==null?void 0:v.url,alt:"",className:zt("object-contain transition-transform duration-200",c?"max-w-none max-h-none scale-150":"max-w-full max-h-[85vh]")})}),t.length>1&&r.jsx("div",{className:"absolute bottom-12 left-1/2 -translate-x-1/2 z-50 flex gap-2 bg-black/50 p-2 rounded-lg max-w-[90vw] overflow-x-auto",children:t.map((w,k)=>r.jsx("button",{onClick:()=>{o(k),a(!1)},className:zt("w-12 h-12 rounded overflow-hidden flex-shrink-0 border-2 transition-all",i===k?"border-white":"border-transparent opacity-60 hover:opacity-100"),children:w.type==="video"?r.jsx("video",{src:w.url,className:"w-full h-full object-cover"}):r.jsx("img",{src:w.url,alt:"",className:"w-full h-full object-cover"})},k))})]})})}const sL=[{type:"like",emoji:"👍",label:"Like"},{type:"love",emoji:"❤️",label:"Love"}],bgt=({commentId:t,reactions:e,currentUserId:n})=>{var m,y;const s=Xr(),[i,o]=P.useState(!1),c=e.find(v=>v.user_id===n),a=cr({mutationFn:async v=>{c?c.reaction_type===v?await ee.from("community_comment_reactions").delete().eq("id",c.id):await ee.from("community_comment_reactions").update({reaction_type:v}).eq("id",c.id):await ee.from("community_comment_reactions").insert({comment_id:t,user_id:n,reaction_type:v})},onSuccess:()=>{s.invalidateQueries({queryKey:["community-posts"]}),o(!1)}}),f={};return e.forEach(v=>{f[v.reaction_type]=(f[v.reaction_type]||0)+1}),r.jsxs("div",{className:"flex items-center gap-2",children:[e.length>0&&r.jsx(q8e,{reactions:e,children:r.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[r.jsx("div",{className:"flex -space-x-0.5",children:Object.keys(f).slice(0,2).map(v=>{var w;return r.jsx("span",{className:"text-sm",children:(w=sL.find(k=>k.type===v))==null?void 0:w.emoji},v)})}),r.jsx("span",{children:e.length})]})}),n&&r.jsxs(Zh,{open:i,onOpenChange:o,children:[r.jsx(Yh,{asChild:!0,children:r.jsx("button",{className:`text-xs hover:text-primary transition-colors ${c?"text-primary font-medium":"text-muted-foreground"}`,children:c?r.jsxs("span",{children:[(m=sL.find(v=>v.type===c.reaction_type))==null?void 0:m.emoji," ",(y=sL.find(v=>v.type===c.reaction_type))==null?void 0:y.label]}):r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(ql,{className:"h-3 w-3"}),"Like"]})})}),r.jsx(mh,{className:"w-auto p-1.5 bg-popover border shadow-lg z-50",side:"top",children:r.jsx("div",{className:"flex gap-0.5",children:sL.map(v=>r.jsx("button",{onClick:()=>a.mutate(v.type),className:"text-xl hover:scale-125 transition-transform p-1",title:v.label,children:v.emoji},v.type))})})]})]})};function wye({content:t,className:e}){const n=/([@#])\[([^\]]+)\]\(([^)]+)\)/g,s=[];let i=0,o,c=0;for(;(o=n.exec(t))!==null;){o.index>i&&s.push(t.substring(i,o.index));const a=o[1],f=o[2],m=o[3],y=a==="#";s.push(r.jsx(ao,{to:y?`/templates/${m}`:`/profile?user=${m}`,className:zt("font-medium hover:underline",y?"text-white bg-[#2a4c64] px-1.5 py-0.5 rounded":"text-primary"),onClick:v=>v.stopPropagation(),children:y?f:`@${f}`},`mention-${c++}`)),i=o.index+o[0].length}return ir.jsx(P.Fragment,{children:a},f))})}function xte({value:t,onChange:e,placeholder:n="What's on your mind? Use @ to mention someone",className:s,minHeight:i="80px",onMentionsChange:o,onTemplatesChange:c,onKeyDown:a,mentionFormat:f="encoded",enableTemplateMentions:m=!1}){const y=P.useRef(null),v=P.useRef(null),[w,k]=P.useState(!1),[C,S]=P.useState("user"),[T,I]=P.useState(""),[A,D]=P.useState(null),[$,F]=P.useState(0),[q,W]=P.useState({top:0,left:0,width:0}),K=P.useRef(new Map),Z=P.useRef(new Map),re=oe=>{if(f==="plain"){const Ue=[];return K.current.forEach(($e,Pe)=>{oe.includes(`@${Pe}`)&&Ue.push($e)}),[...new Set(Ue)]}const ae=/@\[([^\]]+)\]\(([^)]+)\)/g,je=[];let Me;for(;(Me=ae.exec(oe))!==null;)je.push(Me[2]);return[...new Set(je)]},he=oe=>{if(f==="plain"){const Ue=[];return Z.current.forEach(($e,Pe)=>{oe.includes(`#${Pe}`)&&Ue.push($e)}),[...new Set(Ue)]}const ae=/#\[([^\]]+)\]\(([^)]+)\)/g,je=[];let Me;for(;(Me=ae.exec(oe))!==null;)je.push(Me[2]);return[...new Set(je)]};P.useEffect(()=>{if(o){const oe=re(t);o(oe)}if(c){const oe=he(t);c(oe)}},[t,o,c,f]);const{data:ue=[],isLoading:Ne}=rr({queryKey:["mention-users",T],queryFn:async()=>{const oe=ee.from("profiles").select("id, name").limit(8),ae=T.length>=1?oe.ilike("name",`%${T}%`):oe.order("name"),{data:je,error:Me}=await ae;if(Me)throw Me;const Ue=je.map($e=>$e.id),Re=await $5(Ue);return je.map($e=>({id:$e.id,name:$e.name||"Unknown",avatar_url:Re.get($e.id)}))},enabled:w&&C==="user",staleTime:3e4}),{data:se=[],isLoading:xe}=rr({queryKey:["mention-templates",T],queryFn:async()=>{let oe=ee.from("canva_templates").select("id, name, preview_image_url").lte("publish_date",new Date().toISOString()).order("publish_date",{ascending:!1}).limit(8);T.length>=1&&(oe=oe.ilike("name",`%${T}%`));const{data:ae,error:je}=await oe;if(je)throw je;return ae||[]},enabled:w&&C==="template"&&m,staleTime:3e4}),ie=C==="user"?Ne:xe,me=C==="user"?ue:se,fe=oe=>oe.split(" ").map(ae=>ae[0]).join("").toUpperCase().slice(0,2),ve=oe=>{const ae=oe.target.value,je=oe.target.selectionStart;e(ae);const Me=ae.substring(0,je),Ue=Me.lastIndexOf("@"),Re=m?Me.lastIndexOf("#"):-1;let $e=-1,Pe="user";if(Ue>Re?($e=Ue,Pe="user"):Re>Ue&&m&&($e=Re,Pe="template"),$e!==-1){const Ae=Me.substring($e+1),nt=Ae.includes(" "),Te=Ae.includes(` `);if(!nt&&!Te&&Ae.length<=30){D($e),I(Ae),S(Pe),k(!0),F(0);return}}k(!1),D(null)},Ie=oe=>{if(A===null)return;const ae=t.substring(0,A),je=t.substring(A+T.length+1),Me=C==="user"?"@":"#",Ue=f==="plain"?`${Me}${oe.name} `:`${Me}[${oe.name}](${oe.id}) `;f==="plain"&&(C==="user"?K.current.set(oe.name,oe.id):Z.current.set(oe.name,oe.id));const Re=ae+Ue+je;e(Re),k(!1),D(null),I(""),setTimeout(()=>{if(y.current){const $e=ae.length+Ue.length;y.current.focus(),y.current.setSelectionRange($e,$e)}},0)},Se=oe=>{if(!(!w||me.length===0))switch(oe.key){case"ArrowDown":oe.preventDefault(),F(ae=>(ae+1)%me.length);break;case"ArrowUp":oe.preventDefault(),F(ae=>(ae-1+me.length)%me.length);break;case"Enter":me[$]&&(oe.preventDefault(),Ie(me[$]));break;case"Escape":oe.preventDefault(),k(!1);break;case"Tab":me[$]&&(oe.preventDefault(),Ie(me[$]));break}};return P.useEffect(()=>{const oe=ae=>{v.current&&!v.current.contains(ae.target)&&y.current&&!y.current.contains(ae.target)&&k(!1)};return document.addEventListener("mousedown",oe),()=>document.removeEventListener("mousedown",oe)},[]),P.useEffect(()=>{if(!w)return;const oe=()=>{const ae=y.current;if(!ae)return;const je=ae.getBoundingClientRect();W({top:je.bottom+4,left:je.left,width:je.width})};return oe(),window.addEventListener("resize",oe),window.addEventListener("scroll",oe,!0),()=>{window.removeEventListener("resize",oe),window.removeEventListener("scroll",oe,!0)}},[w,t]),r.jsxs("div",{className:"relative flex-1",children:[r.jsx(ps,{ref:y,value:t,onChange:ve,onKeyDown:oe=>{Se(oe),oe.defaultPrevented||a==null||a(oe)},placeholder:n,className:zt("resize-none",s),style:{minHeight:i}}),w&&N1.createPortal(r.jsxs("div",{ref:v,className:"fixed z-[1000] max-h-[220px] overflow-hidden rounded-lg border bg-popover shadow-lg",style:{top:q.top,left:q.left,width:q.width,maxWidth:"320px"},children:[r.jsx("div",{className:"px-3 py-1.5 text-xs font-medium text-muted-foreground border-b bg-muted/30",children:C==="user"?"👤 Mention a person":"📋 Link a template"}),ie?r.jsx("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:"Searching..."}):me.length===0?r.jsx("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:T.length<1?`Type to search ${C==="user"?"people":"templates"}...`:`No ${C==="user"?"users":"templates"} found`}):r.jsx("ul",{className:"py-1 max-h-[180px] overflow-y-auto",children:me.map((oe,ae)=>r.jsx("li",{className:zt("flex items-center gap-2 px-3 py-2 cursor-pointer transition-colors",ae===$?"bg-accent":"hover:bg-accent/50"),onClick:()=>Ie(oe),onMouseEnter:()=>F(ae),children:C==="user"?r.jsxs(r.Fragment,{children:[r.jsxs(Li,{className:"h-6 w-6",children:[r.jsx(Io,{src:oe.avatar_url}),r.jsx(Oi,{className:"text-xs",children:fe(oe.name)})]}),r.jsx("span",{className:"text-sm font-medium truncate",children:oe.name})]}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"h-8 w-8 rounded bg-muted flex items-center justify-center overflow-hidden flex-shrink-0",children:oe.preview_image_url?r.jsx("img",{src:oe.preview_image_url,alt:"",className:"w-full h-full object-cover"}):r.jsx(Gd,{className:"h-4 w-4 text-muted-foreground"})}),r.jsx("span",{className:"text-sm font-medium truncate",children:oe.name})]})},oe.id))})]}),document.body)]})}function wgt(t){const e=/#\[([^\]]+)\]\(([^)]+)\)/g,n=[];let s;for(;(s=e.exec(t))!==null;)n.push(s[2]);return[...new Set(n)]}const hke=t=>t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2);function V8e({comment:t,postId:e,currentUserId:n,currentUserAvatar:s,currentUserEmail:i,canModerate:o,depth:c=0}){const a=Xr(),[f,m]=P.useState(!1),[y,v]=P.useState(""),[w,k]=P.useState([]),C=cr({mutationFn:async({content:A,parentCommentId:D})=>{const{data:$,error:F}=await ee.from("community_comments").insert({post_id:e,user_id:n,content:A,parent_comment_id:D}).select("id").single();if(F)throw F;const q=w;if(q.length>0&&$){const W=q.filter(K=>K!==n).map(K=>({comment_id:$.id,mentioned_user_id:K,mentioned_by_user_id:n}));W.length>0&&await ee.from("community_comment_mentions").insert(W)}},onSuccess:()=>{a.invalidateQueries({queryKey:["community-posts"]}),v(""),k([]),m(!1)}}),S=cr({mutationFn:async A=>{const{error:D}=await ee.from("community_comments").delete().eq("id",A);if(D)throw D},onSuccess:()=>a.invalidateQueries({queryKey:["community-posts"]})}),T=()=>{y.trim()&&C.mutate({content:y,parentCommentId:t.id})};return r.jsxs("div",{className:c>0?"ml-8 border-l-2 border-muted pl-3":"",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(Li,{className:"h-8 w-8 shrink-0",children:[r.jsx(Io,{src:t.user_avatar||void 0}),r.jsx(Oi,{className:"text-xs",children:hke(t.user_name||"U")})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"bg-muted rounded-lg px-3 py-2",children:[r.jsx("div",{className:"font-medium text-sm",children:t.user_name}),r.jsx(wye,{content:t.content,className:"text-sm break-words"})]}),r.jsxs("div",{className:"flex items-center gap-3 mt-1 text-xs text-muted-foreground flex-wrap",children:[r.jsx("span",{children:Yd(new Date(t.created_at),{addSuffix:!0})}),r.jsx(bgt,{commentId:t.id,reactions:t.reactions,currentUserId:n}),n&&c<2&&r.jsxs("button",{onClick:()=>m(!f),className:"hover:text-primary flex items-center gap-1",children:[r.jsx(_T,{className:"h-3 w-3"}),"Reply"]}),(t.user_id===n||o)&&r.jsx("button",{onClick:()=>S.mutate(t.id),className:"hover:text-destructive",children:t.user_id!==n?"Remove":"Delete"})]}),f&&n&&r.jsxs("div",{className:"flex gap-2 mt-2",children:[r.jsxs(Li,{className:"h-6 w-6 shrink-0 mt-1",children:[r.jsx(Io,{src:s||void 0}),r.jsx(Oi,{className:"text-xs",children:hke((i==null?void 0:i.split("@")[0])||"U")})]}),r.jsxs("div",{className:"flex-1 flex gap-2 items-start",children:[r.jsx(xte,{placeholder:`Reply to ${t.user_name}...`,value:y,onChange:v,onMentionsChange:k,mentionFormat:"plain",className:"text-sm min-h-0 py-1.5",minHeight:"32px"}),r.jsx(te,{size:"sm",variant:"ghost",onClick:T,disabled:!y.trim()||C.isPending,className:"h-8 px-2 mt-0.5",children:r.jsx(To,{className:"h-3 w-3"})})]})]})]})]}),t.replies&&t.replies.length>0&&r.jsx("div",{className:"mt-2 space-y-2",children:t.replies.map(A=>r.jsx(V8e,{comment:A,postId:e,currentUserId:n,currentUserAvatar:s,currentUserEmail:i,canModerate:o,depth:c+1},A.id))})]})}const iL=[{type:"like",emoji:"👍",label:"Like"},{type:"love",emoji:"❤️",label:"Love"},{type:"laugh",emoji:"😂",label:"Haha"},{type:"wow",emoji:"😮",label:"Wow"},{type:"sad",emoji:"😢",label:"Sad"},{type:"angry",emoji:"😠",label:"Angry"}],jgt=()=>{const{user:t,isBrokerageManager:e,managedBrokerages:n,isAdmin:s}=Fr(),{avatarUrl:i}=mge(t==null?void 0:t.id),{onlineUsers:o}=LOe(),{toast:c}=la(),a=Xr(),f=P.useRef(null),[m,y]=P.useState("all"),[v,w]=P.useState(""),[k,C]=P.useState(""),[S,T]=P.useState(""),[I,A]=P.useState([]),[D,$]=P.useState([]),[F,q]=P.useState(""),[W,K]=P.useState(!1),[Z,re]=P.useState(null),[he,ue]=P.useState(""),[Ne,se]=P.useState(new Set),[xe,ie]=P.useState({}),[me,fe]=P.useState({}),[ve,Ie]=P.useState([]),[Se,oe]=P.useState([]),[ae,je]=P.useState({open:!1,images:[],index:0});P.useEffect(()=>{if(m.startsWith("group:")){const Le=m.replace("group:","");T(Le),C("")}else m!=="all"?(C(m),T("")):(C(""),T(""))},[m]);const{data:Me=[]}=rr({queryKey:["community-categories"],queryFn:async()=>{const{data:Le,error:ft}=await ee.from("community_categories").select("*").order("sort_order");if(ft)throw ft;return Le}}),{data:Ue=[]}=rr({queryKey:["community-private-groups"],queryFn:async()=>{const{data:Le,error:ft}=await ee.from("community_private_groups").select("id, name, description, icon, brokerage_id, sort_order").order("sort_order");if(ft)throw ft;return Le}}),{data:Re=[],isLoading:$e}=rr({queryKey:["community-posts",m],queryFn:async()=>{let Le=ee.from("community_posts").select("*").order("is_pinned",{ascending:!1}).order("pinned_at",{ascending:!1,nullsFirst:!1}).order("created_at",{ascending:!1});if(m.startsWith("group:")){const Qr=m.replace("group:","");Le=Le.eq("private_group_id",Qr)}else m==="all"||(Le=Le.eq("category_id",m).is("private_group_id",null));const{data:ft,error:Nt}=await Le;if(Nt)throw Nt;const Mt=[...new Set(ft.map(Qr=>Qr.user_id))],{data:It}=await ee.from("profiles").select("id, name").in("id",Mt),tr=new Map((It==null?void 0:It.map(Qr=>[Qr.id,Qr.name]))||[]),Mr=await $5(Mt),pn=[...new Set(ft.filter(Qr=>Qr.category_id).map(Qr=>Qr.category_id))],{data:fs}=await ee.from("community_categories").select("*").in("id",pn),Qn=new Map((fs==null?void 0:fs.map(Qr=>[Qr.id,Qr]))||[]),js=ft.map(Qr=>Qr.id),{data:Qs}=await ee.from("community_post_media").select("*").in("post_id",js).order("sort_order"),{data:si}=await ee.from("community_reactions").select("*").in("post_id",js),wr=[...new Set((si==null?void 0:si.map(Qr=>Qr.user_id))||[])],{data:Ts}=await ee.from("profiles").select("id, name").in("id",wr);new Map((Ts==null?void 0:Ts.map(Qr=>[Qr.id,Qr.name]))||[]),await $5(wr);const{data:ii}=await ee.from("community_comments").select("*").in("post_id",js).order("created_at",{ascending:!0}),mi=[...new Set((ii==null?void 0:ii.map(Qr=>Qr.user_id))||[])],{data:Ta}=await ee.from("profiles").select("id, name").in("id",mi),ga=new Map((Ta==null?void 0:Ta.map(Qr=>[Qr.id,Qr.name]))||[]),vl=await $5(mi),Yo=(ii==null?void 0:ii.map(Qr=>Qr.id))||[],{data:Ds}=await ee.from("community_comment_reactions").select("*").in("comment_id",Yo),Ki=(Ds||[]).map(Qr=>Qr.user_id),_s=[...new Set([...wr,...Ki])],{data:yi}=await ee.from("profiles").select("id, name").in("id",_s),Ni=new Map((yi==null?void 0:yi.map(Qr=>[Qr.id,Qr.name]))||[]),Oo=await $5(_s),{data:sr}=await ee.from("community_post_resources").select("*").in("post_id",js),fo=(sr||[]).filter(Qr=>Qr.resource_type==="template").map(Qr=>Qr.resource_id);let lc=new Map;if(fo.length>0){const{data:Qr}=await ee.from("canva_templates").select("id, name, preview_image_url").in("id",fo);lc=new Map((Qr||[]).map(ba=>[ba.id,{name:ba.name,preview_image_url:ba.preview_image_url}]))}const po=Qr=>{const ba=new Map,Ka=[];return Qr.forEach(dr=>{ba.set(dr.id,{...dr,user_name:ga.get(dr.user_id)||"Unknown User",user_avatar:vl.get(dr.user_id),reactions:(Ds||[]).filter(Ln=>Ln.comment_id===dr.id).map(Ln=>({...Ln,user_name:Ni.get(Ln.user_id)||"Unknown User",user_avatar:Oo.get(Ln.user_id)})),replies:[]})}),Qr.forEach(dr=>{const Ln=ba.get(dr.id);if(dr.parent_comment_id&&ba.has(dr.parent_comment_id)){const xt=ba.get(dr.parent_comment_id);xt.replies=xt.replies||[],xt.replies.push(Ln)}else Ka.push(Ln)}),Ka};return ft.map(Qr=>{const ba=(sr||[]).filter(Ka=>Ka.post_id===Qr.id).map(Ka=>{let dr="",Ln=null;if(Ka.resource_type==="template"){const xt=lc.get(Ka.resource_id);dr=(xt==null?void 0:xt.name)||"Unknown Template",Ln=(xt==null?void 0:xt.preview_image_url)||null}return{id:Ka.id,resource_type:Ka.resource_type,resource_id:Ka.resource_id,resource_name:dr,resource_preview_url:Ln}});return{...Qr,user_name:tr.get(Qr.user_id)||"Unknown User",user_avatar:Mr.get(Qr.user_id),category:Qr.category_id?Qn.get(Qr.category_id):null,media:(Qs==null?void 0:Qs.filter(Ka=>Ka.post_id===Qr.id))||[],reactions:((si==null?void 0:si.filter(Ka=>Ka.post_id===Qr.id))||[]).map(Ka=>({...Ka,user_name:Ni.get(Ka.user_id)||"Unknown User",user_avatar:Oo.get(Ka.user_id)})),comments:po((ii==null?void 0:ii.filter(Ka=>Ka.post_id===Qr.id))||[]),resources:ba}})}}),Pe=cr({mutationFn:async()=>{K(!0);const{data:Le,error:ft}=await ee.from("community_posts").insert({user_id:t.id,category_id:S?null:k||null,private_group_id:S||null,content:v,link_url:F||null}).select().single();if(ft)throw ft;for(let Mt=0;Mt0){const Mt=ve.filter(It=>It!==t.id).map(It=>({post_id:Le.id,mentioned_user_id:It,mentioned_by_user_id:t.id}));Mt.length>0&&await ee.from("community_post_mentions").insert(Mt)}const Nt=wgt(v);if(Nt.length>0){const Mt=Nt.map(It=>({post_id:Le.id,resource_type:"template",resource_id:It}));await ee.from("community_post_resources").insert(Mt)}return Le},onSuccess:async Le=>{var ft;a.invalidateQueries({queryKey:["community-posts"]}),w(""),Ie([]),oe([]),C(""),T(""),A([]),$([]),q(""),c({title:"Post created!"});try{const Nt=((ft=t==null?void 0:t.user_metadata)==null?void 0:ft.name)||"Someone",Mt=v.length>50?v.substring(0,50)+"...":v;await ee.functions.invoke("send-push-notification",{body:{title:"New Community Post",body:`${Nt}: ${Mt}`,url:"/community"}})}catch(Nt){console.error("Failed to send push notification:",Nt)}},onError:Le=>{c({title:"Error creating post",description:Le.message,variant:"destructive"})},onSettled:()=>K(!1)}),Ae=cr({mutationFn:async({postId:Le,content:ft})=>{const{error:Nt}=await ee.from("community_posts").update({content:ft}).eq("id",Le);if(Nt)throw Nt},onSuccess:()=>{a.invalidateQueries({queryKey:["community-posts"]}),re(null),ue(""),c({title:"Post updated!"})}}),nt=cr({mutationFn:async Le=>{const{error:ft}=await ee.from("community_posts").delete().eq("id",Le);if(ft)throw ft},onSuccess:()=>{a.invalidateQueries({queryKey:["community-posts"]}),c({title:"Post deleted"})}}),Te=cr({mutationFn:async({postId:Le,isPinned:ft})=>{const{error:Nt}=await ee.from("community_posts").update({is_pinned:!ft,pinned_at:ft?null:new Date().toISOString(),pinned_by:ft?null:t==null?void 0:t.id}).eq("id",Le);if(Nt)throw Nt},onSuccess:(Le,{isPinned:ft})=>{a.invalidateQueries({queryKey:["community-posts"]}),c({title:ft?"Post unpinned":"Post pinned to top"})}}),Xe=cr({mutationFn:async({postId:Le,reactionType:ft})=>{var Mt;const Nt=(Mt=Re.find(It=>It.id===Le))==null?void 0:Mt.reactions.find(It=>It.user_id===(t==null?void 0:t.id));Nt?Nt.reaction_type===ft?await ee.from("community_reactions").delete().eq("id",Nt.id):await ee.from("community_reactions").update({reaction_type:ft}).eq("id",Nt.id):await ee.from("community_reactions").insert({post_id:Le,user_id:t.id,reaction_type:ft})},onSuccess:()=>a.invalidateQueries({queryKey:["community-posts"]})}),ge=cr({mutationFn:async({postId:Le,content:ft})=>{const{data:Nt,error:Mt}=await ee.from("community_comments").insert({post_id:Le,user_id:t.id,content:ft}).select("id").single();if(Mt)throw Mt;const It=me[Le]||[];if(It.length>0&&Nt){const tr=It.filter(Mr=>Mr!==t.id).map(Mr=>({comment_id:Nt.id,mentioned_user_id:Mr,mentioned_by_user_id:t.id}));tr.length>0&&await ee.from("community_comment_mentions").insert(tr)}},onSuccess:(Le,{postId:ft})=>{a.invalidateQueries({queryKey:["community-posts"]}),ie(Nt=>({...Nt,[ft]:""})),fe(Nt=>({...Nt,[ft]:[]}))}});cr({mutationFn:async Le=>{const{error:ft}=await ee.from("community_comments").delete().eq("id",Le);if(ft)throw ft},onSuccess:()=>a.invalidateQueries({queryKey:["community-posts"]})});const mt=Le=>{const ft=Array.from(Le.target.files||[]);if(ft.length+I.length>10){c({title:"Maximum 10 files allowed",variant:"destructive"});return}A(Nt=>[...Nt,...ft]),ft.forEach(Nt=>{const Mt=new FileReader;Mt.onloadend=()=>{$(It=>[...It,Mt.result])},Mt.readAsDataURL(Nt)})},rt=Le=>{A(ft=>ft.filter((Nt,Mt)=>Mt!==Le)),$(ft=>ft.filter((Nt,Mt)=>Mt!==Le))},We=Le=>Le.split(" ").map(ft=>ft[0]).join("").toUpperCase().slice(0,2),Ce=Le=>{const ft={};return Le.forEach(Nt=>{ft[Nt.reaction_type]=(ft[Nt.reaction_type]||0)+1}),ft},et=Le=>{var ft;return(ft=Le.find(Nt=>Nt.user_id===(t==null?void 0:t.id)))==null?void 0:ft.reaction_type},Fe=Le=>Le.reduce((ft,Nt)=>ft+1+(Nt.replies?Fe(Nt.replies):0),0),Ke=Le=>{if(s)return!0;if(!e||!Le.private_group_id)return!1;const ft=Ue.find(Nt=>Nt.id===Le.private_group_id);return ft!=null&&ft.brokerage_id?n.some(Nt=>Nt.id===ft.brokerage_id):!1};return r.jsx(Or,{title:"Community",children:r.jsxs("div",{className:"flex gap-6 w-full",children:[r.jsx(igt,{categories:Me,privateGroups:Ue,selectedFilter:m,onFilterChange:y,onlineUsers:o}),r.jsxs("div",{className:"flex-1 min-w-0 max-w-2xl mx-auto lg:mx-0 space-y-6",children:[r.jsxs("div",{className:"px-1",children:[r.jsx("h1",{className:"text-4xl lg:text-5xl font-bold text-foreground",children:"Community"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Connect and share with fellow agents"})]}),r.jsx(agt,{categories:Me,privateGroups:Ue,selectedFilter:m,onFilterChange:y,onlineUsers:o}),r.jsx(Ye,{children:r.jsx(Je,{className:"pt-6",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsxs(Li,{className:"h-10 w-10",children:[r.jsx(Io,{src:i||void 0}),r.jsx(Oi,{children:t!=null&&t.email?We(t.email.split("@")[0]):"U"})]}),r.jsxs("div",{className:"flex-1 space-y-3",children:[r.jsx(xte,{placeholder:s?"What's on your mind? Use @ to mention someone, # to link a template":"What's on your mind? Use @ to mention someone",value:v,onChange:w,onMentionsChange:Ie,onTemplatesChange:oe,mentionFormat:"encoded",minHeight:"80px",enableTemplateMentions:s}),D.length>0&&r.jsx("div",{className:"grid grid-cols-3 gap-2",children:D.map((Le,ft)=>{var Nt;return r.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-muted",children:[(Nt=I[ft])!=null&&Nt.type.startsWith("video/")?r.jsx("video",{src:Le,className:"w-full h-full object-cover"}):r.jsx("img",{src:Le,alt:"",className:"w-full h-full object-cover"}),r.jsx(te,{variant:"destructive",size:"icon",className:"absolute top-1 right-1 h-6 w-6",onClick:()=>rt(ft),children:r.jsx(Ms,{className:"h-3 w-3"})})]},ft)})}),F&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(bo,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(yt,{value:F,onChange:Le=>q(Le.target.value),placeholder:"https://...",className:"flex-1"}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>q(""),children:r.jsx(Ms,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex gap-1 flex-wrap",children:[r.jsx("input",{type:"file",ref:f,onChange:mt,accept:"image/*,video/*",multiple:!0,className:"hidden"}),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>{var Le;return(Le=f.current)==null?void 0:Le.click()},children:[r.jsx(Wo,{className:"h-4 w-4 mr-1"}),"Photo"]}),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>{var Le;return(Le=f.current)==null?void 0:Le.click()},children:[r.jsx(Gi,{className:"h-4 w-4 mr-1"}),"Video"]}),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>q("https://"),children:[r.jsx(bo,{className:"h-4 w-4 mr-1"}),"Link"]})]}),r.jsxs("div",{className:"flex items-center gap-2 w-full sm:w-auto justify-end",children:[Ue.length>0?r.jsxs(_n,{value:S||k||"none",onValueChange:Le=>{Le==="none"?(C(""),T("")):Le.startsWith("group:")?(T(Le.replace("group:","")),C("")):(C(Le),T(""))},children:[r.jsx(xn,{className:"w-[130px] sm:w-[160px] h-8 text-xs sm:text-sm",children:r.jsx(bn,{placeholder:"Select..."})}),r.jsxs(vn,{children:[r.jsx(er,{value:"none",children:"No category"}),Me.map(Le=>r.jsxs(er,{value:Le.id,children:[Le.icon," ",Le.name]},Le.id)),Ue.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"px-2 py-1 text-xs font-semibold text-muted-foreground border-t mt-1 pt-1",children:"🔒 Private Groups"}),Ue.map(Le=>r.jsxs(er,{value:`group:${Le.id}`,children:[Le.icon||"🔒"," ",Le.name]},Le.id))]})]})]}):r.jsxs(_n,{value:k,onValueChange:C,children:[r.jsx(xn,{className:"w-[110px] sm:w-[140px] h-8 text-xs sm:text-sm",children:r.jsx(bn,{placeholder:"Category"})}),r.jsx(vn,{children:Me.map(Le=>r.jsxs(er,{value:Le.id,children:[Le.icon," ",Le.name]},Le.id))})]}),r.jsxs(te,{size:"sm",onClick:()=>Pe.mutate(),disabled:!v.trim()||W,children:[r.jsx(To,{className:"h-4 w-4 mr-1"}),"Post"]})]})]})]})]})})}),$e?r.jsx("div",{className:"space-y-4",children:[...Array(3)].map((Le,ft)=>r.jsx(Ye,{children:r.jsx(Je,{className:"pt-6",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Gr,{className:"h-10 w-10 rounded-full"}),r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx(Gr,{className:"h-4 w-32"}),r.jsx(Gr,{className:"h-4 w-full"}),r.jsx(Gr,{className:"h-4 w-3/4"})]})]})})},ft))}):Re.length===0?r.jsx(Ye,{children:r.jsxs(Je,{className:"py-12 text-center",children:[r.jsx(Hl,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"font-semibold mb-2",children:"No posts yet"}),r.jsx("p",{className:"text-muted-foreground",children:"Be the first to start a conversation!"})]})}):r.jsx("div",{className:"space-y-4",children:Re.map(Le=>{var ft,Nt,Mt,It;return r.jsx(Ye,{children:r.jsxs(Je,{className:"pt-6",children:[r.jsxs("div",{className:"flex items-start justify-between mb-3",children:[r.jsxs("div",{className:"flex gap-3 min-w-0",children:[r.jsxs(Li,{className:"h-10 w-10",children:[r.jsx(Io,{src:Le.user_avatar||void 0}),r.jsx(Oi,{children:We(Le.user_name||"U")})]}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"font-semibold break-words",children:Le.user_name}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm text-muted-foreground",children:[r.jsx("span",{children:Yd(new Date(Le.created_at),{addSuffix:!0})}),Le.category&&r.jsxs(r.Fragment,{children:[r.jsx("span",{children:"•"}),r.jsxs(Rt,{variant:"secondary",className:"text-xs",children:[Le.category.icon," ",Le.category.name]})]})]})]})]}),(Le.user_id===(t==null?void 0:t.id)||Ke(Le))&&r.jsxs(fm,{children:[r.jsx(pm,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8",children:r.jsx(Zm,{className:"h-4 w-4"})})}),r.jsxs(Xf,{align:"end",children:[Ke(Le)&&Le.private_group_id&&r.jsx(uo,{onClick:()=>Te.mutate({postId:Le.id,isPinned:Le.is_pinned}),children:Le.is_pinned?r.jsxs(r.Fragment,{children:[r.jsx(vT,{className:"h-4 w-4 mr-2"}),"Unpin Post"]}):r.jsxs(r.Fragment,{children:[r.jsx(X0,{className:"h-4 w-4 mr-2"}),"Pin to Top"]})}),Le.user_id===(t==null?void 0:t.id)&&r.jsxs(uo,{onClick:()=>{re(Le),ue(Le.content)},children:[r.jsx(ma,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsxs(uo,{className:"text-destructive",onClick:()=>nt.mutate(Le.id),children:[r.jsx(Xn,{className:"h-4 w-4 mr-2"}),Le.user_id!==(t==null?void 0:t.id)?"Remove (Moderate)":"Delete"]})]})]})]}),Le.is_pinned&&r.jsxs("div",{className:"flex items-center gap-2 mb-2 text-sm text-primary",children:[r.jsx(X0,{className:"h-4 w-4"}),r.jsx("span",{className:"font-medium",children:"Pinned"})]}),r.jsx("div",{className:"mb-3",children:r.jsx(wye,{content:Le.content})}),Le.media.length>0&&r.jsx("div",{className:`grid gap-2 mb-3 ${Le.media.length===1?"grid-cols-1":Le.media.length===2?"grid-cols-2":Le.media.length===3?"grid-cols-3":"grid-cols-2"}`,children:Le.media.slice(0,4).map((tr,Mr)=>{const pn=Mr===3&&Le.media.length>4,fs=Le.media.length-4;return r.jsxs("div",{className:`relative rounded-lg overflow-hidden bg-muted cursor-pointer group ${Le.media.length===1?"max-h-[500px]":Le.media.length===2?"aspect-[4/3]":"aspect-square"}`,onClick:()=>je({open:!0,images:Le.media.map(Qn=>({url:Qn.media_url,type:Qn.media_type==="video"?"video":"image"})),index:Mr}),children:[tr.media_type==="video"?r.jsx("video",{src:tr.media_url,className:"w-full h-full object-cover transition-transform group-hover:scale-105"}):r.jsx("img",{src:tr.media_url,alt:"",className:"w-full h-full object-cover transition-transform group-hover:scale-105"}),r.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/20 transition-colors flex items-center justify-center",children:r.jsx("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity text-white",children:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-8 w-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0zM10 7v3m0 0v3m0-3h3m-3 0H7"})})})}),pn&&r.jsx("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center",children:r.jsxs("span",{className:"text-white text-2xl font-bold",children:["+",fs]})})]},tr.id)})}),Le.link_url&&r.jsx("a",{href:Le.link_url,target:"_blank",rel:"noopener noreferrer",className:"block p-3 rounded-lg border hover:bg-muted transition-colors mb-3",children:r.jsxs("div",{className:"flex items-center gap-2 text-sm text-primary",children:[r.jsx(bo,{className:"h-4 w-4"}),Le.link_url]})}),Le.reactions.length>0&&r.jsx(q8e,{reactions:Le.reactions,children:r.jsxs("div",{className:"flex items-center gap-2 mb-3 text-sm text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:[r.jsx("div",{className:"flex -space-x-1",children:Object.entries(Ce(Le.reactions)).slice(0,3).map(([tr])=>{var Mr;return r.jsx("span",{className:"text-base",children:(Mr=iL.find(pn=>pn.type===tr))==null?void 0:Mr.emoji},tr)})}),r.jsx("span",{children:Le.reactions.length})]})}),r.jsxs("div",{className:"flex items-center gap-1 border-t border-b py-1 my-2",children:[r.jsxs(Zh,{children:[r.jsx(Yh,{asChild:!0,children:r.jsxs(te,{variant:"ghost",size:"sm",className:"flex-1",children:[et(Le.reactions)?r.jsx("span",{className:"mr-1",children:(ft=iL.find(tr=>tr.type===et(Le.reactions)))==null?void 0:ft.emoji}):r.jsx(Zd,{className:"h-4 w-4 mr-1"}),et(Le.reactions)?(Nt=iL.find(tr=>tr.type===et(Le.reactions)))==null?void 0:Nt.label:"Like"]})}),r.jsx(mh,{className:"w-auto p-2",side:"top",children:r.jsx("div",{className:"flex gap-1",children:iL.map(tr=>r.jsx("button",{onClick:()=>Xe.mutate({postId:Le.id,reactionType:tr.type}),className:"text-2xl hover:scale-125 transition-transform p-1",title:tr.label,children:tr.emoji},tr.type))})})]}),r.jsxs(te,{variant:"ghost",size:"sm",className:"flex-1",onClick:()=>se(tr=>{const Mr=new Set(tr);return Mr.has(Le.id)?Mr.delete(Le.id):Mr.add(Le.id),Mr}),children:[r.jsx(Hl,{className:"h-4 w-4 mr-1"}),"Comment ",Fe(Le.comments)>0&&`(${Fe(Le.comments)})`]})]}),(Ne.has(Le.id)||Fe(Le.comments)>0)&&r.jsxs("div",{className:"space-y-3 mt-3",children:[Le.comments.map(tr=>r.jsx(V8e,{comment:tr,postId:Le.id,currentUserId:t==null?void 0:t.id,currentUserAvatar:i,currentUserEmail:t==null?void 0:t.email,canModerate:Ke(Le)},tr.id)),t&&r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(Li,{className:"h-8 w-8",children:[r.jsx(Io,{src:i||void 0}),r.jsx(Oi,{className:"text-xs",children:We(((Mt=t.email)==null?void 0:Mt.split("@")[0])||"U")})]}),r.jsxs("div",{className:"flex-1 flex gap-2",children:[r.jsx(xte,{placeholder:"Write a comment... (use @ to mention)",value:xe[Le.id]||"",onChange:tr=>ie(Mr=>({...Mr,[Le.id]:tr})),onMentionsChange:tr=>fe(Mr=>({...Mr,[Le.id]:tr})),mentionFormat:"plain",onKeyDown:tr=>{var Mr;tr.defaultPrevented||tr.key==="Enter"&&!tr.shiftKey&&((Mr=xe[Le.id])!=null&&Mr.trim())&&(tr.preventDefault(),ge.mutate({postId:Le.id,content:xe[Le.id]}))},className:"text-sm min-h-0 py-1.5",minHeight:"32px"}),r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>{var tr;(tr=xe[Le.id])!=null&&tr.trim()&&ge.mutate({postId:Le.id,content:xe[Le.id]})},disabled:!((It=xe[Le.id])!=null&&It.trim()),className:"h-8 px-2 mt-0.5",children:r.jsx(To,{className:"h-4 w-4"})})]})]})]})]})},Le.id)})}),r.jsx($r,{open:!!Z,onOpenChange:()=>re(null),children:r.jsxs(zr,{children:[r.jsx(Zr,{children:r.jsx(Kr,{children:"Edit Post"})}),r.jsx(ps,{value:he,onChange:Le=>ue(Le.target.value),className:"min-h-[120px]"}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"outline",onClick:()=>re(null),children:"Cancel"}),r.jsx(te,{onClick:()=>{Z&&Ae.mutate({postId:Z.id,content:he})},disabled:!he.trim(),children:"Save Changes"})]})]})}),r.jsx(_gt,{images:ae.images,initialIndex:ae.index,open:ae.open,onOpenChange:Le=>je(ft=>({...ft,open:Le}))})]})]})})},$N={open:{label:"Open",icon:Xi,color:"bg-yellow-500"},in_progress:{label:"In Progress",icon:Hl,color:"bg-blue-500"},resolved:{label:"Resolved",icon:za,color:"bg-green-500"},closed:{label:"Closed",icon:Lc,color:"bg-muted-foreground"}},fke={general:"General Support",technology:"Technology Support",crm:"CRM Support",marketing:"Marketing Support"};function kgt(){const{user:t}=Fr(),e=Xr(),[n,s]=P.useState(null),[i,o]=P.useState(""),{data:c=[],isLoading:a}=rr({queryKey:["support-tickets"],queryFn:async()=>{const{data:v,error:w}=await ee.from("support_tickets").select("*").eq("user_id",t==null?void 0:t.id).order("created_at",{ascending:!1});if(w)throw w;return v},enabled:!!t}),{data:f=[]}=rr({queryKey:["ticket-replies",n==null?void 0:n.id],queryFn:async()=>{if(!n)return[];const{data:v,error:w}=await ee.from("support_ticket_replies").select("*, profiles(name)").eq("ticket_id",n.id).order("created_at",{ascending:!0});if(w)throw w;return v},enabled:!!n}),m=cr({mutationFn:async v=>{if(!n||!t)throw new Error("Missing data");const{error:w}=await ee.from("support_ticket_replies").insert({ticket_id:n.id,user_id:t.id,content:v,is_admin_reply:!1});if(w)throw w},onSuccess:()=>{e.invalidateQueries({queryKey:["ticket-replies",n==null?void 0:n.id]}),o(""),Ge.success("Reply sent!")},onError:()=>{Ge.error("Failed to send reply")}}),y=()=>{i.trim()&&m.mutate(i)};if(n){const v=$N[n.status].icon;return r.jsx(Or,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>s(null),children:r.jsx(Va,{className:"h-5 w-5"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h1",{className:"text-2xl font-bold",children:n.subject}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx(Rt,{variant:"secondary",children:fke[n.category]}),r.jsxs(Rt,{className:$N[n.status].color,children:[r.jsx(v,{className:"h-3 w-3 mr-1"}),$N[n.status].label]})]})]})]}),r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsxs(An,{children:["Created on ",un(new Date(n.created_at),"MMM d, yyyy 'at' h:mm a")]})}),r.jsx(Je,{children:r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:n.description})})]}),r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsx(Yt,{className:"text-lg",children:"Conversation"})}),r.jsxs(Je,{children:[r.jsx(xl,{className:"h-[300px] pr-4",children:f.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No replies yet"}):r.jsx("div",{className:"space-y-4",children:f.map(w=>{var k;return r.jsxs("div",{className:`p-4 rounded-lg ${w.is_admin_reply?"bg-primary/10 ml-4":"bg-muted mr-4"}`,children:[r.jsxs("div",{className:"flex justify-between items-start mb-2",children:[r.jsx("span",{className:"font-medium text-sm",children:w.is_admin_reply?"Support Team":((k=w.profiles)==null?void 0:k.name)||"You"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:un(new Date(w.created_at),"MMM d, h:mm a")})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:w.content})]},w.id)})})}),n.status!=="closed"&&r.jsxs(r.Fragment,{children:[r.jsx(Vd,{className:"my-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ps,{placeholder:"Type your reply...",value:i,onChange:w=>o(w.target.value),className:"min-h-[80px]"}),r.jsx(te,{onClick:y,disabled:!i.trim()||m.isPending,className:"self-end",children:r.jsx(To,{className:"h-4 w-4"})})]})]})]})]})]})})}return r.jsx(Or,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ye,{className:"bg-gradient-to-br from-primary/10 via-primary/5 to-background border-primary/20",children:r.jsx(Je,{className:"p-6 sm:p-8",children:r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-6",children:[r.jsx("div",{className:"p-4 bg-primary/20 rounded-full",children:r.jsx(my,{className:"h-8 w-8 text-primary"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Need Help?"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Submit a support ticket and our team will get back to you as soon as possible."}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsx(ahe,{trigger:r.jsxs(te,{size:"lg",className:"gap-2",children:[r.jsx(Sn,{className:"h-5 w-5"}),"Submit a Ticket"]})}),r.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-muted rounded-lg",children:[r.jsx(Wa,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:["Or text us: ",r.jsx("span",{className:"font-semibold text-foreground",children:"1-866-527-8668"})]})]})]})]})]})})}),r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("h2",{className:"text-lg font-semibold",children:"Your Tickets"}),r.jsx(ahe,{trigger:r.jsxs(te,{variant:"outline",size:"sm",className:"gap-2",children:[r.jsx(Sn,{className:"h-4 w-4"}),"New Ticket"]})})]}),a?r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading tickets..."}):c.length===0?r.jsx(Ye,{className:"border-dashed",children:r.jsxs(Je,{className:"text-center py-12",children:[r.jsx(Hl,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No tickets yet"}),r.jsx("p",{className:"text-muted-foreground",children:"You haven't submitted any support tickets. Use the button above to get started!"})]})}):r.jsx("div",{className:"space-y-3",children:c.map(v=>{const w=$N[v.status].icon;return r.jsx(Ye,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>s(v),children:r.jsx(Je,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-medium truncate",children:v.subject}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx(Rt,{variant:"outline",className:"text-xs",children:fke[v.category]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:un(new Date(v.created_at),"MMM d, yyyy")})]})]}),r.jsxs(Rt,{className:$N[v.status].color,children:[r.jsx(w,{className:"h-3 w-3 mr-1"}),$N[v.status].label]})]})})},v.id)})})]})})}function Ngt({open:t,onOpenChange:e}){return r.jsx($r,{open:t,onOpenChange:e,children:r.jsxs(zr,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[r.jsx(Zr,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(li,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Kr,{children:"Schedule Agent Onboarding"}),r.jsx(ls,{children:"Book a one-on-one onboarding session with LevelUp"})]})]})}),t&&r.jsx("iframe",{src:"https://tidycal.com/jeremycollins/new-agent-onboarding",className:"w-full border-0 rounded-lg",style:{height:"600px",minHeight:"500px"},title:"Schedule Agent Onboarding"})]})})}function Sgt({open:t,onOpenChange:e}){const{brokerageId:n}=Fr(),[s,i]=P.useState(""),[o,c]=P.useState([]),[a,f]=P.useState(!1),{data:m,isLoading:y}=rr({queryKey:["brokerage-agents-for-onboarding",n],queryFn:async()=>{if(!n)return[];const{data:S,error:T}=await ee.from("profiles").select("id, name, email").eq("brokerage_id",n).order("name",{ascending:!0});if(T)throw T;return S},enabled:t&&!!n}),v=m==null?void 0:m.filter(S=>S.name.toLowerCase().includes(s.toLowerCase())||S.email.toLowerCase().includes(s.toLowerCase())),w=S=>{c(T=>T.includes(S)?T.filter(I=>I!==S):[...T,S])},k=async()=>{if(o.length===0){Ge.error("Please select at least one agent");return}f(!0);try{const{data:S,error:T}=await ee.functions.invoke("send-onboarding-link",{body:{agentIds:o}});if(T)throw T;Ge.success(`Onboarding link sent to ${o.length} agent${o.length>1?"s":""}`),c([]),e(!1)}catch(S){console.error("Error sending onboarding link:",S),Ge.error(S.message||"Failed to send onboarding link")}finally{f(!1)}},C=S=>{S||(c([]),i("")),e(S)};return r.jsx($r,{open:t,onOpenChange:C,children:r.jsxs(zr,{className:"max-w-md",children:[r.jsx(Zr,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(To,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Kr,{children:"Send Onboarding Link"}),r.jsx(ls,{children:"Select agents to receive the onboarding booking link"})]})]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"relative",children:[r.jsx(Ti,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(yt,{placeholder:"Search agents...",value:s,onChange:S=>i(S.target.value),className:"pl-10"})]}),y?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(sn,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):(v==null?void 0:v.length)===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(hs,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No agents found"})]}):r.jsx(xl,{className:"h-[300px] border rounded-lg",children:r.jsx("div",{className:"p-2 space-y-1",children:v==null?void 0:v.map(S=>r.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-lg hover:bg-muted cursor-pointer",onClick:()=>w(S.id),children:[r.jsx(_c,{checked:o.includes(S.id),onCheckedChange:()=>w(S.id)}),r.jsx(Li,{className:"h-8 w-8",children:r.jsx(Oi,{className:"text-xs",children:S.name.split(" ").map(T=>T[0]).join("").toUpperCase()})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:S.name}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:S.email})]})]},S.id))})}),o.length>0&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[o.length," agent",o.length>1?"s":""," selected"]})]}),r.jsxs(ni,{children:[r.jsx(te,{variant:"outline",onClick:()=>C(!1),children:"Cancel"}),r.jsx(te,{onClick:k,disabled:o.length===0||a,children:a?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),"Sending..."]}):r.jsxs(r.Fragment,{children:[r.jsx(To,{className:"h-4 w-4 mr-2"}),"Send Link"]})})]})]})})}function Cgt(){const[t,e]=P.useState(!1),[n,s]=P.useState(!1);return r.jsxs(r.Fragment,{children:[r.jsxs(Ye,{className:"mb-8",children:[r.jsx(Ht,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(hs,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx(Yt,{children:"Agent Onboarding"}),r.jsx(An,{children:"Schedule onboarding sessions for yourself or your agents"})]})]})}),r.jsx(Je,{children:r.jsxs("div",{className:"flex flex-wrap gap-4",children:[r.jsxs(te,{onClick:()=>e(!0),className:"flex items-center gap-2",children:[r.jsx(li,{className:"h-4 w-4"}),"Schedule Agent Onboarding"]}),r.jsxs(te,{variant:"outline",onClick:()=>s(!0),className:"flex items-center gap-2",children:[r.jsx(To,{className:"h-4 w-4"}),"Send New Agent Onboarding Link"]})]})})]}),r.jsx(Ngt,{open:t,onOpenChange:e}),r.jsx(Sgt,{open:n,onOpenChange:s})]})}function Mgt({open:t,onOpenChange:e}){return r.jsx($r,{open:t,onOpenChange:e,children:r.jsxs(zr,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[r.jsx(Zr,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(cg,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Kr,{children:"Schedule Launch Meeting"}),r.jsx(ls,{children:"Book a private LevelUp information session for your brokerage"})]})]})}),t&&r.jsx("iframe",{src:"https://tidycal.com/jeremycollins/levelup-launch-call",className:"w-full border-0 rounded-lg",style:{height:"600px",minHeight:"500px"},title:"Schedule Launch Meeting"})]})})}function Tgt(){const[t,e]=P.useState(!1);return r.jsxs(r.Fragment,{children:[r.jsxs(Ye,{className:"mb-8",children:[r.jsx(Ht,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(cg,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx(Yt,{children:"Launch or ReLaunch Meeting"}),r.jsx(An,{children:"Schedule a private LevelUp information session for your brokerage. Have one of our staff host a meeting to help your team get the most out of all our trainings, tools, and resources."})]})]})}),r.jsx(Je,{children:r.jsxs(te,{onClick:()=>e(!0),className:"flex items-center gap-2",children:[r.jsx(cg,{className:"h-4 w-4"}),"Schedule Launch Meeting"]})})]}),r.jsx(Mgt,{open:t,onOpenChange:e})]})}function Agt(){const t=es(),[e,n]=P.useState(""),[s,i]=P.useState(null),{data:o,isLoading:c}=rr({queryKey:["brokerage-resources-published"],queryFn:async()=>{const{data:S,error:T}=await ee.from("brokerage_resources").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(T)throw T;return S}}),{data:a}=rr({queryKey:["brokerage-resource-categories"],queryFn:async()=>{const{data:S,error:T}=await ee.from("brokerage_resource_categories").select("*").order("sort_order",{ascending:!0});if(T)throw T;return S}}),{data:f}=rr({queryKey:["brokerage-resource-pdfs-all"],queryFn:async()=>{const{data:S,error:T}=await ee.from("brokerage_resource_pdfs").select("resource_id");if(T)throw T;return S}}),{data:m}=rr({queryKey:["brokerage-resource-videos-all"],queryFn:async()=>{const{data:S,error:T}=await ee.from("brokerage_resource_videos").select("resource_id");if(T)throw T;return S}}),{data:y}=rr({queryKey:["brokerage-resource-links-all"],queryFn:async()=>{const{data:S,error:T}=await ee.from("brokerage_resource_links").select("resource_id");if(T)throw T;return S}}),v=o==null?void 0:o.filter(S=>{var A;const T=S.title.toLowerCase().includes(e.toLowerCase())||((A=S.description)==null?void 0:A.toLowerCase().includes(e.toLowerCase())),I=!s||S.category_id===s;return T&&I}),w=a==null?void 0:a.filter(S=>o==null?void 0:o.some(T=>T.category_id===S.id)),k=S=>{const T=(f==null?void 0:f.filter(D=>D.resource_id===S).length)||0,I=(m==null?void 0:m.filter(D=>D.resource_id===S).length)||0,A=(y==null?void 0:y.filter(D=>D.resource_id===S).length)||0;return{pdfCount:T,videoCount:I,linkCount:A}},C=S=>{t(`/brokerage-resources/${S}`)};return r.jsx(Or,{title:"Brokerage Resources",description:"Access exclusive resources for brokerage managers",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Cgt,{}),r.jsx(Tgt,{}),r.jsxs("div",{className:"relative max-w-md",children:[r.jsx(Ti,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(yt,{placeholder:"Search resources...",value:e,onChange:S=>n(S.target.value),className:"pl-10"})]}),w&&w.length>0&&r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsx(Rt,{variant:s===null?"default":"outline",className:"cursor-pointer",onClick:()=>i(null),children:"All"}),w.map(S=>r.jsx(Rt,{variant:s===S.id?"default":"outline",className:"cursor-pointer",onClick:()=>i(S.id),children:S.name},S.id))]}),!c&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[(v==null?void 0:v.length)||0," resource",(v==null?void 0:v.length)!==1?"s":""," available"]}),c?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[...Array(6)].map((S,T)=>r.jsxs(Ye,{children:[r.jsx(Gr,{className:"h-40 w-full"}),r.jsx(Ht,{children:r.jsx(Gr,{className:"h-5 w-3/4"})}),r.jsxs(Je,{children:[r.jsx(Gr,{className:"h-4 w-full mb-2"}),r.jsx(Gr,{className:"h-4 w-2/3"})]})]},T))}):(v==null?void 0:v.length)===0?r.jsxs(Ye,{className:"p-12 text-center",children:[r.jsx(dh,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No resources found"}),r.jsx("p",{className:"text-muted-foreground",children:e||s?"Try adjusting your filters":"Check back later for new resources"})]}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:v==null?void 0:v.map(S=>{const{pdfCount:T,videoCount:I,linkCount:A}=k(S.id),D=a==null?void 0:a.find($=>$.id===S.category_id);return r.jsxs(Ye,{className:"overflow-hidden cursor-pointer hover:shadow-lg transition-shadow",onClick:()=>C(S.id),children:[S.preview_image_url?r.jsx("img",{src:S.preview_image_url,alt:S.title,className:"w-full h-40 object-cover"}):r.jsx("div",{className:"w-full h-40 bg-muted flex items-center justify-center",children:r.jsx(dh,{className:"h-16 w-16 text-muted-foreground"})}),r.jsx(Ht,{className:"pb-2",children:r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsx(Yt,{className:"text-lg line-clamp-1",children:S.title}),D&&r.jsx(Rt,{variant:"secondary",className:"shrink-0 text-xs",children:D.name})]})}),r.jsxs(Je,{children:[S.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:S.description}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[T>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ai,{className:"h-4 w-4"}),T]}),I>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Gi,{className:"h-4 w-4"}),I]}),A>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(bo,{className:"h-4 w-4"}),A]})]})]})]},S.id)})})]})})}const Egt=()=>{const{resourceId:t}=dd(),{data:e,isLoading:n}=rr({queryKey:["brokerage-resource-detail",t],queryFn:async()=>{const{data:i,error:o}=await ee.from("brokerage_resources").select("*").eq("id",t).eq("is_published",!0).single();if(o)throw o;const{data:c}=await ee.from("brokerage_resource_pdfs").select("*").eq("resource_id",t).order("sort_order"),{data:a}=await ee.from("brokerage_resource_videos").select("*").eq("resource_id",t).order("sort_order"),{data:f}=await ee.from("brokerage_resource_links").select("*").eq("resource_id",t).order("sort_order");return{...i,pdfs:c||[],videos:a||[],links:f||[]}},enabled:!!t}),s=i=>i?i<1024?i+" B":i<1024*1024?(i/1024).toFixed(1)+" KB":(i/(1024*1024)).toFixed(1)+" MB":"";return n?r.jsx(Or,{title:"Brokerage Resources",children:r.jsx("div",{className:"flex justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):e?r.jsx(Or,{title:e.title,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(te,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(ao,{to:"/brokerage-resources",children:[r.jsx(Va,{className:"h-4 w-4"}),"Back to Resources"]})}),e.preview_image_url&&r.jsx("div",{className:"relative w-full rounded-lg overflow-hidden bg-muted",children:r.jsx("img",{src:e.preview_image_url,alt:e.title,className:"w-full max-h-[400px] object-cover"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:e.title}),e.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:e.description}})]}),e.videos&&e.videos.length>0&&r.jsx(Ye,{children:r.jsxs(Je,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Gi,{className:"h-4 w-4"}),"Videos (",e.videos.length,")"]}),r.jsx("div",{className:"space-y-4",children:e.videos.map(i=>r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"font-medium",children:i.title}),r.jsx("div",{className:"relative w-full",style:{paddingTop:"56.25%"},children:r.jsx("iframe",{src:i.video_url,className:"absolute top-0 left-0 w-full h-full rounded-lg border",allow:"accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0})})]},i.id))})]})}),e.pdfs&&e.pdfs.length>0&&r.jsx(Ye,{children:r.jsxs(Je,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Ai,{className:"h-4 w-4"}),"Documents (",e.pdfs.length,")"]}),r.jsx("div",{className:"grid gap-2",children:e.pdfs.map(i=>r.jsxs("a",{href:i.file_url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-between p-3 rounded-lg border hover:bg-muted transition-colors group",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 rounded-md bg-primary/10",children:r.jsx(Ai,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-sm",children:i.name}),i.file_size&&r.jsx("div",{className:"text-xs text-muted-foreground",children:s(i.file_size)})]})]}),r.jsx(Mo,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors"})]},i.id))})]})}),e.links&&e.links.length>0&&r.jsx(Ye,{children:r.jsxs(Je,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Fs,{className:"h-4 w-4"}),"Canva Templates (",e.links.length,")"]}),r.jsx("div",{className:"grid gap-2",children:e.links.map(i=>r.jsxs("a",{href:i.canva_share_link,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-between p-3 rounded-lg border hover:bg-muted transition-colors group",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 rounded-md bg-primary/10",children:r.jsx(Fs,{className:"h-4 w-4 text-primary"})}),r.jsx("div",{className:"font-medium text-sm",children:i.title})]}),r.jsx(Fs,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors"})]},i.id))})]})})]})}):r.jsx(Or,{title:"Brokerage Resources",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(dh,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Resource not found"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"This resource may have been removed or is not available."}),r.jsx(te,{asChild:!0,className:"mt-4",children:r.jsx(ao,{to:"/brokerage-resources",children:"Back to Resources"})})]})})};function Igt(){const{onlineUsers:t,totalOnline:e}=LOe();return r.jsxs(Ye,{children:[r.jsx(Ht,{className:"pb-3",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Yt,{className:"text-base flex items-center gap-2",children:[r.jsx(hs,{className:"h-4 w-4"}),"Online Now"]}),r.jsxs(Rt,{variant:"secondary",className:"bg-green-100 text-green-700",children:[r.jsx(Mu,{className:"h-2 w-2 fill-green-500 text-green-500 mr-1"}),e," online"]})]})}),r.jsx(Je,{children:t.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No other users online right now"}):r.jsx(xl,{className:"h-[300px] pr-4",children:r.jsx("div",{className:"space-y-3",children:t.map(n=>{var s;return r.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-lg hover:bg-muted/50 transition-colors",children:[r.jsxs("div",{className:"relative",children:[r.jsxs(Li,{className:"h-9 w-9",children:[r.jsx(Io,{src:n.avatarUrl,alt:n.name}),r.jsx(Oi,{className:"text-xs",children:(s=n.name)==null?void 0:s.split(" ").map(i=>i[0]).join("").slice(0,2).toUpperCase()})]}),r.jsx("span",{className:"absolute bottom-0 right-0 h-2.5 w-2.5 rounded-full bg-green-500 ring-2 ring-background"})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:n.name}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Online ",Yd(new Date(n.onlineSince),{addSuffix:!1})]})]})]},n.id)})})})})]})}const pke={users:{label:"Users & Access",sections:[{title:"Members",description:"Manage users, roles, and brokerage assignments",icon:hs,path:"/admin/members",color:"bg-blue-500/10 text-blue-600"},{title:"Invite Codes",description:"Create and manage signup invite codes",icon:CT,path:"/admin/invite-codes",color:"bg-amber-500/10 text-amber-600"},{title:"Subscriptions",description:"Track and manage user subscriptions",icon:q0,path:"/admin/subscriptions",color:"bg-gradient-to-br from-green-500/20 to-green-500/10 text-green-600"},{title:"Subscription Discounts",description:"Create and manage coupon codes",icon:Gw,path:"/admin/discounts",color:"bg-red-500/10 text-red-600"},{title:"Referral Program",description:"Track brokerage referrals and discounts",icon:Kd,path:"/admin/referrals",color:"bg-teal-500/10 text-teal-600"}]},content:{label:"Content",sections:[{title:"Manage Templates",description:"Upload and organize Canva templates",icon:Gd,path:"/admin/templates",color:"bg-pink-500/10 text-pink-600"},{title:"Manage Academy",description:"Upload videos and training content",icon:W0,path:"/admin/academy",color:"bg-indigo-500/10 text-indigo-600"},{title:"Manage Toolbox",description:"Create and manage resource kits",icon:Iy,path:"/admin/toolbox",color:"bg-orange-500/10 text-orange-600"},{title:"Social Swag",description:"Manage social media content and links",icon:Mi,path:"/admin/social-swag",color:"bg-fuchsia-500/10 text-fuchsia-600"},{title:"Social Swag 2.0",description:"New monthly social media images",icon:Mi,path:"/admin/social-swag-2",color:"bg-cyan-500/10 text-cyan-600"},{title:"Newsletters",description:"Manage monthly newsletter templates",icon:Ay,path:"/admin/newsletters",color:"bg-violet-500/10 text-violet-600"},{title:"Manage Events",description:"Create and publish events with Zoom integration",icon:em,path:"/admin/events",color:"bg-green-500/10 text-green-600"},{title:"Additional Services",description:"Manage additional service offerings",icon:dh,path:"/admin/additional-services",color:"bg-lime-500/10 text-lime-600"},{title:"Brokerage Resources",description:"Manage resources for brokerage managers",icon:dh,path:"/admin/brokerage-resources",color:"bg-slate-500/10 text-slate-600"}]},platform:{label:"Platform",sections:[{title:"Dashboard Management",description:"Configure banners and dashboard modules",icon:$S,path:"/admin/dashboard-management",color:"bg-teal-500/10 text-teal-600"},{title:"Manage Apps",description:"Configure app tiles and access requirements",icon:Th,path:"/admin/apps",color:"bg-purple-500/10 text-purple-600"},{title:"Email Templates",description:"Customize system email templates",icon:di,path:"/admin/email-templates",color:"bg-sky-500/10 text-sky-600"},{title:"The LevelUp Brief",description:"Create popup briefs with videos, links, and polls",icon:nm,path:"/admin/levelup-brief",color:"bg-gradient-to-br from-primary/20 to-primary/10 text-primary"},{title:"Onboarding Checklist",description:"Manage getting started tasks for new users",icon:aT,path:"/admin/onboarding-checklist",color:"bg-emerald-500/10 text-emerald-600"},{title:"Marketplace",description:"Manage store categories, products, and orders",icon:ug,path:"/admin/marketplace",color:"bg-gradient-to-br from-orange-500/20 to-amber-500/10 text-orange-600"},{title:"Reward Store",description:"Manage reward items agents can redeem with points",icon:Qa,path:"/admin/reward-store",color:"bg-purple-500/10 text-purple-600"},{title:"Agent Points",description:"View agent points, leaderboard, and award bonus points",icon:qa,path:"/admin/agent-points",color:"bg-amber-500/10 text-amber-600"},{title:"Integrations",description:"Connect Facebook & Instagram for social posting",icon:Rf,path:"/admin/integrations",color:"bg-blue-500/10 text-blue-600"},{title:"Notification Settings",description:"Test and manage push notifications",icon:nm,path:"/admin/notification-settings",color:"bg-rose-500/10 text-rose-600"}]},community:{label:"Community & Support",sections:[{title:"Community Management",description:"Manage categories and private groups",icon:Wl,path:"/admin/community",color:"bg-cyan-500/10 text-cyan-600"},{title:"Support Tickets",description:"View and respond to agent support requests",icon:qS,path:"/admin/support-tickets",color:"bg-rose-500/10 text-rose-600"},{title:"Wishlist",description:"Review and manage community feature requests",icon:K0,path:"/admin/wishlist",color:"bg-yellow-500/10 text-yellow-600"},{title:"Membership Reviews",description:"View member feedback and ratings",icon:Ca,path:"/admin/membership-reviews",color:"bg-amber-500/10 text-amber-600"},{title:"Weekly Digest",description:"Configure automated weekly email digests",icon:di,path:"/admin/weekly-digest",color:"bg-indigo-500/10 text-indigo-600"}]},insights:{label:"Insights",sections:[{title:"Analytics",description:"View activity logs and platform statistics",icon:xc,path:"/admin/analytics",color:"bg-emerald-500/10 text-emerald-600"}]},"agent-os":{label:"Agent OS",sections:[{title:"Agent OS Control Center",description:"Manage InnerCircle feature: relationship types, action types, scripts, plans & feature flags",icon:ql,path:"/admin/agent-os",color:"bg-gradient-to-br from-rose-500/20 to-pink-500/10 text-rose-600"},{title:"Listing Exchange",description:"Approve, feature, and moderate community listings",icon:Hi,path:"/admin/listing-exchange",color:"bg-gradient-to-br from-blue-500/20 to-sky-500/10 text-blue-600"}]}};function Pgt(){const t=es();return r.jsx(Or,{title:"Admin Dashboard",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col lg:flex-row gap-6",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Admin Dashboard"}),r.jsx("p",{className:"text-muted-foreground",children:"Manage all aspects of your platform"})]}),r.jsx("div",{className:"w-full lg:w-80",children:r.jsx(Igt,{})})]}),r.jsxs(La,{defaultValue:"users",className:"w-full",children:[r.jsx(Ma,{className:"w-full justify-start flex-wrap h-auto gap-1 bg-muted/50 p-1",children:Object.entries(pke).map(([e,n])=>r.jsx(yn,{value:e,className:"data-[state=active]:bg-background",children:n.label},e))}),Object.entries(pke).map(([e,n])=>r.jsx($n,{value:e,className:"mt-6",children:r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:n.sections.map(s=>r.jsxs(Ye,{className:"cursor-pointer hover:shadow-md transition-all hover:border-primary/50 group",onClick:()=>t(s.path),children:[r.jsxs(Ht,{className:"pb-3",children:[r.jsx("div",{className:`w-10 h-10 rounded-lg flex items-center justify-center ${s.color} mb-2 group-hover:scale-110 transition-transform`,children:r.jsx(s.icon,{className:"h-5 w-5"})}),r.jsx(Yt,{className:"text-base",children:s.title})]}),r.jsx(Je,{className:"pt-0",children:r.jsx(An,{className:"text-sm",children:s.description})})]},s.path))})},e))]})]})})}const $s=P.forwardRef(({className:t,...e},n)=>r.jsx("div",{className:"relative w-full overflow-auto",children:r.jsx("table",{ref:n,className:zt("w-full caption-bottom text-sm",t),...e})}));$s.displayName="Table";const Us=P.forwardRef(({className:t,...e},n)=>r.jsx("thead",{ref:n,className:zt("[&_tr]:border-b",t),...e}));Us.displayName="TableHeader";const qs=P.forwardRef(({className:t,...e},n)=>r.jsx("tbody",{ref:n,className:zt("[&_tr:last-child]:border-0",t),...e}));qs.displayName="TableBody";const Lgt=P.forwardRef(({className:t,...e},n)=>r.jsx("tfoot",{ref:n,className:zt("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));Lgt.displayName="TableFooter";const Er=P.forwardRef(({className:t,...e},n)=>r.jsx("tr",{ref:n,className:zt("border-b transition-colors data-[state=selected]:bg-muted hover:bg-muted/50",t),...e}));Er.displayName="TableRow";const At=P.forwardRef(({className:t,...e},n)=>r.jsx("th",{ref:n,className:zt("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...e}));At.displayName="TableHead";const _t=P.forwardRef(({className:t,...e},n)=>r.jsx("td",{ref:n,className:zt("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...e}));_t.displayName="TableCell";const Ogt=P.forwardRef(({className:t,...e},n)=>r.jsx("caption",{ref:n,className:zt("mt-4 text-sm text-muted-foreground",t),...e}));Ogt.displayName="TableCaption";const Dgt=()=>{const{isAdmin:t}=Fr(),e=es(),[n,s]=P.useState([]),[i,o]=P.useState(!0),[c,a]=P.useState(!1),[f,m]=P.useState(null);P.useEffect(()=>{if(!t){e("/dashboard");return}y()},[t]);const y=async()=>{try{const{data:S,error:T}=await ee.from("app_tiles").select("*").order("name");if(T)throw T;s(S||[])}catch(S){console.error("Error loading apps:",S),Ge.error("Failed to load apps")}finally{o(!1)}},v=async S=>{S.preventDefault();const T=new FormData(S.currentTarget),I={name:T.get("name"),description:T.get("description"),icon:T.get("icon"),app_id:T.get("app_id"),target_url:T.get("target_url"),required_tags:T.get("required_tags").split(",").map(A=>A.trim()).filter(Boolean)};try{if(f){const{error:A}=await ee.from("app_tiles").update(I).eq("id",f.id);if(A)throw A;Ge.success("App updated successfully")}else{const{error:A}=await ee.from("app_tiles").insert([I]);if(A)throw A;Ge.success("App created successfully")}a(!1),m(null),y()}catch(A){console.error("Error saving app:",A),Ge.error("Failed to save app")}},w=async S=>{if(confirm("Are you sure you want to delete this app?"))try{const{error:T}=await ee.from("app_tiles").delete().eq("id",S);if(T)throw T;Ge.success("App deleted successfully"),y()}catch(T){console.error("Error deleting app:",T),Ge.error("Failed to delete app")}},k=S=>{m(S),a(!0)},C=()=>{m(null),a(!0)};return i?r.jsx("div",{className:"flex items-center justify-center min-h-screen",children:"Loading..."}):r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"border-b bg-card",children:r.jsx("div",{className:"container mx-auto px-4 py-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>e("/dashboard"),children:[r.jsx(Va,{className:"h-4 w-4 mr-2"}),"Back"]}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Manage Apps"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Create and configure application tiles"})]})]}),r.jsxs($r,{open:c,onOpenChange:a,children:[r.jsx(Lo,{asChild:!0,children:r.jsxs(te,{onClick:C,children:[r.jsx(Sn,{className:"mr-2 h-4 w-4"}),"Add App"]})}),r.jsxs(zr,{className:"max-w-2xl",children:[r.jsxs(Zr,{children:[r.jsx(Kr,{children:f?"Edit App":"Create New App"}),r.jsx(ls,{children:"Configure the application tile settings"})]}),r.jsxs("form",{onSubmit:v,className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"name",children:"App Name"}),r.jsx(yt,{id:"name",name:"name",defaultValue:f==null?void 0:f.name,required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"app_id",children:"App ID"}),r.jsx(yt,{id:"app_id",name:"app_id",defaultValue:f==null?void 0:f.app_id,placeholder:"agent_connect",required:!0})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",name:"description",defaultValue:f==null?void 0:f.description})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"icon",children:"Icon (emoji)"}),r.jsx(yt,{id:"icon",name:"icon",defaultValue:f==null?void 0:f.icon,placeholder:"🚀",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"target_url",children:"Target URL"}),r.jsx(yt,{id:"target_url",name:"target_url",type:"url",defaultValue:f==null?void 0:f.target_url,required:!0})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"required_tags",children:"Required Tags (comma-separated)"}),r.jsx(yt,{id:"required_tags",name:"required_tags",defaultValue:f==null?void 0:f.required_tags.join(", "),placeholder:"levelup-member, agent-connect"})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsx(te,{type:"submit",children:f?"Update":"Create"})]})]})]})]})]})})}),r.jsx("div",{className:"container mx-auto px-4 py-8",children:r.jsxs(Ye,{children:[r.jsxs(Ht,{children:[r.jsx(Yt,{children:"Application Tiles"}),r.jsx(An,{children:"Manage the apps that appear on the member dashboard"})]}),r.jsx(Je,{children:n.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"No apps configured yet"}),r.jsxs(te,{onClick:C,children:[r.jsx(Sn,{className:"mr-2 h-4 w-4"}),"Create First App"]})]}):r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"Icon"}),r.jsx(At,{children:"Name"}),r.jsx(At,{children:"App ID"}),r.jsx(At,{children:"Target URL"}),r.jsx(At,{children:"Tags"}),r.jsx(At,{className:"text-right",children:"Actions"})]})}),r.jsx(qs,{children:n.map(S=>r.jsxs(Er,{children:[r.jsx(_t,{className:"text-2xl",children:S.icon}),r.jsx(_t,{className:"font-medium",children:S.name}),r.jsx(_t,{className:"font-mono text-sm",children:S.app_id}),r.jsx(_t,{className:"text-sm text-muted-foreground max-w-xs truncate",children:S.target_url}),r.jsx(_t,{children:r.jsx("div",{className:"flex flex-wrap gap-1",children:S.required_tags.map(T=>r.jsx("span",{className:"text-xs bg-secondary text-secondary-foreground px-2 py-1 rounded",children:T},T))})}),r.jsx(_t,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>k(S),children:r.jsx(ma,{className:"h-4 w-4"})}),r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>w(S.id),children:r.jsx(Xn,{className:"h-4 w-4"})})]})})]},S.id))})]})})]})})]})};function Ou({title:t,description:e,children:n}){return r.jsxs("div",{className:"space-y-4",children:[r.jsx(ao,{to:"/admin",children:r.jsxs(te,{variant:"ghost",size:"sm",className:"gap-2 text-muted-foreground hover:text-foreground",children:[r.jsx(Va,{className:"h-4 w-4"}),"Back to Admin Dashboard"]})}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:t}),e&&r.jsx("p",{className:"text-muted-foreground",children:e})]}),n]})]})}const mke=({expiresAt:t,className:e})=>{const n=new Date().getTime(),s=new Date(t).getTime(),i=Math.ceil((s-n)/(1e3*60*60*24));return i<=0?r.jsxs(Rt,{variant:"destructive",className:zt("gap-1",e),children:[r.jsx(Ph,{className:"h-3 w-3"}),"Trial Expired"]}):i<=1?r.jsxs(Rt,{variant:"destructive",className:zt("gap-1",e),children:[r.jsx(Xi,{className:"h-3 w-3"}),"Trial: <1 day left"]}):i<=3?r.jsxs(Rt,{className:zt("gap-1 bg-amber-500 hover:bg-amber-600",e),children:[r.jsx(Xi,{className:"h-3 w-3"}),"Trial: ",i," days left"]}):r.jsxs(Rt,{variant:"secondary",className:zt("gap-1",e),children:[r.jsx(Xi,{className:"h-3 w-3"}),"Trial: ",i," days left"]})},H8e=({open:t,onOpenChange:e,brokerages:n,fixedBrokerageId:s,onSuccess:i})=>{const{toast:o}=la(),c=P.useRef(null),[a,f]=P.useState([]),[m,y]=P.useState(""),[v,w]=P.useState(!1),[k,C]=P.useState("upload"),[S,T]=P.useState(null),I=()=>{f([]),y(""),C("upload"),T(null),c.current&&(c.current.value="")},A=()=>{I(),e(!1)},D=K=>{const Z=K.split(` `).map(se=>se.trim()).filter(se=>se);if(Z.length===0)return[];const re=Z[0].toLowerCase(),ue=re.includes("first")||re.includes("last")||re.includes("email")||re.includes("name")||re.includes("phone")||re.includes("sms")||re.includes("consent")?Z.slice(1):Z,Ne=[];for(const se of ue){const ie=(se.includes(" ")?se.split(" "):se.split(",")).map(me=>me.trim().replace(/^["']|["']$/g,""));if(ie.length>=2){let me="",fe="",ve="",Ie="",Se;if(ie.length===2){const je=ie[0].split(" ");me=je[0]||"",fe=je.slice(1).join(" ")||"",ve=ie[1]}else if(ie.length===3)me=ie[0],fe=ie[1],ve=ie[2];else if(ie.length===4)me=ie[0],fe=ie[1],ve=ie[2],Ie=ie[3];else if(ie.length>=5){me=ie[0],fe=ie[1],ve=ie[2],Ie=ie[3];const je=ie[4].toLowerCase();Se=je==="true"||je==="yes"||je==="1"||je==="y"}const ae=/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(ve);Ne.push({firstName:me.trim(),lastName:fe.trim(),email:ve.trim().toLowerCase(),phone:Ie.trim()||void 0,smsConsent:Se,isValid:ae&&me.trim().length>0,error:ae?me.trim()?void 0:"Missing name":"Invalid email"})}}return Ne},$=K=>{var he;const Z=(he=K.target.files)==null?void 0:he[0];if(!Z)return;const re=new FileReader;re.onload=ue=>{var xe;const Ne=(xe=ue.target)==null?void 0:xe.result,se=D(Ne);if(se.length===0){o({title:"No data found",description:"The CSV file appears to be empty or in an unsupported format.",variant:"destructive"});return}f(se),C("preview")},re.readAsText(Z)},F=async()=>{const K=a.filter(re=>re.isValid);if(K.length===0){o({title:"No valid users",description:"There are no valid users to import.",variant:"destructive"});return}const Z=s||m||null;w(!0);try{const{data:{session:re}}=await ee.auth.getSession(),he=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/bulk-create-users",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${re==null?void 0:re.access_token}`},body:JSON.stringify({users:K.map(Ne=>({firstName:Ne.firstName,lastName:Ne.lastName,email:Ne.email,phone:Ne.phone,smsConsent:Ne.smsConsent})),brokerageId:Z})}),ue=await he.json();if(!he.ok)throw new Error(ue.error||"Failed to import users");T(ue),C("result"),ue.created>0&&i(),o({title:"Import Complete",description:`${ue.created} user(s) created successfully.${ue.failed>0?` ${ue.failed} failed.`:""}`})}catch(re){console.error("Import error:",re),o({title:"Import Failed",description:re.message||"Failed to import users",variant:"destructive"})}finally{w(!1)}},q=a.filter(K=>K.isValid).length,W=a.filter(K=>!K.isValid).length;return r.jsx($r,{open:t,onOpenChange:A,children:r.jsxs(zr,{className:"max-w-2xl max-h-[85vh] overflow-hidden flex flex-col",children:[r.jsxs(Zr,{children:[r.jsxs(Kr,{className:"flex items-center gap-2",children:[r.jsx(H0,{className:"h-5 w-5"}),"Import Agents from CSV"]}),r.jsx(ls,{children:"Upload a CSV file with agent information. Each row should contain First Name, Last Name, and Email."})]}),k==="upload"&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-8 text-center",children:[r.jsx("input",{type:"file",accept:".csv,.txt",ref:c,onChange:$,className:"hidden"}),r.jsx(Ao,{className:"h-10 w-10 mx-auto text-muted-foreground mb-4"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Click to upload or drag and drop a CSV file"}),r.jsx(te,{onClick:()=>{var K;return(K=c.current)==null?void 0:K.click()},children:"Select CSV File"})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 text-sm",children:[r.jsx("p",{className:"font-medium mb-2",children:"Expected CSV Format:"}),r.jsxs("code",{className:"text-xs block bg-background p-2 rounded",children:["First Name, Last Name, Email, Phone, SMS Consent",r.jsx("br",{}),"John, Doe, john@example.com, 555-123-4567, yes",r.jsx("br",{}),"Jane, Smith, jane@example.com, 555-987-6543, true"]}),r.jsx("p",{className:"text-muted-foreground mt-2 text-xs",children:"Phone and SMS Consent columns are optional. SMS Consent accepts: yes/no, true/false, 1/0, y/n."})]})]}),k==="preview"&&r.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col space-y-4",children:[!s&&n&&n.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Assign to Brokerage (optional)"}),r.jsxs(_n,{value:m||"none",onValueChange:K=>y(K==="none"?"":K),children:[r.jsx(xn,{children:r.jsx(bn,{placeholder:"Select a brokerage..."})}),r.jsxs(vn,{children:[r.jsx(er,{value:"none",children:"No brokerage"}),n.map(K=>r.jsx(er,{value:K.id,children:K.name},K.id))]})]})]}),r.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(io,{className:"h-4 w-4 text-green-500"}),r.jsxs("span",{children:[q," valid"]})]}),W>0&&r.jsxs("div",{className:"flex items-center gap-2 text-destructive",children:[r.jsx(Bl,{className:"h-4 w-4"}),r.jsxs("span",{children:[W," invalid"]})]})]}),r.jsxs("div",{className:"flex-1 overflow-auto border rounded-lg",children:[r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{className:"bg-muted/30",children:[r.jsx(At,{children:"First Name"}),r.jsx(At,{children:"Last Name"}),r.jsx(At,{children:"Email"}),r.jsx(At,{children:"Phone"}),r.jsx(At,{children:"SMS"}),r.jsx(At,{children:"Status"})]})}),r.jsx(qs,{children:a.slice(0,100).map((K,Z)=>r.jsxs(Er,{children:[r.jsx(_t,{children:K.firstName}),r.jsx(_t,{children:K.lastName}),r.jsx(_t,{children:K.email}),r.jsx(_t,{className:"text-muted-foreground",children:K.phone||"-"}),r.jsx(_t,{className:"text-muted-foreground",children:K.smsConsent===!0?"✓":K.smsConsent===!1?"✗":"-"}),r.jsx(_t,{children:K.isValid?r.jsx(Rt,{variant:"default",className:"bg-green-500/10 text-green-600",children:"Valid"}):r.jsx(Rt,{variant:"destructive",children:K.error||"Invalid"})})]},Z))})]}),a.length>100&&r.jsxs("p",{className:"text-sm text-muted-foreground text-center py-2",children:["Showing first 100 of ",a.length," users"]})]})]}),k==="result"&&S&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"text-center",children:[r.jsx(io,{className:"h-12 w-12 mx-auto text-green-500 mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Import Complete"}),r.jsxs("p",{className:"text-muted-foreground mt-2",children:[S.created," agent(s) created and invited"]}),S.failed>0&&r.jsxs("p",{className:"text-destructive mt-1",children:[S.failed," failed to create"]})]}),S.errors.length>0&&r.jsxs("div",{className:"bg-destructive/10 border border-destructive/20 rounded-lg p-4 max-h-40 overflow-auto",children:[r.jsx("p",{className:"font-medium text-destructive text-sm mb-2",children:"Errors:"}),r.jsxs("ul",{className:"text-sm text-muted-foreground space-y-1",children:[S.errors.slice(0,10).map((K,Z)=>r.jsxs("li",{children:["• ",K]},Z)),S.errors.length>10&&r.jsxs("li",{children:["...and ",S.errors.length-10," more"]})]})]})]}),r.jsxs(ni,{children:[k==="upload"&&r.jsx(te,{variant:"outline",onClick:A,children:"Cancel"}),k==="preview"&&r.jsxs(r.Fragment,{children:[r.jsx(te,{variant:"outline",onClick:I,children:"Back"}),r.jsx(te,{onClick:F,disabled:v||q===0,children:v?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"mr-2 h-4 w-4 animate-spin"}),"Importing..."]}):`Import ${q} Agent${q!==1?"s":""}`})]}),k==="result"&&r.jsx(te,{onClick:A,children:"Done"})]})]})})},Rgt=[{type:"custom",title:"Great job!",message:"Keep up the amazing work!",icon:Ca},{type:"custom",title:"You're on fire!",message:"Your dedication is inspiring!",icon:qa},{type:"custom",title:"Congratulations!",message:"You earned this celebration!",icon:$h}];function W8e({open:t,onOpenChange:e,userId:n,userName:s}){const[i,o]=P.useState("custom"),[c,a]=P.useState(""),[f,m]=P.useState(""),y=Trt(),v=k=>{o(k.type),a(k.title),m(k.message)},w=async k=>{if(k.preventDefault(),!c.trim()){Wi({title:"Title required",description:"Please enter a celebration title",variant:"destructive"});return}try{await y.mutateAsync({user_id:n,celebration_type:i,title:c.trim(),message:f.trim()||void 0}),Wi({title:"Celebration sent! 🎉",description:`${s} will see confetti on their next visit!`}),e(!1),a(""),m(""),o("custom")}catch{Wi({title:"Error",description:"Failed to send celebration",variant:"destructive"})}};return r.jsx($r,{open:t,onOpenChange:e,children:r.jsxs(zr,{className:"sm:max-w-md",children:[r.jsxs(Zr,{children:[r.jsxs(Kr,{className:"flex items-center gap-2",children:[r.jsx($h,{className:"h-5 w-5 text-primary"}),"Send Celebration to ",s]}),r.jsx(ls,{children:"They'll see confetti and this message next time they log in!"})]}),r.jsxs("div",{className:"mb-4",children:[r.jsx(Qe,{className:"text-sm text-muted-foreground mb-2 block",children:"Quick presets:"}),r.jsx("div",{className:"flex gap-2 flex-wrap",children:Rgt.map((k,C)=>r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>v(k),className:"text-xs",children:[r.jsx(k.icon,{className:"h-3 w-3 mr-1"}),k.title]},C))})]}),r.jsxs("form",{onSubmit:w,className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"type",children:"Celebration Type"}),r.jsxs(_n,{value:i,onValueChange:k=>o(k),children:[r.jsx(xn,{children:r.jsx(bn,{})}),r.jsxs(vn,{children:[r.jsx(er,{value:"custom",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ca,{className:"h-4 w-4"})," Custom"]})}),r.jsx(er,{value:"points_earned",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(qa,{className:"h-4 w-4"})," Points Earned"]})}),r.jsx(er,{value:"listing_created",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Hi,{className:"h-4 w-4"})," Listing Created"]})}),r.jsx(er,{value:"deal_closed",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Cd,{className:"h-4 w-4"})," Deal Closed"]})})]})]})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"title",children:"Title *"}),r.jsx(yt,{id:"title",value:c,onChange:k=>a(k.target.value),placeholder:"e.g., Congratulations!",maxLength:100})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"message",children:"Message (optional)"}),r.jsx(ps,{id:"message",value:f,onChange:k=>m(k.target.value),placeholder:"Add a personal message...",rows:3,maxLength:500})]}),r.jsxs("div",{className:"flex gap-2 justify-end",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsxs(te,{type:"submit",disabled:y.isPending,children:[r.jsx($h,{className:"h-4 w-4 mr-2"}),y.isPending?"Sending...":"Send Celebration"]})]})]})]})})}const Kle={points_earned:{label:"Points Earned",icon:qa,color:"bg-yellow-500"},listing_created:{label:"Listing Created",icon:Hi,color:"bg-blue-500"},deal_closed:{label:"Deal Closed",icon:Cd,color:"bg-green-500"},custom:{label:"Custom",icon:Mi,color:"bg-purple-500"}};function Fgt(){const[t,e]=P.useState(""),[n,s]=P.useState("all"),[i,o]=P.useState("all"),{data:c=[],isLoading:a}=rr({queryKey:["admin-celebrations"],queryFn:async()=>{const{data:y,error:v}=await ee.from("celebration_queue").select("*").order("created_at",{ascending:!1}).limit(500);if(v)throw v;const w=[...new Set([...y.map(S=>S.user_id),...y.map(S=>S.created_by).filter(Boolean)])],{data:k}=await ee.from("profiles").select("id, name, email").in("id",w),C=new Map((k==null?void 0:k.map(S=>[S.id,S]))||[]);return y.map(S=>{var T,I,A;return{...S,user_name:((T=C.get(S.user_id))==null?void 0:T.name)||"Unknown",user_email:((I=C.get(S.user_id))==null?void 0:I.email)||"",creator_name:S.created_by?((A=C.get(S.created_by))==null?void 0:A.name)||"System":"Auto-triggered"}})}}),f=c.filter(y=>{var C,S;const v=((C=y.user_name)==null?void 0:C.toLowerCase().includes(t.toLowerCase()))||((S=y.user_email)==null?void 0:S.toLowerCase().includes(t.toLowerCase()))||y.title.toLowerCase().includes(t.toLowerCase()),w=n==="all"||y.celebration_type===n,k=i==="all"||i==="seen"&&y.seen_at||i==="unseen"&&!y.seen_at;return v&&w&&k}),m={total:c.length,seen:c.filter(y=>y.seen_at).length,unseen:c.filter(y=>!y.seen_at).length,byType:Object.keys(Kle).reduce((y,v)=>(y[v]=c.filter(w=>w.celebration_type===v).length,y),{})};return a?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(sn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid gap-4 md:grid-cols-4",children:[r.jsxs(Ye,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium",children:"Total Celebrations"})}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:m.total})})]}),r.jsxs(Ye,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-green-600",children:"Seen"})}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold text-green-600",children:m.seen})})]}),r.jsxs(Ye,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-orange-600",children:"Pending"})}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold text-orange-600",children:m.unseen})})]}),r.jsxs(Ye,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-purple-600",children:"Custom Sent"})}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold text-purple-600",children:m.byType.custom||0})})]})]}),r.jsxs(Ye,{children:[r.jsxs(Ht,{children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx($h,{className:"h-5 w-5"}),"Celebration History"]}),r.jsx(An,{children:"View all celebrations awarded to agents"})]}),r.jsxs(Je,{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Ti,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(yt,{placeholder:"Search by agent name, email, or title...",value:t,onChange:y=>e(y.target.value),className:"pl-9"})]}),r.jsxs(_n,{value:n,onValueChange:s,children:[r.jsx(xn,{className:"w-[180px]",children:r.jsx(bn,{placeholder:"Filter by type"})}),r.jsxs(vn,{children:[r.jsx(er,{value:"all",children:"All Types"}),Object.entries(Kle).map(([y,v])=>r.jsx(er,{value:y,children:v.label},y))]})]}),r.jsxs(_n,{value:i,onValueChange:o,children:[r.jsx(xn,{className:"w-[140px]",children:r.jsx(bn,{placeholder:"Status"})}),r.jsxs(vn,{children:[r.jsx(er,{value:"all",children:"All Status"}),r.jsx(er,{value:"seen",children:"Seen"}),r.jsx(er,{value:"unseen",children:"Pending"})]})]})]}),r.jsx("div",{className:"rounded-md border",children:r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"Type"}),r.jsx(At,{children:"Agent"}),r.jsx(At,{children:"Title"}),r.jsx(At,{children:"Points"}),r.jsx(At,{children:"Created By"}),r.jsx(At,{children:"Created"}),r.jsx(At,{children:"Status"})]})}),r.jsx(qs,{children:f.length===0?r.jsx(Er,{children:r.jsx(_t,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"No celebrations found"})}):f.map(y=>{const v=Kle[y.celebration_type],w=v.icon;return r.jsxs(Er,{children:[r.jsx(_t,{children:r.jsxs(Rt,{variant:"outline",className:"gap-1",children:[r.jsx(w,{className:"h-3 w-3"}),v.label]})}),r.jsx(_t,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:y.user_name}),r.jsx("div",{className:"text-xs text-muted-foreground",children:y.user_email})]})}),r.jsx(_t,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:y.title}),y.message&&r.jsx("div",{className:"text-xs text-muted-foreground truncate max-w-[200px]",children:y.message})]})}),r.jsx(_t,{children:y.points_amount?r.jsxs(Rt,{variant:"secondary",children:["+",y.points_amount]}):r.jsx("span",{className:"text-muted-foreground",children:"-"})}),r.jsx(_t,{children:r.jsx("span",{className:"text-sm text-muted-foreground",children:y.creator_name})}),r.jsx(_t,{children:r.jsx("span",{className:"text-sm text-muted-foreground",children:un(new Date(y.created_at),"MMM d, yyyy h:mm a")})}),r.jsx(_t,{children:y.seen_at?r.jsx(Rt,{variant:"outline",className:"bg-green-50 text-green-700 border-green-200",children:"Seen"}):r.jsx(Rt,{variant:"outline",className:"bg-orange-50 text-orange-700 border-orange-200",children:"Pending"})})]},y.id)})})]})}),f.length>0&&r.jsxs("p",{className:"text-sm text-muted-foreground text-right",children:["Showing ",f.length," of ",c.length," celebrations"]})]})]})]})}const zgt=()=>{const t=es(),{user:e,isAdmin:n}=Fr(),{startImpersonation:s,isLoading:i}=TIe(),{toast:o}=la(),[c,a]=P.useState([]),[f,m]=P.useState([]),[y,v]=P.useState([]),[w,k]=P.useState({}),[C,S]=P.useState(!0),[T,I]=P.useState({}),[A,D]=P.useState(!1),[$,F]=P.useState({email:"",name:"",password:"",brokerage_id:"",role:"user",phone:"",trial_days:""}),[q,W]=P.useState(!1),[K,Z]=P.useState(""),[re,he]=P.useState(1),[ue,Ne]=P.useState(50),[se,xe]=P.useState("all"),[ie,me]=P.useState("all"),[fe,ve]=P.useState("all"),[Ie,Se]=P.useState("all"),[oe,ae]=P.useState(!1),[je,Me]=P.useState(!1),[Ue,Re]=P.useState(null),[$e,Pe]=P.useState(null),[Ae,nt]=P.useState(!1),[Te,Xe]=P.useState({name:"",email:"",brokerage_id:"",phone:""}),[ge,mt]=P.useState(null),[rt,We]=P.useState(!1),[Ce,et]=P.useState(""),[Fe,Ke]=P.useState(!1),[Le,ft]=P.useState(!1),[Nt,Mt]=P.useState(null),[It,tr]=P.useState(""),[Mr,pn]=P.useState(!1),[fs,Qn]=P.useState(!1),[js,Qs]=P.useState(null),[si,wr]=P.useState(!1),[Ts,ii]=P.useState(!1),[mi,Ta]=P.useState(null),[ga,vl]=P.useState(""),[Yo,Ds]=P.useState(!1),[Ki,_s]=P.useState({email:"",name:"",password:"",phone:""}),[yi,Ni]=P.useState(!1),[Oo,sr]=P.useState(!1),[fo,lc]=P.useState(""),[po,Qr]=P.useState(!1),[ba,Ka]=P.useState(!1),[dr,Ln]=P.useState(""),[xt,_e]=P.useState(new Set),[ze,tt]=P.useState(!1),[kt,bt]=P.useState(!1),[Et,$t]=P.useState(null),[Ot,Bt]=P.useState(!1),[mr,ir]=P.useState(null);P.useEffect(()=>{!e||!n||(en(),Br())},[e,n]);const Wr=async()=>{try{const{data:jt,error:Sr}=await ee.from("brokerage_manager_assignments").select("user_id, brokerage_id");if(Sr)throw Sr;const lr={};for(const ys of jt??[])lr[ys.brokerage_id]||(lr[ys.brokerage_id]=[]),lr[ys.brokerage_id].push(ys.user_id);k(lr)}catch(jt){console.error("Error loading brokerage manager assignments:",jt)}},en=async()=>{try{S(!0);const{data:jt,error:Sr}=await ee.functions.invoke("get-user-details");if(Sr)throw Sr;a(jt.users||[]),v(jt.brokerages||[]),await Wr()}catch(jt){console.error("Error loading members:",jt),o({title:"Error",description:"Failed to load members",variant:"destructive"})}finally{S(!1)}},Br=async()=>{try{const{data:jt,error:Sr}=await ee.from("app_tiles").select("id, name, icon, app_id, required_tags").order("name");if(Sr)throw Sr;m(jt||[])}catch(jt){console.error("Error loading apps:",jt),o({title:"Error",description:"Failed to load apps",variant:"destructive"})}},Zn=async jt=>{if(!Te.name.trim()||!Te.email.trim()){o({title:"Error",description:"Name and email are required",variant:"destructive"});return}if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(Te.email)){o({title:"Error",description:"Please enter a valid email address",variant:"destructive"});return}try{const{error:lr}=await ee.from("profiles").update({name:Te.name.trim(),email:Te.email.trim(),brokerage_id:Te.brokerage_id||null,phone:Te.phone.trim()||null}).eq("id",jt);if(lr)throw lr;o({title:"Success",description:"Member details updated successfully"}),Re(null),en()}catch(lr){console.error("Error updating member:",lr),o({title:"Error",description:lr.message||"Failed to update member",variant:"destructive"})}},Wn=async jt=>{try{const{data:{session:Sr}}=await ee.auth.getSession(),lr=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Sr==null?void 0:Sr.access_token}`},body:JSON.stringify({userId:jt})}),ys=await lr.json();if(!lr.ok)throw new Error(ys.error||"Failed to resend welcome email");o({title:"Success",description:"Welcome email sent successfully"})}catch(Sr){console.error("Error resending welcome email:",Sr),o({title:"Error",description:Sr.message||"Failed to resend welcome email",variant:"destructive"})}},Gn=async(jt,Sr)=>{try{const{error:lr}=await ee.functions.invoke("send-password-reset",{body:{email:jt,redirectTo:window.location.origin}});if(lr)throw lr;o({title:"Password Reset Sent",description:`Password reset email sent to ${Sr}`})}catch(lr){console.error("Error sending password reset:",lr),o({title:"Error",description:lr.message||"Failed to send password reset email",variant:"destructive"})}},Ps=async(jt,Sr)=>{if(confirm(`Are you sure you want to delete ${Sr}? This action cannot be undone.`))try{const{data:{session:lr}}=await ee.auth.getSession(),ys=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/delete-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${lr==null?void 0:lr.access_token}`},body:JSON.stringify({userId:jt})}),Ls=await ys.json();if(!ys.ok)throw new Error(Ls.error||"Failed to delete user");o({title:"Success",description:"User deleted successfully"}),en()}catch(lr){console.error("Error deleting user:",lr),o({title:"Error",description:lr.message||"Failed to delete user",variant:"destructive"})}},wa=async()=>{if(!$.email||!$.name||!$.password){o({title:"Error",description:"Please fill in all fields",variant:"destructive"});return}if($.role==="brokerage_manager"&&!$.brokerage_id){o({title:"Error",description:"Please select a brokerage for this manager",variant:"destructive"});return}D(!0);try{const{data:{session:jt}}=await ee.auth.getSession(),Sr=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/create-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${jt==null?void 0:jt.access_token}`},body:JSON.stringify($)}),lr=await Sr.json();if(!Sr.ok)throw new Error(lr.error||"Failed to create user");if($.role&&$.role!=="user"&&lr.userId){const ys=$.role==="brokerage_manager"?$.brokerage_id:void 0;await $a(lr.userId,$.role,"add",ys)}o({title:"Success",description:`User ${$.email} created successfully`}),F({email:"",name:"",password:"",brokerage_id:"",role:"user",phone:"",trial_days:""}),W(!1),en()}catch(jt){console.error("Error creating user:",jt),o({title:"Error",description:jt.message||"Failed to create user",variant:"destructive"})}finally{D(!1)}},$a=async(jt,Sr,lr,ys)=>{try{const{data:{session:Ls}}=await ee.auth.getSession(),jo={userId:jt,role:Sr,action:lr};if(Sr==="brokerage_manager"){if(!ys){o({title:"Error",description:"Please choose a brokerage for this manager assignment",variant:"destructive"});return}jo.brokerageId=ys}const eo=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Ls==null?void 0:Ls.access_token}`},body:JSON.stringify(jo)}),to=await eo.json();if(!eo.ok)throw new Error(to.error||"Failed to manage user role");o({title:"Success",description:`Role ${lr==="add"?"added":"removed"} successfully`}),en()}catch(Ls){console.error("Error managing user role:",Ls),o({title:"Error",description:Ls.message||"Failed to manage user role",variant:"destructive"})}},Aa=(jt,Sr)=>Sr.length===0?!0:Sr.some(lr=>jt.includes(lr)),lo=async(jt,Sr,lr)=>{const ys=`${jt}-${Sr.id}`;mt(ys);try{if(lr){const Ls=c.find(eo=>eo.id===jt),jo=Sr.required_tags.filter(eo=>Ls==null?void 0:Ls.tags.includes(eo));for(const eo of jo){const{error:to}=await ee.from("user_tags").delete().eq("user_id",jt).eq("tag",eo);if(to)throw to}o({title:"Access Removed",description:`Removed access to ${Sr.name}`})}else if(Sr.required_tags.length>0){const{error:Ls}=await ee.from("user_tags").insert({user_id:jt,tag:Sr.required_tags[0]});if(Ls)throw Ls;o({title:"Access Granted",description:`Granted access to ${Sr.name}`})}await en()}catch(Ls){console.error("Error toggling access:",Ls),o({title:"Error",description:Ls.message||"Failed to update access",variant:"destructive"})}finally{mt(null)}},ya=async()=>{const jt=Ce.trim();if(!jt){o({title:"Error",description:"Brokerage name is required",variant:"destructive"});return}if(jt.length>100){o({title:"Error",description:"Brokerage name must be less than 100 characters",variant:"destructive"});return}if(y.find(lr=>lr.name.toLowerCase()===jt.toLowerCase())){o({title:"Error",description:"A brokerage with this name already exists",variant:"destructive"});return}Ke(!0);try{const{error:lr}=await ee.from("brokerages").insert({name:jt});if(lr)throw lr;o({title:"Success",description:`Brokerage "${jt}" created successfully`}),et(""),We(!1),en()}catch(lr){console.error("Error creating brokerage:",lr),o({title:"Error",description:lr.message||"Failed to create brokerage",variant:"destructive"})}finally{Ke(!1)}},zs=jt=>{Mt(jt),tr(jt.name),ft(!0)},ca=()=>{Mt(null),tr(""),ft(!1)},Di=async()=>{if(!Nt)return;const jt=It.trim();if(!jt){o({title:"Error",description:"Brokerage name is required",variant:"destructive"});return}if(jt.length>100){o({title:"Error",description:"Brokerage name must be less than 100 characters",variant:"destructive"});return}pn(!0);try{const{error:Sr}=await ee.from("brokerages").update({name:jt}).eq("id",Nt.id);if(Sr)throw Sr;o({title:"Success",description:"Brokerage updated successfully"}),ca(),en()}catch(Sr){console.error("Error updating brokerage:",Sr),o({title:"Error",description:Sr.message||"Failed to update brokerage",variant:"destructive"})}finally{pn(!1)}},bs=async(jt,Sr)=>{var lr;if(!Sr||typeof Sr!="string"){o({title:"Error",description:"Please select a brokerage first",variant:"destructive"});return}try{const ys={userId:jt,role:"brokerage_manager",action:"add",brokerageId:Sr};console.debug("[assignManagerToBrokerage] payload",ys);const{data:{session:Ls}}=await ee.auth.getSession(),jo=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Ls==null?void 0:Ls.access_token}`},body:JSON.stringify(ys)}),eo=await jo.json();if(!jo.ok&&!((lr=eo.error)!=null&&lr.includes("duplicate")))throw new Error(eo.error||"Failed to add role");o({title:"Success",description:"Manager assigned to brokerage"}),await en()}catch(ys){console.error("Error assigning manager:",ys),o({title:"Error",description:ys.message||"Failed to assign manager",variant:"destructive"})}},Da=jt=>{Qs(jt),Qn(!0)},_l=async()=>{if(js){wr(!0);try{const jt=c.filter(ys=>ys.brokerage_id===js.id),{data:{session:Sr}}=await ee.auth.getSession();for(const ys of jt){const Ls=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/delete-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Sr==null?void 0:Sr.access_token}`},body:JSON.stringify({userId:ys.id})});if(!Ls.ok){const jo=await Ls.json();console.error(`Failed to delete user ${ys.email}:`,jo.error)}}const{error:lr}=await ee.from("brokerages").delete().eq("id",js.id);if(lr)throw lr;o({title:"Success",description:`Brokerage "${js.name}" and ${jt.length} member(s) deleted`}),Qn(!1),Qs(null),en()}catch(jt){console.error("Error deleting brokerage:",jt),o({title:"Error",description:jt.message||"Failed to delete brokerage",variant:"destructive"})}finally{wr(!1)}}},El=jt=>{Ta(jt),vl(""),ii(!0)},Nc=()=>{Ta(null),vl(""),ii(!1)},ep=async jt=>{try{const{error:Sr}=await ee.from("profiles").update({brokerage_id:null}).eq("id",jt);if(Sr)throw Sr;o({title:"Success",description:"User removed from brokerage"}),en()}catch(Sr){console.error("Error removing user from brokerage:",Sr),o({title:"Error",description:Sr.message||"Failed to remove user",variant:"destructive"})}},Xo=async(jt,Sr)=>{try{const{error:lr}=await ee.from("profiles").update({brokerage_id:Sr}).eq("id",jt);if(lr)throw lr;o({title:"Success",description:"User added to brokerage"}),en()}catch(lr){console.error("Error adding user to brokerage:",lr),o({title:"Error",description:lr.message||"Failed to add user",variant:"destructive"})}},hd=async()=>{if(!mi||!Ki.email||!Ki.name||!Ki.password){o({title:"Error",description:"Please fill in all fields",variant:"destructive"});return}Ni(!0);try{const{data:{session:jt}}=await ee.auth.getSession(),Sr=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/create-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${jt==null?void 0:jt.access_token}`},body:JSON.stringify({...Ki,brokerage_id:mi.id,role:"user"})}),lr=await Sr.json();if(!Sr.ok)throw new Error(lr.error||"Failed to create agent");o({title:"Success",description:`Agent ${Ki.email} created successfully`}),_s({email:"",name:"",password:"",phone:""}),Ds(!1),en()}catch(jt){console.error("Error creating agent:",jt),o({title:"Error",description:jt.message||"Failed to create agent",variant:"destructive"})}finally{Ni(!1)}},Qo=jt=>c.filter(Sr=>Sr.brokerage_id===jt),eu=jt=>{const Sr=Qo(jt);if(!ga)return Sr;const lr=ga.toLowerCase();return Sr.filter(ys=>ys.name.toLowerCase().includes(lr)||ys.email.toLowerCase().includes(lr))},Do=jt=>c.filter(Sr=>Sr.brokerage_id!==jt),ef=c.filter(jt=>{var Sr;if(K){const lr=K.toLowerCase();if(!(jt.name.toLowerCase().includes(lr)||jt.email.toLowerCase().includes(lr)||((Sr=jt.brokerage_name)==null?void 0:Sr.toLowerCase().includes(lr))))return!1}return!(se==="claimed"&&!jt.claimed||se==="unclaimed"&&jt.claimed||ie!=="all"&&!jt.roles.includes(ie)||fe==="trial"&&!jt.is_trial||fe==="non-trial"&&jt.is_trial||Ie==="none"&&jt.brokerage_id||Ie!=="all"&&Ie!=="none"&&jt.brokerage_id!==Ie)}),Du=ef.length,Yl=Math.ceil(Du/ue),tp=(re-1)*ue,xm=tp+ue,$c=ef.slice(tp,xm),Ru=jt=>{Z(jt),he(1)},Sc=jt=>{Ne(jt),he(1)},Uc=(jt,Sr)=>{jt(Sr),he(1)},fd=async(jt,Sr)=>{ae(!0);try{const lr=c.find(eo=>eo.id===jt);if(!lr)return;const ys=lr.trial_expires_at?new Date(lr.trial_expires_at):new Date,Ls=new Date(ys.getTime()+Sr*24*60*60*1e3),{error:jo}=await ee.from("profiles").update({trial_expires_at:Ls.toISOString()}).eq("id",jt);if(jo)throw jo;o({title:"Trial Extended",description:`Trial extended by ${Sr} days`}),en()}catch(lr){console.error("Error extending trial:",lr),o({title:"Error",description:lr.message||"Failed to extend trial",variant:"destructive"})}finally{ae(!1)}},Pd=async jt=>{Me(!0);try{const{error:Sr}=await ee.from("profiles").update({is_trial:!1,trial_expires_at:null,trial_started_at:null,trial_claimed_at:null}).eq("id",jt);if(Sr)throw Sr;o({title:"Account Converted",description:"User has been converted to a full account"}),en(),Fu()}catch(Sr){console.error("Error converting trial:",Sr),o({title:"Error",description:Sr.message||"Failed to convert account",variant:"destructive"})}finally{Me(!1)}},tu=jt=>{Pe(jt),Xe({name:jt.name,email:jt.email,brokerage_id:jt.brokerage_id||"",phone:jt.phone||""}),nt(!0)},Fu=()=>{Pe(null),nt(!1),Xe({name:"",email:"",brokerage_id:"",phone:""})},rp=async()=>{$e&&(await Zn($e.id),Fu())},nx=jt=>{_e(Sr=>{const lr=new Set(Sr);return lr.has(jt)?lr.delete(jt):lr.add(jt),lr})},np=()=>{if(xt.size===$c.length&&$c.every(jt=>xt.has(jt.id))){const jt=new Set(xt);$c.forEach(Sr=>jt.delete(Sr.id)),_e(jt)}else{const jt=new Set(xt);$c.forEach(Sr=>jt.add(Sr.id)),_e(jt)}},sp=()=>{_e(new Set)},Wj=async()=>{if(xt.size===0)return;tt(!0);let jt=0,Sr=0;try{const{data:{session:lr}}=await ee.auth.getSession();for(const ys of xt)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${lr==null?void 0:lr.access_token}`},body:JSON.stringify({userId:ys})})).ok?jt++:Sr++}catch{Sr++}o({title:"Bulk Email Complete",description:`Sent ${jt} emails${Sr>0?`, ${Sr} failed`:""}`}),sp()}catch(lr){o({title:"Error",description:lr.message||"Failed to send emails",variant:"destructive"})}finally{tt(!1)}},Pg=async()=>{if(xt.size===0)return;tt(!0);let jt=0,Sr=0;try{const{data:{session:lr}}=await ee.auth.getSession();for(const ys of xt)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/send-password-reset",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${lr==null?void 0:lr.access_token}`},body:JSON.stringify({userId:ys})})).ok?jt++:Sr++}catch{Sr++}o({title:"Bulk Password Reset Complete",description:`Sent ${jt} reset emails${Sr>0?`, ${Sr} failed`:""}`}),sp()}catch(lr){o({title:"Error",description:lr.message||"Failed to send password reset emails",variant:"destructive"})}finally{tt(!1)}},qc=async()=>{if(xt.size===0)return;const jt=c.filter(Ls=>xt.has(Ls.id)).map(Ls=>Ls.name).slice(0,5).join(", "),Sr=xt.size>5?` and ${xt.size-5} more`:"";if(!confirm(`Are you sure you want to delete ${xt.size} users (${jt}${Sr})? This action cannot be undone.`))return;tt(!0);let lr=0,ys=0;try{const{data:{session:Ls}}=await ee.auth.getSession();for(const jo of xt)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/delete-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Ls==null?void 0:Ls.access_token}`},body:JSON.stringify({userId:jo})})).ok?lr++:ys++}catch{ys++}o({title:"Bulk Delete Complete",description:`Deleted ${lr} users${ys>0?`, ${ys} failed`:""}`}),sp(),en()}catch(Ls){o({title:"Error",description:Ls.message||"Failed to delete users",variant:"destructive"})}finally{tt(!1)}},sx=async()=>{bt(!0);try{const{data:{session:jt}}=await ee.auth.getSession(),Sr=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/ghl-phone-sync",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${jt==null?void 0:jt.access_token}`}});if(!Sr.ok){const ys=await Sr.json();throw new Error(ys.error||"Failed to sync phones")}const lr=await Sr.json();o({title:"Phone Sync Complete",description:`Pulled ${lr.summary.pulledFromGHL} from GHL, pushed ${lr.summary.pushedToGHL} to GHL, ${lr.summary.alreadySynced} already synced`}),en()}catch(jt){o({title:"Error",description:jt.message||"Failed to sync phones with GHL",variant:"destructive"})}finally{bt(!1)}},ip=async(jt,Sr)=>{$t(jt);try{const{data:{session:lr}}=await ee.auth.getSession(),{data:ys}=await ee.from("profiles").select("phone").eq("id",jt).single(),Ls=(ys==null?void 0:ys.phone)||"",jo=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/ghl-tag-sync",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${lr==null?void 0:lr.access_token}`},body:JSON.stringify({email:Sr,action:"update",phone:Ls||void 0})});if(!jo.ok){const to=await jo.json();throw new Error(to.error||"Failed to sync with GHL")}const eo=await fetch(`https://services.leadconnectorhq.com/contacts/lookup?locationId=&email=${encodeURIComponent(Sr)}`,{method:"GET",headers:{"Content-Type":"application/json"}});o({title:"Phone Synced",description:Ls?`Phone ${Ls} synced to GHL`:"Sync attempted - run bulk sync to pull phone from GHL"}),en()}catch(lr){o({title:"Error",description:lr.message||"Failed to sync phone",variant:"destructive"})}finally{$t(null)}},zu=async jt=>{await s(jt)},a3=()=>{if(xt.size===0){o({title:"No members selected",description:"Please select members to export",variant:"destructive"});return}const jt=c.filter(to=>xt.has(to.id)),Sr=["Name","Email","Phone","Brokerage","Roles","Status","Created At"],lr=jt.map(to=>[to.name,to.email,to.phone||"",to.brokerage_name||"",to.roles.join("; "),to.claimed?"Claimed":"Unclaimed",new Date(to.created_at).toLocaleDateString()]),ys=[Sr.join(","),...lr.map(to=>to.map(Lg=>`"${(Lg||"").replace(/"/g,'""')}"`).join(","))].join(` `),Ls=new Blob([ys],{type:"text/csv"}),jo=URL.createObjectURL(Ls),eo=document.createElement("a");eo.href=jo,eo.download=`members-export-${new Date().toISOString().split("T")[0]}.csv`,eo.click(),URL.revokeObjectURL(jo),o({title:"Export complete",description:`Exported ${jt.length} member(s)`})};return C?r.jsx(Or,{title:"Members",children:r.jsx("div",{className:"flex items-center justify-center py-20",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs(Or,{title:"Members",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ou,{title:"Member Management",description:"Manage users, roles, and permissions"}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("div",{}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(te,{size:"sm",variant:"outline",onClick:sx,disabled:kt,children:[kt?r.jsx(sn,{className:"mr-2 h-4 w-4 animate-spin"}):r.jsx(Wa,{className:"mr-2 h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:kt?"Syncing...":"Sync Phones with GHL"}),r.jsx("span",{className:"sm:hidden",children:kt?"Syncing...":"Sync GHL"})]}),r.jsxs(te,{size:"sm",variant:"outline",onClick:()=>sr(!0),children:[r.jsx(H0,{className:"mr-2 h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Import CSV"}),r.jsx("span",{className:"sm:hidden",children:"Import"})]}),r.jsxs($r,{open:q,onOpenChange:W,children:[r.jsx(Lo,{asChild:!0,children:r.jsxs(te,{size:"sm",children:[r.jsx(J0,{className:"mr-2 h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Add Member"}),r.jsx("span",{className:"sm:hidden",children:"Add"})]})}),r.jsxs(zr,{children:[r.jsxs(Zr,{children:[r.jsx(Kr,{children:"Create New User"}),r.jsx(ls,{children:"Add a new user to the system. They'll be able to sign in immediately."})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"name",children:"Name"}),r.jsx(yt,{id:"name",placeholder:"John Doe",value:$.name,onChange:jt=>F({...$,name:jt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"email",children:"Email"}),r.jsx(yt,{id:"email",type:"email",placeholder:"john@example.com",value:$.email,onChange:jt=>F({...$,email:jt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"password",children:"Password"}),r.jsx(yt,{id:"password",type:"password",placeholder:"Min 6 characters",value:$.password,onChange:jt=>F({...$,password:jt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"phone",children:"Phone (optional)"}),r.jsx(yt,{id:"phone",type:"tel",placeholder:"555-123-4567",value:$.phone,onChange:jt=>F({...$,phone:jt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Qe,{htmlFor:"brokerage",children:["Brokerage",$.role==="brokerage_manager"?" (required)":""]}),r.jsxs(_n,{value:$.brokerage_id||"none",onValueChange:jt=>F({...$,brokerage_id:jt==="none"?"":jt}),children:[r.jsx(xn,{id:"brokerage",children:r.jsx(bn,{placeholder:$.role==="brokerage_manager"?"Select brokerage":"Select brokerage (optional)"})}),r.jsxs(vn,{children:[r.jsx(er,{value:"none",children:"None"}),y.map(jt=>r.jsx(er,{value:jt.id,children:jt.name},jt.id))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"role",children:"Role"}),r.jsxs(_n,{value:$.role,onValueChange:jt=>F({...$,role:jt}),children:[r.jsx(xn,{id:"role",children:r.jsx(bn,{placeholder:"Select role"})}),r.jsxs(vn,{children:[r.jsx(er,{value:"user",children:"User"}),r.jsx(er,{value:"moderator",children:"Moderator"}),r.jsx(er,{value:"brokerage_manager",children:"Brokerage Manager"}),r.jsx(er,{value:"admin",children:"Admin"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"trial_days",children:"Trial Period (optional)"}),r.jsxs(_n,{value:$.trial_days||"none",onValueChange:jt=>F({...$,trial_days:jt==="none"?"":jt}),children:[r.jsx(xn,{id:"trial_days",children:r.jsx(bn,{placeholder:"No trial (full access)"})}),r.jsxs(vn,{children:[r.jsx(er,{value:"none",children:"No trial (full access)"}),r.jsx(er,{value:"7",children:"7-day trial"}),r.jsx(er,{value:"30",children:"30-day trial"}),r.jsx(er,{value:"60",children:"60-day trial"}),r.jsx(er,{value:"90",children:"90-day trial"}),r.jsx(er,{value:"365",children:"1-year trial"})]})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Trial accounts don't require a credit card. Access expires after the trial period."})]})]}),r.jsxs(ni,{children:[r.jsx(te,{variant:"outline",onClick:()=>W(!1),children:"Cancel"}),r.jsx(te,{onClick:wa,disabled:A,children:A?"Creating...":"Create User"})]})]})]})]})]}),r.jsxs(La,{defaultValue:"members",className:"space-y-6",children:[r.jsxs(Ma,{children:[r.jsx(yn,{value:"members",children:"Members"}),r.jsx(yn,{value:"brokerages",children:"Brokerages"}),r.jsx(yn,{value:"access",children:"Access Matrix"}),r.jsx(yn,{value:"celebrations",children:"Celebrations"})]}),r.jsxs($n,{value:"members",className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[r.jsxs("div",{className:"relative flex-1 min-w-[200px] max-w-md",children:[r.jsx(Ti,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(yt,{placeholder:"Search members...",value:K,onChange:jt=>Ru(jt.target.value),className:"pl-10 h-9"})]}),r.jsxs(_n,{value:se,onValueChange:jt=>Uc(xe,jt),children:[r.jsx(xn,{className:"w-[130px] h-9",children:r.jsx(bn,{})}),r.jsxs(vn,{children:[r.jsx(er,{value:"all",children:"All Status"}),r.jsx(er,{value:"claimed",children:"Active"}),r.jsx(er,{value:"unclaimed",children:"Pending"})]})]}),r.jsxs(_n,{value:ie,onValueChange:jt=>Uc(me,jt),children:[r.jsx(xn,{className:"w-[130px] h-9",children:r.jsx(bn,{})}),r.jsxs(vn,{children:[r.jsx(er,{value:"all",children:"All Roles"}),r.jsx(er,{value:"admin",children:"Admin"}),r.jsx(er,{value:"brokerage_manager",children:"Manager"}),r.jsx(er,{value:"user",children:"User"})]})]}),r.jsxs(_n,{value:fe,onValueChange:jt=>Uc(ve,jt),children:[r.jsx(xn,{className:"w-[130px] h-9",children:r.jsx(bn,{})}),r.jsxs(vn,{children:[r.jsx(er,{value:"all",children:"All Users"}),r.jsx(er,{value:"trial",children:"Trial Only"}),r.jsx(er,{value:"non-trial",children:"Full Only"})]})]}),r.jsxs(_n,{value:Ie,onValueChange:jt=>Uc(Se,jt),children:[r.jsx(xn,{className:"w-[150px] h-9",children:r.jsx(bn,{})}),r.jsxs(vn,{children:[r.jsx(er,{value:"all",children:"All Brokerages"}),r.jsx(er,{value:"none",children:"No Brokerage"}),y.map(jt=>r.jsx(er,{value:jt.id,children:jt.name},jt.id))]})]}),(K||se!=="all"||ie!=="all"||fe!=="all"||Ie!=="all")&&r.jsxs(te,{variant:"ghost",size:"sm",className:"h-9",onClick:()=>{Z(""),xe("all"),me("all"),ve("all"),Se("all"),he(1)},children:[r.jsx(Ms,{className:"h-4 w-4 mr-1"}),"Clear"]}),r.jsxs("div",{className:"flex items-center gap-2 ml-auto",children:[r.jsxs("span",{className:"text-sm text-muted-foreground",children:["Showing ",tp+1,"-",Math.min(xm,Du)," of ",Du," members"]}),r.jsxs(_n,{value:ue.toString(),onValueChange:jt=>Sc(Number(jt)),children:[r.jsx(xn,{className:"h-9 w-[110px]",children:r.jsx(bn,{})}),r.jsxs(vn,{children:[r.jsx(er,{value:"50",children:"50 / page"}),r.jsx(er,{value:"100",children:"100 / page"}),r.jsx(er,{value:"250",children:"250 / page"})]})]})]})]}),xt.size>0&&r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-primary/10 border border-primary/20 rounded-lg",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Qx,{className:"h-4 w-4 text-primary"}),r.jsxs("span",{className:"text-sm font-medium",children:[xt.size," selected"]})]}),r.jsx("div",{className:"flex-1"}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs(te,{size:"sm",variant:"outline",onClick:Wj,disabled:ze,children:[ze?r.jsx(sn,{className:"h-4 w-4 animate-spin mr-1"}):r.jsx(di,{className:"h-4 w-4 mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"Resend Invite"}),r.jsx("span",{className:"sm:hidden",children:"Invite"})]}),r.jsxs(te,{size:"sm",variant:"outline",onClick:Pg,disabled:ze,children:[ze?r.jsx(sn,{className:"h-4 w-4 animate-spin mr-1"}):r.jsx(hT,{className:"h-4 w-4 mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"Password Reset"}),r.jsx("span",{className:"sm:hidden",children:"Reset"})]}),r.jsxs(te,{size:"sm",variant:"outline",onClick:a3,children:[r.jsx(Mo,{className:"h-4 w-4 mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"Export"}),r.jsx("span",{className:"sm:hidden",children:"CSV"})]}),r.jsxs(te,{size:"sm",variant:"destructive",onClick:qc,disabled:ze,children:[ze?r.jsx(sn,{className:"h-4 w-4 animate-spin mr-1"}):r.jsx(Xn,{className:"h-4 w-4 mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"Delete"}),r.jsx("span",{className:"sm:hidden",children:"Del"})]}),r.jsx(te,{size:"sm",variant:"ghost",onClick:sp,disabled:ze,children:r.jsx(Ms,{className:"h-4 w-4"})})]})]}),r.jsx("div",{className:"border rounded-lg bg-card overflow-hidden",children:r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{className:"bg-muted/30 hover:bg-muted/30",children:[r.jsx(At,{className:"w-[50px]",children:r.jsx(_c,{checked:$c.length>0&&$c.every(jt=>xt.has(jt.id)),onCheckedChange:np,"aria-label":"Select all on page"})}),r.jsx(At,{className:"font-semibold",children:"Name"}),r.jsx(At,{className:"font-semibold",children:"Brokerage"}),r.jsx(At,{className:"font-semibold",children:"Status"}),r.jsx(At,{className:"font-semibold",children:"Role"}),r.jsx(At,{className:"font-semibold",children:"Last Login"}),r.jsx(At,{className:"w-[100px]"})]})}),r.jsx(qs,{children:$c.length===0?r.jsx(Er,{children:r.jsx(_t,{colSpan:7,className:"text-center py-12 text-muted-foreground",children:"No members found"})}):$c.map(jt=>r.jsxs(Er,{className:`hover:bg-muted/30 ${xt.has(jt.id)?"bg-primary/5":""}`,children:[r.jsx(_t,{children:r.jsx(_c,{checked:xt.has(jt.id),onCheckedChange:()=>nx(jt.id),"aria-label":`Select ${jt.name}`})}),r.jsx(_t,{children:r.jsxs("div",{children:[r.jsx("button",{onClick:()=>tu(jt),className:"text-primary hover:underline font-medium text-left",children:jt.name}),r.jsx("div",{className:"text-xs text-muted-foreground",children:jt.email})]})}),r.jsx(_t,{className:"text-muted-foreground",children:jt.brokerage_name||"—"}),r.jsx(_t,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(Rt,{variant:jt.claimed?"default":"secondary",className:jt.claimed?"bg-primary text-primary-foreground w-fit":"w-fit",children:jt.claimed?"Active":"Pending"}),jt.is_trial&&jt.trial_expires_at&&r.jsx(mke,{expiresAt:jt.trial_expires_at,className:"w-fit"})]})}),r.jsx(_t,{children:jt.roles.length>0?r.jsx("span",{className:"text-sm capitalize",children:jt.roles[0]}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(_t,{className:"text-muted-foreground",children:jt.last_sign_in_at?new Date(jt.last_sign_in_at).toLocaleDateString():"—"}),r.jsx(_t,{children:r.jsxs("div",{className:"flex gap-1 justify-end",children:[r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8 text-yellow-500 hover:text-yellow-600 hover:bg-yellow-50",onClick:()=>{ir(jt),Bt(!0)},title:"Send celebration",children:r.jsx($h,{className:"h-4 w-4"})}),r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>tu(jt),title:"Edit member",children:r.jsx(ma,{className:"h-4 w-4"})}),r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>ip(jt.id,jt.email),disabled:Et===jt.id,title:"Sync phone with GHL",children:Et===jt.id?r.jsx(sn,{className:"h-4 w-4 animate-spin"}):r.jsx(Wa,{className:"h-4 w-4"})}),r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Wn(jt.id),title:"Resend welcome email",children:r.jsx(di,{className:"h-4 w-4"})}),r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Gn(jt.email,jt.name),title:"Send password reset",children:r.jsx(Vw,{className:"h-4 w-4"})}),r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8 text-blue-600 hover:text-blue-700 hover:bg-blue-50",onClick:()=>zu(jt.id),disabled:i||jt.id===(e==null?void 0:e.id),title:jt.id===(e==null?void 0:e.id)?"Cannot impersonate yourself":`Login as ${jt.name}`,children:i?r.jsx(sn,{className:"h-4 w-4 animate-spin"}):r.jsx(HS,{className:"h-4 w-4"})}),r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>Ps(jt.id,jt.name),title:"Delete user",children:r.jsx(Xn,{className:"h-4 w-4"})})]})})]},jt.id))})]})}),Yl>1&&r.jsxs("div",{className:"flex items-center justify-between px-2 py-4",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["Page ",re," of ",Yl]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(te,{variant:"outline",size:"sm",onClick:()=>he(1),disabled:re===1,children:"First"}),r.jsx(te,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>he(jt=>Math.max(1,jt-1)),disabled:re===1,children:r.jsx(sd,{className:"h-4 w-4"})}),r.jsx("div",{className:"flex items-center gap-1",children:Array.from({length:Math.min(5,Yl)},(jt,Sr)=>{let lr;return Yl<=5||re<=3?lr=Sr+1:re>=Yl-2?lr=Yl-4+Sr:lr=re-2+Sr,r.jsx(te,{variant:re===lr?"default":"outline",size:"sm",className:"h-8 w-8 p-0",onClick:()=>he(lr),children:lr},lr)})}),r.jsx(te,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>he(jt=>Math.min(Yl,jt+1)),disabled:re===Yl,children:r.jsx(Ha,{className:"h-4 w-4"})}),r.jsx(te,{variant:"outline",size:"sm",onClick:()=>he(Yl),disabled:re===Yl,children:"Last"})]})]})]}),r.jsx($r,{open:Ae,onOpenChange:nt,children:r.jsxs(zr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(Zr,{children:[r.jsx(Kr,{children:"Edit Member"}),r.jsx(ls,{children:"Update member details, roles, and app access"})]}),$e&&r.jsxs("div",{className:"space-y-6 py-4",children:[r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"text-sm font-semibold",children:"Basic Information"}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"edit-name",children:"Name"}),r.jsx(yt,{id:"edit-name",value:Te.name,onChange:jt=>Xe({...Te,name:jt.target.value}),maxLength:100})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"edit-email",children:"Email"}),r.jsx(yt,{id:"edit-email",type:"email",value:Te.email,onChange:jt=>Xe({...Te,email:jt.target.value}),maxLength:255})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"edit-phone",children:"Phone"}),r.jsx(yt,{id:"edit-phone",type:"tel",value:Te.phone,onChange:jt=>Xe({...Te,phone:jt.target.value}),placeholder:"555-123-4567"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"edit-brokerage",children:"Brokerage"}),r.jsxs(_n,{value:Te.brokerage_id||"none",onValueChange:jt=>Xe({...Te,brokerage_id:jt==="none"?"":jt}),children:[r.jsx(xn,{id:"edit-brokerage",children:r.jsx(bn,{placeholder:"Select brokerage"})}),r.jsxs(vn,{children:[r.jsx(er,{value:"none",children:"None"}),y.map(jt=>r.jsx(er,{value:jt.id,children:jt.name},jt.id))]})]})]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("h3",{className:"text-sm font-semibold",children:"Roles"}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[$e.roles.map(jt=>r.jsxs(Rt,{variant:"default",className:"gap-1",children:[r.jsx(sm,{className:"h-3 w-3"}),jt,jt==="brokerage_manager"?r.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(manage in Brokerages tab)"}):r.jsx("button",{onClick:()=>$a($e.id,jt,"remove"),className:"ml-1 rounded-full hover:bg-destructive/20",title:"Remove role",children:r.jsx(Ms,{className:"h-3 w-3"})})]},jt)),$e.roles.length===0&&r.jsx("span",{className:"text-sm text-muted-foreground",children:"No roles assigned"})]}),r.jsxs(_n,{onValueChange:jt=>$a($e.id,jt,"add"),children:[r.jsx(xn,{className:"w-[200px]",children:r.jsx(bn,{placeholder:"Add role..."})}),r.jsxs(vn,{children:[!$e.roles.includes("admin")&&r.jsx(er,{value:"admin",children:"Admin"}),!$e.roles.includes("user")&&r.jsx(er,{value:"user",children:"User"})]})]}),!$e.roles.includes("brokerage_manager")&&r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"To add as brokerage manager, use Brokerages tab → Manage"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("h3",{className:"text-sm font-semibold",children:"App Access"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Toggle which apps this member can access"}),r.jsx("div",{className:"grid gap-3",children:f.map(jt=>{const Sr=Aa($e.tags,jt.required_tags),lr=`${$e.id}-${jt.id}`,ys=ge===lr,Ls=jt.required_tags.length===0;return r.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-muted/30",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"text-xl",children:jt.icon}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-sm",children:jt.name}),Ls&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Available to all members"})]})]}),r.jsx("div",{className:"flex items-center gap-2",children:ys?r.jsx(sn,{className:"h-4 w-4 animate-spin text-muted-foreground"}):Ls?r.jsx(Rt,{variant:"secondary",className:"text-xs",children:"Always On"}):r.jsx(Zs,{checked:Sr,onCheckedChange:()=>lo($e.id,jt,Sr)})})]},jt.id)})})]}),$e.is_trial&&r.jsxs("div",{className:"space-y-3 pt-4 border-t",children:[r.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[r.jsx(Xi,{className:"h-4 w-4"}),"Trial Status"]}),r.jsxs("div",{className:"p-4 rounded-lg border bg-amber-50 dark:bg-amber-950/20 border-amber-200 dark:border-amber-800",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsx("div",{children:$e.trial_expires_at&&r.jsx(mke,{expiresAt:$e.trial_expires_at})}),$e.trial_expires_at&&r.jsxs("span",{className:"text-sm text-muted-foreground",children:["Expires: ",new Date($e.trial_expires_at).toLocaleDateString()]})]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(te,{size:"sm",variant:"outline",onClick:()=>fd($e.id,7),disabled:oe,children:[r.jsx(Dw,{className:"h-4 w-4 mr-1"}),"+7 Days"]}),r.jsxs(te,{size:"sm",variant:"outline",onClick:()=>fd($e.id,14),disabled:oe,children:[r.jsx(Dw,{className:"h-4 w-4 mr-1"}),"+14 Days"]}),r.jsxs(te,{size:"sm",variant:"outline",onClick:()=>fd($e.id,30),disabled:oe,children:[r.jsx(Dw,{className:"h-4 w-4 mr-1"}),"+30 Days"]}),r.jsxs(te,{size:"sm",variant:"default",onClick:()=>Pd($e.id),disabled:je,className:"bg-green-600 hover:bg-green-700",children:[r.jsx(Zw,{className:"h-4 w-4 mr-1"}),"Convert to Full Account"]})]}),$e.trial_started_at&&r.jsxs("div",{className:"mt-3 text-xs text-muted-foreground",children:["Trial started: ",new Date($e.trial_started_at).toLocaleDateString(),$e.trial_claimed_at&&r.jsxs("span",{children:[" • Claimed: ",new Date($e.trial_claimed_at).toLocaleDateString()]})]})]})]}),r.jsxs("div",{className:"space-y-2 pt-4 border-t",children:[r.jsx("h3",{className:"text-sm font-semibold",children:"Account Information"}),r.jsxs("div",{className:"text-sm space-y-1 text-muted-foreground",children:[$e.email_confirmed_at&&r.jsxs("div",{children:["Claimed: ",new Date($e.email_confirmed_at).toLocaleString()]}),$e.last_sign_in_at&&r.jsxs("div",{children:["Last login: ",new Date($e.last_sign_in_at).toLocaleString()]}),r.jsxs("div",{children:["Created: ",new Date($e.created_at).toLocaleString()]})]})]})]}),r.jsxs(ni,{children:[r.jsx(te,{variant:"outline",onClick:Fu,children:"Cancel"}),r.jsx(te,{onClick:rp,children:"Save Changes"})]})]})}),r.jsxs($n,{value:"access",children:[f.length===0?r.jsx(Ye,{children:r.jsxs(Je,{className:"py-12 text-center",children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"No apps configured yet"}),r.jsx(te,{onClick:()=>t("/admin/apps"),children:"Configure Apps"})]})}):r.jsxs(Ye,{children:[r.jsxs(Ht,{children:[r.jsx(Yt,{children:"Member Access Matrix"}),r.jsx(An,{children:"Toggle switches to grant or revoke app access for each member"})]}),r.jsxs(Je,{children:[r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b",children:[r.jsx("th",{className:"text-left p-4 font-semibold sticky left-0 bg-card z-10",children:"Member"}),f.map(jt=>r.jsx("th",{className:"text-center p-4 font-semibold min-w-[120px]",children:r.jsxs("div",{className:"flex flex-col items-center gap-1",children:[r.jsx("span",{className:"text-2xl",children:jt.icon}),r.jsx("span",{className:"text-sm",children:jt.name})]})},jt.id))]})}),r.jsxs("tbody",{children:[$c.map(jt=>r.jsxs("tr",{className:"border-b hover:bg-muted/50",children:[r.jsx("td",{className:"p-4 sticky left-0 bg-card z-10",children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:jt.name}),r.jsx("div",{className:"text-sm text-muted-foreground",children:jt.email})]})}),f.map(Sr=>{const lr=Aa(jt.tags,Sr.required_tags),ys=`${jt.id}-${Sr.id}`,Ls=ge===ys;return r.jsx("td",{className:"p-4 text-center",children:r.jsx("div",{className:"flex items-center justify-center",children:Ls?r.jsx(sn,{className:"h-5 w-5 animate-spin text-muted-foreground"}):r.jsx(Zs,{checked:lr,onCheckedChange:()=>lo(jt.id,Sr,lr),disabled:Sr.required_tags.length===0})})},Sr.id)})]},jt.id)),$c.length===0&&r.jsx("tr",{children:r.jsx("td",{colSpan:f.length+1,className:"p-8 text-center text-muted-foreground",children:"No members found"})})]})]})}),Yl>1&&r.jsxs("div",{className:"flex items-center justify-between px-2 py-4 border-t",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["Showing ",tp+1,"-",Math.min(xm,Du)," of ",Du," • Page ",re," of ",Yl]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(te,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>he(jt=>Math.max(1,jt-1)),disabled:re===1,children:r.jsx(sd,{className:"h-4 w-4"})}),r.jsx(te,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>he(jt=>Math.min(Yl,jt+1)),disabled:re===Yl,children:r.jsx(Ha,{className:"h-4 w-4"})})]})]})]})]}),r.jsx("div",{className:"mt-6",children:r.jsx(te,{variant:"outline",onClick:()=>t("/admin/apps"),children:"Manage Apps"})})]}),r.jsxs($n,{value:"brokerages",className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between gap-4",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(Ti,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(yt,{placeholder:"Search brokerages...",value:fo,onChange:jt=>lc(jt.target.value),className:"pl-10"})]}),r.jsxs($r,{open:rt,onOpenChange:We,children:[r.jsx(Lo,{asChild:!0,children:r.jsxs(te,{size:"sm",children:[r.jsx(ra,{className:"mr-2 h-4 w-4"}),"Add Brokerage"]})}),r.jsxs(zr,{children:[r.jsxs(Zr,{children:[r.jsx(Kr,{children:"Create New Brokerage"}),r.jsx(ls,{children:"Add a new brokerage to the system."})]}),r.jsx("div",{className:"space-y-4 py-4",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"brokerage-name",children:"Brokerage Name"}),r.jsx(yt,{id:"brokerage-name",placeholder:"Enter brokerage name",value:Ce,onChange:jt=>et(jt.target.value),maxLength:100})]})}),r.jsxs(ni,{children:[r.jsx(te,{variant:"outline",onClick:()=>We(!1),children:"Cancel"}),r.jsx(te,{onClick:ya,disabled:Fe,children:Fe?"Creating...":"Create Brokerage"})]})]})]})]}),r.jsx("div",{className:"border rounded-lg bg-card overflow-hidden",children:r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{className:"bg-muted/30 hover:bg-muted/30",children:[r.jsx(At,{className:"font-semibold",children:"Brokerage Name"}),r.jsx(At,{className:"font-semibold",children:"Manager(s)"}),r.jsx(At,{className:"font-semibold",children:"Agents"}),r.jsx(At,{className:"w-[150px]"})]})}),r.jsx(qs,{children:(()=>{const jt=y.filter(Sr=>Sr.name.toLowerCase().includes(fo.toLowerCase()));return jt.length===0?r.jsx(Er,{children:r.jsx(_t,{colSpan:4,className:"text-center py-12 text-muted-foreground",children:fo?"No brokerages match your search":"No brokerages found"})}):jt.map(Sr=>{const lr=c.filter(eo=>eo.brokerage_id===Sr.id),Ls=(w[Sr.id]??[]).map(eo=>c.find(to=>to.id===eo)).filter(Boolean),jo=lr.length;return r.jsxs(Er,{className:"hover:bg-muted/30",children:[r.jsx(_t,{children:r.jsx("button",{onClick:()=>zs(Sr),className:"text-primary hover:underline font-medium",children:Sr.name})}),r.jsx(_t,{children:Ls.length>0?r.jsx("div",{className:"flex flex-wrap gap-1",children:Ls.map(eo=>r.jsx(Rt,{variant:"secondary",className:"text-xs",children:eo.name},eo.id))}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"No manager"})}),r.jsxs(_t,{children:[jo," member",jo!==1?"s":""]}),r.jsx(_t,{children:r.jsxs("div",{className:"flex gap-1 justify-end",children:[r.jsxs(te,{size:"sm",variant:"outline",className:"h-8",onClick:()=>El(Sr),children:[r.jsx(hs,{className:"h-4 w-4 mr-1"}),"Manage"]}),r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>zs(Sr),title:"Edit brokerage",children:r.jsx(ma,{className:"h-4 w-4"})}),r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>Da(Sr),title:"Delete brokerage",children:r.jsx(Xn,{className:"h-4 w-4"})})]})})]},Sr.id)})})()})]})}),r.jsx($r,{open:Le,onOpenChange:ft,children:r.jsxs(zr,{className:"max-w-lg",children:[r.jsxs(Zr,{children:[r.jsx(Kr,{children:"Edit Brokerage"}),r.jsx(ls,{children:"Update brokerage details and manage managers"})]}),Nt&&r.jsxs("div",{className:"space-y-6 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"edit-brokerage-name",children:"Brokerage Name"}),r.jsx(yt,{id:"edit-brokerage-name",value:It,onChange:jt=>tr(jt.target.value),maxLength:100})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Qe,{children:"Managers"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Click × to remove manager access for this brokerage (keeps them as a member)"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:(()=>{const Sr=(w[Nt.id]??[]).map(lr=>c.find(ys=>ys.id===lr)).filter(Boolean);return Sr.length===0?r.jsx("span",{className:"text-sm text-muted-foreground",children:"No managers assigned"}):Sr.map(lr=>r.jsxs(Rt,{variant:"default",className:"gap-1",children:[r.jsx(sm,{className:"h-3 w-3"}),lr.name,r.jsx("button",{onClick:()=>$a(lr.id,"brokerage_manager","remove",Nt.id),className:"ml-1 rounded-full hover:bg-destructive/20",title:"Remove manager from this brokerage",children:r.jsx(Ms,{className:"h-3 w-3"})})]},lr.id))})()}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{className:"text-sm text-muted-foreground",children:"Assign manager from existing members:"}),r.jsxs(Zh,{open:po,onOpenChange:Qr,children:[r.jsx(Yh,{asChild:!0,children:r.jsxs(te,{variant:"outline",role:"combobox","aria-expanded":po,className:"w-full justify-between",children:["Search for a member...",r.jsx(Ti,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(mh,{className:"w-full p-0",align:"start",children:r.jsxs(gj,{children:[r.jsx(yj,{placeholder:"Search by name or email..."}),r.jsxs(xj,{className:"max-h-[200px]",children:[r.jsx(vj,{children:"No members found."}),r.jsx(_j,{children:(()=>{const jt=new Set(w[Nt.id]??[]);return c.filter(Sr=>!jt.has(Sr.id)&&(n||Sr.brokerage_id===Nt.id)).map(Sr=>r.jsxs(bj,{value:`${Sr.name} ${Sr.email}`,onSelect:()=>{bs(Sr.id,Nt.id),Qr(!1)},children:[Sr.name," (",Sr.email,")"]},Sr.id))})()})]})]})})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Members in this Brokerage"}),r.jsx("div",{className:"max-h-32 overflow-y-auto border rounded p-2",children:c.filter(jt=>jt.brokerage_id===Nt.id).length===0?r.jsx("span",{className:"text-sm text-muted-foreground",children:"No members"}):c.filter(jt=>jt.brokerage_id===Nt.id).map(jt=>r.jsxs("div",{className:"text-sm py-1 flex items-center justify-between",children:[r.jsx("span",{children:jt.name}),jt.roles.includes("brokerage_manager")&&r.jsx(Rt,{variant:"outline",className:"text-xs",children:"Manager"})]},jt.id))})]})]}),r.jsxs(ni,{children:[r.jsx(te,{variant:"outline",onClick:ca,children:"Cancel"}),r.jsx(te,{onClick:Di,disabled:Mr,children:Mr?"Saving...":"Save Changes"})]})]})}),r.jsx($r,{open:fs,onOpenChange:Qn,children:r.jsxs(zr,{children:[r.jsxs(Zr,{children:[r.jsx(Kr,{className:"text-destructive",children:"Delete Brokerage"}),r.jsxs(ls,{children:['Are you sure you want to delete "',js==null?void 0:js.name,'"?']})]}),r.jsx("div",{className:"py-4",children:r.jsxs("div",{className:"bg-destructive/10 border border-destructive/20 rounded-lg p-4 space-y-2",children:[r.jsx("p",{className:"text-sm font-medium text-destructive",children:"Warning: This action cannot be undone!"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"This will permanently delete:"}),r.jsxs("ul",{className:"text-sm text-muted-foreground list-disc list-inside",children:[r.jsxs("li",{children:['The brokerage "',js==null?void 0:js.name,'"']}),r.jsxs("li",{children:["All ",c.filter(jt=>jt.brokerage_id===(js==null?void 0:js.id)).length," member(s) assigned to this brokerage"]}),r.jsx("li",{children:"All their data, roles, and access"})]})]})}),r.jsxs(ni,{children:[r.jsx(te,{variant:"outline",onClick:()=>Qn(!1),children:"Cancel"}),r.jsx(te,{variant:"destructive",onClick:_l,disabled:si,children:si?"Deleting...":"Yes, Delete Brokerage"})]})]})}),r.jsx($r,{open:Ts,onOpenChange:ii,children:r.jsxs(zr,{className:"max-w-4xl max-h-[85vh] overflow-hidden flex flex-col",children:[r.jsxs(Zr,{children:[r.jsxs(Kr,{className:"flex items-center gap-2",children:[r.jsx(ra,{className:"h-5 w-5"}),"Manage ",mi==null?void 0:mi.name]}),r.jsx(ls,{children:"Add, remove, or manage users in this brokerage"})]}),mi&&r.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[r.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[r.jsx(Ti,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(yt,{placeholder:"Search members...",value:ga,onChange:jt=>vl(jt.target.value),className:"pl-10 h-9"})]}),r.jsxs($r,{open:Yo,onOpenChange:Ds,children:[r.jsx(Lo,{asChild:!0,children:r.jsxs(te,{size:"sm",children:[r.jsx(J0,{className:"h-4 w-4 mr-1"}),"Add New Agent"]})}),r.jsxs(zr,{children:[r.jsxs(Zr,{children:[r.jsx(Kr,{children:"Add New Agent"}),r.jsxs(ls,{children:["Create a new agent for ",mi.name]})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"agent-name",children:"Name"}),r.jsx(yt,{id:"agent-name",placeholder:"John Doe",value:Ki.name,onChange:jt=>_s({...Ki,name:jt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"agent-email",children:"Email"}),r.jsx(yt,{id:"agent-email",type:"email",placeholder:"john@example.com",value:Ki.email,onChange:jt=>_s({...Ki,email:jt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"agent-password",children:"Password"}),r.jsx(yt,{id:"agent-password",type:"password",placeholder:"Min 6 characters",value:Ki.password,onChange:jt=>_s({...Ki,password:jt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"agent-phone",children:"Phone (optional)"}),r.jsx(yt,{id:"agent-phone",type:"tel",placeholder:"555-123-4567",value:Ki.phone,onChange:jt=>_s({...Ki,phone:jt.target.value})})]})]}),r.jsxs(ni,{children:[r.jsx(te,{variant:"outline",onClick:()=>Ds(!1),children:"Cancel"}),r.jsx(te,{onClick:hd,disabled:yi,children:yi?"Creating...":"Create Agent"})]})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Qe,{className:"text-sm text-muted-foreground whitespace-nowrap",children:"Add existing user:"}),r.jsxs(Zh,{open:ba,onOpenChange:Ka,children:[r.jsx(Yh,{asChild:!0,children:r.jsxs(te,{variant:"outline",role:"combobox","aria-expanded":ba,className:"w-[300px] justify-between",children:["Select a user to add...",r.jsx(Ti,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(mh,{className:"w-[300px] p-0",align:"start",children:r.jsxs(gj,{children:[r.jsx(yj,{placeholder:"Search users...",value:dr,onValueChange:Ln}),r.jsxs(xj,{children:[r.jsx(vj,{children:"No users found."}),r.jsx(_j,{children:Do(mi.id).filter(jt=>dr===""||jt.name.toLowerCase().includes(dr.toLowerCase())||jt.email.toLowerCase().includes(dr.toLowerCase())).map(jt=>r.jsxs(bj,{value:`${jt.name} ${jt.email}`,onSelect:()=>{Xo(jt.id,mi.id),Ka(!1),Ln("")},children:[jt.name," (",jt.email,")"]},jt.id))})]})]})})]})]}),r.jsx("div",{className:"flex-1 overflow-auto border rounded-lg",children:r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{className:"bg-muted/30 hover:bg-muted/30",children:[r.jsx(At,{className:"font-semibold",children:"Name"}),r.jsx(At,{className:"font-semibold",children:"Email"}),r.jsx(At,{className:"font-semibold",children:"Status"}),r.jsx(At,{className:"font-semibold",children:"Role"}),r.jsx(At,{className:"w-[120px]"})]})}),r.jsx(qs,{children:eu(mi.id).length===0?r.jsx(Er,{children:r.jsx(_t,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:ga?"No matching members found":"No members in this brokerage"})}):eu(mi.id).map(jt=>r.jsxs(Er,{className:"hover:bg-muted/30",children:[r.jsx(_t,{className:"font-medium",children:jt.name}),r.jsx(_t,{className:"text-muted-foreground",children:jt.email}),r.jsx(_t,{children:jt.claimed?r.jsx(Rt,{variant:"default",className:"bg-green-500/10 text-green-600 hover:bg-green-500/20",children:"Active"}):r.jsx(Rt,{variant:"secondary",children:"Pending"})}),r.jsx(_t,{children:jt.roles.includes("brokerage_manager")?r.jsxs(Rt,{variant:"outline",className:"gap-1",children:[r.jsx(sm,{className:"h-3 w-3"}),"Manager"]}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"Agent"})}),r.jsx(_t,{children:r.jsxs("div",{className:"flex gap-1 justify-end",children:[!jt.claimed&&r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Wn(jt.id),title:"Resend welcome email",children:r.jsx(di,{className:"h-4 w-4"})}),r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>ep(jt.id),title:"Remove from brokerage",children:r.jsx(Ms,{className:"h-4 w-4"})}),r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8 text-blue-600 hover:text-blue-700 hover:bg-blue-50",onClick:()=>zu(jt.id),disabled:i||jt.id===(e==null?void 0:e.id),title:jt.id===(e==null?void 0:e.id)?"Cannot impersonate yourself":`Login as ${jt.name}`,children:i?r.jsx(sn,{className:"h-4 w-4 animate-spin"}):r.jsx(HS,{className:"h-4 w-4"})}),r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>Ps(jt.id,jt.name),title:"Delete user",children:r.jsx(Xn,{className:"h-4 w-4"})})]})})]},jt.id))})]})}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[Qo(mi.id).length," total member",Qo(mi.id).length!==1?"s":""," •",Qo(mi.id).filter(jt=>jt.roles.includes("brokerage_manager")).length," manager",Qo(mi.id).filter(jt=>jt.roles.includes("brokerage_manager")).length!==1?"s":""]})]}),r.jsx(ni,{children:r.jsx(te,{variant:"outline",onClick:Nc,children:"Close"})})]})})]}),r.jsx($n,{value:"celebrations",children:r.jsx(Fgt,{})})]})]}),r.jsx(H8e,{open:Oo,onOpenChange:sr,brokerages:y,onSuccess:en}),mr&&r.jsx(W8e,{open:Ot,onOpenChange:jt=>{Bt(jt),jt||ir(null)},userId:mr.id,userName:mr.name})]})},Bgt=()=>{const[t,e]=P.useState([]),[n,s]=P.useState(!0),[i,o]=P.useState(!1),[c,a]=P.useState(""),[f,m]=P.useState(""),[y,v]=P.useState(""),[w,k]=P.useState("");P.useEffect(()=>{C()},[]);const C=async()=>{const{data:F,error:q}=await ee.from("invite_codes").select("*").order("created_at",{ascending:!1});q?(Ge.error("Failed to load invite codes"),console.error(q)):e(F||[]),s(!1)},S=async F=>{if(F.preventDefault(),!c.trim()){Ge.error("Please enter a code");return}o(!0);const{error:q}=await ee.from("invite_codes").insert({code:c.trim().toUpperCase(),description:f.trim()||null,max_uses:y?parseInt(y):null,trial_days:w?parseInt(w):null});q?q.code==="23505"?Ge.error("This code already exists"):(Ge.error("Failed to create invite code"),console.error(q)):(Ge.success("Invite code created"),a(""),m(""),v(""),k(""),C()),o(!1)},T=async(F,q)=>{const{error:W}=await ee.from("invite_codes").update({is_active:!q}).eq("id",F);W?Ge.error("Failed to update code"):e(t.map(K=>K.id===F?{...K,is_active:!q}:K))},I=async F=>{const{error:q}=await ee.from("invite_codes").delete().eq("id",F);q?Ge.error("Failed to delete code"):(Ge.success("Code deleted"),e(t.filter(W=>W.id!==F)))},A="https://dashboard.relevelup.com",D=F=>{const q=`${A}/join?code=${F}`;navigator.clipboard.writeText(q),Ge.success("Link copied to clipboard")},$=`${A}/join`;return r.jsx(Or,{title:"Invite Codes",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ou,{title:"Invite Codes",description:"Manage signup invite codes"}),r.jsxs(Ye,{children:[r.jsxs(Ht,{children:[r.jsx(Yt,{children:"Create New Code"}),r.jsxs(An,{children:["Share link: ",r.jsx("code",{className:"bg-muted px-2 py-1 rounded text-sm",children:$})]})]}),r.jsx(Je,{children:r.jsxs("form",{onSubmit:S,className:"flex flex-wrap gap-4 items-end",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"code",children:"Code"}),r.jsx(yt,{id:"code",placeholder:"WELCOME2024",value:c,onChange:F=>a(F.target.value),className:"w-40"})]}),r.jsxs("div",{className:"space-y-2 flex-1 min-w-[200px]",children:[r.jsx(Qe,{htmlFor:"description",children:"Description (optional)"}),r.jsx(yt,{id:"description",placeholder:"For marketing campaign",value:f,onChange:F=>m(F.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"maxUses",children:"Max Uses"}),r.jsx(yt,{id:"maxUses",type:"number",placeholder:"Unlimited",value:y,onChange:F=>v(F.target.value),className:"w-28"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"trialDays",children:"Trial Days"}),r.jsx(yt,{id:"trialDays",type:"number",placeholder:"None",value:w,onChange:F=>k(F.target.value),className:"w-28"})]}),r.jsxs(te,{type:"submit",disabled:i,children:[i?r.jsx(sn,{className:"h-4 w-4 animate-spin"}):r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Create"]})]})})]}),r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsx(Yt,{children:"Active Codes"})}),r.jsx(Je,{children:n?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(sn,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):t.length===0?r.jsx("p",{className:"text-center py-8 text-muted-foreground",children:"No invite codes yet"}):r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"Code"}),r.jsx(At,{children:"Description"}),r.jsx(At,{children:"Uses"}),r.jsx(At,{children:"Trial"}),r.jsx(At,{children:"Created"}),r.jsx(At,{children:"Active"}),r.jsx(At,{className:"w-24",children:"Actions"})]})}),r.jsx(qs,{children:t.map(F=>r.jsxs(Er,{children:[r.jsx(_t,{className:"font-mono font-medium",children:F.code}),r.jsx(_t,{className:"text-muted-foreground",children:F.description||"—"}),r.jsxs(_t,{children:[F.uses_count,F.max_uses&&` / ${F.max_uses}`]}),r.jsx(_t,{children:F.trial_days?r.jsxs("span",{className:"text-amber-600 dark:text-amber-400 font-medium",children:[F.trial_days," days"]}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(_t,{className:"text-muted-foreground",children:un(new Date(F.created_at),"MMM d, yyyy")}),r.jsx(_t,{children:r.jsx(Zs,{checked:F.is_active,onCheckedChange:()=>T(F.id,F.is_active)})}),r.jsx(_t,{children:r.jsxs("div",{className:"flex gap-1",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>D(F.code),title:"Copy invite link",children:r.jsx(Ul,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>I(F.id),className:"text-destructive hover:text-destructive",title:"Delete code",children:r.jsx(Xn,{className:"h-4 w-4"})})]})})]},F.id))})]})})]})]})})};function bd(t){this.content=t}bd.prototype={constructor:bd,find:function(t){for(var e=0;e>1}};bd.from=function(t){if(t instanceof bd)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new bd(e)};function G8e(t,e,n){for(let s=0;;s++){if(s==t.childCount||s==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(s),o=e.child(s);if(i==o){n+=i.nodeSize;continue}if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){for(let c=0;i.text[c]==o.text[c];c++)n++;return n}if(i.content.size||o.content.size){let c=G8e(i.content,o.content,n+1);if(c!=null)return c}n+=i.nodeSize}}function K8e(t,e,n,s){for(let i=t.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:n,b:s};let c=t.child(--i),a=e.child(--o),f=c.nodeSize;if(c==a){n-=f,s-=f;continue}if(!c.sameMarkup(a))return{a:n,b:s};if(c.isText&&c.text!=a.text){let m=0,y=Math.min(c.text.length,a.text.length);for(;me&&s(f,i+a,o||null,c)!==!1&&f.content.size){let y=a+1;f.nodesBetween(Math.max(0,e-y),Math.min(f.content.size,n-y),s,i+y)}a=m}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,s,i){let o="",c=!0;return this.nodesBetween(e,n,(a,f)=>{let m=a.isText?a.text.slice(Math.max(e,f)-f,n-f):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&m||a.isTextblock)&&s&&(c?c=!1:o+=s),o+=m},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,s=e.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(s)&&(i[i.length-1]=n.withText(n.text+s.text),o=1);oe)for(let o=0,c=0;ce&&((cn)&&(a.isText?a=a.cut(Math.max(0,e-c),Math.min(a.text.length,n-c)):a=a.cut(Math.max(0,e-c-1),Math.min(a.content.size,n-c-1))),s.push(a),i+=a.nodeSize),c=f}return new gn(s,i)}cutByIndex(e,n){return e==n?gn.empty:e==0&&n==this.content.length?this:new gn(this.content.slice(e,n))}replaceChild(e,n){let s=this.content[e];if(s==n)return this;let i=this.content.slice(),o=this.size+n.nodeSize-s.nodeSize;return i[e]=n,new gn(i,o)}addToStart(e){return new gn([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new gn(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;nthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,s=0;;n++){let i=this.child(n),o=s+i.nodeSize;if(o>=e)return o==e?aL(n+1,o):aL(n,s);s=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return gn.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new gn(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return gn.empty;let n,s=0;for(let i=0;ithis.type.rank&&(n||(n=e.slice(0,i)),n.push(this),s=!0),n&&n.push(o)}}return n||(n=e.slice()),s||n.push(this),n}removeFromSet(e){for(let n=0;ns.type.rank-i.type.rank),n}};Eo.none=[];class _te extends Error{}class cs{constructor(e,n,s){this.content=e,this.openStart=n,this.openEnd=s}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let s=Y8e(this.content,e+this.openStart,n);return s&&new cs(s,this.openStart,this.openEnd)}removeBetween(e,n){return new cs(Z8e(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return cs.empty;let s=n.openStart||0,i=n.openEnd||0;if(typeof s!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new cs(gn.fromJSON(e,n.content),s,i)}static maxOpen(e,n=!0){let s=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)s++;for(let o=e.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)i++;return new cs(e,s,i)}}cs.empty=new cs(gn.empty,0,0);function Z8e(t,e,n){let{index:s,offset:i}=t.findIndex(e),o=t.maybeChild(s),{index:c,offset:a}=t.findIndex(n);if(i==e||o.isText){if(a!=n&&!t.child(c).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(s!=c)throw new RangeError("Removing non-flat range");return t.replaceChild(s,o.copy(Z8e(o.content,e-i-1,n-i-1)))}function Y8e(t,e,n,s){let{index:i,offset:o}=t.findIndex(e),c=t.maybeChild(i);if(o==e||c.isText)return s&&!s.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=Y8e(c.content,e-o-1,n,c);return a&&t.replaceChild(i,c.copy(a))}function $gt(t,e,n){if(n.openStart>t.depth)throw new _te("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new _te("Inconsistent open depths");return X8e(t,e,n,0)}function X8e(t,e,n,s){let i=t.index(s),o=t.node(s);if(i==e.index(s)&&s=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function qT(t,e,n,s){let i=(e||t).node(n),o=0,c=e?e.index(n):i.childCount;t&&(o=t.index(n),t.depth>n?o++:t.textOffset&&(Yw(t.nodeAfter,s),o++));for(let a=o;ai&&_he(t,e,i+1),c=s.depth>i&&_he(n,s,i+1),a=[];return qT(null,t,i,a),o&&c&&e.index(i)==n.index(i)?(Q8e(o,c),Yw(Xw(o,J8e(t,e,n,s,i+1)),a)):(o&&Yw(Xw(o,bte(t,e,i+1)),a),qT(e,n,i,a),c&&Yw(Xw(c,bte(n,s,i+1)),a)),qT(s,null,i,a),new gn(a)}function bte(t,e,n){let s=[];if(qT(null,t,n,s),t.depth>n){let i=_he(t,e,n+1);Yw(Xw(i,bte(t,e,n+1)),s)}return qT(e,null,n,s),new gn(s)}function Ugt(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let o=n-1;o>=0;o--)i=e.node(o).copy(gn.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class zA{constructor(e,n,s){this.pos=e,this.path=n,this.parentOffset=s,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let s=this.pos-this.path[this.path.length-1],i=e.child(n);return s?e.child(n).cut(s):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let s=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let o=0;o0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos=0;s--)if(e.pos<=this.end(s)&&(!n||n(this.node(s))))return new wte(this,e,s);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let s=[],i=0,o=n;for(let c=e;;){let{index:a,offset:f}=c.content.findIndex(o),m=o-f;if(s.push(c,a,i+f),!m||(c=c.child(a),c.isText))break;o=m-1,i+=f+1}return new zA(n,s,o)}static resolveCached(e,n){let s=gke.get(e);if(s)for(let o=0;oe&&this.nodesBetween(e,n,o=>(s.isInSet(o.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),eRe(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,s=gn.empty,i=0,o=s.childCount){let c=this.contentMatchAt(e).matchFragment(s,i,o),a=c&&c.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let f=i;fn.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let s;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");s=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,s)}let i=gn.fromJSON(e,n.content),o=e.nodeType(n.type).create(n.attrs,i,s);return o.type.checkAttrs(o.attrs),o}};i1.prototype.text=void 0;class jte extends i1{constructor(e,n,s,i){if(super(e,n,null,i),!s)throw new RangeError("Empty text nodes are not allowed");this.text=s}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):eRe(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new jte(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new jte(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function eRe(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class jj{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let s=new Wgt(e,n);if(s.next==null)return jj.empty;let i=tRe(s);s.next&&s.err("Unexpected trailing text");let o=Jgt(Qgt(i));return eyt(o,s),o}matchType(e){for(let n=0;nm.createAndFill()));for(let m=0;m=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(s){e.push(s);for(let i=0;i{let o=i+(s.validEnd?"*":" ")+" ";for(let c=0;c"+e.indexOf(s.next[c].next);return o}).join(` `)}}jj.empty=new jj(!0);class Wgt{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function tRe(t){let e=[];do e.push(Ggt(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Ggt(t){let e=[];do e.push(Kgt(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Kgt(t){let e=Xgt(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=Zgt(t,e);else break;return e}function yke(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function Zgt(t,e){let n=yke(t),s=n;return t.eat(",")&&(t.next!="}"?s=yke(t):s=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:s,expr:e}}function Ygt(t,e){let n=t.nodeTypes,s=n[e];if(s)return[s];let i=[];for(let o in n){let c=n[o];c.isInGroup(e)&&i.push(c)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function Xgt(t){if(t.eat("(")){let e=tRe(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=Ygt(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Qgt(t){let e=[[]];return i(o(t,0),n()),e;function n(){return e.push([])-1}function s(c,a,f){let m={term:f,to:a};return e[c].push(m),m}function i(c,a){c.forEach(f=>f.to=a)}function o(c,a){if(c.type=="choice")return c.exprs.reduce((f,m)=>f.concat(o(m,a)),[]);if(c.type=="seq")for(let f=0;;f++){let m=o(c.exprs[f],a);if(f==c.exprs.length-1)return m;i(m,a=n())}else if(c.type=="star"){let f=n();return s(a,f),i(o(c.expr,f),f),[s(f)]}else if(c.type=="plus"){let f=n();return i(o(c.expr,a),f),i(o(c.expr,f),f),[s(f)]}else{if(c.type=="opt")return[s(a)].concat(o(c.expr,a));if(c.type=="range"){let f=a;for(let m=0;m{t[c].forEach(({term:a,to:f})=>{if(!a)return;let m;for(let y=0;y{m||i.push([a,m=[]]),m.indexOf(y)==-1&&m.push(y)})})});let o=e[s.join(",")]=new jj(s.indexOf(t.length-1)>-1);for(let c=0;c-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:sRe(this.attrs,e)}create(e=null,n,s){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new i1(this,this.computeAttrs(e),gn.from(n),Eo.setFrom(s))}createChecked(e=null,n,s){return n=gn.from(n),this.checkContent(n),new i1(this,this.computeAttrs(e),n,Eo.setFrom(s))}createAndFill(e=null,n,s){if(e=this.computeAttrs(e),n=gn.from(n),n.size){let c=this.contentMatch.fillBefore(n);if(!c)return null;n=c.append(n)}let i=this.contentMatch.matchFragment(n),o=i&&i.fillBefore(gn.empty,!0);return o?new i1(this,e,n.append(o),Eo.setFrom(s)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let s=0;s-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;ns[o]=new oRe(o,n,c));let i=n.spec.topNode||"doc";if(!s[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!s.text)throw new RangeError("Every schema needs a 'text' type");for(let o in s.text.attrs)throw new RangeError("The text node type should not have attributes");return s}};function tyt(t,e,n){let s=n.split("|");return i=>{let o=i===null?"null":typeof i;if(s.indexOf(o)<0)throw new RangeError(`Expected value of type ${s} for attribute ${e} on type ${t}, got ${o}`)}}class ryt{constructor(e,n,s){this.hasDefault=Object.prototype.hasOwnProperty.call(s,"default"),this.default=s.default,this.validate=typeof s.validate=="string"?tyt(e,n,s.validate):s.validate}get isRequired(){return!this.hasDefault}}class wse{constructor(e,n,s,i){this.name=e,this.rank=n,this.schema=s,this.spec=i,this.attrs=aRe(e,i.attrs),this.excluded=null;let o=nRe(this.attrs);this.instance=o?new Eo(this,o):null}create(e=null){return!e&&this.instance?this.instance:new Eo(this,sRe(this.attrs,e))}static compile(e,n){let s=Object.create(null),i=0;return e.forEach((o,c)=>s[o]=new wse(o,i++,n,c)),s}removeFromSet(e){for(var n=0;n-1}}class lRe{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=bd.from(e.nodes),n.marks=bd.from(e.marks||{}),this.nodes=vke.compile(this.spec.nodes,this),this.marks=wse.compile(this.spec.marks,this);let s=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let o=this.nodes[i],c=o.spec.content||"",a=o.spec.marks;if(o.contentMatch=s[c]||(s[c]=jj.parse(c,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=a=="_"?null:a?_ke(this,a.split(" ")):a==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],c=o.spec.excludes;o.excluded=c==null?[o]:c==""?[]:_ke(this,c.split(" "))}this.nodeFromJSON=i=>i1.fromJSON(this,i),this.markFromJSON=i=>Eo.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,s,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof vke){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,s,i)}text(e,n){let s=this.nodes.text;return new jte(s,s.defaultAttrs,e,Eo.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function _ke(t,e){let n=[];for(let s=0;s-1)&&n.push(c=f)}if(!c)throw new SyntaxError("Unknown mark type: '"+e[s]+"'")}return n}function nyt(t){return t.tag!=null}function syt(t){return t.style!=null}let VT=class whe{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let s=this.matchedStyles=[];n.forEach(i=>{if(nyt(i))this.tags.push(i);else if(syt(i)){let o=/[^=]*/.exec(i.style)[0];s.indexOf(o)<0&&s.push(o),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let o=e.nodes[i.node];return o.contentMatch.matchType(o)})}parse(e,n={}){let s=new wke(this,n,!1);return s.addAll(e,Eo.none,n.from,n.to),s.finish()}parseSlice(e,n={}){let s=new wke(this,n,!0);return s.addAll(e,Eo.none,n.from,n.to),cs.maxOpen(s.finish())}matchTag(e,n,s){for(let i=s?this.tags.indexOf(s)+1:0;ie.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(c.getAttrs){let f=c.getAttrs(n);if(f===!1)continue;c.attrs=f||void 0}return c}}}static schemaRules(e){let n=[];function s(i){let o=i.priority==null?50:i.priority,c=0;for(;c{s(c=jke(c)),c.mark||c.ignore||c.clearMark||(c.mark=i)})}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(c=>{s(c=jke(c)),c.node||c.ignore||c.mark||(c.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new whe(e,whe.schemaRules(e)))}};const cRe={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},iyt={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},dRe={ol:!0,ul:!0},BA=1,jhe=2,HT=4;function bke(t,e,n){return e!=null?(e?BA:0)|(e==="full"?jhe:0):t&&t.whitespace=="pre"?BA|jhe:n&~HT}class oL{constructor(e,n,s,i,o,c){this.type=e,this.attrs=n,this.marks=s,this.solid=i,this.options=c,this.content=[],this.activeMarks=Eo.none,this.match=o||(c&HT?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(gn.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let s=this.type.contentMatch,i;return(i=s.findWrapping(e.type))?(this.match=s,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&BA)){let s=this.content[this.content.length-1],i;if(s&&s.isText&&(i=/[ \t\r\n\u000c]+$/.exec(s.text))){let o=s;s.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let n=gn.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(gn.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!cRe.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class wke{constructor(e,n,s){this.parser=e,this.options=n,this.isOpen=s,this.open=0,this.localPreserveWS=!1;let i=n.topNode,o,c=bke(null,n.preserveWhitespace,0)|(s?HT:0);i?o=new oL(i.type,i.attrs,Eo.none,!0,n.topMatch||i.type.contentMatch,c):s?o=new oL(null,null,Eo.none,!0,null,c):o=new oL(e.schema.topNodeType,null,Eo.none,!0,null,c),this.nodes=[o],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let s=e.nodeValue,i=this.top,o=i.options&jhe?"full":this.localPreserveWS||(i.options&BA)>0,{schema:c}=this.parser;if(o==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(s)){if(o)if(o==="full")s=s.replace(/\r\n?/g,` `);else if(c.linebreakReplacement&&/[\r\n]/.test(s)&&this.top.findWrapping(c.linebreakReplacement.create())){let a=s.split(/\r?\n|\r/);for(let f=0;f!f.clearMark(m)):n=n.concat(this.parser.schema.marks[f.mark].create(f.attrs)),f.consuming===!1)a=f;else break}}return n}addElementByRule(e,n,s,i){let o,c;if(n.node)if(c=this.parser.schema.nodes[n.node],c.isLeaf)this.insertNode(c.create(n.attrs),s,e.nodeName=="BR")||this.leafFallback(e,s);else{let f=this.enter(c,n.attrs||null,s,n.preserveWhitespace);f&&(o=!0,s=f)}else{let f=this.parser.schema.marks[n.mark];s=s.concat(f.create(n.attrs))}let a=this.top;if(c&&c.isLeaf)this.findInside(e);else if(i)this.addElement(e,s,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(f=>this.insertNode(f,s,!1));else{let f=e;typeof n.contentElement=="string"?f=e.querySelector(n.contentElement):typeof n.contentElement=="function"?f=n.contentElement(e):n.contentElement&&(f=n.contentElement),this.findAround(e,f,!0),this.addAll(f,s),this.findAround(e,f,!1)}o&&this.sync(a)&&this.open--}addAll(e,n,s,i){let o=s||0;for(let c=s?e.childNodes[s]:e.firstChild,a=i==null?null:e.childNodes[i];c!=a;c=c.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(c,n);this.findAtPoint(e,o)}findPlace(e,n,s){let i,o;for(let c=this.open,a=0;c>=0;c--){let f=this.nodes[c],m=f.findWrapping(e);if(m&&(!i||i.length>m.length+a)&&(i=m,o=f,!m.length))break;if(f.solid){if(s)break;a+=2}}if(!i)return null;this.sync(o);for(let c=0;c(c.type?c.type.allowsMarkType(m.type):kke(m.type,e))?(f=m.addToSet(f),!1):!0),this.nodes.push(new oL(e,n,f,i,null,a)),this.open++,s}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=BA)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let s=this.nodes[n].content;for(let i=s.length-1;i>=0;i--)e+=s[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let s=0;s-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),s=this.options.context,i=!this.isOpen&&(!s||s.parent.type==this.nodes[0].type),o=-(s?s.depth+1:0)+(i?0:1),c=(a,f)=>{for(;a>=0;a--){let m=n[a];if(m==""){if(a==n.length-1||a==0)continue;for(;f>=o;f--)if(c(a-1,f))return!0;return!1}else{let y=f>0||f==0&&i?this.nodes[f].type:s&&f>=o?s.node(f-o).type:null;if(!y||y.name!=m&&!y.isInGroup(m))return!1;f--}}return!0};return c(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let s=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(s&&s.isTextblock&&s.defaultAttrs)return s}for(let n in this.parser.schema.nodes){let s=this.parser.schema.nodes[n];if(s.isTextblock&&s.defaultAttrs)return s}}}function ayt(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let s=e.nodeType==1?e.nodeName.toLowerCase():null;s&&dRe.hasOwnProperty(s)&&n?(n.appendChild(e),e=n):s=="li"?n=e:s&&(n=null)}}function oyt(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function jke(t){let e={};for(let n in t)e[n]=t[n];return e}function kke(t,e){let n=e.schema.nodes;for(let s in n){let i=n[s];if(!i.allowsMarkType(t))continue;let o=[],c=a=>{o.push(a);for(let f=0;f{if(o.length||c.marks.length){let a=0,f=0;for(;a=0;i--){let o=this.serializeMark(e.marks[i],e.isInline,n);o&&((o.contentDOM||o.dom).appendChild(s),s=o.dom)}return s}serializeMark(e,n,s={}){let i=this.marks[e.type.name];return i&&see(Yle(s),i(e,n),null,e.attrs)}static renderSpec(e,n,s=null,i){return see(e,n,s,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Bj(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Nke(e.nodes);return n.text||(n.text=s=>s.text),n}static marksFromSchema(e){return Nke(e.marks)}}function Nke(t){let e={};for(let n in t){let s=t[n].spec.toDOM;s&&(e[n]=s)}return e}function Yle(t){return t.document||window.document}const Ske=new WeakMap;function lyt(t){let e=Ske.get(t);return e===void 0&&Ske.set(t,e=cyt(t)),e}function cyt(t){let e=null;function n(s){if(s&&typeof s=="object")if(Array.isArray(s))if(typeof s[0]=="string")e||(e=[]),e.push(s);else for(let i=0;i-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let c=i.indexOf(" ");c>0&&(n=i.slice(0,c),i=i.slice(c+1));let a,f=n?t.createElementNS(n,i):t.createElement(i),m=e[1],y=1;if(m&&typeof m=="object"&&m.nodeType==null&&!Array.isArray(m)){y=2;for(let v in m)if(m[v]!=null){let w=v.indexOf(" ");w>0?f.setAttributeNS(v.slice(0,w),v.slice(w+1),m[v]):v=="style"&&f.style?f.style.cssText=m[v]:f.setAttribute(v,m[v])}}for(let v=y;vy)throw new RangeError("Content hole must be the only child of its parent node");return{dom:f,contentDOM:f}}else{let{dom:k,contentDOM:C}=see(t,w,n,s);if(f.appendChild(k),C){if(a)throw new RangeError("Multiple content holes");a=C}}}return{dom:f,contentDOM:a}}const uRe=65535,hRe=Math.pow(2,16);function dyt(t,e){return t+e*hRe}function Cke(t){return t&uRe}function uyt(t){return(t-(t&uRe))/hRe}const fRe=1,pRe=2,iee=4,mRe=8;class khe{constructor(e,n,s){this.pos=e,this.delInfo=n,this.recover=s}get deleted(){return(this.delInfo&mRe)>0}get deletedBefore(){return(this.delInfo&(fRe|iee))>0}get deletedAfter(){return(this.delInfo&(pRe|iee))>0}get deletedAcross(){return(this.delInfo&iee)>0}}class Rh{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Rh.empty)return Rh.empty}recover(e){let n=0,s=Cke(e);if(!this.inverted)for(let i=0;ie)break;let m=this.ranges[a+o],y=this.ranges[a+c],v=f+m;if(e<=v){let w=m?e==f?-1:e==v?1:n:n,k=f+i+(w<0?0:y);if(s)return k;let C=e==(n<0?f:v)?null:dyt(a/3,e-f),S=e==f?pRe:e==v?fRe:iee;return(n<0?e!=f:e!=v)&&(S|=mRe),new khe(k,S,C)}i+=y-m}return s?e+i:new khe(e+i,0,null)}touches(e,n){let s=0,i=Cke(n),o=this.inverted?2:1,c=this.inverted?1:2;for(let a=0;ae)break;let m=this.ranges[a+o],y=f+m;if(e<=y&&a==i*3)return!0;s+=this.ranges[a+c]-m}return!1}forEach(e){let n=this.inverted?2:1,s=this.inverted?1:2;for(let i=0,o=0;i=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?s-i-1:void 0)}}invert(){let e=new $A;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let s=this.from;so&&f!c.isAtom||!a.type.allowsMarkType(this.mark.type)?c:c.mark(this.mark.addToSet(c.marks)),i),n.openStart,n.openEnd);return bc.fromReplace(e,this.from,this.to,o)}invert(){return new tg(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),s=e.mapResult(this.to,-1);return n.deleted&&s.deleted||n.pos>=s.pos?null:new M0(n.pos,s.pos,this.mark)}merge(e){return e instanceof M0&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new M0(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new M0(n.from,n.to,e.markFromJSON(n.mark))}}Jd.jsonID("addMark",M0);class tg extends Jd{constructor(e,n,s){super(),this.from=e,this.to=n,this.mark=s}apply(e){let n=e.slice(this.from,this.to),s=new cs(jye(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return bc.fromReplace(e,this.from,this.to,s)}invert(){return new M0(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),s=e.mapResult(this.to,-1);return n.deleted&&s.deleted||n.pos>=s.pos?null:new tg(n.pos,s.pos,this.mark)}merge(e){return e instanceof tg&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new tg(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new tg(n.from,n.to,e.markFromJSON(n.mark))}}Jd.jsonID("removeMark",tg);class T0 extends Jd{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return bc.fail("No node at mark step's position");let s=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return bc.fromReplace(e,this.pos,this.pos+1,new cs(gn.from(s),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let s=this.mark.addToSet(n.marks);if(s.length==n.marks.length){for(let i=0;is.pos?null:new ad(n.pos,s.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ad(n.from,n.to,n.gapFrom,n.gapTo,cs.fromJSON(e,n.slice),n.insert,!!n.structure)}}Jd.jsonID("replaceAround",ad);function Nhe(t,e,n){let s=t.resolve(e),i=n-e,o=s.depth;for(;i>0&&o>0&&s.indexAfter(o)==s.node(o).childCount;)o--,i--;if(i>0){let c=s.node(o).maybeChild(s.indexAfter(o));for(;i>0;){if(!c||c.isLeaf)return!0;c=c.firstChild,i--}}return!1}function hyt(t,e,n,s){let i=[],o=[],c,a;t.doc.nodesBetween(e,n,(f,m,y)=>{if(!f.isInline)return;let v=f.marks;if(!s.isInSet(v)&&y.type.allowsMarkType(s.type)){let w=Math.max(m,e),k=Math.min(m+f.nodeSize,n),C=s.addToSet(v);for(let S=0;St.step(f)),o.forEach(f=>t.step(f))}function fyt(t,e,n,s){let i=[],o=0;t.doc.nodesBetween(e,n,(c,a)=>{if(!c.isInline)return;o++;let f=null;if(s instanceof wse){let m=c.marks,y;for(;y=s.isInSet(m);)(f||(f=[])).push(y),m=y.removeFromSet(m)}else s?s.isInSet(c.marks)&&(f=[s]):f=c.marks;if(f&&f.length){let m=Math.min(a+c.nodeSize,n);for(let y=0;yt.step(new tg(c.from,c.to,c.style)))}function kye(t,e,n,s=n.contentMatch,i=!0){let o=t.doc.nodeAt(e),c=[],a=e+1;for(let f=0;f=0;f--)t.step(c[f])}function pyt(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function WC(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let s=t.depth,i=0,o=0;;--s){let c=t.$from.node(s),a=t.$from.index(s)+i,f=t.$to.indexAfter(s)-o;if(sn;C--)S||s.index(C)>0?(S=!0,y=gn.from(s.node(C).copy(y)),v++):f--;let w=gn.empty,k=0;for(let C=o,S=!1;C>n;C--)S||i.after(C+1)=0;c--){if(s.size){let a=n[c].type.contentMatch.matchFragment(s);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}s=gn.from(n[c].type.create(n[c].attrs,s))}let i=e.start,o=e.end;t.step(new ad(i,o,i,o,new cs(s,0,0),n.length,!0))}function vyt(t,e,n,s,i){if(!s.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=t.steps.length;t.doc.nodesBetween(e,n,(c,a)=>{let f=typeof i=="function"?i(c):i;if(c.isTextblock&&!c.hasMarkup(s,f)&&_yt(t.doc,t.mapping.slice(o).map(a),s)){let m=null;if(s.schema.linebreakReplacement){let k=s.whitespace=="pre",C=!!s.contentMatch.matchType(s.schema.linebreakReplacement);k&&!C?m=!1:!k&&C&&(m=!0)}m===!1&&yRe(t,c,a,o),kye(t,t.mapping.slice(o).map(a,1),s,void 0,m===null);let y=t.mapping.slice(o),v=y.map(a,1),w=y.map(a+c.nodeSize,1);return t.step(new ad(v,w,v+1,w-1,new cs(gn.from(s.create(f,null,c.marks)),0,0),1,!0)),m===!0&&gRe(t,c,a,o),!1}})}function gRe(t,e,n,s){e.forEach((i,o)=>{if(i.isText){let c,a=/\r?\n|\r/g;for(;c=a.exec(i.text);){let f=t.mapping.slice(s).map(n+1+o+c.index);t.replaceWith(f,f+1,e.type.schema.linebreakReplacement.create())}}})}function yRe(t,e,n,s){e.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let c=t.mapping.slice(s).map(n+1+o);t.replaceWith(c,c+1,e.type.schema.text(` `))}})}function _yt(t,e,n){let s=t.resolve(e),i=s.index();return s.parent.canReplaceWith(i,i+1,n)}function byt(t,e,n,s,i){let o=t.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");n||(n=o.type);let c=n.create(s,null,i||o.marks);if(o.isLeaf)return t.replaceWith(e,e+o.nodeSize,c);if(!n.validContent(o.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new ad(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new cs(gn.from(c),0,0),1,!0))}function Py(t,e,n=1,s){let i=t.resolve(e),o=i.depth-n,c=s&&s[s.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!c.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let m=i.depth-1,y=n-2;m>o;m--,y--){let v=i.node(m),w=i.index(m);if(v.type.spec.isolating)return!1;let k=v.content.cutByIndex(w,v.childCount),C=s&&s[y+1];C&&(k=k.replaceChild(0,C.type.create(C.attrs)));let S=s&&s[y]||v;if(!v.canReplace(w+1,v.childCount)||!S.type.validContent(k))return!1}let a=i.indexAfter(o),f=s&&s[0];return i.node(o).canReplaceWith(a,a,f?f.type:i.node(o+1).type)}function wyt(t,e,n=1,s){let i=t.doc.resolve(e),o=gn.empty,c=gn.empty;for(let a=i.depth,f=i.depth-n,m=n-1;a>f;a--,m--){o=gn.from(i.node(a).copy(o));let y=s&&s[m];c=gn.from(y?y.type.create(y.attrs,c):i.node(a).copy(c))}t.step(new ed(e,e,new cs(o.append(c),n,n),!0))}function L1(t,e){let n=t.resolve(e),s=n.index();return xRe(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(s,s+1)}function jyt(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:s}=t.type.schema;for(let i=0;i0?(o=s.node(i+1),a++,c=s.node(i).maybeChild(a)):(o=s.node(i).maybeChild(a-1),c=s.node(i+1)),o&&!o.isTextblock&&xRe(o,c)&&s.node(i).canReplace(a,a+1))return e;if(i==0)break;e=n<0?s.before(i):s.after(i)}}function kyt(t,e,n){let s=null,{linebreakReplacement:i}=t.doc.type.schema,o=t.doc.resolve(e-n),c=o.node().type;if(i&&c.inlineContent){let y=c.whitespace=="pre",v=!!c.contentMatch.matchType(i);y&&!v?s=!1:!y&&v&&(s=!0)}let a=t.steps.length;if(s===!1){let y=t.doc.resolve(e+n);yRe(t,y.node(),y.before(),a)}c.inlineContent&&kye(t,e+n-1,c,o.node().contentMatchAt(o.index()),s==null);let f=t.mapping.slice(a),m=f.map(e-n);if(t.step(new ed(m,f.map(e+n,-1),cs.empty,!0)),s===!0){let y=t.doc.resolve(m);gRe(t,y.node(),y.before(),t.steps.length)}return t}function Nyt(t,e,n){let s=t.resolve(e);if(s.parent.canReplaceWith(s.index(),s.index(),n))return e;if(s.parentOffset==0)for(let i=s.depth-1;i>=0;i--){let o=s.index(i);if(s.node(i).canReplaceWith(o,o,n))return s.before(i+1);if(o>0)return null}if(s.parentOffset==s.parent.content.size)for(let i=s.depth-1;i>=0;i--){let o=s.indexAfter(i);if(s.node(i).canReplaceWith(o,o,n))return s.after(i+1);if(o=0;c--){let a=c==s.depth?0:s.pos<=(s.start(c+1)+s.end(c+1))/2?-1:1,f=s.index(c)+(a>0?1:0),m=s.node(c),y=!1;if(o==1)y=m.canReplace(f,f,i);else{let v=m.contentMatchAt(f).findWrapping(i.firstChild.type);y=v&&m.canReplaceWith(f,f,v[0])}if(y)return a==0?s.pos:a<0?s.before(c+1):s.after(c+1)}return null}function kse(t,e,n=e,s=cs.empty){if(e==n&&!s.size)return null;let i=t.resolve(e),o=t.resolve(n);return _Re(i,o,s)?new ed(e,n,s):new Syt(i,o,s).fit()}function _Re(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class Syt{constructor(e,n,s){this.$from=e,this.$to=n,this.unplaced=s,this.frontier=[],this.placed=gn.empty;for(let i=0;i<=e.depth;i++){let o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=gn.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let m=this.findFittable();m?this.placeNodes(m):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,s=this.$from,i=this.close(e<0?this.$to:s.doc.resolve(e));if(!i)return null;let o=this.placed,c=s.depth,a=i.depth;for(;c&&a&&o.childCount==1;)o=o.firstChild.content,c--,a--;let f=new cs(o,c,a);return e>-1?new ad(s.pos,e,this.$to.pos,this.$to.end(),f,n):f.size||s.pos!=this.$to.pos?new ed(s.pos,i.pos,f):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,s=0,i=this.unplaced.openEnd;s1&&(i=0),o.type.spec.isolating&&i<=s){e=s;break}n=o.content}for(let n=1;n<=2;n++)for(let s=n==1?e:this.unplaced.openStart;s>=0;s--){let i,o=null;s?(o=Qle(this.unplaced.content,s-1).firstChild,i=o.content):i=this.unplaced.content;let c=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:f,match:m}=this.frontier[a],y,v=null;if(n==1&&(c?m.matchType(c.type)||(v=m.fillBefore(gn.from(c),!1)):o&&f.compatibleContent(o.type)))return{sliceDepth:s,frontierDepth:a,parent:o,inject:v};if(n==2&&c&&(y=m.findWrapping(c.type)))return{sliceDepth:s,frontierDepth:a,parent:o,wrap:y};if(o&&m.matchType(o.type))break}}}openMore(){let{content:e,openStart:n,openEnd:s}=this.unplaced,i=Qle(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new cs(e,n+1,Math.max(s,i.size+n>=e.size-s?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:s}=this.unplaced,i=Qle(e,n);if(i.childCount<=1&&n>0){let o=e.size-n<=n+i.size;this.unplaced=new cs(q5(e,n-1,1),n-1,o?n-1:s)}else this.unplaced=new cs(q5(e,n,1),n,s)}placeNodes({sliceDepth:e,frontierDepth:n,parent:s,inject:i,wrap:o}){for(;this.depth>n;)this.closeFrontierNode();if(o)for(let S=0;S1||f==0||S.content.size)&&(v=T,y.push(bRe(S.mark(w.allowedMarks(S.marks)),m==1?f:0,m==a.childCount?k:-1)))}let C=m==a.childCount;C||(k=-1),this.placed=V5(this.placed,n,gn.from(y)),this.frontier[n].match=v,C&&k<0&&s&&s.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let S=0,T=a;S1&&i==this.$to.end(--s);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:s,type:i}=this.frontier[n],o=n=0;a--){let{match:f,type:m}=this.frontier[a],y=Jle(e,a,m,f,!0);if(!y||y.childCount)continue e}return{depth:n,fit:c,move:o?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=V5(this.placed,n.depth,n.fit)),e=n.move;for(let s=n.depth+1;s<=e.depth;s++){let i=e.node(s),o=i.type.contentMatch.fillBefore(i.content,!0,e.index(s));this.openFrontierNode(i.type,i.attrs,o)}return e}openFrontierNode(e,n=null,s){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=V5(this.placed,this.depth,gn.from(e.create(n,s))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(gn.empty,!0);n.childCount&&(this.placed=V5(this.placed,this.frontier.length,n))}}function q5(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(q5(t.firstChild.content,e-1,n)))}function V5(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(V5(t.lastChild.content,e-1,n)))}function Qle(t,e){for(let n=0;n1&&(s=s.replaceChild(0,bRe(s.firstChild,e-1,s.childCount==1?n-1:0))),e>0&&(s=t.type.contentMatch.fillBefore(s).append(s),n<=0&&(s=s.append(t.type.contentMatch.matchFragment(s).fillBefore(gn.empty,!0)))),t.copy(s)}function Jle(t,e,n,s,i){let o=t.node(e),c=i?t.indexAfter(e):t.index(e);if(c==o.childCount&&!n.compatibleContent(o.type))return null;let a=s.fillBefore(o.content,!0,c);return a&&!Cyt(n,o.content,c)?a:null}function Cyt(t,e,n){for(let s=n;s0;w--,k--){let C=i.node(w).type.spec;if(C.defining||C.definingAsContext||C.isolating)break;c.indexOf(w)>-1?a=w:i.before(w)==k&&c.splice(1,0,-w)}let f=c.indexOf(a),m=[],y=s.openStart;for(let w=s.content,k=0;;k++){let C=w.firstChild;if(m.push(C),k==s.openStart)break;w=C.content}for(let w=y-1;w>=0;w--){let k=m[w],C=Myt(k.type);if(C&&!k.sameMarkup(i.node(Math.abs(a)-1)))y=w;else if(C||!k.type.isTextblock)break}for(let w=s.openStart;w>=0;w--){let k=(w+y+1)%(s.openStart+1),C=m[k];if(C)for(let S=0;S=0&&(t.replace(e,n,s),!(t.steps.length>v));w--){let k=c[w];k<0||(e=i.before(k),n=o.after(k))}}function wRe(t,e,n,s,i){if(es){let o=i.contentMatchAt(0),c=o.fillBefore(t).append(t);t=c.append(o.matchFragment(c).fillBefore(gn.empty,!0))}return t}function Ayt(t,e,n,s){if(!s.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=Nyt(t.doc,e,s.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new cs(gn.from(s),0,0))}function Eyt(t,e,n){let s=t.doc.resolve(e),i=t.doc.resolve(n),o=jRe(s,i);for(let c=0;c0&&(f||s.node(a-1).canReplace(s.index(a-1),i.indexAfter(a-1))))return t.delete(s.before(a),i.after(a))}for(let c=1;c<=s.depth&&c<=i.depth;c++)if(e-s.start(c)==s.depth-c&&n>s.end(c)&&i.end(c)-n!=i.depth-c&&s.start(c-1)==i.start(c-1)&&s.node(c-1).canReplace(s.index(c-1),i.index(c-1)))return t.delete(s.before(c),n);t.delete(e,n)}function jRe(t,e){let n=[],s=Math.min(t.depth,e.depth);for(let i=s;i>=0;i--){let o=t.start(i);if(oe.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(o==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&n.push(i)}return n}class l4 extends Jd{constructor(e,n,s){super(),this.pos=e,this.attr=n,this.value=s}apply(e){let n=e.nodeAt(this.pos);if(!n)return bc.fail("No node at attribute step's position");let s=Object.create(null);for(let o in n.attrs)s[o]=n.attrs[o];s[this.attr]=this.value;let i=n.type.create(s,null,n.marks);return bc.fromReplace(e,this.pos,this.pos+1,new cs(gn.from(i),0,n.isLeaf?0:1))}getMap(){return Rh.empty}invert(e){return new l4(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new l4(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new l4(n.pos,n.attr,n.value)}}Jd.jsonID("attr",l4);class UA extends Jd{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let s=e.type.create(n,e.content,e.marks);return bc.ok(s)}getMap(){return Rh.empty}invert(e){return new UA(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new UA(n.attr,n.value)}}Jd.jsonID("docAttr",UA);let Z4=class extends Error{};Z4=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Z4.prototype=Object.create(Error.prototype);Z4.prototype.constructor=Z4;Z4.prototype.name="TransformError";class kRe{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new $A}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Z4(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,s=cs.empty){let i=kse(this.doc,e,n,s);return i&&this.step(i),this}replaceWith(e,n,s){return this.replace(e,n,new cs(gn.from(s),0,0))}delete(e,n){return this.replace(e,n,cs.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,s){return Tyt(this,e,n,s),this}replaceRangeWith(e,n,s){return Ayt(this,e,n,s),this}deleteRange(e,n){return Eyt(this,e,n),this}lift(e,n){return myt(this,e,n),this}join(e,n=1){return kyt(this,e,n),this}wrap(e,n){return xyt(this,e,n),this}setBlockType(e,n=e,s,i=null){return vyt(this,e,n,s,i),this}setNodeMarkup(e,n,s=null,i){return byt(this,e,n,s,i),this}setNodeAttribute(e,n,s){return this.step(new l4(e,n,s)),this}setDocAttribute(e,n){return this.step(new UA(e,n)),this}addNodeMark(e,n){return this.step(new T0(e,n)),this}removeNodeMark(e,n){let s=this.doc.nodeAt(e);if(!s)throw new RangeError("No node at position "+e);if(n instanceof Eo)n.isInSet(s.marks)&&this.step(new kj(e,n));else{let i=s.marks,o,c=[];for(;o=n.isInSet(i);)c.push(new kj(e,o)),i=o.removeFromSet(i);for(let a=c.length-1;a>=0;a--)this.step(c[a])}return this}split(e,n=1,s){return wyt(this,e,n,s),this}addMark(e,n,s){return hyt(this,e,n,s),this}removeMark(e,n,s){return fyt(this,e,n,s),this}clearIncompatible(e,n,s){return kye(this,e,n,s),this}}const ece=Object.create(null);class aa{constructor(e,n,s){this.$anchor=e,this.$head=n,this.ranges=s||[new Iyt(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n=0;o--){let c=n<0?eS(e.node(0),e.node(o),e.before(o+1),e.index(o),n,s):eS(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,n,s);if(c)return c}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new qh(e.node(0))}static atStart(e){return eS(e,e,0,0,1)||new qh(e)}static atEnd(e){return eS(e,e,e.content.size,e.childCount,-1)||new qh(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let s=ece[n.type];if(!s)throw new RangeError(`No selection type ${n.type} defined`);return s.fromJSON(e,n)}static jsonID(e,n){if(e in ece)throw new RangeError("Duplicate use of selection JSON ID "+e);return ece[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Fi.between(this.$anchor,this.$head).getBookmark()}}aa.prototype.visible=!0;class Iyt{constructor(e,n){this.$from=e,this.$to=n}}let Tke=!1;function Ake(t){!Tke&&!t.parent.inlineContent&&(Tke=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Fi extends aa{constructor(e,n=e){Ake(e),Ake(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let s=e.resolve(n.map(this.head));if(!s.parent.inlineContent)return aa.near(s);let i=e.resolve(n.map(this.anchor));return new Fi(i.parent.inlineContent?i:s,s)}replace(e,n=cs.empty){if(super.replace(e,n),n==cs.empty){let s=this.$from.marksAcross(this.$to);s&&e.ensureMarks(s)}}eq(e){return e instanceof Fi&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Nse(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Fi(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,s=n){let i=e.resolve(n);return new this(i,s==n?i:e.resolve(s))}static between(e,n,s){let i=e.pos-n.pos;if((!s||i)&&(s=i>=0?1:-1),!n.parent.inlineContent){let o=aa.findFrom(n,s,!0)||aa.findFrom(n,-s,!0);if(o)n=o.$head;else return aa.near(n,s)}return e.parent.inlineContent||(i==0?e=n:(e=(aa.findFrom(e,-s,!0)||aa.findFrom(e,s,!0)).$anchor,e.pos0?0:1);i>0?c=0;c+=i){let a=e.child(c);if(a.isAtom){if(!o&&Xs.isSelectable(a))return Xs.create(t,n-(i<0?a.nodeSize:0))}else{let f=eS(t,a,n+i,i<0?a.childCount:0,i,o);if(f)return f}n+=a.nodeSize*i}return null}function Eke(t,e,n){let s=t.steps.length-1;if(s{c==null&&(c=y)}),t.setSelection(aa.near(t.doc.resolve(c),n))}const Ike=1,lL=2,Pke=4;class Lyt extends kRe{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(e){return this.storedMarks=e,this.updated|=lL,this}ensureMarks(e){return Eo.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&lL)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~lL,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let s=this.selection;return n&&(e=e.mark(this.storedMarks||(s.empty?s.$from.marks():s.$from.marksAcross(s.$to)||Eo.none))),s.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,s){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(s==null&&(s=n),!e)return this.deleteRange(n,s);let o=this.storedMarks;if(!o){let c=this.doc.resolve(n);o=s==n?c.marks():c.marksAcross(this.doc.resolve(s))}return this.replaceRangeWith(n,s,i.text(e,o)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(aa.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Pke,this}get scrolledIntoView(){return(this.updated&Pke)>0}}function Lke(t,e){return!e||!t?t:t.bind(e)}class H5{constructor(e,n,s){this.name=e,this.init=Lke(n.init,s),this.apply=Lke(n.apply,s)}}const Oyt=[new H5("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new H5("selection",{init(t,e){return t.selection||aa.atStart(e.doc)},apply(t){return t.selection}}),new H5("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,s){return s.selection.$cursor?t.storedMarks:null}}),new H5("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class tce{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Oyt.slice(),n&&n.forEach(s=>{if(this.pluginsByKey[s.key])throw new RangeError("Adding different instances of a keyed plugin ("+s.key+")");this.plugins.push(s),this.pluginsByKey[s.key]=s,s.spec.state&&this.fields.push(new H5(s.key,s.spec.state,s))})}}class mS{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let s=0;ss.toJSON())),e&&typeof e=="object")for(let s in e){if(s=="doc"||s=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[s],o=i.spec.state;o&&o.toJSON&&(n[s]=o.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,s){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new tce(e.schema,e.plugins),o=new mS(i);return i.fields.forEach(c=>{if(c.name=="doc")o.doc=i1.fromJSON(e.schema,n.doc);else if(c.name=="selection")o.selection=aa.fromJSON(o.doc,n.selection);else if(c.name=="storedMarks")n.storedMarks&&(o.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(s)for(let a in s){let f=s[a],m=f.spec.state;if(f.key==c.name&&m&&m.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){o[c.name]=m.fromJSON.call(f,e,n[a],o);return}}o[c.name]=c.init(e,o)}}),o}}function NRe(t,e,n){for(let s in t){let i=t[s];i instanceof Function?i=i.bind(e):s=="handleDOMEvents"&&(i=NRe(i,e,{})),n[s]=i}return n}class Id{constructor(e){this.spec=e,this.props={},e.props&&NRe(e.props,this,this.props),this.key=e.key?e.key.key:SRe("plugin")}getState(e){return e[this.key]}}const rce=Object.create(null);function SRe(t){return t in rce?t+"$"+ ++rce[t]:(rce[t]=0,t+"$")}class Jh{constructor(e="key"){this.key=SRe(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const kd=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Y4=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let She=null;const hy=function(t,e,n){let s=She||(She=document.createRange());return s.setEnd(t,n??t.nodeValue.length),s.setStart(t,e||0),s},Dyt=function(){She=null},Nj=function(t,e,n,s){return n&&(Oke(t,e,n,s,-1)||Oke(t,e,n,s,1))},Ryt=/^(img|br|input|textarea|hr)$/i;function Oke(t,e,n,s,i){for(var o;;){if(t==n&&e==s)return!0;if(e==(i<0?0:Mf(t))){let c=t.parentNode;if(!c||c.nodeType!=1||hI(t)||Ryt.test(t.nodeName)||t.contentEditable=="false")return!1;e=kd(t)+(i<0?0:1),t=c}else if(t.nodeType==1){let c=t.childNodes[e+(i<0?-1:0)];if(c.nodeType==1&&c.contentEditable=="false")if(!((o=c.pmViewDesc)===null||o===void 0)&&o.ignoreForSelection)e+=i;else return!1;else t=c,e=i<0?Mf(t):0}else return!1}}function Mf(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Fyt(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Mf(t)}else if(t.parentNode&&!hI(t))e=kd(t),t=t.parentNode;else return null}}function zyt(t,e){for(;;){if(t.nodeType==3&&e2),jf=X4||(_g?/Mac/.test(_g.platform):!1),TRe=_g?/Win/.test(_g.platform):!1,jy=/Android \d/.test(O1),fI=!!Dke&&"webkitFontSmoothing"in Dke.documentElement.style,qyt=fI?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Vyt(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function sy(t,e){return typeof t=="number"?t:t[e]}function Hyt(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,s=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*s}}function Rke(t,e,n){let s=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,o=t.dom.ownerDocument;for(let c=n||t.dom;c;){if(c.nodeType!=1){c=Y4(c);continue}let a=c,f=a==o.body,m=f?Vyt(o):Hyt(a),y=0,v=0;if(e.topm.bottom-sy(s,"bottom")&&(v=e.bottom-e.top>m.bottom-m.top?e.top+sy(i,"top")-m.top:e.bottom-m.bottom+sy(i,"bottom")),e.leftm.right-sy(s,"right")&&(y=e.right-m.right+sy(i,"right")),y||v)if(f)o.defaultView.scrollBy(y,v);else{let k=a.scrollLeft,C=a.scrollTop;v&&(a.scrollTop+=v),y&&(a.scrollLeft+=y);let S=a.scrollLeft-k,T=a.scrollTop-C;e={left:e.left-S,top:e.top-T,right:e.right-S,bottom:e.bottom-T}}let w=f?"fixed":getComputedStyle(c).position;if(/^(fixed|sticky)$/.test(w))break;c=w=="absolute"?c.offsetParent:Y4(c)}}function Wyt(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),s,i;for(let o=(e.left+e.right)/2,c=n+1;c=n-20){s=a,i=f.top;break}}return{refDOM:s,refTop:i,stack:ARe(t.dom)}}function ARe(t){let e=[],n=t.ownerDocument;for(let s=t;s&&(e.push({dom:s,top:s.scrollTop,left:s.scrollLeft}),t!=n);s=Y4(s));return e}function Gyt({refDOM:t,refTop:e,stack:n}){let s=t?t.getBoundingClientRect().top:0;ERe(n,s==0?0:s-e)}function ERe(t,e){for(let n=0;n=a){c=Math.max(C.bottom,c),a=Math.min(C.top,a);let S=C.left>e.left?C.left-e.left:C.right=(C.left+C.right)/2?1:0));continue}}else C.top>e.top&&!f&&C.left<=e.left&&C.right>=e.left&&(f=y,m={left:Math.max(C.left,Math.min(C.right,e.left)),top:C.top});!n&&(e.left>=C.right&&e.top>=C.top||e.left>=C.left&&e.top>=C.bottom)&&(o=v+1)}}return!n&&f&&(n=f,i=m,s=0),n&&n.nodeType==3?Zyt(n,i):!n||s&&n.nodeType==1?{node:t,offset:o}:IRe(n,i)}function Zyt(t,e){let n=t.nodeValue.length,s=document.createRange(),i;for(let o=0;o=(c.left+c.right)/2?1:0)};break}}return s.detach(),i||{node:t,offset:0}}function Cye(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Yyt(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left(c.left+c.right)/2?1:-1}return t.docView.posFromDOM(s,i,o)}function Qyt(t,e,n,s){let i=-1;for(let o=e,c=!1;o!=t.dom;){let a=t.docView.nearestDesc(o,!0),f;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((f=a.dom.getBoundingClientRect()).width||f.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!c&&f.left>s.left||f.top>s.top?i=a.posBefore:(!c&&f.right-1?i:t.docView.posFromDOM(e,n,-1)}function PRe(t,e,n){let s=t.childNodes.length;if(s&&n.tope.top&&i++}let m;fI&&i&&s.nodeType==1&&(m=s.childNodes[i-1]).nodeType==1&&m.contentEditable=="false"&&m.getBoundingClientRect().top>=e.top&&i--,s==t.dom&&i==s.childNodes.length-1&&s.lastChild.nodeType==1&&e.top>s.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(i==0||s.nodeType!=1||s.childNodes[i-1].nodeName!="BR")&&(a=Qyt(t,s,i,e))}a==null&&(a=Xyt(t,c,e));let f=t.docView.nearestDesc(c,!0);return{pos:a,inside:f?f.posAtStart-f.border:-1}}function Fke(t){return t.top=0&&i==s.nodeValue.length?(f--,y=1):n<0?f--:m++,x5(Gx(hy(s,f,m),y),y<0)}if(!t.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(n<0||i==Mf(s))){let f=s.childNodes[i-1];if(f.nodeType==1)return nce(f.getBoundingClientRect(),!1)}if(o==null&&i=0)}if(o==null&&i&&(n<0||i==Mf(s))){let f=s.childNodes[i-1],m=f.nodeType==3?hy(f,Mf(f)-(c?0:1)):f.nodeType==1&&(f.nodeName!="BR"||!f.nextSibling)?f:null;if(m)return x5(Gx(m,1),!1)}if(o==null&&i=0)}function x5(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function nce(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function ORe(t,e,n){let s=t.state,i=t.root.activeElement;s!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{s!=e&&t.updateState(s),i!=t.dom&&i&&i.focus()}}function txt(t,e,n){let s=e.selection,i=n=="up"?s.$from:s.$to;return ORe(t,e,()=>{let{node:o}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(o,!0);if(!a)break;if(a.node.isBlock){o=a.contentDOM||a.dom;break}o=a.dom.parentNode}let c=LRe(t,i.pos,1);for(let a=o.firstChild;a;a=a.nextSibling){let f;if(a.nodeType==1)f=a.getClientRects();else if(a.nodeType==3)f=hy(a,0,a.nodeValue.length).getClientRects();else continue;for(let m=0;my.top+1&&(n=="up"?c.top-y.top>(y.bottom-c.top)*2:y.bottom-c.bottom>(c.bottom-y.top)*2))return!1}}return!0})}const rxt=/[\u0590-\u08ac]/;function nxt(t,e,n){let{$head:s}=e.selection;if(!s.parent.isTextblock)return!1;let i=s.parentOffset,o=!i,c=i==s.parent.content.size,a=t.domSelection();return a?!rxt.test(s.parent.textContent)||!a.modify?n=="left"||n=="backward"?o:c:ORe(t,e,()=>{let{focusNode:f,focusOffset:m,anchorNode:y,anchorOffset:v}=t.domSelectionRange(),w=a.caretBidiLevel;a.modify("move",n,"character");let k=s.depth?t.docView.domAfterPos(s.before()):t.dom,{focusNode:C,focusOffset:S}=t.domSelectionRange(),T=C&&!k.contains(C.nodeType==1?C:C.parentNode)||f==C&&m==S;try{a.collapse(y,v),f&&(f!=y||m!=v)&&a.extend&&a.extend(f,m)}catch{}return w!=null&&(a.caretBidiLevel=w),T}):s.pos==s.start()||s.pos==s.end()}let zke=null,Bke=null,$ke=!1;function sxt(t,e,n){return zke==e&&Bke==n?$ke:(zke=e,Bke=n,$ke=n=="up"||n=="down"?txt(t,e,n):nxt(t,e,n))}const qf=0,Uke=1,mw=2,bg=3;class pI{constructor(e,n,s,i){this.parent=e,this.children=n,this.dom=s,this.contentDOM=i,this.dirty=qf,s.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,s){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;nkd(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.nextSibling)break}}return i??s>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let s=!0,i=e;i;i=i.parentNode){let o=this.getDesc(i),c;if(o&&(!n||o.node))if(s&&(c=o.nodeDOM)&&!(c.nodeType==1?c.contains(e.nodeType==1?e:e.parentNode):c==e))s=!1;else return o}}getDesc(e){let n=e.pmViewDesc;for(let s=n;s;s=s.parent)if(s==this)return n}posFromDOM(e,n,s){for(let i=e;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(e,n,s)}return-1}descAt(e){for(let n=0,s=0;ne||c instanceof RRe){i=e-o;break}o=a}if(i)return this.children[s].domFromPos(i-this.children[s].border,n);for(let o;s&&!(o=this.children[s-1]).size&&o instanceof DRe&&o.side>=0;s--);if(n<=0){let o,c=!0;for(;o=s?this.children[s-1]:null,!(!o||o.dom.parentNode==this.contentDOM);s--,c=!1);return o&&n&&c&&!o.border&&!o.domAtom?o.domFromPos(o.size,n):{node:this.contentDOM,offset:o?kd(o.dom)+1:0}}else{let o,c=!0;for(;o=s=y&&n<=m-f.border&&f.node&&f.contentDOM&&this.contentDOM.contains(f.contentDOM))return f.parseRange(e,n,y);e=c;for(let v=a;v>0;v--){let w=this.children[v-1];if(w.size&&w.dom.parentNode==this.contentDOM&&!w.emptyChildAt(1)){i=kd(w.dom)+1;break}e-=w.size}i==-1&&(i=0)}if(i>-1&&(m>n||a==this.children.length-1)){n=m;for(let y=a+1;yC&&cn){let C=a;a=f,f=C}let k=document.createRange();k.setEnd(f.node,f.offset),k.setStart(a.node,a.offset),m.removeAllRanges(),m.addRange(k)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let s=0,i=0;i=s:es){let a=s+o.border,f=c-o.border;if(e>=a&&n<=f){this.dirty=e==s||n==c?mw:Uke,e==a&&n==f&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=bg:o.markDirty(e-a,n-a);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?mw:bg}s=c}this.dirty=mw}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let s=e==1?mw:Uke;n.dirty{if(!o)return i;if(o.parent)return o.parent.posBeforeChild(o)})),!n.type.spec.raw){if(c.nodeType!=1){let a=document.createElement("span");a.appendChild(c),c=a}c.contentEditable="false",c.classList.add("ProseMirror-widget")}super(e,[],c,null),this.widget=n,this.widget=n,o=this}matchesWidget(e){return this.dirty==qf&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class ixt extends pI{constructor(e,n,s,i){super(e,[],n,null),this.textDOM=s,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Sj extends pI{constructor(e,n,s,i,o){super(e,[],s,i),this.mark=n,this.spec=o}static create(e,n,s,i){let o=i.nodeViews[n.type.name],c=o&&o(n,i,s);return(!c||!c.dom)&&(c=Bj.renderSpec(document,n.type.spec.toDOM(n,s),null,n.attrs)),new Sj(e,n,c.dom,c.contentDOM||c.dom,c)}parseRule(){return this.dirty&bg||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=bg&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=qf){let s=this.parent;for(;!s.node;)s=s.parent;s.dirty0&&(o=Ehe(o,0,e,s));for(let a=0;a{if(!f)return c;if(f.parent)return f.parent.posBeforeChild(f)},s,i),y=m&&m.dom,v=m&&m.contentDOM;if(n.isText){if(!y)y=document.createTextNode(n.text);else if(y.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else y||({dom:y,contentDOM:v}=Bj.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!v&&!n.isText&&y.nodeName!="BR"&&(y.hasAttribute("contenteditable")||(y.contentEditable="false"),n.type.spec.draggable&&(y.draggable=!0));let w=y;return y=BRe(y,s,n),m?f=new axt(e,n,s,i,y,v||null,w,m,o,c+1):n.isText?new Cse(e,n,s,i,y,w,o):new o1(e,n,s,i,y,v||null,w,o,c+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let s=this.children[n];if(this.dom.contains(s.dom.parentNode)){e.contentElement=s.dom.parentNode;break}}e.contentElement||(e.getContent=()=>gn.empty)}return e}matchesNode(e,n,s){return this.dirty==qf&&e.eq(this.node)&&kte(n,this.outerDeco)&&s.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let s=this.node.inlineContent,i=n,o=e.composing?this.localCompositionInfo(e,n):null,c=o&&o.pos>-1?o:null,a=o&&o.pos<0,f=new lxt(this,c&&c.node,e);uxt(this.node,this.innerDeco,(m,y,v)=>{m.spec.marks?f.syncToMarks(m.spec.marks,s,e):m.type.side>=0&&!v&&f.syncToMarks(y==this.node.childCount?Eo.none:this.node.child(y).marks,s,e),f.placeWidget(m,e,i)},(m,y,v,w)=>{f.syncToMarks(m.marks,s,e);let k;f.findNodeMatch(m,y,v,w)||a&&e.state.selection.from>i&&e.state.selection.to-1&&f.updateNodeAt(m,y,v,k,e)||f.updateNextNode(m,y,v,e,w,i)||f.addNode(m,y,v,e,i),i+=m.nodeSize}),f.syncToMarks([],s,e),this.node.isTextblock&&f.addTextblockHacks(),f.destroyRest(),(f.changed||this.dirty==mw)&&(c&&this.protectLocalComposition(e,c),FRe(this.contentDOM,this.children,e),X4&&hxt(this.dom))}localCompositionInfo(e,n){let{from:s,to:i}=e.state.selection;if(!(e.state.selection instanceof Fi)||sn+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let c=o.nodeValue,a=fxt(this.node.content,c,s-n,i-n);return a<0?null:{node:o,pos:a,text:c}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:s,text:i}){if(this.getDesc(n))return;let o=n;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let c=new ixt(this,o,n,i);e.input.compositionNodes.push(c),this.children=Ehe(this.children,s,s+i.length,e,c)}update(e,n,s,i){return this.dirty==bg||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,s,i),!0)}updateInner(e,n,s,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=s,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=qf}updateOuterDeco(e){if(kte(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,s=this.dom;this.dom=zRe(this.dom,this.nodeDOM,Ahe(this.outerDeco,this.node,n),Ahe(e,this.node,n)),this.dom!=s&&(s.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function qke(t,e,n,s,i){BRe(s,e,t);let o=new o1(void 0,t,e,n,s,s,s,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class Cse extends o1{constructor(e,n,s,i,o,c,a){super(e,n,s,i,o,null,c,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,s,i){return this.dirty==bg||this.dirty!=qf&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=qf||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=qf,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,s){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,s)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,s){let i=this.node.cut(e,n),o=document.createTextNode(i.text);return new Cse(this.parent,i,this.outerDeco,this.innerDeco,o,o,s)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=bg)}get domAtom(){return!1}isText(e){return this.node.text==e}}class RRe extends pI{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==qf&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class axt extends o1{constructor(e,n,s,i,o,c,a,f,m,y){super(e,n,s,i,o,c,a,m,y),this.spec=f}update(e,n,s,i){if(this.dirty==bg)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,n,s);return o&&this.updateInner(e,n,s,i),o}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,s,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,s,i){this.spec.setSelection?this.spec.setSelection(e,n,s.root):super.setSelection(e,n,s,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function FRe(t,e,n){let s=t.firstChild,i=!1;for(let o=0;o>1,c=Math.min(o,e.length);for(;i-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let f=Sj.create(this.top,e[o],n,s);this.top.children.splice(this.index,0,f),this.top=f,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,s,i){let o=-1,c;if(i>=this.preMatch.index&&(c=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&c.matchesNode(e,n,s))o=this.top.children.indexOf(c,this.index);else for(let a=this.index,f=Math.min(this.top.children.length,a+5);a0;){let a;for(;;)if(s){let m=n.children[s-1];if(m instanceof Sj)n=m,s=m.children.length;else{a=m,s--;break}}else{if(n==e)break e;s=n.parent.children.indexOf(n),n=n.parent}let f=a.node;if(f){if(f!=t.child(i-1))break;--i,o.set(a,i),c.push(a)}}return{index:i,matched:o,matches:c.reverse()}}function dxt(t,e){return t.type.side-e.type.side}function uxt(t,e,n,s){let i=e.locals(t),o=0;if(i.length==0){for(let m=0;mo;)a.push(i[c++]);let C=o+w.nodeSize;if(w.isText){let T=C;c!T.inline):a.slice();s(w,S,e.forChild(o,w),k),o=C}}function hxt(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function fxt(t,e,n,s){for(let i=0,o=0;i=n){if(o>=s&&f.slice(s-e.length-a,s-a)==e)return s-e.length;let m=a=0&&m+e.length+a>=n)return a+m;if(n==s&&f.length>=s+e.length-a&&f.slice(s-a,s-a+e.length)==e)return s}}return-1}function Ehe(t,e,n,s,i){let o=[];for(let c=0,a=0;c=n||y<=e?o.push(f):(mn&&o.push(f.slice(n-m,f.size,s)))}return o}function Mye(t,e=null){let n=t.domSelectionRange(),s=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),o=i&&i.size==0,c=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(c<0)return null;let a=s.resolve(c),f,m;if(Sse(n)){for(f=c;i&&!i.node;)i=i.parent;let v=i.node;if(i&&v.isAtom&&Xs.isSelectable(v)&&i.parent&&!(v.isInline&&Byt(n.focusNode,n.focusOffset,i.dom))){let w=i.posBefore;m=new Xs(c==w?a:s.resolve(w))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let v=c,w=c;for(let k=0;k{(n.anchorNode!=s||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!$Re(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function mxt(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,s=n.nodeName=="IMG";s?e.collapse(n.parentNode,kd(n)+1):e.collapse(n,0),!s&&!t.state.selection.visible&&fh&&a1<=11&&(n.disabled=!0,n.disabled=!1)}function URe(t,e){if(e instanceof Xs){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Kke(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Kke(t)}function Kke(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Tye(t,e,n,s){return t.someProp("createSelectionBetween",i=>i(t,e,n))||Fi.between(e,n,s)}function Zke(t){return t.editable&&!t.hasFocus()?!1:qRe(t)}function qRe(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function gxt(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Nj(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Ihe(t,e){let{$anchor:n,$head:s}=t.selection,i=e>0?n.max(s):n.min(s),o=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return o&&aa.findFrom(o,e)}function r0(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Yke(t,e,n){let s=t.state.selection;if(s instanceof Fi)if(n.indexOf("s")>-1){let{$head:i}=s,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let c=t.state.doc.resolve(i.pos+o.nodeSize*(e<0?-1:1));return r0(t,new Fi(s.$anchor,c))}else if(s.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Ihe(t.state,e);return i&&i instanceof Xs?r0(t,i):!1}else if(!(jf&&n.indexOf("m")>-1)){let i=s.$head,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,c;if(!o||o.isText)return!1;let a=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(c=t.docView.descAt(a))&&!c.contentDOM?Xs.isSelectable(o)?r0(t,new Xs(e<0?t.state.doc.resolve(i.pos-o.nodeSize):i)):fI?r0(t,new Fi(t.state.doc.resolve(e<0?a:a+o.nodeSize))):!1:!1}}else return!1;else{if(s instanceof Xs&&s.node.isInline)return r0(t,new Fi(e>0?s.$to:s.$from));{let i=Ihe(t.state,e);return i?r0(t,i):!1}}}function Nte(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function GT(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function qN(t,e){return e<0?yxt(t):xxt(t)}function yxt(t){let e=t.domSelectionRange(),n=e.focusNode,s=e.focusOffset;if(!n)return;let i,o,c=!1;for(Uf&&n.nodeType==1&&s0){if(n.nodeType!=1)break;{let a=n.childNodes[s-1];if(GT(a,-1))i=n,o=--s;else if(a.nodeType==3)n=a,s=n.nodeValue.length;else break}}else{if(VRe(n))break;{let a=n.previousSibling;for(;a&>(a,-1);)i=n.parentNode,o=kd(a),a=a.previousSibling;if(a)n=a,s=Nte(n);else{if(n=n.parentNode,n==t.dom)break;s=0}}}c?Phe(t,n,s):i&&Phe(t,i,o)}function xxt(t){let e=t.domSelectionRange(),n=e.focusNode,s=e.focusOffset;if(!n)return;let i=Nte(n),o,c;for(;;)if(s{t.state==i&&Ly(t)},50)}function Xke(t,e){let n=t.state.doc.resolve(e);if(!(rd||TRe)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let o=t.coordsAtPos(e-1),c=(o.top+o.bottom)/2;if(c>i.top&&c1)return o.lefti.top&&c1)return o.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Qke(t,e,n){let s=t.state.selection;if(s instanceof Fi&&!s.empty||n.indexOf("s")>-1||jf&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=s;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let c=Ihe(t.state,e);if(c&&c instanceof Xs)return r0(t,c)}if(!i.parent.inlineContent){let c=e<0?i:o,a=s instanceof qh?aa.near(c,e):aa.findFrom(c,e);return a?r0(t,a):!1}return!1}function Jke(t,e){if(!(t.state.selection instanceof Fi))return!0;let{$head:n,$anchor:s,empty:i}=t.state.selection;if(!n.sameParent(s))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let c=t.state.tr;return e<0?c.delete(n.pos-o.nodeSize,n.pos):c.delete(n.pos,n.pos+o.nodeSize),t.dispatch(c),!0}return!1}function eNe(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function bxt(t){if(!Qd||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let s=e.firstChild;eNe(t,s,"true"),setTimeout(()=>eNe(t,s,"false"),20)}return!1}function wxt(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function jxt(t,e){let n=e.keyCode,s=wxt(e);if(n==8||jf&&n==72&&s=="c")return Jke(t,-1)||qN(t,-1);if(n==46&&!e.shiftKey||jf&&n==68&&s=="c")return Jke(t,1)||qN(t,1);if(n==13||n==27)return!0;if(n==37||jf&&n==66&&s=="c"){let i=n==37?Xke(t,t.state.selection.from)=="ltr"?-1:1:-1;return Yke(t,i,s)||qN(t,i)}else if(n==39||jf&&n==70&&s=="c"){let i=n==39?Xke(t,t.state.selection.from)=="ltr"?1:-1:1;return Yke(t,i,s)||qN(t,i)}else{if(n==38||jf&&n==80&&s=="c")return Qke(t,-1,s)||qN(t,-1);if(n==40||jf&&n==78&&s=="c")return bxt(t)||Qke(t,1,s)||qN(t,1);if(s==(jf?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Aye(t,e){t.someProp("transformCopied",k=>{e=k(e,t)});let n=[],{content:s,openStart:i,openEnd:o}=e;for(;i>1&&o>1&&s.childCount==1&&s.firstChild.childCount==1;){i--,o--;let k=s.firstChild;n.push(k.type.name,k.attrs!=k.type.defaultAttrs?k.attrs:null),s=k.content}let c=t.someProp("clipboardSerializer")||Bj.fromSchema(t.state.schema),a=YRe(),f=a.createElement("div");f.appendChild(c.serializeFragment(s,{document:a}));let m=f.firstChild,y,v=0;for(;m&&m.nodeType==1&&(y=ZRe[m.nodeName.toLowerCase()]);){for(let k=y.length-1;k>=0;k--){let C=a.createElement(y[k]);for(;f.firstChild;)C.appendChild(f.firstChild);f.appendChild(C),v++}m=f.firstChild}m&&m.nodeType==1&&m.setAttribute("data-pm-slice",`${i} ${o}${v?` -${v}`:""} ${JSON.stringify(n)}`);let w=t.someProp("clipboardTextSerializer",k=>k(e,t))||e.content.textBetween(0,e.content.size,` `);return{dom:f,text:w,slice:e}}function HRe(t,e,n,s,i){let o=i.parent.type.spec.code,c,a;if(!n&&!e)return null;let f=!!e&&(s||o||!n);if(f){if(t.someProp("transformPastedText",w=>{e=w(e,o||s,t)}),o)return a=new cs(gn.from(t.state.schema.text(e.replace(/\r\n?/g,` `))),0,0),t.someProp("transformPasted",w=>{a=w(a,t,!0)}),a;let v=t.someProp("clipboardTextParser",w=>w(e,i,s,t));if(v)a=v;else{let w=i.marks(),{schema:k}=t.state,C=Bj.fromSchema(k);c=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(S=>{let T=c.appendChild(document.createElement("p"));S&&T.appendChild(C.serializeNode(k.text(S,w)))})}}else t.someProp("transformPastedHTML",v=>{n=v(n,t)}),c=Cxt(n),fI&&Mxt(c);let m=c&&c.querySelector("[data-pm-slice]"),y=m&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(m.getAttribute("data-pm-slice")||"");if(y&&y[3])for(let v=+y[3];v>0;v--){let w=c.firstChild;for(;w&&w.nodeType!=1;)w=w.nextSibling;if(!w)break;c=w}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||VT.fromSchema(t.state.schema)).parseSlice(c,{preserveWhitespace:!!(f||y),context:i,ruleFromNode(w){return w.nodeName=="BR"&&!w.nextSibling&&w.parentNode&&!kxt.test(w.parentNode.nodeName)?{ignore:!0}:null}})),y)a=Txt(tNe(a,+y[1],+y[2]),y[4]);else if(a=cs.maxOpen(Nxt(a.content,i),!0),a.openStart||a.openEnd){let v=0,w=0;for(let k=a.content.firstChild;v{a=v(a,t,f)}),a}const kxt=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Nxt(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),o,c=[];if(t.forEach(a=>{if(!c)return;let f=i.findWrapping(a.type),m;if(!f)return c=null;if(m=c.length&&o.length&&GRe(f,o,a,c[c.length-1],0))c[c.length-1]=m;else{c.length&&(c[c.length-1]=KRe(c[c.length-1],o.length));let y=WRe(a,f);c.push(y),i=i.matchType(y.type),o=f}}),c)return gn.from(c)}return t}function WRe(t,e,n=0){for(let s=e.length-1;s>=n;s--)t=e[s].create(null,gn.from(t));return t}function GRe(t,e,n,s,i){if(i1&&(o=0),i=n&&(a=e<0?c.contentMatchAt(0).fillBefore(a,o<=i).append(a):a.append(c.contentMatchAt(c.childCount).fillBefore(gn.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,c.copy(a))}function tNe(t,e,n){return en})),ice.createHTML(t)):t}function Cxt(t){let e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=YRe().createElement("div"),s=/<([a-z][^>\s]+)/i.exec(t),i;if((i=s&&ZRe[s[1].toLowerCase()])&&(t=i.map(o=>"<"+o+">").join("")+t+i.map(o=>"").reverse().join("")),n.innerHTML=Sxt(t),i)for(let o=0;o=0;a-=2){let f=n.nodes[s[a]];if(!f||f.hasRequiredAttrs())break;i=gn.from(f.create(s[a+1],i)),o++,c++}return new cs(i,o,c)}const Au={},Eu={},Axt={touchstart:!0,touchmove:!0};class Ext{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Ixt(t){for(let e in Au){let n=Au[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=s=>{Lxt(t,s)&&!Eye(t,s)&&(t.editable||!(s.type in Eu))&&n(t,s)},Axt[e]?{passive:!0}:void 0)}Qd&&t.dom.addEventListener("input",()=>null),Ohe(t)}function A0(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function Pxt(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Ohe(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=s=>Eye(t,s))})}function Eye(t,e){return t.someProp("handleDOMEvents",n=>{let s=n[e.type];return s?s(t,e)||e.defaultPrevented:!1})}function Lxt(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function Oxt(t,e){!Eye(t,e)&&Au[e.type]&&(t.editable||!(e.type in Eu))&&Au[e.type](t,e)}Eu.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!QRe(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(jy&&rd&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),X4&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let s=Date.now();t.input.lastIOSEnter=s,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==s&&(t.someProp("handleKeyDown",i=>i(t,aw(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",s=>s(t,n))||jxt(t,n)?n.preventDefault():A0(t,"key")};Eu.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Eu.keypress=(t,e)=>{let n=e;if(QRe(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||jf&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let s=t.state.selection;if(!(s instanceof Fi)||!s.$from.sameParent(s.$to)){let i=String.fromCharCode(n.charCode),o=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",c=>c(t,s.$from.pos,s.$to.pos,i,o))&&t.dispatch(o()),n.preventDefault()}};function Mse(t){return{left:t.clientX,top:t.clientY}}function Dxt(t,e){let n=e.x-t.clientX,s=e.y-t.clientY;return n*n+s*s<100}function Iye(t,e,n,s,i){if(s==-1)return!1;let o=t.state.doc.resolve(s);for(let c=o.depth+1;c>0;c--)if(t.someProp(e,a=>c>o.depth?a(t,n,o.nodeAfter,o.before(c),i,!0):a(t,n,o.node(c),o.before(c),i,!1)))return!0;return!1}function c4(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let s=t.state.tr.setSelection(e);s.setMeta("pointer",!0),t.dispatch(s)}function Rxt(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),s=n.nodeAfter;return s&&s.isAtom&&Xs.isSelectable(s)?(c4(t,new Xs(n)),!0):!1}function Fxt(t,e){if(e==-1)return!1;let n=t.state.selection,s,i;n instanceof Xs&&(s=n.node);let o=t.state.doc.resolve(e);for(let c=o.depth+1;c>0;c--){let a=c>o.depth?o.nodeAfter:o.node(c);if(Xs.isSelectable(a)){s&&n.$from.depth>0&&c>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?i=o.before(n.$from.depth):i=o.before(c);break}}return i!=null?(c4(t,Xs.create(t.state.doc,i)),!0):!1}function zxt(t,e,n,s,i){return Iye(t,"handleClickOn",e,n,s)||t.someProp("handleClick",o=>o(t,e,s))||(i?Fxt(t,n):Rxt(t,n))}function Bxt(t,e,n,s){return Iye(t,"handleDoubleClickOn",e,n,s)||t.someProp("handleDoubleClick",i=>i(t,e,s))}function $xt(t,e,n,s){return Iye(t,"handleTripleClickOn",e,n,s)||t.someProp("handleTripleClick",i=>i(t,e,s))||Uxt(t,n,s)}function Uxt(t,e,n){if(n.button!=0)return!1;let s=t.state.doc;if(e==-1)return s.inlineContent?(c4(t,Fi.create(s,0,s.content.size)),!0):!1;let i=s.resolve(e);for(let o=i.depth+1;o>0;o--){let c=o>i.depth?i.nodeAfter:i.node(o),a=i.before(o);if(c.inlineContent)c4(t,Fi.create(s,a+1,a+1+c.content.size));else if(Xs.isSelectable(c))c4(t,Xs.create(s,a));else continue;return!0}}function Pye(t){return Ste(t)}const XRe=jf?"metaKey":"ctrlKey";Au.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let s=Pye(t),i=Date.now(),o="singleClick";i-t.input.lastClick.time<500&&Dxt(n,t.input.lastClick)&&!n[XRe]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?o="doubleClick":t.input.lastClick.type=="doubleClick"&&(o="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:o,button:n.button};let c=t.posAtCoords(Mse(n));c&&(o=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new qxt(t,c,n,!!s)):(o=="doubleClick"?Bxt:$xt)(t,c.pos,c.inside,n)?n.preventDefault():A0(t,"pointer"))};class qxt{constructor(e,n,s,i){this.view=e,this.pos=n,this.event=s,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!s[XRe],this.allowDefault=s.shiftKey;let o,c;if(n.inside>-1)o=e.state.doc.nodeAt(n.inside),c=n.inside;else{let y=e.state.doc.resolve(n.pos);o=y.parent,c=y.depth?y.before():0}const a=i?null:s.target,f=a?e.docView.nearestDesc(a,!0):null;this.target=f&&f.nodeDOM.nodeType==1?f.nodeDOM:null;let{selection:m}=e.state;(s.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||m instanceof Xs&&m.from<=c&&m.to>c)&&(this.mightDrag={node:o,pos:c,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Uf&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),A0(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Ly(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Mse(e))),this.updateAllowDefault(e),this.allowDefault||!n?A0(this.view,"pointer"):zxt(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Qd&&this.mightDrag&&!this.mightDrag.node.isAtom||rd&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(c4(this.view,aa.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):A0(this.view,"pointer")}move(e){this.updateAllowDefault(e),A0(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Au.touchstart=t=>{t.input.lastTouch=Date.now(),Pye(t),A0(t,"pointer")};Au.touchmove=t=>{t.input.lastTouch=Date.now(),A0(t,"pointer")};Au.contextmenu=t=>Pye(t);function QRe(t,e){return t.composing?!0:Qd&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const Vxt=jy?5e3:-1;Eu.compositionstart=Eu.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Fi&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(s=>s.type.spec.inclusive===!1)||rd&&TRe&&Hxt(t)))t.markCursor=t.state.storedMarks||n.marks(),Ste(t,!0),t.markCursor=null;else if(Ste(t,!e.selection.empty),Uf&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let s=t.domSelectionRange();for(let i=s.focusNode,o=s.focusOffset;i&&i.nodeType==1&&o!=0;){let c=o<0?i.lastChild:i.childNodes[o-1];if(!c)break;if(c.nodeType==3){let a=t.domSelection();a&&a.collapse(c,c.nodeValue.length);break}else i=c,o=-1}}t.input.composing=!0}JRe(t,Vxt)};function Hxt(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let s=e.childNodes[n];return s.nodeType==1&&s.contentEditable=="false"}Eu.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,JRe(t,20))};function JRe(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Ste(t),e))}function eFe(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Gxt());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function Wxt(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=Fyt(e.focusNode,e.focusOffset),s=zyt(e.focusNode,e.focusOffset);if(n&&s&&n!=s){let i=s.pmViewDesc,o=t.domObserver.lastChangedTextNode;if(n==o||s==o)return o;if(!i||!i.isText(s.nodeValue))return s;if(t.input.compositionNode==s){let c=n.pmViewDesc;if(!(!c||!c.isText(n.nodeValue)))return s}}return n||s}function Gxt(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Ste(t,e=!1){if(!(jy&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),eFe(t),e||t.docView&&t.docView.dirty){let n=Mye(t),s=t.state.selection;return n&&!n.eq(s)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!s.$from.node(s.$from.sharedDepth(s.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function Kxt(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let s=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),s.removeAllRanges(),s.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const qA=fh&&a1<15||X4&&qyt<604;Au.copy=Eu.cut=(t,e)=>{let n=e,s=t.state.selection,i=n.type=="cut";if(s.empty)return;let o=qA?null:n.clipboardData,c=s.content(),{dom:a,text:f}=Aye(t,c);o?(n.preventDefault(),o.clearData(),o.setData("text/html",a.innerHTML),o.setData("text/plain",f)):Kxt(t,a),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Zxt(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function Yxt(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,s=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(s.contentEditable="true"),s.style.cssText="position: fixed; left: -10000px; top: 10px",s.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),s.parentNode&&s.parentNode.removeChild(s),n?VA(t,s.value,null,i,e):VA(t,s.textContent,s.innerHTML,i,e)},50)}function VA(t,e,n,s,i){let o=HRe(t,e,n,s,t.state.selection.$from);if(t.someProp("handlePaste",f=>f(t,i,o||cs.empty)))return!0;if(!o)return!1;let c=Zxt(o),a=c?t.state.tr.replaceSelectionWith(c,s):t.state.tr.replaceSelection(o);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function tFe(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Eu.paste=(t,e)=>{let n=e;if(t.composing&&!jy)return;let s=qA?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;s&&VA(t,tFe(s),s.getData("text/html"),i,n)?n.preventDefault():Yxt(t,n)};class rFe{constructor(e,n,s){this.slice=e,this.move=n,this.node=s}}const Xxt=jf?"altKey":"ctrlKey";function nFe(t,e){let n=t.someProp("dragCopies",s=>!s(e));return n??!e[Xxt]}Au.dragstart=(t,e)=>{let n=e,s=t.input.mouseDown;if(s&&s.done(),!n.dataTransfer)return;let i=t.state.selection,o=i.empty?null:t.posAtCoords(Mse(n)),c;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof Xs?i.to-1:i.to))){if(s&&s.mightDrag)c=Xs.create(t.state.doc,s.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let v=t.docView.nearestDesc(n.target,!0);v&&v.node.type.spec.draggable&&v!=t.docView&&(c=Xs.create(t.state.doc,v.posBefore))}}let a=(c||t.state.selection).content(),{dom:f,text:m,slice:y}=Aye(t,a);(!n.dataTransfer.files.length||!rd||MRe>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(qA?"Text":"text/html",f.innerHTML),n.dataTransfer.effectAllowed="copyMove",qA||n.dataTransfer.setData("text/plain",m),t.dragging=new rFe(y,nFe(t,n),c)};Au.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Eu.dragover=Eu.dragenter=(t,e)=>e.preventDefault();Eu.drop=(t,e)=>{try{Qxt(t,e,t.dragging)}finally{t.dragging=null}};function Qxt(t,e,n){if(!e.dataTransfer)return;let s=t.posAtCoords(Mse(e));if(!s)return;let i=t.state.doc.resolve(s.pos),o=n&&n.slice;o?t.someProp("transformPasted",k=>{o=k(o,t,!1)}):o=HRe(t,tFe(e.dataTransfer),qA?null:e.dataTransfer.getData("text/html"),!1,i);let c=!!(n&&nFe(t,e));if(t.someProp("handleDrop",k=>k(t,e,o||cs.empty,c))){e.preventDefault();return}if(!o)return;e.preventDefault();let a=o?vRe(t.state.doc,i.pos,o):i.pos;a==null&&(a=i.pos);let f=t.state.tr;if(c){let{node:k}=n;k?k.replace(f):f.deleteSelection()}let m=f.mapping.map(a),y=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,v=f.doc;if(y?f.replaceRangeWith(m,m,o.content.firstChild):f.replaceRange(m,m,o),f.doc.eq(v))return;let w=f.doc.resolve(m);if(y&&Xs.isSelectable(o.content.firstChild)&&w.nodeAfter&&w.nodeAfter.sameMarkup(o.content.firstChild))f.setSelection(new Xs(w));else{let k=f.mapping.map(a);f.mapping.maps[f.mapping.maps.length-1].forEach((C,S,T,I)=>k=I),f.setSelection(Tye(t,w,f.doc.resolve(k)))}t.focus(),t.dispatch(f.setMeta("uiEvent","drop"))}Au.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Ly(t)},20))};Au.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};Au.beforeinput=(t,e)=>{if(rd&&jy&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:s}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=s||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",o=>o(t,aw(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in Eu)Au[t]=Eu[t];function HA(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Cte{constructor(e,n){this.toDOM=e,this.spec=n||Qw,this.side=this.spec.side||0}map(e,n,s,i){let{pos:o,deleted:c}=e.mapResult(n.from+i,this.side<0?-1:1);return c?null:new Ef(o-s,o-s,this)}valid(){return!0}eq(e){return this==e||e instanceof Cte&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&HA(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class l1{constructor(e,n){this.attrs=e,this.spec=n||Qw}map(e,n,s,i){let o=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-s,c=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-s;return o>=c?null:new Ef(o,c,this)}valid(e,n){return n.from=e&&(!o||o(a.spec))&&s.push(a.copy(a.from+i,a.to+i))}for(let c=0;ce){let a=this.children[c]+1;this.children[c+2].findInner(e-a,n-a,s,i+a,o)}}map(e,n,s){return this==zd||e.maps.length==0?this:this.mapInner(e,n,0,0,s||Qw)}mapInner(e,n,s,i,o){let c;for(let a=0;a{let m=f+s,y;if(y=iFe(n,a,m)){for(i||(i=this.children.slice());oa&&v.to=e){this.children[a]==e&&(s=this.children[a+2]);break}let o=e+1,c=o+n.content.size;for(let a=0;ao&&f.type instanceof l1){let m=Math.max(o,f.from)-o,y=Math.min(c,f.to)-o;mi.map(e,n,Qw));return d0.from(s)}forChild(e,n){if(n.isLeaf)return Pc.empty;let s=[];for(let i=0;in instanceof Pc)?e:e.reduce((n,s)=>n.concat(s instanceof Pc?s:s.members),[]))}}forEachSet(e){for(let n=0;n{let T=S-C-(k-w);for(let I=0;IA+y-v)continue;let D=a[I]+y-v;k>=D?a[I+1]=w<=D?-2:-1:w>=y&&T&&(a[I]+=T,a[I+1]+=T)}v+=T}),y=n.maps[m].map(y,-1)}let f=!1;for(let m=0;m=s.content.size){f=!0;continue}let w=n.map(t[m+1]+o,-1),k=w-i,{index:C,offset:S}=s.content.findIndex(v),T=s.maybeChild(C);if(T&&S==v&&S+T.nodeSize==k){let I=a[m+2].mapInner(n,T,y+1,t[m]+o+1,c);I!=zd?(a[m]=v,a[m+1]=k,a[m+2]=I):(a[m+1]=-2,f=!0)}else f=!0}if(f){let m=e0t(a,t,e,n,i,o,c),y=Mte(m,s,0,c);e=y.local;for(let v=0;vn&&c.to{let m=iFe(t,a,f+n);if(m){o=!0;let y=Mte(m,a,n+f+1,s);y!=zd&&i.push(f,f+a.nodeSize,y)}});let c=sFe(o?aFe(t):t,-n).sort(Jw);for(let a=0;a0;)e++;t.splice(e,0,n)}function ace(t){let e=[];return t.someProp("decorations",n=>{let s=n(t.state);s&&s!=zd&&e.push(s)}),t.cursorWrapper&&e.push(Pc.create(t.state.doc,[t.cursorWrapper.deco])),d0.from(e)}const t0t={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},r0t=fh&&a1<=11;class n0t{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class s0t{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new n0t,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(s=>{for(let i=0;ii.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),r0t&&(this.onCharData=s=>{this.queue.push({target:s.target,type:"characterData",oldValue:s.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,t0t)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;nthis.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Zke(this.view)){if(this.suppressingSelectionUpdates)return Ly(this.view);if(fh&&a1<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Nj(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,s;for(let o=e.focusNode;o;o=Y4(o))n.add(o);for(let o=e.anchorNode;o;o=Y4(o))if(n.has(o)){s=o;break}let i=s&&this.view.docView.nearestDesc(s);if(i&&i.ignoreMutation({type:"selection",target:s.nodeType==3?s.parentNode:s}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let s=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(s)&&Zke(e)&&!this.ignoreSelectionChange(s),o=-1,c=-1,a=!1,f=[];if(e.editable)for(let y=0;yv.nodeName=="BR");if(y.length==2){let[v,w]=y;v.parentNode&&v.parentNode.parentNode==w.parentNode?w.remove():v.remove()}else{let{focusNode:v}=this.currentSelection;for(let w of y){let k=w.parentNode;k&&k.nodeName=="LI"&&(!v||o0t(e,v)!=k)&&w.remove()}}}else if((rd||Qd)&&f.some(y=>y.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let y of f)if(y.nodeName=="BR"&&y.parentNode){let v=y.nextSibling;v&&v.nodeType==1&&v.contentEditable=="false"&&y.parentNode.removeChild(y)}}let m=null;o<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||i)&&(o>-1&&(e.docView.markDirty(o,c),i0t(e)),this.handleDOMChange(o,c,a,f),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(s)||Ly(e),this.currentSelection.set(s))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let s=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(s==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!s||s.ignoreMutation(e))return null;if(e.type=="childList"){for(let y=0;yi;T--){let I=s.childNodes[T-1],A=I.pmViewDesc;if(I.nodeName=="BR"&&!A){o=T;break}if(!A||A.size)break}let v=t.state.doc,w=t.someProp("domParser")||VT.fromSchema(t.state.schema),k=v.resolve(c),C=null,S=w.parse(s,{topNode:k.parent,topMatch:k.parent.contentMatchAt(k.index()),topOpen:!0,from:i,to:o,preserveWhitespace:k.parent.type.whitespace=="pre"?"full":!0,findPositions:m,ruleFromNode:c0t,context:k});if(m&&m[0].pos!=null){let T=m[0].pos,I=m[1]&&m[1].pos;I==null&&(I=T),C={anchor:T+c,head:I+c}}return{doc:S,sel:C,from:c,to:a}}function c0t(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Qd&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Qd&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const d0t=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function u0t(t,e,n,s,i){let o=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let W=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,K=Mye(t,W);if(K&&!t.state.selection.eq(K)){if(rd&&jy&&t.input.lastKeyCode===13&&Date.now()-100re(t,aw(13,"Enter"))))return;let Z=t.state.tr.setSelection(K);W=="pointer"?Z.setMeta("pointer",!0):W=="key"&&Z.scrollIntoView(),o&&Z.setMeta("composition",o),t.dispatch(Z)}return}let c=t.state.doc.resolve(e),a=c.sharedDepth(n);e=c.before(a+1),n=t.state.doc.resolve(n).after(a+1);let f=t.state.selection,m=l0t(t,e,n),y=t.state.doc,v=y.slice(m.from,m.to),w,k;t.input.lastKeyCode===8&&Date.now()-100Date.now()-225||jy)&&i.some(W=>W.nodeType==1&&!d0t.test(W.nodeName))&&(!C||C.endA>=C.endB)&&t.someProp("handleKeyDown",W=>W(t,aw(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!C)if(s&&f instanceof Fi&&!f.empty&&f.$head.sameParent(f.$anchor)&&!t.composing&&!(m.sel&&m.sel.anchor!=m.sel.head))C={start:f.from,endA:f.to,endB:f.to};else{if(m.sel){let W=oNe(t,t.state.doc,m.sel);if(W&&!W.eq(t.state.selection)){let K=t.state.tr.setSelection(W);o&&K.setMeta("composition",o),t.dispatch(K)}}return}t.state.selection.fromt.state.selection.from&&C.start<=t.state.selection.from+2&&t.state.selection.from>=m.from?C.start=t.state.selection.from:C.endA=t.state.selection.to-2&&t.state.selection.to<=m.to&&(C.endB+=t.state.selection.to-C.endA,C.endA=t.state.selection.to)),fh&&a1<=11&&C.endB==C.start+1&&C.endA==C.start&&C.start>m.from&&m.doc.textBetween(C.start-m.from-1,C.start-m.from+1)=="  "&&(C.start--,C.endA--,C.endB--);let S=m.doc.resolveNoCache(C.start-m.from),T=m.doc.resolveNoCache(C.endB-m.from),I=y.resolve(C.start),A=S.sameParent(T)&&S.parent.inlineContent&&I.end()>=C.endA;if((X4&&t.input.lastIOSEnter>Date.now()-225&&(!A||i.some(W=>W.nodeName=="DIV"||W.nodeName=="P"))||!A&&S.posW(t,aw(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>C.start&&f0t(y,C.start,C.endA,S,T)&&t.someProp("handleKeyDown",W=>W(t,aw(8,"Backspace")))){jy&&rd&&t.domObserver.suppressSelectionUpdates();return}rd&&C.endB==C.start&&(t.input.lastChromeDelete=Date.now()),jy&&!A&&S.start()!=T.start()&&T.parentOffset==0&&S.depth==T.depth&&m.sel&&m.sel.anchor==m.sel.head&&m.sel.head==C.endA&&(C.endB-=2,T=m.doc.resolveNoCache(C.endB-m.from),setTimeout(()=>{t.someProp("handleKeyDown",function(W){return W(t,aw(13,"Enter"))})},20));let D=C.start,$=C.endA,F=W=>{let K=W||t.state.tr.replace(D,$,m.doc.slice(C.start-m.from,C.endB-m.from));if(m.sel){let Z=oNe(t,K.doc,m.sel);Z&&!(rd&&t.composing&&Z.empty&&(C.start!=C.endB||t.input.lastChromeDeleteLy(t),20));let W=F(t.state.tr.delete(D,$)),K=y.resolve(C.start).marksAcross(y.resolve(C.endA));K&&W.ensureMarks(K),t.dispatch(W)}else if(C.endA==C.endB&&(q=h0t(S.parent.content.cut(S.parentOffset,T.parentOffset),I.parent.content.cut(I.parentOffset,C.endA-I.start())))){let W=F(t.state.tr);q.type=="add"?W.addMark(D,$,q.mark):W.removeMark(D,$,q.mark),t.dispatch(W)}else if(S.parent.child(S.index()).isText&&S.index()==T.index()-(T.textOffset?0:1)){let W=S.parent.textBetween(S.parentOffset,T.parentOffset),K=()=>F(t.state.tr.insertText(W,D,$));t.someProp("handleTextInput",Z=>Z(t,D,$,W,K))||t.dispatch(K())}else t.dispatch(F());else t.dispatch(F())}function oNe(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Tye(t,e.resolve(n.anchor),e.resolve(n.head))}function h0t(t,e){let n=t.firstChild.marks,s=e.firstChild.marks,i=n,o=s,c,a,f;for(let y=0;yy.mark(a.addToSet(y.marks));else if(i.length==0&&o.length==1)a=o[0],c="remove",f=y=>y.mark(a.removeFromSet(y.marks));else return null;let m=[];for(let y=0;yn||oce(c,!0,!1)0&&(e||t.indexAfter(s)==t.node(s).childCount);)s--,i++,e=!1;if(n){let o=t.node(s).maybeChild(t.indexAfter(s));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function p0t(t,e,n,s,i){let o=t.findDiffStart(e,n);if(o==null)return null;let{a:c,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let f=Math.max(0,o-Math.min(c,a));s-=c+f-o}if(c=c?o-s:0;o-=f,o&&o=a?o-s:0;o-=f,o&&o=56320&&e<=57343&&n>=55296&&n<=56319}class oFe{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Ext,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(fNe),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=uNe(this),dNe(this),this.nodeViews=hNe(this),this.docView=qke(this.state.doc,cNe(this),ace(this),this.dom,this),this.domObserver=new s0t(this,(s,i,o,c)=>u0t(this,s,i,o,c)),this.domObserver.start(),Ixt(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Ohe(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(fNe),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let s in this._props)n[s]=this._props[s];n.state=this.state;for(let s in e)n[s]=e[s];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var s;let i=this.state,o=!1,c=!1;e.storedMarks&&this.composing&&(eFe(this),c=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let k=hNe(this);g0t(k,this.nodeViews)&&(this.nodeViews=k,o=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&Ohe(this),this.editable=uNe(this),dNe(this);let f=ace(this),m=cNe(this),y=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",v=o||!this.docView.matchesNode(e.doc,m,f);(v||!e.selection.eq(i.selection))&&(c=!0);let w=y=="preserve"&&c&&this.dom.style.overflowAnchor==null&&Wyt(this);if(c){this.domObserver.stop();let k=v&&(fh||rd)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&m0t(i.selection,e.selection);if(v){let C=rd?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Wxt(this)),(o||!this.docView.update(e.doc,m,f,this))&&(this.docView.updateOuterDeco(m),this.docView.destroy(),this.docView=qke(e.doc,m,f,this.dom,this)),C&&!this.trackWrites&&(k=!0)}k||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&gxt(this))?Ly(this,k):(URe(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((s=this.dragging)===null||s===void 0)&&s.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),y=="reset"?this.dom.scrollTop=0:y=="to selection"?this.scrollToSelection():w&&Gyt(w)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Xs){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Rke(this,n.getBoundingClientRect(),e)}else Rke(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n0&&this.state.doc.nodeAt(o))==s.node&&(i=o)}this.dragging=new rFe(e.slice,e.move,i<0?void 0:Xs.create(this.state.doc,i))}someProp(e,n){let s=this._props&&this._props[e],i;if(s!=null&&(i=n?n(s):s))return i;for(let c=0;cn.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Jyt(this,e)}coordsAtPos(e,n=1){return LRe(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,s=-1){let i=this.docView.posFromDOM(e,n,s);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return sxt(this,n||this.state,e)}pasteHTML(e,n){return VA(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return VA(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return Aye(this,e)}destroy(){this.docView&&(Pxt(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ace(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Dyt())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Oxt(this,e)}domSelectionRange(){let e=this.domSelection();return e?Qd&&this.root.nodeType===11&&$yt(this.dom.ownerDocument)==this.dom&&a0t(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}oFe.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function cNe(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let s in n)s=="class"?e.class+=" "+n[s]:s=="style"?e.style=(e.style?e.style+";":"")+n[s]:!e[s]&&s!="contenteditable"&&s!="nodeName"&&(e[s]=String(n[s]))}),e.translate||(e.translate="no"),[Ef.node(0,t.state.doc.content.size,e)]}function dNe(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Ef.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function uNe(t){return!t.someProp("editable",e=>e(t.state)===!1)}function m0t(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function hNe(t){let e=Object.create(null);function n(s){for(let i in s)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=s[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function g0t(t,e){let n=0,s=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)s++;return n!=s}function fNe(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var b1={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Tte={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},y0t=typeof navigator<"u"&&/Mac/.test(navigator.platform),x0t=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Nd=0;Nd<10;Nd++)b1[48+Nd]=b1[96+Nd]=String(Nd);for(var Nd=1;Nd<=24;Nd++)b1[Nd+111]="F"+Nd;for(var Nd=65;Nd<=90;Nd++)b1[Nd]=String.fromCharCode(Nd+32),Tte[Nd]=String.fromCharCode(Nd);for(var lce in b1)Tte.hasOwnProperty(lce)||(Tte[lce]=b1[lce]);function v0t(t){var e=y0t&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||x0t&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Tte:b1)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const _0t=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),b0t=typeof navigator<"u"&&/Win/.test(navigator.platform);function w0t(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let s,i,o,c;for(let a=0;at.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function cFe(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const dFe=(t,e,n)=>{let s=cFe(t,n);if(!s)return!1;let i=Rye(s);if(!i){let c=s.blockRange(),a=c&&WC(c);return a==null?!1:(e&&e(t.tr.lift(c,a).scrollIntoView()),!0)}let o=i.nodeBefore;if(vFe(t,i,e,-1))return!0;if(s.parent.content.size==0&&(Q4(o,"end")||Xs.isSelectable(o)))for(let c=s.depth;;c--){let a=kse(t.doc,s.before(c),s.after(c),cs.empty);if(a&&a.slice.size1)break}return o.isAtom&&i.depth==s.depth-1?(e&&e(t.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},N0t=(t,e,n)=>{let s=cFe(t,n);if(!s)return!1;let i=Rye(s);return i?uFe(t,i,e):!1},S0t=(t,e,n)=>{let s=fFe(t,n);if(!s)return!1;let i=Fye(s);return i?uFe(t,i,e):!1};function uFe(t,e,n){let s=e.nodeBefore,i=s,o=e.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let y=i.lastChild;if(!y)return!1;i=y}let c=e.nodeAfter,a=c,f=e.pos+1;for(;!a.isTextblock;f++){if(a.type.spec.isolating)return!1;let y=a.firstChild;if(!y)return!1;a=y}let m=kse(t.doc,o,f,cs.empty);if(!m||m.from!=o||m instanceof ed&&m.slice.size>=f-o)return!1;if(n){let y=t.tr.step(m);y.setSelection(Fi.create(y.doc,o)),n(y.scrollIntoView())}return!0}function Q4(t,e,n=!1){for(let s=t;s;s=e=="start"?s.firstChild:s.lastChild){if(s.isTextblock)return!0;if(n&&s.childCount!=1)return!1}return!1}const hFe=(t,e,n)=>{let{$head:s,empty:i}=t.selection,o=s;if(!i)return!1;if(s.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):s.parentOffset>0)return!1;o=Rye(s)}let c=o&&o.nodeBefore;return!c||!Xs.isSelectable(c)?!1:(e&&e(t.tr.setSelection(Xs.create(t.doc,o.pos-c.nodeSize)).scrollIntoView()),!0)};function Rye(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function fFe(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let s=fFe(t,n);if(!s)return!1;let i=Fye(s);if(!i)return!1;let o=i.nodeAfter;if(vFe(t,i,e,1))return!0;if(s.parent.content.size==0&&(Q4(o,"start")||Xs.isSelectable(o))){let c=kse(t.doc,s.before(),s.after(),cs.empty);if(c&&c.slice.size{let{$head:s,empty:i}=t.selection,o=s;if(!i)return!1;if(s.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):s.parentOffset=0;e--){let n=t.node(e);if(t.index(e)+1{let n=t.selection,s=n instanceof Xs,i;if(s){if(n.node.isTextblock||!L1(t.doc,n.from))return!1;i=n.from}else if(i=jse(t.doc,n.from,-1),i==null)return!1;if(e){let o=t.tr.join(i);s&&o.setSelection(Xs.create(o.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},M0t=(t,e)=>{let n=t.selection,s;if(n instanceof Xs){if(n.node.isTextblock||!L1(t.doc,n.to))return!1;s=n.to}else if(s=jse(t.doc,n.to,1),s==null)return!1;return e&&e(t.tr.join(s).scrollIntoView()),!0},T0t=(t,e)=>{let{$from:n,$to:s}=t.selection,i=n.blockRange(s),o=i&&WC(i);return o==null?!1:(e&&e(t.tr.lift(i,o).scrollIntoView()),!0)},gFe=(t,e)=>{let{$head:n,$anchor:s}=t.selection;return!n.parent.type.spec.code||!n.sameParent(s)?!1:(e&&e(t.tr.insertText(` `).scrollIntoView()),!0)};function zye(t){for(let e=0;e{let{$head:n,$anchor:s}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(s))return!1;let i=n.node(-1),o=n.indexAfter(-1),c=zye(i.contentMatchAt(o));if(!c||!i.canReplaceWith(o,o,c))return!1;if(e){let a=n.after(),f=t.tr.replaceWith(a,a,c.createAndFill());f.setSelection(aa.near(f.doc.resolve(a),1)),e(f.scrollIntoView())}return!0},yFe=(t,e)=>{let n=t.selection,{$from:s,$to:i}=n;if(n instanceof qh||s.parent.inlineContent||i.parent.inlineContent)return!1;let o=zye(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let c=(!s.parentOffset&&i.index(){let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let o=n.before();if(Py(t.doc,o))return e&&e(t.tr.split(o).scrollIntoView()),!0}let s=n.blockRange(),i=s&&WC(s);return i==null?!1:(e&&e(t.tr.lift(s,i).scrollIntoView()),!0)};function E0t(t){return(e,n)=>{let{$from:s,$to:i}=e.selection;if(e.selection instanceof Xs&&e.selection.node.isBlock)return!s.parentOffset||!Py(e.doc,s.pos)?!1:(n&&n(e.tr.split(s.pos).scrollIntoView()),!0);if(!s.depth)return!1;let o=[],c,a,f=!1,m=!1;for(let k=s.depth;;k--)if(s.node(k).isBlock){f=s.end(k)==s.pos+(s.depth-k),m=s.start(k)==s.pos-(s.depth-k),a=zye(s.node(k-1).contentMatchAt(s.indexAfter(k-1))),o.unshift(f&&a?{type:a}:null),c=k;break}else{if(k==1)return!1;o.unshift(null)}let y=e.tr;(e.selection instanceof Fi||e.selection instanceof qh)&&y.deleteSelection();let v=y.mapping.map(s.pos),w=Py(y.doc,v,o.length,o);if(w||(o[0]=a?{type:a}:null,w=Py(y.doc,v,o.length,o)),!w)return!1;if(y.split(v,o.length,o),!f&&m&&s.node(c).type!=a){let k=y.mapping.map(s.before(c)),C=y.doc.resolve(k);a&&s.node(c-1).canReplaceWith(C.index(),C.index()+1,a)&&y.setNodeMarkup(y.mapping.map(s.before(c)),a)}return n&&n(y.scrollIntoView()),!0}}const I0t=E0t(),P0t=(t,e)=>{let{$from:n,to:s}=t.selection,i,o=n.sharedDepth(s);return o==0?!1:(i=n.before(o),e&&e(t.tr.setSelection(Xs.create(t.doc,i))),!0)};function L0t(t,e,n){let s=e.nodeBefore,i=e.nodeAfter,o=e.index();return!s||!i||!s.type.compatibleContent(i.type)?!1:!s.content.size&&e.parent.canReplace(o-1,o)?(n&&n(t.tr.delete(e.pos-s.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(i.isTextblock||L1(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function vFe(t,e,n,s){let i=e.nodeBefore,o=e.nodeAfter,c,a,f=i.type.spec.isolating||o.type.spec.isolating;if(!f&&L0t(t,e,n))return!0;let m=!f&&e.parent.canReplace(e.index(),e.index()+1);if(m&&(c=(a=i.contentMatchAt(i.childCount)).findWrapping(o.type))&&a.matchType(c[0]||o.type).validEnd){if(n){let k=e.pos+o.nodeSize,C=gn.empty;for(let I=c.length-1;I>=0;I--)C=gn.from(c[I].create(null,C));C=gn.from(i.copy(C));let S=t.tr.step(new ad(e.pos-1,k,e.pos,k,new cs(C,1,0),c.length,!0)),T=S.doc.resolve(k+2*c.length);T.nodeAfter&&T.nodeAfter.type==i.type&&L1(S.doc,T.pos)&&S.join(T.pos),n(S.scrollIntoView())}return!0}let y=o.type.spec.isolating||s>0&&f?null:aa.findFrom(e,1),v=y&&y.$from.blockRange(y.$to),w=v&&WC(v);if(w!=null&&w>=e.depth)return n&&n(t.tr.lift(v,w).scrollIntoView()),!0;if(m&&Q4(o,"start",!0)&&Q4(i,"end")){let k=i,C=[];for(;C.push(k),!k.isTextblock;)k=k.lastChild;let S=o,T=1;for(;!S.isTextblock;S=S.firstChild)T++;if(k.canReplace(k.childCount,k.childCount,S.content)){if(n){let I=gn.empty;for(let D=C.length-1;D>=0;D--)I=gn.from(C[D].copy(I));let A=t.tr.step(new ad(e.pos-C.length,e.pos+o.nodeSize,e.pos+T,e.pos+o.nodeSize-T,new cs(I,C.length,0),0,!0));n(A.scrollIntoView())}return!0}}return!1}function _Fe(t){return function(e,n){let s=e.selection,i=t<0?s.$from:s.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(n&&n(e.tr.setSelection(Fi.create(e.doc,t<0?i.start(o):i.end(o)))),!0):!1}}const O0t=_Fe(-1),D0t=_Fe(1);function R0t(t,e=null){return function(n,s){let{$from:i,$to:o}=n.selection,c=i.blockRange(o),a=c&&Nye(c,t,e);return a?(s&&s(n.tr.wrap(c,a).scrollIntoView()),!0):!1}}function pNe(t,e=null){return function(n,s){let i=!1;for(let o=0;o{if(i)return!1;if(!(!f.isTextblock||f.hasMarkup(t,e)))if(f.type==t)i=!0;else{let y=n.doc.resolve(m),v=y.index();i=y.parent.canReplaceWith(v,v+1,t)}})}if(!i)return!1;if(s){let o=n.tr;for(let c=0;c=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let f=c.resolve(e.start-2);o=new wte(f,f,e.depth),e.endIndex=0;y--)o=gn.from(n[y].type.create(n[y].attrs,o));t.step(new ad(e.start-(s?2:0),e.end,e.start,e.end,new cs(o,0,0),n.length,!0));let c=0;for(let y=0;yc.childCount>0&&c.firstChild.type==t);return o?n?s.node(o.depth-1).type==t?U0t(e,n,t,o):q0t(e,n,o):!0:!1}}function U0t(t,e,n,s){let i=t.tr,o=s.end,c=s.$to.end(s.depth);oS;C--)k-=i.child(C).nodeSize,s.delete(k-1,k+1);let o=s.doc.resolve(n.start),c=o.nodeAfter;if(s.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,f=n.endIndex==i.childCount,m=o.node(-1),y=o.index(-1);if(!m.canReplace(y+(a?0:1),y+1,c.content.append(f?gn.empty:gn.from(i))))return!1;let v=o.pos,w=v+c.nodeSize;return s.step(new ad(v-(a?1:0),w+(f?1:0),v+1,w-1,new cs((a?gn.empty:gn.from(i.copy(gn.empty))).append(f?gn.empty:gn.from(i.copy(gn.empty))),a?0:1,f?0:1),a?0:1)),e(s.scrollIntoView()),!0}function V0t(t){return function(e,n){let{$from:s,$to:i}=e.selection,o=s.blockRange(i,m=>m.childCount>0&&m.firstChild.type==t);if(!o)return!1;let c=o.startIndex;if(c==0)return!1;let a=o.parent,f=a.child(c-1);if(f.type!=t)return!1;if(n){let m=f.lastChild&&f.lastChild.type==a.type,y=gn.from(m?t.create():null),v=new cs(gn.from(t.create(null,gn.from(a.type.create(null,y)))),m?3:1,0),w=o.start,k=o.end;n(e.tr.step(new ad(w-(m?3:1),k,w,k,v,1,!0)).scrollIntoView())}return!0}}function Tse(t){const{state:e,transaction:n}=t;let{selection:s}=n,{doc:i}=n,{storedMarks:o}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return o},get selection(){return s},get doc(){return i},get tr(){return s=n.selection,i=n.doc,o=n.storedMarks,n}}}class Ase{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:n,state:s}=this,{view:i}=n,{tr:o}=s,c=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([a,f])=>[a,(...y)=>{const v=f(...y)(c);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(o),v}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:s,editor:i,state:o}=this,{view:c}=i,a=[],f=!!e,m=e||o.tr,y=()=>(!f&&n&&!m.getMeta("preventDispatch")&&!this.hasCustomState&&c.dispatch(m),a.every(w=>w===!0)),v={...Object.fromEntries(Object.entries(s).map(([w,k])=>[w,(...S)=>{const T=this.buildProps(m,n),I=k(...S)(T);return a.push(I),v}])),run:y};return v}createCan(e){const{rawCommands:n,state:s}=this,i=!1,o=e||s.tr,c=this.buildProps(o,i);return{...Object.fromEntries(Object.entries(n).map(([f,m])=>[f,(...y)=>m(...y)({...c,dispatch:void 0})])),chain:()=>this.createChain(o,i)}}buildProps(e,n=!0){const{rawCommands:s,editor:i,state:o}=this,{view:c}=i,a={tr:e,editor:i,view:c,state:Tse({state:o,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(s).map(([f,m])=>[f,(...y)=>m(...y)(a)]))}};return a}}let H0t=class{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){const s=this.callbacks[e];return s&&s.forEach(i=>i.apply(this,n)),this}off(e,n){const s=this.callbacks[e];return s&&(n?this.callbacks[e]=s.filter(i=>i!==n):delete this.callbacks[e]),this}once(e,n){const s=(...i)=>{this.off(e,s),n.apply(this,i)};return this.on(e,s)}removeAllListeners(){this.callbacks={}}};function vs(t,e,n){return t.config[e]===void 0&&t.parent?vs(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?vs(t.parent,e,n):null}):t.config[e]}function Ese(t){const e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),s=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:s}}function bFe(t){const e=[],{nodeExtensions:n,markExtensions:s}=Ese(t),i=[...n,...s],o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(c=>{const a={name:c.name,options:c.options,storage:c.storage,extensions:i},f=vs(c,"addGlobalAttributes",a);if(!f)return;f().forEach(y=>{y.types.forEach(v=>{Object.entries(y.attributes).forEach(([w,k])=>{e.push({type:v,name:w,attribute:{...o,...k}})})})})}),i.forEach(c=>{const a={name:c.name,options:c.options,storage:c.storage},f=vs(c,"addAttributes",a);if(!f)return;const m=f();Object.entries(m).forEach(([y,v])=>{const w={...o,...v};typeof(w==null?void 0:w.default)=="function"&&(w.default=w.default()),w!=null&&w.isRequired&&(w==null?void 0:w.default)===void 0&&delete w.default,e.push({type:c.name,name:y,attribute:w})})}),e}function ld(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function cd(...t){return t.filter(e=>!!e).reduce((e,n)=>{const s={...e};return Object.entries(n).forEach(([i,o])=>{if(!s[i]){s[i]=o;return}if(i==="class"){const a=o?String(o).split(" "):[],f=s[i]?s[i].split(" "):[],m=a.filter(y=>!f.includes(y));s[i]=[...f,...m].join(" ")}else if(i==="style"){const a=o?o.split(";").map(y=>y.trim()).filter(Boolean):[],f=s[i]?s[i].split(";").map(y=>y.trim()).filter(Boolean):[],m=new Map;f.forEach(y=>{const[v,w]=y.split(":").map(k=>k.trim());m.set(v,w)}),a.forEach(y=>{const[v,w]=y.split(":").map(k=>k.trim());m.set(v,w)}),s[i]=Array.from(m.entries()).map(([y,v])=>`${y}: ${v}`).join("; ")}else s[i]=o}),s},{})}function Dhe(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,s)=>cd(n,s),{})}function wFe(t){return typeof t=="function"}function oa(t,e=void 0,...n){return wFe(t)?e?t.bind(e)(...n):t(...n):t}function W0t(t={}){return Object.keys(t).length===0&&t.constructor===Object}function G0t(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function mNe(t,e){return"style"in t?t:{...t,getAttrs:n=>{const s=t.getAttrs?t.getAttrs(n):t.attrs;if(s===!1)return!1;const i=e.reduce((o,c)=>{const a=c.attribute.parseHTML?c.attribute.parseHTML(n):G0t(n.getAttribute(c.name));return a==null?o:{...o,[c.name]:a}},{});return{...s,...i}}}}function gNe(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&W0t(n)?!1:n!=null))}function K0t(t,e){var n;const s=bFe(t),{nodeExtensions:i,markExtensions:o}=Ese(t),c=(n=i.find(m=>vs(m,"topNode")))===null||n===void 0?void 0:n.name,a=Object.fromEntries(i.map(m=>{const y=s.filter(I=>I.type===m.name),v={name:m.name,options:m.options,storage:m.storage,editor:e},w=t.reduce((I,A)=>{const D=vs(A,"extendNodeSchema",v);return{...I,...D?D(m):{}}},{}),k=gNe({...w,content:oa(vs(m,"content",v)),marks:oa(vs(m,"marks",v)),group:oa(vs(m,"group",v)),inline:oa(vs(m,"inline",v)),atom:oa(vs(m,"atom",v)),selectable:oa(vs(m,"selectable",v)),draggable:oa(vs(m,"draggable",v)),code:oa(vs(m,"code",v)),whitespace:oa(vs(m,"whitespace",v)),linebreakReplacement:oa(vs(m,"linebreakReplacement",v)),defining:oa(vs(m,"defining",v)),isolating:oa(vs(m,"isolating",v)),attrs:Object.fromEntries(y.map(I=>{var A;return[I.name,{default:(A=I==null?void 0:I.attribute)===null||A===void 0?void 0:A.default}]}))}),C=oa(vs(m,"parseHTML",v));C&&(k.parseDOM=C.map(I=>mNe(I,y)));const S=vs(m,"renderHTML",v);S&&(k.toDOM=I=>S({node:I,HTMLAttributes:Dhe(I,y)}));const T=vs(m,"renderText",v);return T&&(k.toText=T),[m.name,k]})),f=Object.fromEntries(o.map(m=>{const y=s.filter(T=>T.type===m.name),v={name:m.name,options:m.options,storage:m.storage,editor:e},w=t.reduce((T,I)=>{const A=vs(I,"extendMarkSchema",v);return{...T,...A?A(m):{}}},{}),k=gNe({...w,inclusive:oa(vs(m,"inclusive",v)),excludes:oa(vs(m,"excludes",v)),group:oa(vs(m,"group",v)),spanning:oa(vs(m,"spanning",v)),code:oa(vs(m,"code",v)),attrs:Object.fromEntries(y.map(T=>{var I;return[T.name,{default:(I=T==null?void 0:T.attribute)===null||I===void 0?void 0:I.default}]}))}),C=oa(vs(m,"parseHTML",v));C&&(k.parseDOM=C.map(T=>mNe(T,y)));const S=vs(m,"renderHTML",v);return S&&(k.toDOM=T=>S({mark:T,HTMLAttributes:Dhe(T,y)})),[m.name,k]}));return new lRe({topNode:c,nodes:a,marks:f})}function dce(t,e){return e.nodes[t]||e.marks[t]||null}function yNe(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function $ye(t,e){const n=Bj.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}const Z0t=(t,e=500)=>{let n="";const s=t.parentOffset;return t.parent.nodesBetween(Math.max(0,s-e),s,(i,o,c,a)=>{var f,m;const y=((m=(f=i.type.spec).toText)===null||m===void 0?void 0:m.call(f,{node:i,pos:o,parent:c,index:a}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?y:y.slice(0,Math.max(0,s-o))}),n};function Uye(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class Ise{constructor(e){this.find=e.find,this.handler=e.handler}}const Y0t=(t,e)=>{if(Uye(e))return e.exec(t);const n=e(t);if(!n)return null;const s=[n.text];return s.index=n.index,s.input=t,s.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),s.push(n.replaceWith)),s};function cL(t){var e;const{editor:n,from:s,to:i,text:o,rules:c,plugin:a}=t,{view:f}=n;if(f.composing)return!1;const m=f.state.doc.resolve(s);if(m.parent.type.spec.code||!((e=m.nodeBefore||m.nodeAfter)===null||e===void 0)&&e.marks.find(w=>w.type.spec.code))return!1;let y=!1;const v=Z0t(m)+o;return c.forEach(w=>{if(y)return;const k=Y0t(v,w.find);if(!k)return;const C=f.state.tr,S=Tse({state:f.state,transaction:C}),T={from:s-(k[0].length-o.length),to:i},{commands:I,chain:A,can:D}=new Ase({editor:n,state:S});w.handler({state:S,range:T,match:k,commands:I,chain:A,can:D})===null||!C.steps.length||(C.setMeta(a,{transform:C,from:s,to:i,text:o}),f.dispatch(C),y=!0)}),y}function X0t(t){const{editor:e,rules:n}=t,s=new Id({state:{init(){return null},apply(i,o,c){const a=i.getMeta(s);if(a)return a;const f=i.getMeta("applyInputRules");return!!f&&setTimeout(()=>{let{text:y}=f;typeof y=="string"?y=y:y=$ye(gn.from(y),c.schema);const{from:v}=f,w=v+y.length;cL({editor:e,from:v,to:w,text:y,rules:n,plugin:s})}),i.selectionSet||i.docChanged?null:o}},props:{handleTextInput(i,o,c,a){return cL({editor:e,from:o,to:c,text:a,rules:n,plugin:s})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&cL({editor:e,from:o.pos,to:o.pos,text:"",rules:n,plugin:s})}),!1)},handleKeyDown(i,o){if(o.key!=="Enter")return!1;const{$cursor:c}=i.state.selection;return c?cL({editor:e,from:c.pos,to:c.pos,text:` `,rules:n,plugin:s}):!1}},isInputRules:!0});return s}function Q0t(t){return Object.prototype.toString.call(t).slice(8,-1)}function dL(t){return Q0t(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Pse(t,e){const n={...t};return dL(t)&&dL(e)&&Object.keys(e).forEach(s=>{dL(e[s])&&dL(t[s])?n[s]=Pse(t[s],e[s]):n[s]=e[s]}),n}class wg{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=oa(vs(this,"addOptions",{name:this.name}))),this.storage=oa(vs(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new wg(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Pse(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new wg(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=oa(vs(n,"addOptions",{name:n.name})),n.storage=oa(vs(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:e,mark:n}){const{tr:s}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const c=i.marks();if(!!!c.find(m=>(m==null?void 0:m.type.name)===n.name))return!1;const f=c.find(m=>(m==null?void 0:m.type.name)===n.name);return f&&s.removeStoredMark(f),s.insertText(" ",i.pos),e.view.dispatch(s),!0}return!1}}function J0t(t){return typeof t=="number"}class e1t{constructor(e){this.find=e.find,this.handler=e.handler}}const t1t=(t,e,n)=>{if(Uye(e))return[...t.matchAll(e)];const s=e(t,n);return s?s.map(i=>{const o=[i.text];return o.index=i.index,o.input=t,o.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(i.replaceWith)),o}):[]};function r1t(t){const{editor:e,state:n,from:s,to:i,rule:o,pasteEvent:c,dropEvent:a}=t,{commands:f,chain:m,can:y}=new Ase({editor:e,state:n}),v=[];return n.doc.nodesBetween(s,i,(k,C)=>{if(!k.isTextblock||k.type.spec.code)return;const S=Math.max(s,C),T=Math.min(i,C+k.content.size),I=k.textBetween(S-C,T-C,void 0,"");t1t(I,o.find,c).forEach(D=>{if(D.index===void 0)return;const $=S+D.index+1,F=$+D[0].length,q={from:n.tr.mapping.map($),to:n.tr.mapping.map(F)},W=o.handler({state:n,range:q,match:D,commands:f,chain:m,can:y,pasteEvent:c,dropEvent:a});v.push(W)})}),v.every(k=>k!==null)}let uL=null;const n1t=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)===null||e===void 0||e.setData("text/html",t),n};function s1t(t){const{editor:e,rules:n}=t;let s=null,i=!1,o=!1,c=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const f=({state:y,from:v,to:w,rule:k,pasteEvt:C})=>{const S=y.tr,T=Tse({state:y,transaction:S});if(!(!r1t({editor:e,state:T,from:Math.max(v-1,0),to:w.b-1,rule:k,pasteEvent:C,dropEvent:a})||!S.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return c=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,S}};return n.map(y=>new Id({view(v){const w=C=>{var S;s=!((S=v.dom.parentElement)===null||S===void 0)&&S.contains(C.target)?v.dom.parentElement:null,s&&(uL=e)},k=()=>{uL&&(uL=null)};return window.addEventListener("dragstart",w),window.addEventListener("dragend",k),{destroy(){window.removeEventListener("dragstart",w),window.removeEventListener("dragend",k)}}},props:{handleDOMEvents:{drop:(v,w)=>{if(o=s===v.dom.parentElement,a=w,!o){const k=uL;k!=null&&k.isEditable&&setTimeout(()=>{const C=k.state.selection;C&&k.commands.deleteRange({from:C.from,to:C.to})},10)}return!1},paste:(v,w)=>{var k;const C=(k=w.clipboardData)===null||k===void 0?void 0:k.getData("text/html");return c=w,i=!!(C!=null&&C.includes("data-pm-slice")),!1}}},appendTransaction:(v,w,k)=>{const C=v[0],S=C.getMeta("uiEvent")==="paste"&&!i,T=C.getMeta("uiEvent")==="drop"&&!o,I=C.getMeta("applyPasteRules"),A=!!I;if(!S&&!T&&!A)return;if(A){let{text:F}=I;typeof F=="string"?F=F:F=$ye(gn.from(F),k.schema);const{from:q}=I,W=q+F.length,K=n1t(F);return f({rule:y,state:k,from:q,to:{b:W},pasteEvt:K})}const D=w.doc.content.findDiffStart(k.doc.content),$=w.doc.content.findDiffEnd(k.doc.content);if(!(!J0t(D)||!$||D===$.b))return f({rule:y,state:k,from:D,to:$,pasteEvt:c})}}))}function i1t(t){const e=t.filter((n,s)=>t.indexOf(n)!==s);return Array.from(new Set(e))}class gS{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=gS.resolve(e),this.schema=K0t(this.extensions,n),this.setupExtensions()}static resolve(e){const n=gS.sort(gS.flatten(e)),s=i1t(n.map(i=>i.name));return s.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${s.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),n}static flatten(e){return e.map(n=>{const s={name:n.name,options:n.options,storage:n.storage},i=vs(n,"addExtensions",s);return i?[n,...this.flatten(i())]:n}).flat(10)}static sort(e){return e.sort((s,i)=>{const o=vs(s,"priority")||100,c=vs(i,"priority")||100;return o>c?-1:o{const s={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:dce(n.name,this.schema)},i=vs(n,"addCommands",s);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,n=gS.sort([...this.extensions].reverse()),s=[],i=[],o=n.map(c=>{const a={name:c.name,options:c.options,storage:c.storage,editor:e,type:dce(c.name,this.schema)},f=[],m=vs(c,"addKeyboardShortcuts",a);let y={};if(c.type==="mark"&&vs(c,"exitable",a)&&(y.ArrowRight=()=>wg.handleExit({editor:e,mark:c})),m){const S=Object.fromEntries(Object.entries(m()).map(([T,I])=>[T,()=>I({editor:e})]));y={...y,...S}}const v=k0t(y);f.push(v);const w=vs(c,"addInputRules",a);yNe(c,e.options.enableInputRules)&&w&&s.push(...w());const k=vs(c,"addPasteRules",a);yNe(c,e.options.enablePasteRules)&&k&&i.push(...k());const C=vs(c,"addProseMirrorPlugins",a);if(C){const S=C();f.push(...S)}return f}).flat();return[X0t({editor:e,rules:s}),...s1t({editor:e,rules:i}),...o]}get attributes(){return bFe(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=Ese(this.extensions);return Object.fromEntries(n.filter(s=>!!vs(s,"addNodeView")).map(s=>{const i=this.attributes.filter(f=>f.type===s.name),o={name:s.name,options:s.options,storage:s.storage,editor:e,type:ld(s.name,this.schema)},c=vs(s,"addNodeView",o);if(!c)return[];const a=(f,m,y,v,w)=>{const k=Dhe(f,i);return c()({node:f,view:m,getPos:y,decorations:v,innerDecorations:w,editor:e,extension:s,HTMLAttributes:k})};return[s.name,a]}))}setupExtensions(){this.extensions.forEach(e=>{var n;this.editor.extensionStorage[e.name]=e.storage;const s={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:dce(e.name,this.schema)};e.type==="mark"&&(!((n=oa(vs(e,"keepOnSplit",s)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const i=vs(e,"onBeforeCreate",s),o=vs(e,"onCreate",s),c=vs(e,"onUpdate",s),a=vs(e,"onSelectionUpdate",s),f=vs(e,"onTransaction",s),m=vs(e,"onFocus",s),y=vs(e,"onBlur",s),v=vs(e,"onDestroy",s);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),c&&this.editor.on("update",c),a&&this.editor.on("selectionUpdate",a),f&&this.editor.on("transaction",f),m&&this.editor.on("focus",m),y&&this.editor.on("blur",y),v&&this.editor.on("destroy",v)})}}class Ad{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=oa(vs(this,"addOptions",{name:this.name}))),this.storage=oa(vs(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Ad(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Pse(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Ad({...this.config,...e});return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=oa(vs(n,"addOptions",{name:n.name})),n.storage=oa(vs(n,"addStorage",{name:n.name,options:n.options})),n}}function jFe(t,e,n){const{from:s,to:i}=e,{blockSeparator:o=` `,textSerializers:c={}}=n||{};let a="";return t.nodesBetween(s,i,(f,m,y,v)=>{var w;f.isBlock&&m>s&&(a+=o);const k=c==null?void 0:c[f.type.name];if(k)return y&&(a+=k({node:f,pos:m,parent:y,index:v,range:e})),!1;f.isText&&(a+=(w=f==null?void 0:f.text)===null||w===void 0?void 0:w.slice(Math.max(s,m)-m,i-m))}),a}function kFe(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const a1t=Ad.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Id({key:new Jh("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:s,selection:i}=e,{ranges:o}=i,c=Math.min(...o.map(y=>y.$from.pos)),a=Math.max(...o.map(y=>y.$to.pos)),f=kFe(n);return jFe(s,{from:c,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:f})}}})]}}),o1t=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),l1t=(t=!1)=>({commands:e})=>e.setContent("",t),c1t=()=>({state:t,tr:e,dispatch:n})=>{const{selection:s}=e,{ranges:i}=s;return n&&i.forEach(({$from:o,$to:c})=>{t.doc.nodesBetween(o.pos,c.pos,(a,f)=>{if(a.type.isText)return;const{doc:m,mapping:y}=e,v=m.resolve(y.map(f)),w=m.resolve(y.map(f+a.nodeSize)),k=v.blockRange(w);if(!k)return;const C=WC(k);if(a.type.isTextblock){const{defaultType:S}=v.parent.contentMatchAt(v.index());e.setNodeMarkup(k.start,S)}(C||C===0)&&e.lift(k,C)})}),!0},d1t=t=>e=>t(e),u1t=()=>({state:t,dispatch:e})=>yFe(t,e),h1t=(t,e)=>({editor:n,tr:s})=>{const{state:i}=n,o=i.doc.slice(t.from,t.to);s.deleteRange(t.from,t.to);const c=s.mapping.map(e);return s.insert(c,o.content),s.setSelection(new Fi(s.doc.resolve(Math.max(c-1,0)))),!0},f1t=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,s=n.$anchor.node();if(s.content.size>0)return!1;const i=t.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===s.type){if(e){const a=i.before(o),f=i.after(o);t.delete(a,f).scrollIntoView()}return!0}return!1},p1t=t=>({tr:e,state:n,dispatch:s})=>{const i=ld(t,n.schema),o=e.selection.$anchor;for(let c=o.depth;c>0;c-=1)if(o.node(c).type===i){if(s){const f=o.before(c),m=o.after(c);e.delete(f,m).scrollIntoView()}return!0}return!1},m1t=t=>({tr:e,dispatch:n})=>{const{from:s,to:i}=t;return n&&e.delete(s,i),!0},g1t=()=>({state:t,dispatch:e})=>Dye(t,e),y1t=()=>({commands:t})=>t.keyboardShortcut("Enter"),x1t=()=>({state:t,dispatch:e})=>A0t(t,e);function Ate(t,e,n={strict:!0}){const s=Object.keys(e);return s.length?s.every(i=>n.strict?e[i]===t[i]:Uye(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function NFe(t,e,n={}){return t.find(s=>s.type===e&&Ate(Object.fromEntries(Object.keys(n).map(i=>[i,s.attrs[i]])),n))}function xNe(t,e,n={}){return!!NFe(t,e,n)}function qye(t,e,n){var s;if(!t||!e)return;let i=t.parent.childAfter(t.parentOffset);if((!i.node||!i.node.marks.some(y=>y.type===e))&&(i=t.parent.childBefore(t.parentOffset)),!i.node||!i.node.marks.some(y=>y.type===e)||(n=n||((s=i.node.marks[0])===null||s===void 0?void 0:s.attrs),!NFe([...i.node.marks],e,n)))return;let c=i.index,a=t.start()+i.offset,f=c+1,m=a+i.node.nodeSize;for(;c>0&&xNe([...t.parent.child(c-1).marks],e,n);)c-=1,a-=t.parent.child(c).nodeSize;for(;f({tr:n,state:s,dispatch:i})=>{const o=D1(t,s.schema),{doc:c,selection:a}=n,{$from:f,from:m,to:y}=a;if(i){const v=qye(f,o,e);if(v&&v.from<=m&&v.to>=y){const w=Fi.create(c,v.from,v.to);n.setSelection(w)}}return!0},_1t=t=>e=>{const n=typeof t=="function"?t(e):t;for(let s=0;s({editor:n,view:s,tr:i,dispatch:o})=>{e={scrollIntoView:!0,...e};const c=()=>{(Vye()||b1t())&&s.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(s.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};if(s.hasFocus()&&t===null||t===!1)return!0;if(o&&t===null&&!SFe(n.state.selection))return c(),!0;const a=CFe(i.doc,t)||n.state.selection,f=n.state.selection.eq(a);return o&&(f||i.setSelection(a),f&&i.storedMarks&&i.setStoredMarks(i.storedMarks),c()),!0},j1t=(t,e)=>n=>t.every((s,i)=>e(s,{...n,index:i})),k1t=(t,e)=>({tr:n,commands:s})=>s.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),MFe=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const s=e[n];s.nodeType===3&&s.nodeValue&&/^(\n\s\s|\n)$/.test(s.nodeValue)?t.removeChild(s):s.nodeType===1&&MFe(s)}return t};function hL(t){const e=`${t}`,n=new window.DOMParser().parseFromString(e,"text/html").body;return MFe(n)}function WA(t,e,n){if(t instanceof i1||t instanceof gn)return t;n={slice:!0,parseOptions:{},...n};const s=typeof t=="object"&&t!==null,i=typeof t=="string";if(s)try{if(Array.isArray(t)&&t.length>0)return gn.fromArray(t.map(a=>e.nodeFromJSON(a)));const c=e.nodeFromJSON(t);return n.errorOnInvalidContent&&c.check(),c}catch(o){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",o),WA("",e,n)}if(i){if(n.errorOnInvalidContent){let c=!1,a="";const f=new lRe({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:m=>(c=!0,a=typeof m=="string"?m:m.outerHTML,null)}]}})});if(n.slice?VT.fromSchema(f).parseSlice(hL(t),n.parseOptions):VT.fromSchema(f).parse(hL(t),n.parseOptions),n.errorOnInvalidContent&&c)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const o=VT.fromSchema(e);return n.slice?o.parseSlice(hL(t),n.parseOptions).content:o.parse(hL(t),n.parseOptions)}return WA("",e,n)}function N1t(t,e,n){const s=t.steps.length-1;if(s{c===0&&(c=y)}),t.setSelection(aa.near(t.doc.resolve(c),n))}const S1t=t=>!("type"in t),C1t=(t,e,n)=>({tr:s,dispatch:i,editor:o})=>{var c;if(i){n={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;const f=T=>{o.emit("contentError",{editor:o,error:T,disableCollaboration:()=>{o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}})},m={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!o.options.enableContentCheck&&o.options.emitContentError)try{WA(e,o.schema,{parseOptions:m,errorOnInvalidContent:!0})}catch(T){f(T)}try{a=WA(e,o.schema,{parseOptions:m,errorOnInvalidContent:(c=n.errorOnInvalidContent)!==null&&c!==void 0?c:o.options.enableContentCheck})}catch(T){return f(T),!1}let{from:y,to:v}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},w=!0,k=!0;if((S1t(a)?a:[a]).forEach(T=>{T.check(),w=w?T.isText&&T.marks.length===0:!1,k=k?T.isBlock:!1}),y===v&&k){const{parent:T}=s.doc.resolve(y);T.isTextblock&&!T.type.spec.code&&!T.childCount&&(y-=1,v+=1)}let S;if(w){if(Array.isArray(e))S=e.map(T=>T.text||"").join("");else if(e instanceof gn){let T="";e.forEach(I=>{I.text&&(T+=I.text)}),S=T}else typeof e=="object"&&e&&e.text?S=e.text:S=e;s.insertText(S,y,v)}else S=a,s.replaceWith(y,v,S);n.updateSelection&&N1t(s,s.steps.length-1,-1),n.applyInputRules&&s.setMeta("applyInputRules",{from:y,text:S}),n.applyPasteRules&&s.setMeta("applyPasteRules",{from:y,text:S})}return!0},M1t=()=>({state:t,dispatch:e})=>C0t(t,e),T1t=()=>({state:t,dispatch:e})=>M0t(t,e),A1t=()=>({state:t,dispatch:e})=>dFe(t,e),E1t=()=>({state:t,dispatch:e})=>pFe(t,e),I1t=()=>({state:t,dispatch:e,tr:n})=>{try{const s=jse(t.doc,t.selection.$from.pos,-1);return s==null?!1:(n.join(s,2),e&&e(n),!0)}catch{return!1}},P1t=()=>({state:t,dispatch:e,tr:n})=>{try{const s=jse(t.doc,t.selection.$from.pos,1);return s==null?!1:(n.join(s,2),e&&e(n),!0)}catch{return!1}},L1t=()=>({state:t,dispatch:e})=>N0t(t,e),O1t=()=>({state:t,dispatch:e})=>S0t(t,e);function TFe(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function D1t(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let s,i,o,c;for(let a=0;a({editor:e,view:n,tr:s,dispatch:i})=>{const o=D1t(t).split(/-(?!$)/),c=o.find(m=>!["Alt","Ctrl","Meta","Shift"].includes(m)),a=new KeyboardEvent("keydown",{key:c==="Space"?" ":c,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),f=e.captureTransaction(()=>{n.someProp("handleKeyDown",m=>m(n,a))});return f==null||f.steps.forEach(m=>{const y=m.map(s.mapping);y&&i&&s.maybeStep(y)}),!0};function GA(t,e,n={}){const{from:s,to:i,empty:o}=t.selection,c=e?ld(e,t.schema):null,a=[];t.doc.nodesBetween(s,i,(v,w)=>{if(v.isText)return;const k=Math.max(s,w),C=Math.min(i,w+v.nodeSize);a.push({node:v,from:k,to:C})});const f=i-s,m=a.filter(v=>c?c.name===v.node.type.name:!0).filter(v=>Ate(v.node.attrs,n,{strict:!1}));return o?!!m.length:m.reduce((v,w)=>v+w.to-w.from,0)>=f}const F1t=(t,e={})=>({state:n,dispatch:s})=>{const i=ld(t,n.schema);return GA(n,i,e)?T0t(n,s):!1},z1t=()=>({state:t,dispatch:e})=>xFe(t,e),B1t=t=>({state:e,dispatch:n})=>{const s=ld(t,e.schema);return $0t(s)(e,n)},$1t=()=>({state:t,dispatch:e})=>gFe(t,e);function Lse(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function vNe(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((s,i)=>(n.includes(i)||(s[i]=t[i]),s),{})}const U1t=(t,e)=>({tr:n,state:s,dispatch:i})=>{let o=null,c=null;const a=Lse(typeof t=="string"?t:t.name,s.schema);return a?(a==="node"&&(o=ld(t,s.schema)),a==="mark"&&(c=D1(t,s.schema)),i&&n.selection.ranges.forEach(f=>{s.doc.nodesBetween(f.$from.pos,f.$to.pos,(m,y)=>{o&&o===m.type&&n.setNodeMarkup(y,void 0,vNe(m.attrs,e)),c&&m.marks.length&&m.marks.forEach(v=>{c===v.type&&n.addMark(y,y+m.nodeSize,c.create(vNe(v.attrs,e)))})})}),!0):!1},q1t=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),V1t=()=>({tr:t,dispatch:e})=>{if(e){const n=new qh(t.doc);t.setSelection(n)}return!0},H1t=()=>({state:t,dispatch:e})=>hFe(t,e),W1t=()=>({state:t,dispatch:e})=>mFe(t,e),G1t=()=>({state:t,dispatch:e})=>P0t(t,e),K1t=()=>({state:t,dispatch:e})=>D0t(t,e),Z1t=()=>({state:t,dispatch:e})=>O0t(t,e);function Rhe(t,e,n={},s={}){return WA(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:s.errorOnInvalidContent})}const Y1t=(t,e=!1,n={},s={})=>({editor:i,tr:o,dispatch:c,commands:a})=>{var f,m;const{doc:y}=o;if(n.preserveWhitespace!=="full"){const v=Rhe(t,i.schema,n,{errorOnInvalidContent:(f=s.errorOnInvalidContent)!==null&&f!==void 0?f:i.options.enableContentCheck});return c&&o.replaceWith(0,y.content.size,v).setMeta("preventUpdate",!e),!0}return c&&o.setMeta("preventUpdate",!e),a.insertContentAt({from:0,to:y.content.size},t,{parseOptions:n,errorOnInvalidContent:(m=s.errorOnInvalidContent)!==null&&m!==void 0?m:i.options.enableContentCheck})};function AFe(t,e){const n=D1(e,t.schema),{from:s,to:i,empty:o}=t.selection,c=[];o?(t.storedMarks&&c.push(...t.storedMarks),c.push(...t.selection.$head.marks())):t.doc.nodesBetween(s,i,f=>{c.push(...f.marks)});const a=c.find(f=>f.type.name===n.name);return a?{...a.attrs}:{}}function X1t(t,e){const n=new kRe(t);return e.forEach(s=>{s.steps.forEach(i=>{n.step(i)})}),n}function Q1t(t){for(let e=0;e{n(i)&&s.push({node:i,pos:o})}),s}function evt(t,e){for(let n=t.depth;n>0;n-=1){const s=t.node(n);if(e(s))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:s}}}function Hye(t){return e=>evt(e.$from,t)}function tvt(t,e){const n={from:0,to:t.content.size};return jFe(t,n,e)}function rvt(t,e){const n=ld(e,t.schema),{from:s,to:i}=t.selection,o=[];t.doc.nodesBetween(s,i,a=>{o.push(a)});const c=o.reverse().find(a=>a.type.name===n.name);return c?{...c.attrs}:{}}function EFe(t,e){const n=Lse(typeof e=="string"?e:e.name,t.schema);return n==="node"?rvt(t,e):n==="mark"?AFe(t,e):{}}function nvt(t,e=JSON.stringify){const n={};return t.filter(s=>{const i=e(s);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function svt(t){const e=nvt(t);return e.length===1?e:e.filter((n,s)=>!e.filter((o,c)=>c!==s).some(o=>n.oldRange.from>=o.oldRange.from&&n.oldRange.to<=o.oldRange.to&&n.newRange.from>=o.newRange.from&&n.newRange.to<=o.newRange.to))}function ivt(t){const{mapping:e,steps:n}=t,s=[];return e.maps.forEach((i,o)=>{const c=[];if(i.ranges.length)i.forEach((a,f)=>{c.push({from:a,to:f})});else{const{from:a,to:f}=n[o];if(a===void 0||f===void 0)return;c.push({from:a,to:f})}c.forEach(({from:a,to:f})=>{const m=e.slice(o).map(a,-1),y=e.slice(o).map(f),v=e.invert().map(m,-1),w=e.invert().map(y);s.push({oldRange:{from:v,to:w},newRange:{from:m,to:y}})})}),svt(s)}function Wye(t,e,n){const s=[];return t===e?n.resolve(t).marks().forEach(i=>{const o=n.resolve(t),c=qye(o,i.type);c&&s.push({mark:i,...c})}):n.nodesBetween(t,e,(i,o)=>{!i||(i==null?void 0:i.nodeSize)===void 0||s.push(...i.marks.map(c=>({from:o,to:o+i.nodeSize,mark:c})))}),s}function aee(t,e,n){return Object.fromEntries(Object.entries(n).filter(([s])=>{const i=t.find(o=>o.type===e&&o.name===s);return i?i.attribute.keepOnSplit:!1}))}function Fhe(t,e,n={}){const{empty:s,ranges:i}=t.selection,o=e?D1(e,t.schema):null;if(s)return!!(t.storedMarks||t.selection.$from.marks()).filter(v=>o?o.name===v.type.name:!0).find(v=>Ate(v.attrs,n,{strict:!1}));let c=0;const a=[];if(i.forEach(({$from:v,$to:w})=>{const k=v.pos,C=w.pos;t.doc.nodesBetween(k,C,(S,T)=>{if(!S.isText&&!S.marks.length)return;const I=Math.max(k,T),A=Math.min(C,T+S.nodeSize),D=A-I;c+=D,a.push(...S.marks.map($=>({mark:$,from:I,to:A})))})}),c===0)return!1;const f=a.filter(v=>o?o.name===v.mark.type.name:!0).filter(v=>Ate(v.mark.attrs,n,{strict:!1})).reduce((v,w)=>v+w.to-w.from,0),m=a.filter(v=>o?v.mark.type!==o&&v.mark.type.excludes(o):!0).reduce((v,w)=>v+w.to-w.from,0);return(f>0?f+m:f)>=c}function avt(t,e,n={}){if(!e)return GA(t,null,n)||Fhe(t,null,n);const s=Lse(e,t.schema);return s==="node"?GA(t,e,n):s==="mark"?Fhe(t,e,n):!1}function _Ne(t,e){const{nodeExtensions:n}=Ese(e),s=n.find(c=>c.name===t);if(!s)return!1;const i={name:s.name,options:s.options,storage:s.storage},o=oa(vs(s,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function Gye(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var s;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((s=t.text)!==null&&s!==void 0?s:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(o=>{i!==!1&&(Gye(o,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function ovt(t){return t instanceof Xs}function lvt(t,e,n){var s;const{selection:i}=e;let o=null;if(SFe(i)&&(o=i.$cursor),o){const a=(s=t.storedMarks)!==null&&s!==void 0?s:o.marks();return!!n.isInSet(a)||!a.some(f=>f.type.excludes(n))}const{ranges:c}=i;return c.some(({$from:a,$to:f})=>{let m=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,f.pos,(y,v,w)=>{if(m)return!1;if(y.isInline){const k=!w||w.type.allowsMarkType(n),C=!!n.isInSet(y.marks)||!y.marks.some(S=>S.type.excludes(n));m=k&&C}return!m}),m})}const cvt=(t,e={})=>({tr:n,state:s,dispatch:i})=>{const{selection:o}=n,{empty:c,ranges:a}=o,f=D1(t,s.schema);if(i)if(c){const m=AFe(s,f);n.addStoredMark(f.create({...m,...e}))}else a.forEach(m=>{const y=m.$from.pos,v=m.$to.pos;s.doc.nodesBetween(y,v,(w,k)=>{const C=Math.max(k,y),S=Math.min(k+w.nodeSize,v);w.marks.find(I=>I.type===f)?w.marks.forEach(I=>{f===I.type&&n.addMark(C,S,f.create({...I.attrs,...e}))}):n.addMark(C,S,f.create(e))})});return lvt(s,n,f)},dvt=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),uvt=(t,e={})=>({state:n,dispatch:s,chain:i})=>{const o=ld(t,n.schema);let c;return n.selection.$anchor.sameParent(n.selection.$head)&&(c=n.selection.$anchor.parent.attrs),o.isTextblock?i().command(({commands:a})=>pNe(o,{...c,...e})(n)?!0:a.clearNodes()).command(({state:a})=>pNe(o,{...c,...e})(a,s)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},hvt=t=>({tr:e,dispatch:n})=>{if(n){const{doc:s}=e,i=yw(t,0,s.content.size),o=Xs.create(s,i);e.setSelection(o)}return!0},fvt=t=>({tr:e,dispatch:n})=>{if(n){const{doc:s}=e,{from:i,to:o}=typeof t=="number"?{from:t,to:t}:t,c=Fi.atStart(s).from,a=Fi.atEnd(s).to,f=yw(i,c,a),m=yw(o,c,a),y=Fi.create(s,f,m);e.setSelection(y)}return!0},pvt=t=>({state:e,dispatch:n})=>{const s=ld(t,e.schema);return V0t(s)(e,n)};function bNe(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const s=n.filter(i=>e==null?void 0:e.includes(i.type.name));t.tr.ensureMarks(s)}}const mvt=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:s,editor:i})=>{const{selection:o,doc:c}=e,{$from:a,$to:f}=o,m=i.extensionManager.attributes,y=aee(m,a.node().type.name,a.node().attrs);if(o instanceof Xs&&o.node.isBlock)return!a.parentOffset||!Py(c,a.pos)?!1:(s&&(t&&bNe(n,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const v=f.parentOffset===f.parent.content.size,w=a.depth===0?void 0:Q1t(a.node(-1).contentMatchAt(a.indexAfter(-1)));let k=v&&w?[{type:w,attrs:y}]:void 0,C=Py(e.doc,e.mapping.map(a.pos),1,k);if(!k&&!C&&Py(e.doc,e.mapping.map(a.pos),1,w?[{type:w}]:void 0)&&(C=!0,k=w?[{type:w,attrs:y}]:void 0),s){if(C&&(o instanceof Fi&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,k),w&&!v&&!a.parentOffset&&a.parent.type!==w)){const S=e.mapping.map(a.before()),T=e.doc.resolve(S);a.node(-1).canReplaceWith(T.index(),T.index()+1,w)&&e.setNodeMarkup(e.mapping.map(a.before()),w)}t&&bNe(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return C},gvt=(t,e={})=>({tr:n,state:s,dispatch:i,editor:o})=>{var c;const a=ld(t,s.schema),{$from:f,$to:m}=s.selection,y=s.selection.node;if(y&&y.isBlock||f.depth<2||!f.sameParent(m))return!1;const v=f.node(-1);if(v.type!==a)return!1;const w=o.extensionManager.attributes;if(f.parent.content.size===0&&f.node(-1).childCount===f.indexAfter(-1)){if(f.depth===2||f.node(-3).type!==a||f.index(-2)!==f.node(-2).childCount-1)return!1;if(i){let I=gn.empty;const A=f.index(-1)?1:f.index(-2)?2:3;for(let K=f.depth-A;K>=f.depth-3;K-=1)I=gn.from(f.node(K).copy(I));const D=f.indexAfter(-1){if(W>-1)return!1;K.isTextblock&&K.content.size===0&&(W=Z+1)}),W>-1&&n.setSelection(Fi.near(n.doc.resolve(W))),n.scrollIntoView()}return!0}const k=m.pos===f.end()?v.contentMatchAt(0).defaultType:null,C={...aee(w,v.type.name,v.attrs),...e},S={...aee(w,f.node().type.name,f.node().attrs),...e};n.delete(f.pos,m.pos);const T=k?[{type:a,attrs:C},{type:k,attrs:S}]:[{type:a,attrs:C}];if(!Py(n.doc,f.pos,2))return!1;if(i){const{selection:I,storedMarks:A}=s,{splittableMarks:D}=o.extensionManager,$=A||I.$to.parentOffset&&I.$from.marks();if(n.split(f.pos,2,T).scrollIntoView(),!$||!i)return!0;const F=$.filter(q=>D.includes(q.type.name));n.ensureMarks(F)}return!0},uce=(t,e)=>{const n=Hye(c=>c.type===e)(t.selection);if(!n)return!0;const s=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(s===void 0)return!0;const i=t.doc.nodeAt(s);return n.node.type===(i==null?void 0:i.type)&&L1(t.doc,n.pos)&&t.join(n.pos),!0},hce=(t,e)=>{const n=Hye(c=>c.type===e)(t.selection);if(!n)return!0;const s=t.doc.resolve(n.start).after(n.depth);if(s===void 0)return!0;const i=t.doc.nodeAt(s);return n.node.type===(i==null?void 0:i.type)&&L1(t.doc,s)&&t.join(s),!0},yvt=(t,e,n,s={})=>({editor:i,tr:o,state:c,dispatch:a,chain:f,commands:m,can:y})=>{const{extensions:v,splittableMarks:w}=i.extensionManager,k=ld(t,c.schema),C=ld(e,c.schema),{selection:S,storedMarks:T}=c,{$from:I,$to:A}=S,D=I.blockRange(A),$=T||S.$to.parentOffset&&S.$from.marks();if(!D)return!1;const F=Hye(q=>_Ne(q.type.name,v))(S);if(D.depth>=1&&F&&D.depth-F.depth<=1){if(F.node.type===k)return m.liftListItem(C);if(_Ne(F.node.type.name,v)&&k.validContent(F.node.content)&&a)return f().command(()=>(o.setNodeMarkup(F.pos,k),!0)).command(()=>uce(o,k)).command(()=>hce(o,k)).run()}return!n||!$||!a?f().command(()=>y().wrapInList(k,s)?!0:m.clearNodes()).wrapInList(k,s).command(()=>uce(o,k)).command(()=>hce(o,k)).run():f().command(()=>{const q=y().wrapInList(k,s),W=$.filter(K=>w.includes(K.type.name));return o.ensureMarks(W),q?!0:m.clearNodes()}).wrapInList(k,s).command(()=>uce(o,k)).command(()=>hce(o,k)).run()},xvt=(t,e={},n={})=>({state:s,commands:i})=>{const{extendEmptyMarkRange:o=!1}=n,c=D1(t,s.schema);return Fhe(s,c,e)?i.unsetMark(c,{extendEmptyMarkRange:o}):i.setMark(c,e)},vvt=(t,e,n={})=>({state:s,commands:i})=>{const o=ld(t,s.schema),c=ld(e,s.schema),a=GA(s,o,n);let f;return s.selection.$anchor.sameParent(s.selection.$head)&&(f=s.selection.$anchor.parent.attrs),a?i.setNode(c,f):i.setNode(o,{...f,...n})},_vt=(t,e={})=>({state:n,commands:s})=>{const i=ld(t,n.schema);return GA(n,i,e)?s.lift(i):s.wrapIn(i,e)},bvt=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let s=0;s=0;f-=1)c.step(a.steps[f].invert(a.docs[f]));if(o.text){const f=c.doc.resolve(o.from).marks();c.replaceWith(o.from,o.to,t.schema.text(o.text,f))}else c.delete(o.from,o.to)}return!0}}return!1},wvt=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:s,ranges:i}=n;return s||e&&i.forEach(o=>{t.removeMark(o.$from.pos,o.$to.pos)}),!0},jvt=(t,e={})=>({tr:n,state:s,dispatch:i})=>{var o;const{extendEmptyMarkRange:c=!1}=e,{selection:a}=n,f=D1(t,s.schema),{$from:m,empty:y,ranges:v}=a;if(!i)return!0;if(y&&c){let{from:w,to:k}=a;const C=(o=m.marks().find(T=>T.type===f))===null||o===void 0?void 0:o.attrs,S=qye(m,f,C);S&&(w=S.from,k=S.to),n.removeMark(w,k,f)}else v.forEach(w=>{n.removeMark(w.$from.pos,w.$to.pos,f)});return n.removeStoredMark(f),!0},kvt=(t,e={})=>({tr:n,state:s,dispatch:i})=>{let o=null,c=null;const a=Lse(typeof t=="string"?t:t.name,s.schema);return a?(a==="node"&&(o=ld(t,s.schema)),a==="mark"&&(c=D1(t,s.schema)),i&&n.selection.ranges.forEach(f=>{const m=f.$from.pos,y=f.$to.pos;let v,w,k,C;n.selection.empty?s.doc.nodesBetween(m,y,(S,T)=>{o&&o===S.type&&(k=Math.max(T,m),C=Math.min(T+S.nodeSize,y),v=T,w=S)}):s.doc.nodesBetween(m,y,(S,T)=>{T=m&&T<=y&&(o&&o===S.type&&n.setNodeMarkup(T,void 0,{...S.attrs,...e}),c&&S.marks.length&&S.marks.forEach(I=>{if(c===I.type){const A=Math.max(T,m),D=Math.min(T+S.nodeSize,y);n.addMark(A,D,c.create({...I.attrs,...e}))}}))}),w&&(v!==void 0&&n.setNodeMarkup(v,void 0,{...w.attrs,...e}),c&&w.marks.length&&w.marks.forEach(S=>{c===S.type&&n.addMark(k,C,c.create({...S.attrs,...e}))}))}),!0):!1},Nvt=(t,e={})=>({state:n,dispatch:s})=>{const i=ld(t,n.schema);return R0t(i,e)(n,s)},Svt=(t,e={})=>({state:n,dispatch:s})=>{const i=ld(t,n.schema);return F0t(i,e)(n,s)};var Cvt=Object.freeze({__proto__:null,blur:o1t,clearContent:l1t,clearNodes:c1t,command:d1t,createParagraphNear:u1t,cut:h1t,deleteCurrentNode:f1t,deleteNode:p1t,deleteRange:m1t,deleteSelection:g1t,enter:y1t,exitCode:x1t,extendMarkRange:v1t,first:_1t,focus:w1t,forEach:j1t,insertContent:k1t,insertContentAt:C1t,joinBackward:A1t,joinDown:T1t,joinForward:E1t,joinItemBackward:I1t,joinItemForward:P1t,joinTextblockBackward:L1t,joinTextblockForward:O1t,joinUp:M1t,keyboardShortcut:R1t,lift:F1t,liftEmptyBlock:z1t,liftListItem:B1t,newlineInCode:$1t,resetAttributes:U1t,scrollIntoView:q1t,selectAll:V1t,selectNodeBackward:H1t,selectNodeForward:W1t,selectParentNode:G1t,selectTextblockEnd:K1t,selectTextblockStart:Z1t,setContent:Y1t,setMark:cvt,setMeta:dvt,setNode:uvt,setNodeSelection:hvt,setTextSelection:fvt,sinkListItem:pvt,splitBlock:mvt,splitListItem:gvt,toggleList:yvt,toggleMark:xvt,toggleNode:vvt,toggleWrap:_vt,undoInputRule:bvt,unsetAllMarks:wvt,unsetMark:jvt,updateAttributes:kvt,wrapIn:Nvt,wrapInList:Svt});const Mvt=Ad.create({name:"commands",addCommands(){return{...Cvt}}}),Tvt=Ad.create({name:"drop",addProseMirrorPlugins(){return[new Id({key:new Jh("tiptapDrop"),props:{handleDrop:(t,e,n,s)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:s})}}})]}}),Avt=Ad.create({name:"editable",addProseMirrorPlugins(){return[new Id({key:new Jh("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Evt=new Jh("focusEvents"),Ivt=Ad.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Id({key:Evt,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const s=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(s),!1},blur:(e,n)=>{t.isFocused=!1;const s=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(s),!1}}}})]}}),Pvt=Ad.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:c})=>[()=>c.undoInputRule(),()=>c.command(({tr:a})=>{const{selection:f,doc:m}=a,{empty:y,$anchor:v}=f,{pos:w,parent:k}=v,C=v.parent.isTextblock&&w>0?a.doc.resolve(w-1):v,S=C.parent.type.spec.isolating,T=v.pos-v.parentOffset,I=S&&C.parent.childCount===1?T===v.pos:aa.atStart(m).from===w;return!y||!k.type.isTextblock||k.textContent.length||!I||I&&v.parent.type.name==="paragraph"?!1:c.clearNodes()}),()=>c.deleteSelection(),()=>c.joinBackward(),()=>c.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:c})=>[()=>c.deleteSelection(),()=>c.deleteCurrentNode(),()=>c.joinForward(),()=>c.selectNodeForward()]),s={Enter:()=>this.editor.commands.first(({commands:c})=>[()=>c.newlineInCode(),()=>c.createParagraphNear(),()=>c.liftEmptyBlock(),()=>c.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...s},o={...s,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Vye()||TFe()?o:i},addProseMirrorPlugins(){return[new Id({key:new Jh("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(S=>S.getMeta("composition")))return;const s=t.some(S=>S.docChanged)&&!e.doc.eq(n.doc),i=t.some(S=>S.getMeta("preventClearDocument"));if(!s||i)return;const{empty:o,from:c,to:a}=e.selection,f=aa.atStart(e.doc).from,m=aa.atEnd(e.doc).to;if(o||!(c===f&&a===m)||!Gye(n.doc))return;const w=n.tr,k=Tse({state:n,transaction:w}),{commands:C}=new Ase({editor:this.editor,state:k});if(C.clearNodes(),!!w.steps.length)return w}})]}}),Lvt=Ad.create({name:"paste",addProseMirrorPlugins(){return[new Id({key:new Jh("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),Ovt=Ad.create({name:"tabindex",addProseMirrorPlugins(){return[new Id({key:new Jh("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class ow{get name(){return this.node.type.name}constructor(e,n,s=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=s,this.resolvedPos=e,this.editor=n,this.currentNode=i}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,s=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,s=this.to-1}this.editor.commands.insertContentAt({from:n,to:s},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new ow(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new ow(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new ow(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,s)=>{const i=n.isBlock&&!n.isTextblock,o=n.isAtom&&!n.isText,c=this.pos+s+(o?0:1);if(c<0||c>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(c);if(!i&&a.depth<=this.depth)return;const f=new ow(a,this.editor,i,i?n:null);i&&(f.actualDepth=this.depth+1),e.push(new ow(a,this.editor,i,i?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let s=null,i=this.parent;for(;i&&!s;){if(i.node.type.name===e)if(Object.keys(n).length>0){const o=i.node.attrs,c=Object.keys(n);for(let a=0;a{s&&i.length>0||(c.node.type.name===e&&o.every(f=>n[f]===c.node.attrs[f])&&i.push(c),!(s&&i.length>0)&&(i=i.concat(c.querySelectorAll(e,n,s))))}),i}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}}const Dvt=`.ProseMirror { position: relative; } .ProseMirror { word-wrap: break-word; white-space: pre-wrap; white-space: break-spaces; -webkit-font-variant-ligatures: none; font-variant-ligatures: none; font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */ } .ProseMirror [contenteditable="false"] { white-space: normal; } .ProseMirror [contenteditable="false"] [contenteditable="true"] { white-space: pre-wrap; } .ProseMirror pre { white-space: pre-wrap; } img.ProseMirror-separator { display: inline !important; border: none !important; margin: 0 !important; width: 0 !important; height: 0 !important; } .ProseMirror-gapcursor { display: none; pointer-events: none; position: absolute; margin: 0; } .ProseMirror-gapcursor:after { content: ""; display: block; position: absolute; top: -2px; width: 20px; border-top: 1px solid black; animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite; } @keyframes ProseMirror-cursor-blink { to { visibility: hidden; } } .ProseMirror-hideselection *::selection { background: transparent; } .ProseMirror-hideselection *::-moz-selection { background: transparent; } .ProseMirror-hideselection * { caret-color: transparent; } .ProseMirror-focused .ProseMirror-gapcursor { display: block; } .tippy-box[data-animation=fade][data-state=hidden] { opacity: 0 }`;function Rvt(t,e,n){const s=document.querySelector("style[data-tiptap-style]");if(s!==null)return s;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}class Fvt extends H0t{constructor(e={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:n})=>{throw n},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:n,slice:s,moved:i})=>this.options.onDrop(n,s,i)),this.on("paste",({event:n,slice:s})=>this.options.onPaste(n,s)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=Rvt(Dvt,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,n=!0){this.setOptions({editable:e}),n&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,n){const s=wFe(n)?n(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:s});return this.view.updateState(i),i}unregisterPlugin(e){if(this.isDestroyed)return;const n=this.state.plugins;let s=n;if([].concat(e).forEach(o=>{const c=typeof o=="string"?`${o}$`:o.key;s=s.filter(a=>!a.key.startsWith(c))}),n.length===s.length)return;const i=this.state.reconfigure({plugins:s});return this.view.updateState(i),i}createExtensionManager(){var e,n;const i=[...this.options.enableCoreExtensions?[Avt,a1t.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),Mvt,Ivt,Pvt,Ovt,Tvt,Lvt].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o==null?void 0:o.type));this.extensionManager=new gS(i,this)}createCommandManager(){this.commandManager=new Ase({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let n;try{n=Rhe(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(c){if(!(c instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(c.message))throw c;this.emit("contentError",{editor:this,error:c,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(a=>a.name!=="collaboration"),this.createExtensionManager()}}),n=Rhe(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const s=CFe(n,this.options.autofocus);this.view=new oFe(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)===null||e===void 0?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:mS.create({doc:n,selection:s||void 0})});const i=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(i),this.createNodeViews(),this.prependClass();const o=this.view.dom;o.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const n=this.capturedTransaction;return this.capturedTransaction=null,n}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(c=>{var a;return(a=this.capturedTransaction)===null||a===void 0?void 0:a.step(c)});return}const n=this.state.apply(e),s=!this.state.selection.eq(n.selection);this.emit("beforeTransaction",{editor:this,transaction:e,nextState:n}),this.view.updateState(n),this.emit("transaction",{editor:this,transaction:e}),s&&this.emit("selectionUpdate",{editor:this,transaction:e});const i=e.getMeta("focus"),o=e.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:e}),o&&this.emit("blur",{editor:this,event:o.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return EFe(this.state,e)}isActive(e,n){const s=typeof e=="string"?e:null,i=typeof e=="string"?n:e;return avt(this.state,s,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return $ye(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:n=` `,textSerializers:s={}}=e||{};return tvt(this.state.doc,{blockSeparator:n,textSerializers:{...kFe(this.schema),...s}})}get isEmpty(){return Gye(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){const e=this.view.dom;e&&e.editor&&delete e.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,n){var s;return((s=this.$doc)===null||s===void 0?void 0:s.querySelector(e,n))||null}$nodes(e,n){var s;return((s=this.$doc)===null||s===void 0?void 0:s.querySelectorAll(e,n))||null}$pos(e){const n=this.state.doc.resolve(e);return new ow(n,this)}get $doc(){return this.$pos(0)}}function J4(t){return new Ise({find:t.find,handler:({state:e,range:n,match:s})=>{const i=oa(t.getAttributes,void 0,s);if(i===!1||i===null)return null;const{tr:o}=e,c=s[s.length-1],a=s[0];if(c){const f=a.search(/\S/),m=n.from+a.indexOf(c),y=m+c.length;if(Wye(n.from,n.to,e.doc).filter(k=>k.mark.type.excluded.find(S=>S===t.type&&S!==k.mark.type)).filter(k=>k.to>m).length)return null;yn.from&&o.delete(n.from+f,m);const w=n.from+f+c.length;o.addMark(n.from+f,w,t.type.create(i||{})),o.removeStoredMark(t.type)}}})}function zvt(t){return new Ise({find:t.find,handler:({state:e,range:n,match:s})=>{const i=oa(t.getAttributes,void 0,s)||{},{tr:o}=e,c=n.from;let a=n.to;const f=t.type.create(i);if(s[1]){const m=s[0].lastIndexOf(s[1]);let y=c+m;y>a?y=a:a=y+s[1].length;const v=s[0][s[0].length-1];o.insertText(v,c+s[0].length-1),o.replaceWith(y,a,f)}else if(s[0]){const m=t.type.isInline?c:c-1;o.insert(m,t.type.create(i)).delete(o.mapping.map(c),o.mapping.map(a))}o.scrollIntoView()}})}function zhe(t){return new Ise({find:t.find,handler:({state:e,range:n,match:s})=>{const i=e.doc.resolve(n.from),o=oa(t.getAttributes,void 0,s)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,o)}})}function KA(t){return new Ise({find:t.find,handler:({state:e,range:n,match:s,chain:i})=>{const o=oa(t.getAttributes,void 0,s)||{},c=e.tr.delete(n.from,n.to),f=c.doc.resolve(n.from).blockRange(),m=f&&Nye(f,t.type,o);if(!m)return null;if(c.wrap(f,m),t.keepMarks&&t.editor){const{selection:v,storedMarks:w}=e,{splittableMarks:k}=t.editor.extensionManager,C=w||v.$to.parentOffset&&v.$from.marks();if(C){const S=C.filter(T=>k.includes(T.type.name));c.ensureMarks(S)}}if(t.keepAttributes){const v=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(v,o).run()}const y=c.doc.resolve(n.from-1).nodeBefore;y&&y.type===t.type&&L1(c.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(s,y))&&c.join(n.from-1)}})}let gm=class Bhe{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=oa(vs(this,"addOptions",{name:this.name}))),this.storage=oa(vs(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Bhe(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Pse(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Bhe(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=oa(vs(n,"addOptions",{name:n.name})),n.storage=oa(vs(n,"addStorage",{name:n.name,options:n.options})),n}};function Cj(t){return new e1t({find:t.find,handler:({state:e,range:n,match:s,pasteEvent:i})=>{const o=oa(t.getAttributes,void 0,s,i);if(o===!1||o===null)return null;const{tr:c}=e,a=s[s.length-1],f=s[0];let m=n.to;if(a){const y=f.search(/\S/),v=n.from+f.indexOf(a),w=v+a.length;if(Wye(n.from,n.to,e.doc).filter(C=>C.mark.type.excluded.find(T=>T===t.type&&T!==C.mark.type)).filter(C=>C.to>v).length)return null;wn.from&&c.delete(n.from+y,v),m=n.from+y+a.length,c.addMark(n.from+y,m,t.type.create(o||{})),c.removeStoredMark(t.type)}}})}function Bvt(t,e){const{selection:n}=t,{$from:s}=n;if(n instanceof Xs){const o=s.index();return s.parent.canReplaceWith(o,o+1,e)}let i=s.depth;for(;i>=0;){const o=s.index(i);if(s.node(i).contentMatchAt(o).matchType(e))return!0;i-=1}return!1}function $vt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var IFe={exports:{}},fce={};/** * @license React * use-sync-external-store-shim.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 wNe;function Uvt(){if(wNe)return fce;wNe=1;var t=lt;function e(v,w){return v===w&&(v!==0||1/v===1/w)||v!==v&&w!==w}var n=typeof Object.is=="function"?Object.is:e,s=t.useState,i=t.useEffect,o=t.useLayoutEffect,c=t.useDebugValue;function a(v,w){var k=w(),C=s({inst:{value:k,getSnapshot:w}}),S=C[0].inst,T=C[1];return o(function(){S.value=k,S.getSnapshot=w,f(S)&&T({inst:S})},[v,k,w]),i(function(){return f(S)&&T({inst:S}),v(function(){f(S)&&T({inst:S})})},[v]),c(k),k}function f(v){var w=v.getSnapshot;v=v.value;try{var k=w();return!n(v,k)}catch{return!0}}function m(v,w){return w()}var y=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?m:a;return fce.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:y,fce}IFe.exports=Uvt();var Kye=IFe.exports;const qvt=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},Vvt=({contentComponent:t})=>{const e=Kye.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return lt.createElement(lt.Fragment,null,Object.values(e))};function Hvt(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,s){e={...e,[n]:Nme.createPortal(s.reactElement,s.element,n)},t.forEach(i=>i())},removeRenderer(n){const s={...e};delete s[n],e=s,t.forEach(i=>i())}}}class Wvt extends lt.Component{constructor(e){var n;super(e),this.editorContentRef=lt.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!(!((n=e.editor)===null||n===void 0)&&n.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const e=this.props.editor;if(e&&!e.isDestroyed&&e.options.element){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.options.element.childNodes),e.setOptions({element:n}),e.contentComponent=Hvt(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(s=>s.hasContentComponentInitialized?s:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){const e=this.props.editor;if(!e||(this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null,!e.options.element.firstChild))return;const n=document.createElement("div");n.append(...e.options.element.childNodes),e.setOptions({element:n})}render(){const{editor:e,innerRef:n,...s}=this.props;return lt.createElement(lt.Fragment,null,lt.createElement("div",{ref:qvt(n,this.editorContentRef),...s}),(e==null?void 0:e.contentComponent)&<.createElement(Vvt,{contentComponent:e.contentComponent}))}}const Gvt=P.forwardRef((t,e)=>{const n=lt.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return lt.createElement(Wvt,{key:n,innerRef:e,...t})}),PFe=lt.memo(Gvt);var Kvt=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var s,i,o;if(Array.isArray(e)){if(s=e.length,s!=n.length)return!1;for(i=s;i--!==0;)if(!t(e[i],n[i]))return!1;return!0}if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(i of e.entries())if(!n.has(i[0]))return!1;for(i of e.entries())if(!t(i[1],n.get(i[0])))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(i of e.entries())if(!n.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(n)){if(s=e.length,s!=n.length)return!1;for(i=s;i--!==0;)if(e[i]!==n[i])return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(o=Object.keys(e),s=o.length,s!==Object.keys(n).length)return!1;for(i=s;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return!1;for(i=s;i--!==0;){var c=o[i];if(!(c==="_owner"&&e.$$typeof)&&!t(e[c],n[c]))return!1}return!0}return e!==e&&n!==n},Zvt=$vt(Kvt),LFe={exports:{}},pce={};/** * @license React * use-sync-external-store-shim/with-selector.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 jNe;function Yvt(){if(jNe)return pce;jNe=1;var t=lt,e=Kye;function n(m,y){return m===y&&(m!==0||1/m===1/y)||m!==m&&y!==y}var s=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,o=t.useRef,c=t.useEffect,a=t.useMemo,f=t.useDebugValue;return pce.useSyncExternalStoreWithSelector=function(m,y,v,w,k){var C=o(null);if(C.current===null){var S={hasValue:!1,value:null};C.current=S}else S=C.current;C=a(function(){function I(q){if(!A){if(A=!0,D=q,q=w(q),k!==void 0&&S.hasValue){var W=S.value;if(k(W,q))return $=W}return $=q}if(W=$,s(D,q))return W;var K=w(q);return k!==void 0&&k(W,K)?W:(D=q,$=K)}var A=!1,D,$,F=v===void 0?null:v;return[function(){return I(y())},F===null?void 0:function(){return I(F())}]},[y,v,w,k]);var T=i(m,C[0],C[1]);return c(function(){S.hasValue=!0,S.value=T},[T]),f(T),T},pce}LFe.exports=Yvt();var Xvt=LFe.exports;const Qvt=typeof window<"u"?P.useLayoutEffect:P.useEffect;class Jvt{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){const n=()=>{this.transactionNumber+=1,this.subscribers.forEach(i=>i())},s=this.editor;return s.on("transaction",n),()=>{s.off("transaction",n)}}}}function e_t(t){var e;const[n]=P.useState(()=>new Jvt(t.editor)),s=Xvt.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!==null&&e!==void 0?e:Zvt);return Qvt(()=>n.watch(t.editor),[t.editor,n]),P.useDebugValue(s),s}const t_t=!1,$he=typeof window>"u",r_t=$he||!!(typeof window<"u"&&window.next);class Zye{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?$he||r_t?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...s)=>{var i,o;return(o=(i=this.options.current).onBeforeCreate)===null||o===void 0?void 0:o.call(i,...s)},onBlur:(...s)=>{var i,o;return(o=(i=this.options.current).onBlur)===null||o===void 0?void 0:o.call(i,...s)},onCreate:(...s)=>{var i,o;return(o=(i=this.options.current).onCreate)===null||o===void 0?void 0:o.call(i,...s)},onDestroy:(...s)=>{var i,o;return(o=(i=this.options.current).onDestroy)===null||o===void 0?void 0:o.call(i,...s)},onFocus:(...s)=>{var i,o;return(o=(i=this.options.current).onFocus)===null||o===void 0?void 0:o.call(i,...s)},onSelectionUpdate:(...s)=>{var i,o;return(o=(i=this.options.current).onSelectionUpdate)===null||o===void 0?void 0:o.call(i,...s)},onTransaction:(...s)=>{var i,o;return(o=(i=this.options.current).onTransaction)===null||o===void 0?void 0:o.call(i,...s)},onUpdate:(...s)=>{var i,o;return(o=(i=this.options.current).onUpdate)===null||o===void 0?void 0:o.call(i,...s)},onContentError:(...s)=>{var i,o;return(o=(i=this.options.current).onContentError)===null||o===void 0?void 0:o.call(i,...s)},onDrop:(...s)=>{var i,o;return(o=(i=this.options.current).onDrop)===null||o===void 0?void 0:o.call(i,...s)},onPaste:(...s)=>{var i,o;return(o=(i=this.options.current).onPaste)===null||o===void 0?void 0:o.call(i,...s)}};return new Fvt(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(s=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(s)?!0:s==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((i,o)=>{var c;return i===((c=n.extensions)===null||c===void 0?void 0:c[o])}):e[s]===n[s])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?Zye.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((s,i)=>s===e[i]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}}function OFe(t={},e=[]){const n=P.useRef(t);n.current=t;const[s]=P.useState(()=>new Zye(n)),i=Kye.useSyncExternalStore(s.subscribe,s.getEditor,s.getServerSnapshot);return P.useDebugValue(i),P.useEffect(s.onRender(e)),e_t({editor:i,selector:({transactionNumber:o})=>t.shouldRerenderOnTransaction===!1?null:t.immediatelyRender&&o===0?0:o+1}),i}const n_t=P.createContext({editor:null});n_t.Consumer;const s_t=P.createContext({onDragStart:void 0}),i_t=()=>P.useContext(s_t);lt.forwardRef((t,e)=>{const{onDragStart:n}=i_t(),s=t.as||"div";return lt.createElement(s,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});const a_t=/^\s*>\s$/,o_t=gm.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",cd(this.options.HTMLAttributes,t),0]},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[KA({find:a_t,type:this.type})]}}),l_t=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,c_t=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,d_t=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,u_t=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,h_t=wg.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return["strong",cd(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[J4({find:l_t,type:this.type}),J4({find:d_t,type:this.type})]},addPasteRules(){return[Cj({find:c_t,type:this.type}),Cj({find:u_t,type:this.type})]}}),f_t="listItem",kNe="textStyle",NNe=/^\s*([-+*])\s$/,p_t=gm.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",cd(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(f_t,this.editor.getAttributes(kNe)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=KA({find:NNe,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=KA({find:NNe,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(kNe),editor:this.editor})),[t]}}),m_t=/(^|[^`])`([^`]+)`(?!`)/,g_t=/(^|[^`])`([^`]+)`(?!`)/g,y_t=wg.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",cd(this.options.HTMLAttributes,t),0]},addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[J4({find:m_t,type:this.type})]},addPasteRules(){return[Cj({find:g_t,type:this.type})]}}),x_t=/^```([a-z]+)?[\s\n]$/,v_t=/^~~~([a-z]+)?[\s\n]$/,__t=gm.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options,o=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(c=>c.startsWith(n)).map(c=>c.replace(n,""))[0];return o||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",cd(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:s,empty:i}=n;if(!i||s.parent.type!==this.type)return!1;const o=s.parentOffset===s.parent.nodeSize-2,c=s.parent.textContent.endsWith(` `);return!o||!c?!1:t.chain().command(({tr:a})=>(a.delete(s.pos-2,s.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:s}=e,{$from:i,empty:o}=n;if(!o||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const a=i.after();return a===void 0?!1:s.nodeAt(a)?t.commands.command(({tr:m})=>(m.setSelection(aa.near(s.resolve(a))),!0)):t.commands.exitCode()}}},addInputRules(){return[zhe({find:x_t,type:this.type,getAttributes:t=>({language:t[1]})}),zhe({find:v_t,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Id({key:new Jh("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),s=e.clipboardData.getData("vscode-editor-data"),i=s?JSON.parse(s):void 0,o=i==null?void 0:i.mode;if(!n||!o)return!1;const{tr:c,schema:a}=t.state,f=a.text(n.replace(/\r\n?/g,` `));return c.replaceSelectionWith(this.type.create({language:o},f)),c.selection.$from.parent.type!==this.type&&c.setSelection(Fi.near(c.doc.resolve(Math.max(0,c.selection.from-2)))),c.setMeta("paste",!0),t.dispatch(c),!0}}})]}}),b_t=gm.create({name:"doc",topNode:!0,content:"block+"});function w_t(t={}){return new Id({view(e){return new j_t(e,t)}})}class j_t{constructor(e,n){var s;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(s=n.width)!==null&&s!==void 0?s:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let o=c=>{this[i](c)};return e.dom.addEventListener(i,o),{name:i,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,s,i=this.editorView.dom,o=i.getBoundingClientRect(),c=o.width/i.offsetWidth,a=o.height/i.offsetHeight;if(n){let v=e.nodeBefore,w=e.nodeAfter;if(v||w){let k=this.editorView.nodeDOM(this.cursorPos-(v?v.nodeSize:0));if(k){let C=k.getBoundingClientRect(),S=v?C.bottom:C.top;v&&w&&(S=(S+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let T=this.width/2*a;s={left:C.left,right:C.right,top:S-T,bottom:S+T}}}}if(!s){let v=this.editorView.coordsAtPos(this.cursorPos),w=this.width/2*c;s={left:v.left-w,right:v.left+w,top:v.top,bottom:v.bottom}}let f=this.editorView.dom.offsetParent;this.element||(this.element=f.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let m,y;if(!f||f==document.body&&getComputedStyle(f).position=="static")m=-pageXOffset,y=-pageYOffset;else{let v=f.getBoundingClientRect(),w=v.width/f.offsetWidth,k=v.height/f.offsetHeight;m=v.left-f.scrollLeft*w,y=v.top-f.scrollTop*k}this.element.style.left=(s.left-m)/c+"px",this.element.style.top=(s.top-y)/a+"px",this.element.style.width=(s.right-s.left)/c+"px",this.element.style.height=(s.bottom-s.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),s=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=s&&s.type.spec.disableDropCursor,o=typeof i=="function"?i(this.editorView,n,e):i;if(n&&!o){let c=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=vRe(this.editorView.state.doc,c,this.editorView.dragging.slice);a!=null&&(c=a)}this.setCursor(c),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}const k_t=Ad.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[w_t(this.options)]}});class zl extends aa{constructor(e){super(e,e)}map(e,n){let s=e.resolve(n.map(this.head));return zl.valid(s)?new zl(s):aa.near(s)}content(){return cs.empty}eq(e){return e instanceof zl&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new zl(e.resolve(n.pos))}getBookmark(){return new Yye(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!N_t(e)||!S_t(e))return!1;let s=n.type.spec.allowGapCursor;if(s!=null)return s;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,s=!1){e:for(;;){if(!s&&zl.valid(e))return e;let i=e.pos,o=null;for(let c=e.depth;;c--){let a=e.node(c);if(n>0?e.indexAfter(c)0){o=a.child(n>0?e.indexAfter(c):e.index(c)-1);break}else if(c==0)return null;i+=n;let f=e.doc.resolve(i);if(zl.valid(f))return f}for(;;){let c=n>0?o.firstChild:o.lastChild;if(!c){if(o.isAtom&&!o.isText&&!Xs.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*n),s=!1;continue e}break}o=c,i+=n;let a=e.doc.resolve(i);if(zl.valid(a))return a}return null}}}zl.prototype.visible=!1;zl.findFrom=zl.findGapCursorFrom;aa.jsonID("gapcursor",zl);class Yye{constructor(e){this.pos=e}map(e){return new Yye(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return zl.valid(n)?new zl(n):aa.near(n)}}function DFe(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function N_t(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),s=t.node(e);if(n==0){if(s.type.spec.isolating)return!0;continue}for(let i=s.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||DFe(i.type))return!0;if(i.inlineContent)return!1}}return!0}function S_t(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),s=t.node(e);if(n==s.childCount){if(s.type.spec.isolating)return!0;continue}for(let i=s.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||DFe(i.type))return!0;if(i.inlineContent)return!1}}return!0}function C_t(){return new Id({props:{decorations:E_t,createSelectionBetween(t,e,n){return e.pos==n.pos&&zl.valid(n)?new zl(n):null},handleClick:T_t,handleKeyDown:M_t,handleDOMEvents:{beforeinput:A_t}}})}const M_t=lFe({ArrowLeft:fL("horiz",-1),ArrowRight:fL("horiz",1),ArrowUp:fL("vert",-1),ArrowDown:fL("vert",1)});function fL(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(s,i,o){let c=s.selection,a=e>0?c.$to:c.$from,f=c.empty;if(c instanceof Fi){if(!o.endOfTextblock(n)||a.depth==0)return!1;f=!1,a=s.doc.resolve(e>0?a.after():a.before())}let m=zl.findGapCursorFrom(a,e,f);return m?(i&&i(s.tr.setSelection(new zl(m))),!0):!1}}function T_t(t,e,n){if(!t||!t.editable)return!1;let s=t.state.doc.resolve(e);if(!zl.valid(s))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&Xs.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new zl(s))),!0)}function A_t(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof zl))return!1;let{$from:n}=t.state.selection,s=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!s)return!1;let i=gn.empty;for(let c=s.length-1;c>=0;c--)i=gn.from(s[c].createAndFill(null,i));let o=t.state.tr.replace(n.pos,n.pos,new cs(i,0,0));return o.setSelection(Fi.near(o.doc.resolve(n.pos+1))),t.dispatch(o),!1}function E_t(t){if(!(t.selection instanceof zl))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Pc.create(t.doc,[Ef.widget(t.selection.head,e,{key:"gapcursor"})])}const I_t=Ad.create({name:"gapCursor",addProseMirrorPlugins(){return[C_t()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=oa(vs(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),P_t=gm.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",cd(this.options.HTMLAttributes,t)]},renderText(){return` `},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:s})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:o}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:c}=this.options,{splittableMarks:a}=s.extensionManager,f=o||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:m,dispatch:y})=>{if(y&&f&&c){const v=f.filter(w=>a.includes(w.type.name));m.ensureMarks(v)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),L_t=gm.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,cd(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>zhe({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var Ete=200,od=function(){};od.prototype.append=function(e){return e.length?(e=od.from(e),!this.length&&e||e.length=n?od.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};od.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};od.prototype.forEach=function(e,n,s){n===void 0&&(n=0),s===void 0&&(s=this.length),n<=s?this.forEachInner(e,n,s,0):this.forEachInvertedInner(e,n,s,0)};od.prototype.map=function(e,n,s){n===void 0&&(n=0),s===void 0&&(s=this.length);var i=[];return this.forEach(function(o,c){return i.push(e(o,c))},n,s),i};od.from=function(e){return e instanceof od?e:e&&e.length?new RFe(e):od.empty};var RFe=function(t){function e(s){t.call(this),this.values=s}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,c,a){for(var f=o;f=c;f--)if(i(this.values[f],a+f)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Ete)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Ete)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(od);od.empty=new RFe([]);var O_t=function(t){function e(n,s){t.call(this),this.left=n,this.right=s,this.length=n.length+s.length,this.depth=Math.max(n.depth,s.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(s){return sa&&this.right.forEachInner(s,Math.max(i-a,0),Math.min(this.length,o)-a,c+a)===!1)return!1},e.prototype.forEachInvertedInner=function(s,i,o,c){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(s,i-a,Math.max(o,a)-a,c+a)===!1||o=o?this.right.slice(s-o,i-o):this.left.slice(s,o).append(this.right.slice(0,i-o))},e.prototype.leafAppend=function(s){var i=this.right.leafAppend(s);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(s){var i=this.left.leafPrepend(s);if(i)return new e(i,this.right)},e.prototype.appendInner=function(s){return this.left.depth>=Math.max(this.right.depth,s.depth)+1?new e(this.left,new e(this.right,s)):new e(this,s)},e}(od);const D_t=500;class Gp{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let s=this.items.length;for(;;s--)if(this.items.get(s-1).selection){--s;break}let i,o;n&&(i=this.remapping(s,this.items.length),o=i.maps.length);let c=e.tr,a,f,m=[],y=[];return this.items.forEach((v,w)=>{if(!v.step){i||(i=this.remapping(s,w+1),o=i.maps.length),o--,y.push(v);return}if(i){y.push(new qm(v.map));let k=v.step.map(i.slice(o)),C;k&&c.maybeStep(k).doc&&(C=c.mapping.maps[c.mapping.maps.length-1],m.push(new qm(C,void 0,void 0,m.length+y.length))),o--,C&&i.appendMap(C,o)}else c.maybeStep(v.step);if(v.selection)return a=i?v.selection.map(i.slice(o)):v.selection,f=new Gp(this.items.slice(0,s).append(y.reverse().concat(m)),this.eventCount-1),!1},this.items.length,0),{remaining:f,transform:c,selection:a}}addTransform(e,n,s,i){let o=[],c=this.eventCount,a=this.items,f=!i&&a.length?a.get(a.length-1):null;for(let y=0;yF_t&&(a=R_t(a,m),c-=m),new Gp(a.append(o),c)}remapping(e,n){let s=new $A;return this.items.forEach((i,o)=>{let c=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?s.maps.length-i.mirrorOffset:void 0;s.appendMap(i.map,c)},e,n),s}addMaps(e){return this.eventCount==0?this:new Gp(this.items.append(e.map(n=>new qm(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let s=[],i=Math.max(0,this.items.length-n),o=e.mapping,c=e.steps.length,a=this.eventCount;this.items.forEach(w=>{w.selection&&a--},i);let f=n;this.items.forEach(w=>{let k=o.getMirror(--f);if(k==null)return;c=Math.min(c,k);let C=o.maps[k];if(w.step){let S=e.steps[k].invert(e.docs[k]),T=w.selection&&w.selection.map(o.slice(f+1,k));T&&a++,s.push(new qm(C,S,T))}else s.push(new qm(C))},i);let m=[];for(let w=n;wD_t&&(v=v.compress(this.items.length-s.length)),v}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),s=n.maps.length,i=[],o=0;return this.items.forEach((c,a)=>{if(a>=e)i.push(c),c.selection&&o++;else if(c.step){let f=c.step.map(n.slice(s)),m=f&&f.getMap();if(s--,m&&n.appendMap(m,s),f){let y=c.selection&&c.selection.map(n.slice(s));y&&o++;let v=new qm(m.invert(),f,y),w,k=i.length-1;(w=i.length&&i[k].merge(v))?i[k]=w:i.push(v)}}else c.map&&s--},this.items.length,0),new Gp(od.from(i.reverse()),o)}}Gp.empty=new Gp(od.empty,0);function R_t(t,e){let n;return t.forEach((s,i)=>{if(s.selection&&e--==0)return n=i,!1}),t.slice(n)}class qm{constructor(e,n,s,i){this.map=e,this.step=n,this.selection=s,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new qm(n.getMap().invert(),n,this.selection)}}}class n0{constructor(e,n,s,i,o){this.done=e,this.undone=n,this.prevRanges=s,this.prevTime=i,this.prevComposition=o}}const F_t=20;function z_t(t,e,n,s){let i=n.getMeta(ej),o;if(i)return i.historyState;n.getMeta(U_t)&&(t=new n0(t.done,t.undone,null,0,-1));let c=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(c&&c.getMeta(ej))return c.getMeta(ej).redo?new n0(t.done.addTransform(n,void 0,s,oee(e)),t.undone,SNe(n.mapping.maps),t.prevTime,t.prevComposition):new n0(t.done,t.undone.addTransform(n,void 0,s,oee(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(c&&c.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),f=t.prevTime==0||!c&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-s.newGroupDelay||!B_t(n,t.prevRanges)),m=c?mce(t.prevRanges,n.mapping):SNe(n.mapping.maps);return new n0(t.done.addTransform(n,f?e.selection.getBookmark():void 0,s,oee(e)),Gp.empty,m,n.time,a??t.prevComposition)}else return(o=n.getMeta("rebased"))?new n0(t.done.rebased(n,o),t.undone.rebased(n,o),mce(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new n0(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),mce(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function B_t(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((s,i)=>{for(let o=0;o=e[o]&&(n=!0)}),n}function SNe(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((s,i,o,c)=>e.push(o,c));return e}function mce(t,e){if(!t)return null;let n=[];for(let s=0;s{let i=ej.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(s){let o=$_t(i,n,t);o&&s(e?o.scrollIntoView():o)}return!0}}const zFe=FFe(!1,!0),BFe=FFe(!0,!0),V_t=Ad.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>zFe(t,e),redo:()=>({state:t,dispatch:e})=>BFe(t,e)}},addProseMirrorPlugins(){return[q_t(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),H_t=gm.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",cd(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!Bvt(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$from:s,$to:i}=n,o=t();return s.parentOffset===0?o.insertContentAt({from:Math.max(s.pos-1,0),to:i.pos},{type:this.name}):ovt(n)?o.insertContentAt(i.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({tr:c,dispatch:a})=>{var f;if(a){const{$to:m}=c.selection,y=m.end();if(m.nodeAfter)m.nodeAfter.isTextblock?c.setSelection(Fi.create(c.doc,m.pos+1)):m.nodeAfter.isBlock?c.setSelection(Xs.create(c.doc,m.pos)):c.setSelection(Fi.create(c.doc,m.pos));else{const v=(f=m.parent.type.contentMatch.defaultType)===null||f===void 0?void 0:f.create();v&&(c.insert(y,v),c.setSelection(Fi.create(c.doc,y+1)))}c.scrollIntoView()}return!0}).run()}}},addInputRules(){return[zvt({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),W_t=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,G_t=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,K_t=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Z_t=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Y_t=wg.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",cd(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[J4({find:W_t,type:this.type}),J4({find:K_t,type:this.type})]},addPasteRules(){return[Cj({find:G_t,type:this.type}),Cj({find:Z_t,type:this.type})]}}),X_t=gm.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",cd(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Q_t="listItem",MNe="textStyle",TNe=/^(\d+)\.\s$/,J_t=gm.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",cd(this.options.HTMLAttributes,n),0]:["ol",cd(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Q_t,this.editor.getAttributes(MNe)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=KA({find:TNe,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=KA({find:TNe,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(MNe)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),e2t=gm.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",cd(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),t2t=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,r2t=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,n2t=wg.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",cd(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[J4({find:t2t,type:this.type})]},addPasteRules(){return[Cj({find:r2t,type:this.type})]}}),s2t=gm.create({name:"text",group:"inline"}),$Fe=Ad.create({name:"starterKit",addExtensions(){const t=[];return this.options.bold!==!1&&t.push(h_t.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(o_t.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(p_t.configure(this.options.bulletList)),this.options.code!==!1&&t.push(y_t.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(__t.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(b_t.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(k_t.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(I_t.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(P_t.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(L_t.configure(this.options.heading)),this.options.history!==!1&&t.push(V_t.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(H_t.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(Y_t.configure(this.options.italic)),this.options.listItem!==!1&&t.push(X_t.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(J_t.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(e2t.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(n2t.configure(this.options.strike)),this.options.text!==!1&&t.push(s2t.configure(this.options.text)),t}}),i2t="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",a2t="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",Uhe="numeric",qhe="ascii",Vhe="alpha",KT="asciinumeric",W5="alphanumeric",Hhe="domain",UFe="emoji",o2t="scheme",l2t="slashscheme",yce="whitespace";function c2t(t,e){return t in e||(e[t]=[]),e[t]}function xw(t,e,n){e[Uhe]&&(e[KT]=!0,e[W5]=!0),e[qhe]&&(e[KT]=!0,e[Vhe]=!0),e[KT]&&(e[W5]=!0),e[Vhe]&&(e[W5]=!0),e[W5]&&(e[Hhe]=!0),e[UFe]&&(e[Hhe]=!0);for(const s in e){const i=c2t(s,n);i.indexOf(t)<0&&i.push(t)}}function d2t(t,e){const n={};for(const s in e)e[s].indexOf(t)>=0&&(n[s]=!0);return n}function rh(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}rh.groups={};rh.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let s=0;st.ta(e,n,s,i),Pl=(t,e,n,s,i)=>t.tr(e,n,s,i),ANe=(t,e,n,s,i)=>t.ts(e,n,s,i),jn=(t,e,n,s,i)=>t.tt(e,n,s,i),cy="WORD",Whe="UWORD",qFe="ASCIINUMERICAL",VFe="ALPHANUMERICAL",ZA="LOCALHOST",Ghe="TLD",Khe="UTLD",lee="SCHEME",rS="SLASH_SCHEME",Xye="NUM",Zhe="WS",Qye="NL",ZT="OPENBRACE",YT="CLOSEBRACE",Ite="OPENBRACKET",Pte="CLOSEBRACKET",Lte="OPENPAREN",Ote="CLOSEPAREN",Dte="OPENANGLEBRACKET",Rte="CLOSEANGLEBRACKET",Fte="FULLWIDTHLEFTPAREN",zte="FULLWIDTHRIGHTPAREN",Bte="LEFTCORNERBRACKET",$te="RIGHTCORNERBRACKET",Ute="LEFTWHITECORNERBRACKET",qte="RIGHTWHITECORNERBRACKET",Vte="FULLWIDTHLESSTHAN",Hte="FULLWIDTHGREATERTHAN",Wte="AMPERSAND",Gte="APOSTROPHE",Kte="ASTERISK",s0="AT",Zte="BACKSLASH",Yte="BACKTICK",Xte="CARET",u0="COLON",Jye="COMMA",Qte="DOLLAR",Vm="DOT",Jte="EQUALS",exe="EXCLAMATION",vf="HYPHEN",XT="PERCENT",ere="PIPE",tre="PLUS",rre="POUND",QT="QUERY",txe="QUOTE",HFe="FULLWIDTHMIDDLEDOT",rxe="SEMI",Hm="SLASH",JT="TILDE",nre="UNDERSCORE",WFe="EMOJI",sre="SYM";var GFe=Object.freeze({__proto__:null,ALPHANUMERICAL:VFe,AMPERSAND:Wte,APOSTROPHE:Gte,ASCIINUMERICAL:qFe,ASTERISK:Kte,AT:s0,BACKSLASH:Zte,BACKTICK:Yte,CARET:Xte,CLOSEANGLEBRACKET:Rte,CLOSEBRACE:YT,CLOSEBRACKET:Pte,CLOSEPAREN:Ote,COLON:u0,COMMA:Jye,DOLLAR:Qte,DOT:Vm,EMOJI:WFe,EQUALS:Jte,EXCLAMATION:exe,FULLWIDTHGREATERTHAN:Hte,FULLWIDTHLEFTPAREN:Fte,FULLWIDTHLESSTHAN:Vte,FULLWIDTHMIDDLEDOT:HFe,FULLWIDTHRIGHTPAREN:zte,HYPHEN:vf,LEFTCORNERBRACKET:Bte,LEFTWHITECORNERBRACKET:Ute,LOCALHOST:ZA,NL:Qye,NUM:Xye,OPENANGLEBRACKET:Dte,OPENBRACE:ZT,OPENBRACKET:Ite,OPENPAREN:Lte,PERCENT:XT,PIPE:ere,PLUS:tre,POUND:rre,QUERY:QT,QUOTE:txe,RIGHTCORNERBRACKET:$te,RIGHTWHITECORNERBRACKET:qte,SCHEME:lee,SEMI:rxe,SLASH:Hm,SLASH_SCHEME:rS,SYM:sre,TILDE:JT,TLD:Ghe,UNDERSCORE:nre,UTLD:Khe,UWORD:Whe,WORD:cy,WS:Zhe});const iy=/[a-z]/,v5=new RegExp("\\p{L}","u"),xce=new RegExp("\\p{Emoji}","u"),ay=/\d/,vce=/\s/,ENe="\r",_ce=` `,u2t="️",h2t="‍",bce="";let pL=null,mL=null;function f2t(t=[]){const e={};rh.groups=e;const n=new rh;pL==null&&(pL=INe(i2t)),mL==null&&(mL=INe(a2t)),jn(n,"'",Gte),jn(n,"{",ZT),jn(n,"}",YT),jn(n,"[",Ite),jn(n,"]",Pte),jn(n,"(",Lte),jn(n,")",Ote),jn(n,"<",Dte),jn(n,">",Rte),jn(n,"(",Fte),jn(n,")",zte),jn(n,"「",Bte),jn(n,"」",$te),jn(n,"『",Ute),jn(n,"』",qte),jn(n,"<",Vte),jn(n,">",Hte),jn(n,"&",Wte),jn(n,"*",Kte),jn(n,"@",s0),jn(n,"`",Yte),jn(n,"^",Xte),jn(n,":",u0),jn(n,",",Jye),jn(n,"$",Qte),jn(n,".",Vm),jn(n,"=",Jte),jn(n,"!",exe),jn(n,"-",vf),jn(n,"%",XT),jn(n,"|",ere),jn(n,"+",tre),jn(n,"#",rre),jn(n,"?",QT),jn(n,'"',txe),jn(n,"/",Hm),jn(n,";",rxe),jn(n,"~",JT),jn(n,"_",nre),jn(n,"\\",Zte),jn(n,"・",HFe);const s=Pl(n,ay,Xye,{[Uhe]:!0});Pl(s,ay,s);const i=Pl(s,iy,qFe,{[KT]:!0}),o=Pl(s,v5,VFe,{[W5]:!0}),c=Pl(n,iy,cy,{[qhe]:!0});Pl(c,ay,i),Pl(c,iy,c),Pl(i,ay,i),Pl(i,iy,i);const a=Pl(n,v5,Whe,{[Vhe]:!0});Pl(a,iy),Pl(a,ay,o),Pl(a,v5,a),Pl(o,ay,o),Pl(o,iy),Pl(o,v5,o);const f=jn(n,_ce,Qye,{[yce]:!0}),m=jn(n,ENe,Zhe,{[yce]:!0}),y=Pl(n,vce,Zhe,{[yce]:!0});jn(n,bce,y),jn(m,_ce,f),jn(m,bce,y),Pl(m,vce,y),jn(y,ENe),jn(y,_ce),Pl(y,vce,y),jn(y,bce,y);const v=Pl(n,xce,WFe,{[UFe]:!0});jn(v,"#"),Pl(v,xce,v),jn(v,u2t,v);const w=jn(v,h2t);jn(w,"#"),Pl(w,xce,v);const k=[[iy,c],[ay,i]],C=[[iy,null],[v5,a],[ay,o]];for(let S=0;SS[0]>T[0]?1:-1);for(let S=0;S=0?A[Hhe]=!0:iy.test(T)?ay.test(T)?A[KT]=!0:A[qhe]=!0:A[Uhe]=!0,ANe(n,T,T,A)}return ANe(n,"localhost",ZA,{ascii:!0}),n.jd=new rh(sre),{start:n,tokens:Object.assign({groups:e},GFe)}}function KFe(t,e){const n=p2t(e.replace(/[A-Z]/g,a=>a.toLowerCase())),s=n.length,i=[];let o=0,c=0;for(;c=0&&(v+=n[c].length,w++),m+=n[c].length,o+=n[c].length,c++;o-=v,c-=w,m-=v,i.push({t:y.t,v:e.slice(o-m,o),s:o-m,e:o})}return i}function p2t(t){const e=[],n=t.length;let s=0;for(;s56319||s+1===n||(o=t.charCodeAt(s+1))<56320||o>57343?t[s]:t.slice(s,s+2);e.push(c),s+=c.length}return e}function qx(t,e,n,s,i){let o;const c=e.length;for(let a=0;a=0;)o++;if(o>0){e.push(n.join(""));for(let c=parseInt(t.substring(s,s+o),10);c>0;c--)n.pop();s+=o}else n.push(t[s]),s++}return e}const YA={defaultProtocol:"http",events:null,format:PNe,formatHref:PNe,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function nxe(t,e=null){let n=Object.assign({},YA);t&&(n=Object.assign(n,t instanceof nxe?t.o:t));const s=n.ignoreTags,i=[];for(let o=0;on?s.substring(0,n)+"…":s},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=YA.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),s=t.get("formatHref",n,this),i=t.get("tagName",n,e),o=this.toFormattedString(t),c={},a=t.get("className",n,e),f=t.get("target",n,e),m=t.get("rel",n,e),y=t.getObj("attributes",n,e),v=t.getObj("events",n,e);return c.href=s,a&&(c.class=a),f&&(c.target=f),m&&(c.rel=m),y&&Object.assign(c,y),{tagName:i,attributes:c,content:o,eventListeners:v}}};function Ose(t,e){class n extends ZFe{constructor(i,o){super(i,o),this.t=t}}for(const s in e)n.prototype[s]=e[s];return n.t=t,n}const LNe=Ose("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),ONe=Ose("text"),m2t=Ose("nl"),gL=Ose("url",{isLink:!0,toHref(t=YA.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==ZA&&t[1].t===u0}}),mf=t=>new rh(t);function g2t({groups:t}){const e=t.domain.concat([Wte,Kte,s0,Zte,Yte,Xte,Qte,Jte,vf,Xye,XT,ere,tre,rre,Hm,sre,JT,nre]),n=[Gte,u0,Jye,Vm,exe,XT,QT,txe,rxe,Dte,Rte,ZT,YT,Pte,Ite,Lte,Ote,Fte,zte,Bte,$te,Ute,qte,Vte,Hte],s=[Wte,Gte,Kte,Zte,Yte,Xte,Qte,Jte,vf,ZT,YT,XT,ere,tre,rre,QT,Hm,sre,JT,nre],i=mf(),o=jn(i,JT);ia(o,s,o),ia(o,t.domain,o);const c=mf(),a=mf(),f=mf();ia(i,t.domain,c),ia(i,t.scheme,a),ia(i,t.slashscheme,f),ia(c,s,o),ia(c,t.domain,c);const m=jn(c,s0);jn(o,s0,m),jn(a,s0,m),jn(f,s0,m);const y=jn(o,Vm);ia(y,s,o),ia(y,t.domain,o);const v=mf();ia(m,t.domain,v),ia(v,t.domain,v);const w=jn(v,Vm);ia(w,t.domain,v);const k=mf(LNe);ia(w,t.tld,k),ia(w,t.utld,k),jn(m,ZA,k);const C=jn(v,vf);jn(C,vf,C),ia(C,t.domain,v),ia(k,t.domain,v),jn(k,Vm,w),jn(k,vf,C);const S=jn(k,u0);ia(S,t.numeric,LNe);const T=jn(c,vf),I=jn(c,Vm);jn(T,vf,T),ia(T,t.domain,c),ia(I,s,o),ia(I,t.domain,c);const A=mf(gL);ia(I,t.tld,A),ia(I,t.utld,A),ia(A,t.domain,c),ia(A,s,o),jn(A,Vm,I),jn(A,vf,T),jn(A,s0,m);const D=jn(A,u0),$=mf(gL);ia(D,t.numeric,$);const F=mf(gL),q=mf();ia(F,e,F),ia(F,n,q),ia(q,e,F),ia(q,n,q),jn(A,Hm,F),jn($,Hm,F);const W=jn(a,u0),K=jn(f,u0),Z=jn(K,Hm),re=jn(Z,Hm);ia(a,t.domain,c),jn(a,Vm,I),jn(a,vf,T),ia(f,t.domain,c),jn(f,Vm,I),jn(f,vf,T),ia(W,t.domain,F),jn(W,Hm,F),jn(W,QT,F),ia(re,t.domain,F),ia(re,e,F),jn(re,Hm,F);const he=[[ZT,YT],[Ite,Pte],[Lte,Ote],[Dte,Rte],[Fte,zte],[Bte,$te],[Ute,qte],[Vte,Hte]];for(let ue=0;ue=0&&w++,i++,y++;if(w<0)i-=y,i0&&(o.push(wce(ONe,e,c)),c=[]),i-=w,y-=w;const k=v.t,C=n.slice(i-y,i);o.push(wce(k,e,C))}}return c.length>0&&o.push(wce(ONe,e,c)),o}function wce(t,e,n){const s=n[0].s,i=n[n.length-1].e,o=e.slice(s,i);return new t(o,n)}const x2t=typeof console<"u"&&console&&console.warn||(()=>{}),v2t="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",il={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function _2t(){return rh.groups={},il.scanner=null,il.parser=null,il.tokenQueue=[],il.pluginQueue=[],il.customSchemes=[],il.initialized=!1,il}function DNe(t,e=!1){if(il.initialized&&x2t(`linkifyjs: already initialized - will not register custom scheme "${t}" ${v2t}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format. 1. Must only contain digits, lowercase ASCII letters or "-" 2. Cannot start or end with "-" 3. "-" cannot repeat`);il.customSchemes.push([t,e])}function b2t(){il.scanner=f2t(il.customSchemes);for(let t=0;t{const i=e.some(m=>m.docChanged)&&!n.doc.eq(s.doc),o=e.some(m=>m.getMeta("preventAutolink"));if(!i||o)return;const{tr:c}=s,a=X1t(n.doc,[...e]);if(ivt(a).forEach(({newRange:m})=>{const y=J1t(s.doc,m,k=>k.isTextblock);let v,w;if(y.length>1)v=y[0],w=s.doc.textBetween(v.pos,v.pos+v.node.nodeSize,void 0," ");else if(y.length){const k=s.doc.textBetween(m.from,m.to," "," ");if(!j2t.test(k))return;v=y[0],w=s.doc.textBetween(v.pos,m.to,void 0," ")}if(v&&w){const k=w.split(w2t).filter(Boolean);if(k.length<=0)return!1;const C=k[k.length-1],S=v.pos+w.lastIndexOf(C);if(!C)return!1;const T=sxe(C).map(I=>I.toObject(t.defaultProtocol));if(!N2t(T))return!1;T.filter(I=>I.isLink).map(I=>({...I,from:S+I.start+1,to:S+I.end+1})).filter(I=>s.schema.marks.code?!s.doc.rangeHasMark(I.from,I.to,s.schema.marks.code):!0).filter(I=>t.validate(I.value)).filter(I=>t.shouldAutoLink(I.value)).forEach(I=>{Wye(I.from,I.to,s.doc).some(A=>A.mark.type===t.type)||c.addMark(I.from,I.to,t.type.create({href:I.href}))})}}),!!c.steps.length)return c}})}function C2t(t){return new Id({key:new Jh("handleClickLink"),props:{handleClick:(e,n,s)=>{var i,o;if(s.button!==0||!e.editable)return!1;let c=s.target;const a=[];for(;c.nodeName!=="DIV";)a.push(c),c=c.parentNode;if(!a.find(w=>w.nodeName==="A"))return!1;const f=EFe(e.state,t.type.name),m=s.target,y=(i=m==null?void 0:m.href)!==null&&i!==void 0?i:f.href,v=(o=m==null?void 0:m.target)!==null&&o!==void 0?o:f.target;return m&&y?(window.open(y,v),!0):!1}}})}function M2t(t){return new Id({key:new Jh("handlePasteLink"),props:{handlePaste:(e,n,s)=>{const{state:i}=e,{selection:o}=i,{empty:c}=o;if(c)return!1;let a="";s.content.forEach(m=>{a+=m.textContent});const f=YFe(a,{defaultProtocol:t.defaultProtocol}).find(m=>m.isLink&&m.value===a);return!a||!f?!1:t.editor.commands.setMark(t.type,{href:f.href})}}})}function Lv(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(s=>{const i=typeof s=="string"?s:s.scheme;i&&n.push(i)}),!t||t.replace(k2t,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const XFe=wg.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){DNe(t);return}DNe(t.scheme,t.optionalSlashes)})},onDestroy(){_2t()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!Lv(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!Lv(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!Lv(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",cd(this.options.HTMLAttributes,t),0]:["a",cd(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:s=>!!Lv(s,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:s=>!!Lv(s,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Cj({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:s}=this.options,i=YFe(t).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:c=>!!Lv(c,n),protocols:n,defaultProtocol:s}));i.length&&i.forEach(o=>e.push({text:o.value,data:{href:o.href},index:o.start}))}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(S2t({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:s=>this.options.isAllowedUri(s,{defaultValidate:i=>!!Lv(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(C2t({type:this.type})),this.options.linkOnPaste&&t.push(M2t({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),QFe=Ad.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e),toggleTextAlign:t=>({editor:e,commands:n})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?n.unsetTextAlign():n.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),T2t=t=>{if(!t.children.length)return;const e=t.querySelectorAll("span");e&&e.forEach(n=>{var s,i;const o=n.getAttribute("style"),c=(i=(s=n.parentElement)===null||s===void 0?void 0:s.closest("span"))===null||i===void 0?void 0:i.getAttribute("style");n.setAttribute("style",`${c};${o}`)})},JFe=wg.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!1}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&T2t(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",cd(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({tr:t})=>{const{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(n,s)=>{if(n.isTextblock)return!0;n.marks.filter(i=>i.type===this.type).some(i=>Object.values(i.attrs).some(o=>!!o))||t.removeMark(s,s+n.nodeSize,this.type)}),!0}}}});function Qy({content:t,onChange:e,placeholder:n="Enter content...",minHeight:s="150px"}){const[i,o]=P.useState(!1),[c,a]=P.useState(""),[f,m]=P.useState(!0),y=OFe({extensions:[$Fe,XFe.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),QFe.configure({types:["heading","paragraph"]}),JFe],content:t,onUpdate:({editor:C})=>{e(C.getHTML())},editorProps:{attributes:{class:"outline-none","data-placeholder":n}}});P.useEffect(()=>{y&&t!==y.getHTML()&&y.commands.setContent(t)},[t,y]);const v=()=>{if(!y)return;const C=y.getAttributes("link").href||"",S=y.getAttributes("link").target;a(C),m(S==="_blank"),o(!0)},w=()=>{y&&(c===""?y.chain().focus().extendMarkRange("link").unsetLink().run():y.chain().focus().extendMarkRange("link").setLink({href:c,target:f?"_blank":null,rel:f?"noopener noreferrer nofollow":null}).run(),o(!1),a(""))},k=()=>{y&&y.chain().focus().extendMarkRange("link").unsetLink().run()};return y?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"border rounded-lg overflow-hidden",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 p-2 border-b bg-muted/30",children:[r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().toggleHeading({level:1}).run(),className:y.isActive("heading",{level:1})?"bg-muted":"",title:"Heading 1",children:r.jsx(dT,{className:"h-4 w-4"})}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().toggleHeading({level:2}).run(),className:y.isActive("heading",{level:2})?"bg-muted":"",title:"Heading 2",children:r.jsx(uT,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().toggleBold().run(),className:y.isActive("bold")?"bg-muted":"",title:"Bold",children:r.jsx(IS,{className:"h-4 w-4"})}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().toggleItalic().run(),className:y.isActive("italic")?"bg-muted":"",title:"Italic",children:r.jsx(BS,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().toggleBulletList().run(),className:y.isActive("bulletList")?"bg-muted":"",title:"Bullet List",children:r.jsx(rm,{className:"h-4 w-4"})}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().toggleOrderedList().run(),className:y.isActive("orderedList")?"bg-muted":"",title:"Numbered List",children:r.jsx(VS,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().setTextAlign("left").run(),className:y.isActive({textAlign:"left"})?"bg-muted":"",title:"Align Left",children:r.jsx(TS,{className:"h-4 w-4"})}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().setTextAlign("center").run(),className:y.isActive({textAlign:"center"})?"bg-muted":"",title:"Align Center",children:r.jsx(MS,{className:"h-4 w-4"})}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().setTextAlign("right").run(),className:y.isActive({textAlign:"right"})?"bg-muted":"",title:"Align Right",children:r.jsx(AS,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:v,className:y.isActive("link")?"bg-muted":"",title:"Add Link",children:r.jsx(bo,{className:"h-4 w-4"})}),y.isActive("link")&&r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:k,title:"Remove Link",children:r.jsx(bo,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().undo().run(),disabled:!y.can().undo(),title:"Undo",children:r.jsx(QS,{className:"h-4 w-4"})}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().redo().run(),disabled:!y.can().redo(),title:"Redo",children:r.jsx(YS,{className:"h-4 w-4"})})]}),r.jsx(PFe,{editor:y,className:"prose prose-sm max-w-none p-3 focus:outline-none [&_.ProseMirror]:outline-none",style:{minHeight:s}})]}),r.jsx($r,{open:i,onOpenChange:o,children:r.jsxs(zr,{className:"sm:max-w-md",children:[r.jsx(Zr,{children:r.jsx(Kr,{children:"Insert Link"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"link-url",children:"URL"}),r.jsx(yt,{id:"link-url",value:c,onChange:C=>a(C.target.value),placeholder:"https://example.com"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Zs,{id:"link-new-tab",checked:f,onCheckedChange:m}),r.jsx(Qe,{htmlFor:"link-new-tab",children:"Open in new tab"})]})]}),r.jsxs(ni,{children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>o(!1),children:"Cancel"}),r.jsx(te,{type:"button",onClick:w,children:c?"Apply Link":"Remove Link"})]})]})})]}):null}const Dse=async t=>{try{const{data:e,error:n}=await ee.from("push_notification_settings").select("is_enabled").eq("setting_key",t).maybeSingle();return n?(console.error("Error checking notification setting:",n),!0):(e==null?void 0:e.is_enabled)??!0}catch(e){return console.error("Error checking notification setting:",e),!0}},mI=async t=>{try{const{data:e,error:n}=await ee.functions.invoke("send-push-notification",{body:t});return n?(console.error("Error sending notification:",n),{success:!1,error:n}):(console.log("Notification sent:",e),{success:!0,data:e})}catch(e){return console.error("Error sending notification:",e),{success:!1,error:e}}},A2t=async(t,e)=>await Dse("new_templates")?mI({title:"New Template Available",body:`Check out the new template: ${t}`,url:`/templates/${e}`}):(console.log("New template notifications are disabled"),{success:!1,skipped:!0}),E2t=async(t,e)=>mI({title:"New Academy Video",body:`New video added: ${t}`,url:`/academy/${e}`}),I2t=async(t,e)=>await Dse("new_events")?mI({title:"New Event",body:`New event: ${t}`,url:`/events/${e}`}):(console.log("New event notifications are disabled"),{success:!1,skipped:!0}),P2t=async(t,e)=>await Dse("new_toolbox")?mI({title:"New Resource Kit",body:`New resource kit available: ${t}`,url:`/toolbox/${e}`}):(console.log("New toolbox notifications are disabled"),{success:!1,skipped:!0}),Yhe=async(t,e)=>await Dse("new_social_swag")?mI({title:"New Social Swag",body:`New social swag available: ${t}`,url:`/social-swag/${e}`}):(console.log("New social swag notifications are disabled"),{success:!1,skipped:!0}),yL={title:"",description:"",image_url:"",video_url:"",event_date:void 0,event_time:"12:00",zoom_link:"",zoom_meeting_id:"",capacity:"",is_published:!1};function L2t(){const t=es(),e=Xr(),[n,s]=P.useState(!1),[i,o]=P.useState(null),[c,a]=P.useState(yL),[f,m]=P.useState(null),[y,v]=P.useState(null),[w,k]=P.useState(!1),C=P.useRef(null),[S,T]=P.useState(!1),[I,A]=P.useState(null),[D,$]=P.useState(!1),[F,q]=P.useState(null),[W,K]=P.useState(null),[Z,re]=P.useState(!0),[he,ue]=P.useState(""),{data:Ne,isLoading:se}=rr({queryKey:["admin-events"],queryFn:async()=>{const{data:Ce,error:et}=await ee.from("events").select("*").order("event_date",{ascending:!0});if(et)throw et;return Ce}}),{data:xe}=rr({queryKey:["event-registrations-count"],queryFn:async()=>{const{data:Ce,error:et}=await ee.from("event_registrations").select("event_id");if(et)throw et;const Fe={};return Ce.forEach(Ke=>{Fe[Ke.event_id]=(Fe[Ke.event_id]||0)+1}),Fe}}),{data:ie,isLoading:me}=rr({queryKey:["event-registrations-details",I==null?void 0:I.id],queryFn:async()=>{if(!I)return[];const{data:Ce,error:et}=await ee.from("event_registrations").select("id, user_id, registered_at, zoom_join_url, zoom_name, zoom_email").eq("event_id",I.id).order("registered_at",{ascending:!1});if(et)throw et;if(!Ce||Ce.length===0)return[];const Fe=Ce.map(ft=>ft.user_id).filter(Boolean);let Ke=[];if(Fe.length>0){const{data:ft,error:Nt}=await ee.from("profiles").select("id, name, email").in("id",Fe);if(Nt)throw Nt;Ke=ft||[]}const Le=new Map((Ke==null?void 0:Ke.map(ft=>[ft.id,ft]))||[]);return Ce.map(ft=>({...ft,profiles:ft.user_id&&Le.get(ft.user_id)||null}))},enabled:!!I}),{data:fe,isLoading:ve}=rr({queryKey:["event-attendees-details",I==null?void 0:I.id],queryFn:async()=>{if(!I)return[];const{data:Ce,error:et}=await ee.from("event_attendees").select("id, user_id, zoom_email, zoom_name, join_time, leave_time, duration_minutes, manually_added, created_at").eq("event_id",I.id).order("created_at",{ascending:!1});if(et)throw et;if(!Ce||Ce.length===0)return[];const Fe=Ce.map(Mt=>Mt.user_id).filter(Boolean);let Ke=[];if(Fe.length>0){const{data:Mt,error:It}=await ee.from("profiles").select("id, name, email").in("id",Fe);if(It)throw It;Ke=Mt||[]}const{data:Le}=await ee.from("agent_points").select("user_id").eq("event_id",I.id),ft=new Set((Le==null?void 0:Le.map(Mt=>Mt.user_id))||[]),Nt=new Map((Ke==null?void 0:Ke.map(Mt=>[Mt.id,Mt]))||[]);return Ce.map(Mt=>({...Mt,profiles:Mt.user_id&&Nt.get(Mt.user_id)||null,points_awarded:Mt.user_id?ft.has(Mt.user_id):!1}))},enabled:!!I}),Ie=Ce=>{A(Ce),T(!0)},Se=cr({mutationFn:async Ce=>{const{data:{session:et}}=await ee.auth.getSession();if(!et)throw new Error("Not authenticated");const Fe=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/zoom-sync-registrations",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${et.access_token}`},body:JSON.stringify({event_id:Ce})}),Ke=await Fe.json();if(!Fe.ok)throw new Error(Ke.error||"Failed to sync");return Ke},onSuccess:Ce=>{e.invalidateQueries({queryKey:["event-registrations-details",I==null?void 0:I.id]}),e.invalidateQueries({queryKey:["event-registrations-count"]}),Ge.success(Ce.message)},onError:Ce=>{Ge.error("Failed to sync: "+Ce.message)}}),oe=cr({mutationFn:async Ce=>{const{data:{session:et}}=await ee.auth.getSession();if(!et)throw new Error("Not authenticated");const Fe=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/zoom-sync-attendees",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${et.access_token}`},body:JSON.stringify({event_id:Ce})}),Ke=await Fe.json();if(!Fe.ok)throw new Error(Ke.error||"Failed to sync attendees");return Ke},onSuccess:Ce=>{e.invalidateQueries({queryKey:["event-attendees-details",I==null?void 0:I.id]}),e.invalidateQueries({queryKey:["event-leaderboard"]}),e.invalidateQueries({queryKey:["admin-agent-points"]}),Ce!=null&&Ce.message?Ge.success(Ce.message):Ge.success(`Synced ${Ce.synced||0} attendees. ${Ce.points_awarded||0} points awarded!`)},onError:Ce=>{Ge.error("Failed to sync attendees: "+Ce.message)}}),ae=cr({mutationFn:async({eventId:Ce,testMode:et})=>{const{data:{session:Fe}}=await ee.auth.getSession();if(!Fe)throw new Error("Not authenticated");const Ke=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/send-event-reminder",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Fe.access_token}`},body:JSON.stringify({event_id:Ce,test_mode:et})}),Le=await Ke.json();if(!Ke.ok)throw new Error(Le.error||"Failed to send reminders");return Le},onSuccess:Ce=>{Ce.test?Ge.success(Ce.message||"Test email sent!"):Ge.success(Ce.message||`Reminder emails sent to ${Ce.sent} registrants!`)},onError:Ce=>{Ge.error("Failed to send reminders: "+Ce.message)}}),{data:je}=rr({queryKey:["all-profiles-for-linking"],queryFn:async()=>{let Ce=[],et=0;const Fe=1e3;for(;;){const{data:Ke,error:Le}=await ee.from("profiles").select("id, name, email").order("name",{ascending:!0}).range(et,et+Fe-1);if(Le)throw Le;if(!Ke||Ke.length===0||(Ce=[...Ce,...Ke],Ke.length{const{error:Le}=await ee.from("event_attendees").update({user_id:et}).eq("id",Ce);if(Le)throw Le;if(Ke&&Fe){const{error:Nt}=await ee.from("zoom_email_aliases").upsert({user_id:et,zoom_email:Fe.toLowerCase()},{onConflict:"zoom_email"});Nt&&console.error("Failed to save alias:",Nt)}const ft=I==null?void 0:I.id;if(ft){const{data:Nt}=await ee.from("user_roles").select("id").eq("user_id",et).eq("role","admin").single();if(!Nt){const{data:Mt}=await ee.from("agent_points").select("id").eq("user_id",et).eq("event_id",ft).single();Mt||(await ee.rpc("award_attendance_points",{p_user_id:et,p_event_id:ft,p_points:10,p_reason:"Event Attendance (Manual Link)"}),await ee.rpc("check_and_award_badges",{p_user_id:et}))}}return{userId:et,zoomEmail:Fe,shouldSaveAlias:Ke}},onSuccess:Ce=>{e.invalidateQueries({queryKey:["event-attendees-details",I==null?void 0:I.id]}),e.invalidateQueries({queryKey:["event-leaderboard"]}),e.invalidateQueries({queryKey:["admin-agent-points"]});let et="Attendee linked and points awarded!";Ce.shouldSaveAlias&&Ce.zoomEmail&&(et+=` Email "${Ce.zoomEmail}" will be auto-matched in the future.`),Ge.success(et),$(!1),q(null),K(null),ue("")},onError:Ce=>{Ge.error("Failed to link attendee: "+Ce.message)}}),Ue=Ce=>{q(Ce),K(null),re(!0),ue(""),$(!0)},Re=()=>{!F||!W||Me.mutate({attendeeId:F.id,userId:W,zoomEmail:F.zoom_email,shouldSaveAlias:Z})},$e=(je==null?void 0:je.filter(Ce=>{var Fe,Ke;if(!he)return!0;const et=he.toLowerCase();return((Fe=Ce.name)==null?void 0:Fe.toLowerCase().includes(et))||((Ke=Ce.email)==null?void 0:Ke.toLowerCase().includes(et))}))||[],Pe=async Ce=>{const et=Ce.name.split(".").pop(),Ke=`${`${crypto.randomUUID()}.${et}`}`,{error:Le}=await ee.storage.from("event-images").upload(Ke,Ce);if(Le)throw Le;const{data:{publicUrl:ft}}=ee.storage.from("event-images").getPublicUrl(Ke);return ft},Ae=Ce=>{var Fe;const et=(Fe=Ce.target.files)==null?void 0:Fe[0];if(et){if(et.size>5*1024*1024){Ge.error("Image must be less than 5MB");return}m(et),v(URL.createObjectURL(et))}},nt=()=>{m(null),v(null),a({...c,image_url:""}),C.current&&(C.current.value="")},Te=cr({mutationFn:async Ce=>{k(!0);let et=Ce.image_url;f&&(et=await Pe(f)||"");const Fe=new Date(Ce.event_date),[Ke,Le]=Ce.event_time.split(":");Fe.setHours(parseInt(Ke),parseInt(Le));const{data:ft,error:Nt}=await ee.from("events").insert({title:Ce.title,description:Ce.description||null,image_url:et||null,video_url:Ce.video_url||null,event_date:Fe.toISOString(),zoom_link:Ce.zoom_link,zoom_meeting_id:Ce.zoom_meeting_id||null,capacity:Ce.capacity?parseInt(Ce.capacity):null,is_published:Ce.is_published}).select().single();if(Nt)throw Nt;ft&&I2t(Ce.title,ft.id)},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-events"]}),Ge.success("Event created successfully"),s(!1),a(yL),m(null),v(null),k(!1)},onError:Ce=>{Ge.error("Failed to create event: "+Ce.message),k(!1)}}),Xe=cr({mutationFn:async({id:Ce,data:et})=>{k(!0);let Fe=et.image_url;f&&(Fe=await Pe(f)||"");const Ke=new Date(et.event_date),[Le,ft]=et.event_time.split(":");Ke.setHours(parseInt(Le),parseInt(ft));const{error:Nt}=await ee.from("events").update({title:et.title,description:et.description||null,image_url:Fe||null,video_url:et.video_url||null,event_date:Ke.toISOString(),zoom_link:et.zoom_link,zoom_meeting_id:et.zoom_meeting_id||null,capacity:et.capacity?parseInt(et.capacity):null,is_published:et.is_published}).eq("id",Ce);if(Nt)throw Nt},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-events"]}),Ge.success("Event updated successfully"),s(!1),o(null),a(yL),m(null),v(null),k(!1)},onError:Ce=>{Ge.error("Failed to update event: "+Ce.message),k(!1)}}),ge=cr({mutationFn:async Ce=>{const{error:et}=await ee.from("events").delete().eq("id",Ce);if(et)throw et},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-events"]}),Ge.success("Event deleted successfully")},onError:Ce=>{Ge.error("Failed to delete event: "+Ce.message)}}),mt=Ce=>{var Fe;const et=new Date(Ce.event_date);o(Ce),a({title:Ce.title,description:Ce.description||"",image_url:Ce.image_url||"",video_url:Ce.video_url||"",event_date:et,event_time:un(et,"HH:mm"),zoom_link:Ce.zoom_link,zoom_meeting_id:Ce.zoom_meeting_id||"",capacity:((Fe=Ce.capacity)==null?void 0:Fe.toString())||"",is_published:Ce.is_published}),v(Ce.image_url||null),m(null),s(!0)},rt=Ce=>{if(Ce.preventDefault(),!c.event_date){Ge.error("Please select a date");return}i?Xe.mutate({id:i.id,data:c}):Te.mutate(c)},We=()=>{s(!1),o(null),a(yL),m(null),v(null)};return r.jsx("div",{className:"min-h-screen bg-background p-6",children:r.jsxs("div",{className:"max-w-6xl mx-auto",children:[r.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>t("/dashboard"),children:r.jsx(Va,{className:"h-5 w-5"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Event Management"}),r.jsx("p",{className:"text-muted-foreground",children:"Create and manage upcoming events"})]})]}),r.jsxs(Ye,{className:"mb-6",children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsx(Yt,{children:"All Events"}),r.jsxs($r,{open:n,onOpenChange:Ce=>!Ce&&We(),children:[r.jsx(Lo,{asChild:!0,children:r.jsxs(te,{onClick:()=>s(!0),children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Add Event"]})}),r.jsxs(zr,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsx(Zr,{children:r.jsx(Kr,{children:i?"Edit Event":"Create New Event"})}),r.jsxs("form",{onSubmit:rt,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"title",children:"Title *"}),r.jsx(yt,{id:"title",value:c.title,onChange:Ce=>a({...c,title:Ce.target.value}),placeholder:"Event title",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Description"}),r.jsx(Qy,{content:c.description,onChange:Ce=>a({...c,description:Ce}),placeholder:"Event description",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Event Image"}),r.jsx("input",{type:"file",ref:C,accept:"image/*",onChange:Ae,className:"hidden"}),y?r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:y,alt:"Event preview",className:"w-full h-32 object-cover rounded-lg border"}),r.jsx(te,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:nt,children:r.jsx(Ms,{className:"h-4 w-4"})})]}):r.jsxs(te,{type:"button",variant:"outline",className:"w-full h-32 border-dashed flex flex-col gap-2",onClick:()=>{var Ce;return(Ce=C.current)==null?void 0:Ce.click()},children:[r.jsx(Ao,{className:"h-6 w-6"}),r.jsx("span",{className:"text-sm",children:"Click to upload image"})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Date *"}),r.jsxs(Zh,{children:[r.jsx(Yh,{asChild:!0,children:r.jsxs(te,{variant:"outline",className:zt("w-full justify-start text-left font-normal",!c.event_date&&"text-muted-foreground"),children:[r.jsx(li,{className:"mr-2 h-4 w-4"}),c.event_date?un(c.event_date,"PPP"):"Pick a date"]})}),r.jsx(mh,{className:"w-auto p-0",align:"start",children:r.jsx(wj,{mode:"single",selected:c.event_date,onSelect:Ce=>a({...c,event_date:Ce}),initialFocus:!0,className:"p-3 pointer-events-auto"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"time",children:"Time *"}),r.jsx(yt,{id:"time",type:"time",value:c.event_time,onChange:Ce=>a({...c,event_time:Ce.target.value}),required:!0})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"zoom_link",children:"Zoom Link *"}),r.jsx(yt,{id:"zoom_link",value:c.zoom_link,onChange:Ce=>a({...c,zoom_link:Ce.target.value}),placeholder:"https://zoom.us/j/...",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"zoom_meeting_id",children:"Zoom Meeting ID (for API registration)"}),r.jsx(yt,{id:"zoom_meeting_id",value:c.zoom_meeting_id,onChange:Ce=>a({...c,zoom_meeting_id:Ce.target.value}),placeholder:"e.g., 1234567890 (find in Zoom dashboard)"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional: Enter the numeric meeting ID for automatic Zoom registration"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"video_url",children:"Promo Video URL (optional)"}),r.jsx(yt,{id:"video_url",value:c.video_url,onChange:Ce=>a({...c,video_url:Ce.target.value}),placeholder:"YouTube, Vimeo, or Bunny.net embed URL"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Add a preview/promo video for this event"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"capacity",children:"Capacity (optional)"}),r.jsx(yt,{id:"capacity",type:"number",value:c.capacity,onChange:Ce=>a({...c,capacity:Ce.target.value}),placeholder:"Leave empty for unlimited",min:"1"})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Qe,{htmlFor:"is_published",children:"Published"}),r.jsx(Zs,{id:"is_published",checked:c.is_published,onCheckedChange:Ce=>a({...c,is_published:Ce})})]}),r.jsxs("div",{className:"flex gap-2 pt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:We,className:"flex-1",children:"Cancel"}),r.jsx(te,{type:"submit",className:"flex-1",disabled:Te.isPending||Xe.isPending||w,children:w?"Uploading...":i?"Update Event":"Create Event"})]})]})]})]})]}),r.jsx(Je,{children:se?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading events..."}):(Ne==null?void 0:Ne.length)===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No events yet. Create your first event!"}):r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"Title"}),r.jsx(At,{children:"Date & Time"}),r.jsx(At,{children:"Registrations"}),r.jsx(At,{children:"Status"}),r.jsx(At,{className:"text-right",children:"Actions"})]})}),r.jsx(qs,{children:Ne==null?void 0:Ne.map(Ce=>r.jsxs(Er,{children:[r.jsx(_t,{className:"font-medium",children:Ce.title}),r.jsx(_t,{children:un(new Date(Ce.event_date),"PPP p")}),r.jsx(_t,{children:r.jsxs(te,{variant:"ghost",size:"sm",className:"gap-1",onClick:()=>Ie(Ce),children:[r.jsx(hs,{className:"h-4 w-4"}),(xe==null?void 0:xe[Ce.id])||0,Ce.capacity&&` / ${Ce.capacity}`]})}),r.jsx(_t,{children:r.jsx("span",{className:zt("px-2 py-1 rounded-full text-xs font-medium",Ce.is_published?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200"),children:Ce.is_published?"Published":"Draft"})}),r.jsx(_t,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>window.open(Ce.zoom_link,"_blank"),title:"Open Zoom Link",children:r.jsx(Fs,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>mt(Ce),children:r.jsx(ma,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>{confirm("Are you sure you want to delete this event?")&&ge.mutate(Ce.id)},children:r.jsx(Xn,{className:"h-4 w-4 text-destructive"})})]})})]},Ce.id))})]})})]}),r.jsx($r,{open:S,onOpenChange:T,children:r.jsxs(zr,{className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[r.jsxs(Zr,{children:[r.jsxs(Kr,{className:"flex items-center gap-2",children:[r.jsx(hs,{className:"h-5 w-5"}),I==null?void 0:I.title]}),r.jsx(ls,{children:"View registrations and attendees for this event"})]}),r.jsxs("div",{className:"flex items-center justify-end mb-4 gap-2 flex-wrap",children:[r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>ae.mutate({eventId:I.id,testMode:!0}),disabled:ae.isPending,children:[r.jsx(di,{className:zt("h-4 w-4 mr-2",ae.isPending&&"animate-spin")}),"Send Test to Me"]}),r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>ae.mutate({eventId:I.id}),disabled:ae.isPending||!(ie!=null&&ie.length),children:[r.jsx(di,{className:zt("h-4 w-4 mr-2",ae.isPending&&"animate-spin")}),ae.isPending?"Sending...":"Send Reminder to All"]}),(I==null?void 0:I.zoom_meeting_id)&&r.jsxs(r.Fragment,{children:[r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>Se.mutate(I.id),disabled:Se.isPending,children:[r.jsx(Dl,{className:zt("h-4 w-4 mr-2",Se.isPending&&"animate-spin")}),Se.isPending?"Syncing...":"Sync Registrations"]}),r.jsxs(te,{variant:"default",size:"sm",onClick:()=>oe.mutate(I.id),disabled:oe.isPending,children:[r.jsx(qa,{className:zt("h-4 w-4 mr-2",oe.isPending&&"animate-spin")}),oe.isPending?"Syncing...":"Sync Attendees & Award Points"]})]})]}),r.jsxs(La,{defaultValue:"registrations",className:"w-full",children:[r.jsxs(Ma,{className:"grid w-full grid-cols-2",children:[r.jsxs(yn,{value:"registrations",className:"gap-2",children:[r.jsx(hs,{className:"h-4 w-4"}),"Registrations (",(ie==null?void 0:ie.length)||0,")"]}),r.jsxs(yn,{value:"attendees",className:"gap-2",children:[r.jsx(io,{className:"h-4 w-4"}),"Attendees (",(fe==null?void 0:fe.length)||0,")"]})]}),r.jsx($n,{value:"registrations",className:"mt-4",children:me?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading registrations..."}):(ie==null?void 0:ie.length)===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx("p",{children:"No registrations yet for this event."}),(I==null?void 0:I.zoom_meeting_id)&&r.jsx("p",{className:"text-xs mt-2",children:'Click "Sync Registrations" to import from Zoom.'})]}):r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"Name"}),r.jsx(At,{children:"Email"}),r.jsx(At,{children:"Registered"}),r.jsx(At,{children:"Status"})]})}),r.jsx(qs,{children:ie==null?void 0:ie.map(Ce=>{var Le,ft;const et=((Le=Ce.profiles)==null?void 0:Le.name)||Ce.zoom_name||"Unknown",Fe=((ft=Ce.profiles)==null?void 0:ft.email)||Ce.zoom_email||null,Ke=!Ce.user_id;return r.jsxs(Er,{children:[r.jsx(_t,{className:"font-medium",children:r.jsxs("div",{className:"flex items-center gap-2",children:[et,Ke&&r.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:"External"})]})}),r.jsx(_t,{children:Fe?r.jsxs("a",{href:`mailto:${Fe}`,className:"flex items-center gap-1 text-primary hover:underline",children:[r.jsx(di,{className:"h-3 w-3"}),Fe]}):r.jsx("span",{className:"text-muted-foreground",children:"No email"})}),r.jsx(_t,{className:"text-muted-foreground text-sm",children:un(new Date(Ce.registered_at),"MMM d, yyyy h:mm a")}),r.jsx(_t,{children:Ce.zoom_join_url?r.jsx("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-1 rounded-full bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",children:"Registered"}):r.jsx("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-1 rounded-full bg-muted text-muted-foreground",children:"Pending"})})]},Ce.id)})})]})}),r.jsx($n,{value:"attendees",className:"mt-4",children:ve?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading attendees..."}):(fe==null?void 0:fe.length)===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx("p",{children:"No attendees recorded yet."}),(I==null?void 0:I.zoom_meeting_id)&&r.jsx("p",{className:"text-xs mt-2",children:'Click "Sync Attendees & Award Points" after the event ends to import actual participants from Zoom.'})]}):r.jsxs(r.Fragment,{children:[(fe==null?void 0:fe.filter(Ce=>!Ce.user_id).length)>0&&r.jsxs("div",{className:"mb-6 p-4 border border-amber-200 bg-amber-50 dark:border-amber-800 dark:bg-amber-950 rounded-lg",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx(Bl,{className:"h-4 w-4 text-amber-600 dark:text-amber-400"}),r.jsxs("h4",{className:"font-medium text-amber-800 dark:text-amber-200",children:["Unmatched Attendees (",fe==null?void 0:fe.filter(Ce=>!Ce.user_id).length,")"]})]}),r.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-300 mb-3",children:"These attendees couldn't be matched to a profile. Link them to award points."}),r.jsx("div",{className:"space-y-2",children:fe==null?void 0:fe.filter(Ce=>!Ce.user_id).map(Ce=>r.jsxs("div",{className:"flex items-center justify-between p-2 bg-background rounded border",children:[r.jsxs("div",{className:"flex flex-col",children:[r.jsx("span",{className:"font-medium text-sm",children:Ce.zoom_name||"Unknown"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:Ce.zoom_email||"No email"})]}),r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>Ue(Ce),className:"gap-1",children:[r.jsx(Rf,{className:"h-3 w-3"}),"Link to Profile"]})]},Ce.id))})]}),r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"Name"}),r.jsx(At,{children:"Email"}),r.jsx(At,{children:"Duration"}),r.jsx(At,{children:"Points"})]})}),r.jsx(qs,{children:fe==null?void 0:fe.filter(Ce=>Ce.user_id).map(Ce=>{var Ke,Le;const et=((Ke=Ce.profiles)==null?void 0:Ke.name)||Ce.zoom_name||"Unknown",Fe=((Le=Ce.profiles)==null?void 0:Le.email)||Ce.zoom_email||null;return r.jsxs(Er,{children:[r.jsx(_t,{className:"font-medium",children:r.jsxs("div",{className:"flex items-center gap-2",children:[et,Ce.manually_added&&r.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",children:"Manual"})]})}),r.jsx(_t,{children:Fe?r.jsxs("a",{href:`mailto:${Fe}`,className:"flex items-center gap-1 text-primary hover:underline",children:[r.jsx(di,{className:"h-3 w-3"}),Fe]}):r.jsx("span",{className:"text-muted-foreground",children:"No email"})}),r.jsx(_t,{children:Ce.duration_minutes?r.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-sm",children:[r.jsx(Xi,{className:"h-3 w-3"}),Ce.duration_minutes," min"]}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(_t,{children:Ce.points_awarded?r.jsxs("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-1 rounded-full bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",children:[r.jsx(qa,{className:"h-3 w-3"}),"+10 pts"]}):r.jsx("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-1 rounded-full bg-muted text-muted-foreground",children:"Pending"})})]},Ce.id)})})]})]})})]})]})}),r.jsx($r,{open:D,onOpenChange:$,children:r.jsxs(zr,{className:"max-w-md",children:[r.jsxs(Zr,{children:[r.jsxs(Kr,{className:"flex items-center gap-2",children:[r.jsx(Rf,{className:"h-5 w-5"}),"Link Attendee to Profile"]}),r.jsx(ls,{children:"Link this Zoom attendee to an existing member profile to award them points."})]}),F&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"p-3 bg-muted rounded-lg",children:[r.jsx("p",{className:"text-sm font-medium",children:F.zoom_name||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:F.zoom_email||"No email"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Search for a profile"}),r.jsxs("div",{className:"relative",children:[r.jsx(Ti,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(yt,{placeholder:"Search by name or email...",value:he,onChange:Ce=>ue(Ce.target.value),className:"pl-9"})]})]}),r.jsx("div",{className:"max-h-48 overflow-y-auto border rounded-md",children:$e.length===0?r.jsx("div",{className:"p-4 text-center text-sm text-muted-foreground",children:"No profiles found"}):r.jsx("div",{className:"divide-y",children:$e.slice(0,20).map(Ce=>r.jsxs("button",{type:"button",onClick:()=>K(Ce.id),className:zt("w-full p-3 text-left hover:bg-muted/50 transition-colors",W===Ce.id&&"bg-primary/10 border-l-2 border-primary"),children:[r.jsx("p",{className:"text-sm font-medium",children:Ce.name||"Unnamed"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:Ce.email})]},Ce.id))})}),F.zoom_email&&r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(_c,{id:"save-alias",checked:Z,onCheckedChange:Ce=>re(Ce)}),r.jsx("label",{htmlFor:"save-alias",className:"text-sm text-muted-foreground cursor-pointer",children:"Remember this email for future auto-matching"})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[r.jsx(te,{variant:"outline",onClick:()=>$(!1),children:"Cancel"}),r.jsx(te,{onClick:Re,disabled:!W||Me.isPending,children:Me.isPending?"Linking...":"Link & Award Points"})]})]})]})})]})})}const O2t=()=>{const{user:t}=Fr(),{toast:e}=la(),n=Xr(),[s,i]=Ed(),[o,c]=P.useState(!1),[a,f]=P.useState(null),[m,y]=P.useState({name:"",description:"",category_id:"",type_id:"",publish_date:new Date().toISOString().split("T")[0],links:[{title:"",canva_share_link:"",sort_order:0}],guides:[],video_url:""}),[v,w]=P.useState(null),[k,C]=P.useState(0),[S,T]=P.useState(!1),[I,A]=P.useState(null),[D,$]=P.useState(""),[F,q]=P.useState(""),[W,K]=P.useState(""),[Z,re]=P.useState(!1),[he,ue]=P.useState(!1),{data:Ne=[]}=rr({queryKey:["template-categories"],queryFn:async()=>{const{data:Xe,error:ge}=await ee.from("template_categories").select("*").order("name");if(ge)throw ge;return Xe}}),{data:se=[]}=rr({queryKey:["template-types"],queryFn:async()=>{const{data:Xe,error:ge}=await ee.from("template_types").select("*").order("name");if(ge)throw ge;return Xe}}),{data:xe=[],isLoading:ie}=rr({queryKey:["canva-templates-admin"],queryFn:async()=>{const{data:Xe,error:ge}=await ee.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).order("publish_date",{ascending:!1});if(ge)throw ge;const{data:mt,error:rt}=await ee.from("template_links").select("*").order("sort_order");if(rt)throw rt;const{data:We,error:Ce}=await ee.from("template_guides").select("*").order("sort_order");if(Ce)throw Ce;return Xe.map(Fe=>({...Fe,links:(mt==null?void 0:mt.filter(Ke=>Ke.template_id===Fe.id))||[],guides:(We==null?void 0:We.filter(Ke=>Ke.template_id===Fe.id))||[]}))}});P.useEffect(()=>{const Xe=s.get("edit");if(Xe&&xe.length>0){const ge=xe.find(mt=>mt.id===Xe);ge&&(oe(ge),i({},{replace:!0}))}},[xe,s]);const me=cr({mutationFn:async Xe=>{const{data:ge,error:mt}=await ee.from("template_categories").insert({name:Xe}).select().single();if(mt)throw mt;return ge},onSuccess:Xe=>{n.invalidateQueries({queryKey:["template-categories"]}),y({...m,category_id:Xe.id}),q(""),re(!1),e({title:"Category added"})},onError:Xe=>{e({title:"Error adding category",description:Xe.message,variant:"destructive"})}}),fe=cr({mutationFn:async Xe=>{const{data:ge,error:mt}=await ee.from("template_types").insert({name:Xe}).select().single();if(mt)throw mt;return ge},onSuccess:Xe=>{n.invalidateQueries({queryKey:["template-types"]}),y({...m,type_id:Xe.id}),K(""),ue(!1),e({title:"Type added"})},onError:Xe=>{e({title:"Error adding type",description:Xe.message,variant:"destructive"})}}),ve=cr({mutationFn:async Xe=>{var Ce;let ge=Xe.existingImageUrl;if(Xe.image){const et=Xe.image.name.split(".").pop(),Fe=`${Date.now()}-${Math.random().toString(36).substring(7)}.${et}`,{error:Ke}=await ee.storage.from("template-previews").upload(Fe,Xe.image);if(Ke)throw Ke;const{data:Le}=ee.storage.from("template-previews").getPublicUrl(Fe);ge=Le.publicUrl}const mt={name:Xe.template.name,description:Xe.template.description||null,category_id:Xe.template.category_id||null,type_id:Xe.template.type_id||null,preview_image_url:ge,video_url:Xe.videoUrl||null,publish_date:Xe.template.publish_date?new Date(Xe.template.publish_date).toISOString():new Date().toISOString(),created_by:t==null?void 0:t.id};let rt=Xe.templateId;if(rt){const{error:et}=await ee.from("canva_templates").update(mt).eq("id",rt);if(et)throw et;const{error:Fe}=await ee.from("template_links").delete().eq("template_id",rt);if(Fe)throw Fe;const Ke=((Ce=Xe.existingGuides)==null?void 0:Ce.map(Nt=>Nt.id).filter(Boolean))||[],Le=Xe.template.guides.map(Nt=>Nt.id).filter(Boolean),ft=Ke.filter(Nt=>!Le.includes(Nt));ft.length>0&&await ee.from("template_guides").delete().in("id",ft)}else{const{data:et,error:Fe}=await ee.from("canva_templates").insert(mt).select().single();if(Fe)throw Fe;rt=et.id,A2t(Xe.template.name,et.id)}const We=Xe.template.links.filter(et=>et.title.trim()&&et.canva_share_link.trim());if(We.length>0){const et=We.map((Ke,Le)=>({template_id:rt,title:Ke.title.trim(),canva_share_link:Ke.canva_share_link.trim(),sort_order:Le})),{error:Fe}=await ee.from("template_links").insert(et);if(Fe)throw Fe}for(let et=0;et{n.invalidateQueries({queryKey:["canva-templates-admin"]}),n.invalidateQueries({queryKey:["canva-templates"]}),Se(),c(!1),e({title:a?"Template updated":"Template created"})},onError:Xe=>{e({title:"Error saving template",description:Xe.message,variant:"destructive"})}}),Ie=cr({mutationFn:async Xe=>{const{error:ge}=await ee.from("canva_templates").delete().eq("id",Xe);if(ge)throw ge},onSuccess:()=>{n.invalidateQueries({queryKey:["canva-templates-admin"]}),n.invalidateQueries({queryKey:["canva-templates"]}),e({title:"Template deleted"})},onError:Xe=>{e({title:"Error deleting template",description:Xe.message,variant:"destructive"})}}),Se=()=>{y({name:"",description:"",category_id:"",type_id:"",publish_date:new Date().toISOString().split("T")[0],links:[{title:"",canva_share_link:"",sort_order:0}],guides:[],video_url:""}),A(null),$(""),f(null),re(!1),ue(!1),q(""),K(""),w(null),C(0),T(!1)},oe=Xe=>{var ge;f(Xe),y({name:Xe.name,description:Xe.description||"",category_id:Xe.category_id||"",type_id:Xe.type_id||"",publish_date:Xe.publish_date?new Date(Xe.publish_date).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],links:Xe.links&&Xe.links.length>0?Xe.links.map(mt=>({id:mt.id,title:mt.title,canva_share_link:mt.canva_share_link,sort_order:mt.sort_order})):[{title:"",canva_share_link:"",sort_order:0}],guides:((ge=Xe.guides)==null?void 0:ge.map(mt=>({id:mt.id,name:mt.name,file_url:mt.file_url,file_type:mt.file_type,file_size:mt.file_size,sort_order:mt.sort_order})))||[],video_url:Xe.video_url||""}),$(Xe.preview_image_url||""),w(null),c(!0)},ae=Xe=>{var mt;const ge=(mt=Xe.target.files)==null?void 0:mt[0];ge&&(A(ge),$(URL.createObjectURL(ge)))},je=()=>{y({...m,links:[...m.links,{title:"",canva_share_link:"",sort_order:m.links.length}]})},Me=Xe=>{if(m.links.length<=1)return;const ge=m.links.filter((mt,rt)=>rt!==Xe);y({...m,links:ge})},Ue=(Xe,ge,mt)=>{const rt=[...m.links];rt[Xe]={...rt[Xe],[ge]:mt},y({...m,links:rt})},Re=Xe=>{const ge=Xe.target.files;if(!ge)return;const mt=Array.from(ge).map((rt,We)=>({name:rt.name.replace(/\.[^/.]+$/,""),file_url:"",file_type:rt.type,file_size:rt.size,sort_order:m.guides.length+We,file:rt}));y({...m,guides:[...m.guides,...mt]}),Xe.target.value=""},$e=Xe=>{const ge=m.guides.filter((mt,rt)=>rt!==Xe);y({...m,guides:ge})},Pe=(Xe,ge)=>{const mt=[...m.guides];mt[Xe]={...mt[Xe],name:ge},y({...m,guides:mt})},Ae=async()=>{if(!v)return null;T(!0),C(0);try{const{data:Xe,error:ge}=await ee.functions.invoke("bunny-upload",{body:{action:"create",title:m.name||v.name}});if(ge)throw new Error(ge.message);const{videoId:mt,libraryId:rt}=Xe,{data:We,error:Ce}=await ee.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:mt}});if(Ce)throw new Error(Ce.message);const et=new XMLHttpRequest;return await new Promise((Ke,Le)=>{et.upload.addEventListener("progress",ft=>{if(ft.lengthComputable){const Nt=Math.round(ft.loaded/ft.total*100);C(Nt)}}),et.addEventListener("load",()=>{et.status>=200&&et.status<300?Ke():Le(new Error(`Upload failed with status ${et.status}`))}),et.addEventListener("error",()=>Le(new Error("Upload failed"))),et.open("PUT",We.uploadUrl),et.setRequestHeader("AccessKey",We.apiKey),et.send(v)}),`https://player.mediadelivery.net/embed/${rt}/${mt}`}catch(Xe){return console.error("Bunny upload error:",Xe),e({title:"Video upload failed",description:Xe instanceof Error?Xe.message:"Unknown error",variant:"destructive"}),null}finally{T(!1)}},nt=Xe=>{var mt;const ge=(mt=Xe.target.files)==null?void 0:mt[0];ge&&w(ge),Xe.target.value=""},Te=async Xe=>{if(Xe.preventDefault(),!m.name.trim()){e({title:"Please enter a template name",variant:"destructive"});return}if(m.links.filter(rt=>rt.title.trim()&&rt.canva_share_link.trim()).length===0){e({title:"Please add at least one Canva link",variant:"destructive"});return}let mt=m.video_url;if(v){const rt=await Ae();if(!rt)return;mt=rt}ve.mutate({template:m,image:I,existingImageUrl:(a==null?void 0:a.preview_image_url)||null,templateId:a==null?void 0:a.id,existingGuides:a==null?void 0:a.guides,videoUrl:mt})};return r.jsx(Or,{title:"Manage Templates",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ou,{title:"Manage Templates",description:"Create and manage Canva templates"}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsxs(Ye,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-muted-foreground",children:"Total Templates"})}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:xe.length})})]}),r.jsxs(Ye,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-muted-foreground",children:"Categories"})}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:Ne.length})})]}),r.jsxs(Ye,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-muted-foreground",children:"Template Types"})}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:se.length})})]})]}),r.jsxs($r,{open:o,onOpenChange:Xe=>{c(Xe),Xe||Se()},children:[r.jsx(Lo,{asChild:!0,children:r.jsxs(te,{className:"gap-2",children:[r.jsx(Sn,{className:"h-4 w-4"}),"Add Template"]})}),r.jsxs(zr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Zr,{children:r.jsx(Kr,{children:a?"Edit Template":"Add New Template"})}),r.jsxs("form",{onSubmit:Te,className:"space-y-6 pt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"name",children:"Name *"}),r.jsx(yt,{id:"name",value:m.name,onChange:Xe=>y({...m,name:Xe.target.value}),placeholder:"Template name",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Description"}),r.jsx(Qy,{content:m.description,onChange:Xe=>y({...m,description:Xe}),placeholder:"Brief description of the template",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Qe,{children:"Canva Links *"}),r.jsxs(te,{type:"button",variant:"outline",size:"sm",onClick:je,className:"gap-1",children:[r.jsx(Sn,{className:"h-3 w-3"}),"Add Link"]})]}),r.jsx("div",{className:"space-y-3",children:m.links.map((Xe,ge)=>r.jsxs("div",{className:"flex gap-2 items-start p-3 border rounded-lg bg-muted/30",children:[r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx(yt,{value:Xe.title,onChange:mt=>Ue(ge,"title",mt.target.value),placeholder:"Link title (e.g., Instagram Post, Story)"}),r.jsx(yt,{value:Xe.canva_share_link,onChange:mt=>Ue(ge,"canva_share_link",mt.target.value),placeholder:"https://www.canva.com/design/..."})]}),m.links.length>1&&r.jsx(te,{type:"button",variant:"ghost",size:"icon",className:"shrink-0 text-muted-foreground hover:text-destructive",onClick:()=>Me(ge),children:r.jsx(Ms,{className:"h-4 w-4"})})]},ge))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Category"}),Z?r.jsxs("div",{className:"flex gap-2",children:[r.jsx(yt,{value:F,onChange:Xe=>q(Xe.target.value),placeholder:"New category name",className:"flex-1"}),r.jsx(te,{type:"button",size:"sm",onClick:()=>F.trim()&&me.mutate(F.trim()),disabled:me.isPending,children:"Add"}),r.jsx(te,{type:"button",size:"sm",variant:"ghost",onClick:()=>{re(!1),q("")},children:r.jsx(Ms,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(_n,{value:m.category_id,onValueChange:Xe=>y({...m,category_id:Xe}),children:[r.jsx(xn,{className:"flex-1",children:r.jsx(bn,{placeholder:"Select category"})}),r.jsx(vn,{children:Ne.map(Xe=>r.jsx(er,{value:Xe.id,children:Xe.name},Xe.id))})]}),r.jsx(te,{type:"button",variant:"outline",size:"icon",onClick:()=>re(!0),children:r.jsx(Sn,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Template Type"}),he?r.jsxs("div",{className:"flex gap-2",children:[r.jsx(yt,{value:W,onChange:Xe=>K(Xe.target.value),placeholder:"New type name",className:"flex-1"}),r.jsx(te,{type:"button",size:"sm",onClick:()=>W.trim()&&fe.mutate(W.trim()),disabled:fe.isPending,children:"Add"}),r.jsx(te,{type:"button",size:"sm",variant:"ghost",onClick:()=>{ue(!1),K("")},children:r.jsx(Ms,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(_n,{value:m.type_id,onValueChange:Xe=>y({...m,type_id:Xe}),children:[r.jsx(xn,{className:"flex-1",children:r.jsx(bn,{placeholder:"Select type"})}),r.jsx(vn,{children:se.map(Xe=>r.jsx(er,{value:Xe.id,children:Xe.name},Xe.id))})]}),r.jsx(te,{type:"button",variant:"outline",size:"icon",onClick:()=>ue(!0),children:r.jsx(Sn,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(yt,{id:"publish_date",type:"date",value:m.publish_date,onChange:Xe=>y({...m,publish_date:Xe.target.value})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Templates are sorted by publish date (newest first) on the member page"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Preview Image"}),r.jsxs("div",{className:"flex items-start gap-4",children:[D?r.jsxs("div",{className:"relative w-32 h-24 rounded-lg overflow-hidden border bg-muted",children:[r.jsx("img",{src:D,alt:"Preview",className:"w-full h-full object-cover"}),r.jsx(te,{type:"button",size:"icon",variant:"destructive",className:"absolute top-1 right-1 h-6 w-6",onClick:()=>{A(null),$("")},children:r.jsx(Ms,{className:"h-3 w-3"})})]}):r.jsx("div",{className:"w-32 h-24 rounded-lg border-2 border-dashed border-muted-foreground/25 flex items-center justify-center",children:r.jsx(Wo,{className:"h-8 w-8 text-muted-foreground/50"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx(yt,{type:"file",accept:"image/*",onChange:ae,className:"cursor-pointer"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Upload a preview image for this template"})]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Qe,{children:"Video (Optional)"}),m.video_url&&!v?r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-muted/30",children:[r.jsx(Gi,{className:"h-5 w-5 text-primary shrink-0"}),r.jsx("span",{className:"text-sm flex-1 truncate",children:"Video uploaded"}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>y({...m,video_url:""}),className:"text-destructive hover:text-destructive",children:"Remove"})]}),r.jsx("div",{className:"aspect-video max-w-md rounded-lg overflow-hidden border",children:r.jsx("iframe",{src:m.video_url,className:"w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})]}):S?r.jsxs("div",{className:"space-y-2 p-4 border rounded-lg bg-muted/30",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(sn,{className:"h-4 w-4 animate-spin"}),r.jsxs("span",{className:"text-sm",children:["Uploading video... ",k,"%"]})]}),r.jsx(zc,{value:k,className:"h-2"})]}):v?r.jsxs("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-muted/30",children:[r.jsx(Gi,{className:"h-5 w-5 text-muted-foreground shrink-0"}),r.jsx("span",{className:"text-sm flex-1 truncate",children:v.name}),r.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[(v.size/1024/1024).toFixed(1)," MB"]}),r.jsx(te,{type:"button",variant:"ghost",size:"icon",className:"shrink-0 text-muted-foreground hover:text-destructive h-8 w-8",onClick:()=>w(null),children:r.jsx(Ms,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{className:"cursor-pointer",children:[r.jsx(yt,{type:"file",accept:"video/*",onChange:nt,className:"hidden"}),r.jsxs("div",{className:"flex items-center justify-center gap-2 p-6 border-2 border-dashed rounded-lg hover:border-primary/50 transition-colors",children:[r.jsx(Gi,{className:"h-8 w-8 text-muted-foreground/50"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Click to upload a video"})]})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Upload a video to embed on the template page (Bunny.net)"})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Qe,{children:"Guide Files (PDFs)"}),r.jsxs("label",{className:"cursor-pointer",children:[r.jsx(yt,{type:"file",accept:".pdf,.doc,.docx",multiple:!0,onChange:Re,className:"hidden"}),r.jsx(te,{type:"button",variant:"outline",size:"sm",className:"gap-1",asChild:!0,children:r.jsxs("span",{children:[r.jsx(Ao,{className:"h-3 w-3"}),"Add Files"]})})]})]}),m.guides.length>0?r.jsx("div",{className:"space-y-2",children:m.guides.map((Xe,ge)=>r.jsxs("div",{className:"flex gap-2 items-center p-3 border rounded-lg bg-muted/30",children:[r.jsx(Ai,{className:"h-5 w-5 text-muted-foreground shrink-0"}),r.jsx(yt,{value:Xe.name,onChange:mt=>Pe(ge,mt.target.value),placeholder:"Guide name",className:"flex-1"}),Xe.file_size&&r.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[(Xe.file_size/1024).toFixed(0)," KB"]}),r.jsx(te,{type:"button",variant:"ghost",size:"icon",className:"shrink-0 text-muted-foreground hover:text-destructive h-8 w-8",onClick:()=>$e(ge),children:r.jsx(Ms,{className:"h-4 w-4"})})]},Xe.id||ge))}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No guide files added. Upload PDFs to help agents understand how to use this template."})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>{c(!1),Se()},children:"Cancel"}),r.jsx(te,{type:"submit",disabled:ve.isPending,children:ve.isPending?"Saving...":a?"Update":"Create"})]})]})]})]})]}),r.jsx(Ye,{children:r.jsx(Je,{className:"p-0",children:ie?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading..."}):xe.length===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No templates yet. Add your first template!"}):r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"Preview"}),r.jsx(At,{children:"Name"}),r.jsx(At,{children:"Links"}),r.jsx(At,{children:"Category"}),r.jsx(At,{children:"Type"}),r.jsx(At,{children:"Publish Date"}),r.jsx(At,{className:"text-right",children:"Actions"})]})}),r.jsx(qs,{children:xe.map(Xe=>{var ge,mt,rt,We,Ce;return r.jsxs(Er,{children:[r.jsx(_t,{children:r.jsx("div",{className:"w-16 h-12 rounded overflow-hidden bg-muted",children:Xe.preview_image_url?r.jsx("img",{src:Xe.preview_image_url,alt:Xe.name,className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Wo,{className:"h-4 w-4 text-muted-foreground"})})})}),r.jsx(_t,{className:"font-medium",children:Xe.name}),r.jsx(_t,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsxs(Rt,{variant:"secondary",children:[((ge=Xe.links)==null?void 0:ge.length)||0," link",(((mt=Xe.links)==null?void 0:mt.length)||0)!==1?"s":""]}),(((rt=Xe.guides)==null?void 0:rt.length)||0)>0&&r.jsxs(Rt,{variant:"outline",className:"gap-1",children:[r.jsx(Ai,{className:"h-3 w-3"}),(We=Xe.guides)==null?void 0:We.length," guide",(((Ce=Xe.guides)==null?void 0:Ce.length)||0)!==1?"s":""]})]})}),r.jsx(_t,{children:Xe.category?r.jsx(Rt,{variant:"secondary",children:Xe.category.name}):r.jsx("span",{className:"text-muted-foreground",children:"-"})}),r.jsx(_t,{children:Xe.type?r.jsx(Rt,{variant:"outline",children:Xe.type.name}):r.jsx("span",{className:"text-muted-foreground",children:"-"})}),r.jsx(_t,{className:"text-muted-foreground",children:new Date(Xe.publish_date).toLocaleDateString()}),r.jsx(_t,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{size:"icon",variant:"ghost",onClick:()=>oe(Xe),children:r.jsx(ma,{className:"h-4 w-4"})}),r.jsx(te,{size:"icon",variant:"ghost",className:"text-destructive hover:text-destructive",onClick:()=>{confirm("Delete this template?")&&Ie.mutate(Xe.id)},children:r.jsx(Xn,{className:"h-4 w-4"})})]})})]},Xe.id)})})]})})})]})})},D2t=[{value:"bunny_stream",label:"Bunny.net Stream (Upload)"},{value:"youtube",label:"YouTube"},{value:"vimeo",label:"Vimeo"},{value:"google_drive",label:"Google Drive"},{value:"amazon_s3",label:"Amazon S3"},{value:"loom",label:"Loom"},{value:"other",label:"Other"}],R2t=()=>{const{user:t}=Fr(),{toast:e}=la(),n=Xr(),[s,i]=P.useState(!1),[o,c]=P.useState(null),[a,f]=P.useState({title:"",description:"",video_url:"",video_type:"youtube",duration:"",category_id:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),[m,y]=P.useState(null),[v,w]=P.useState(""),[k,C]=P.useState([]),[S,T]=P.useState([]),[I,A]=P.useState([]),[D,$]=P.useState(""),[F,q]=P.useState(!1),[W,K]=P.useState(null),[Z,re]=P.useState(0),[he,ue]=P.useState(!1),[Ne,se]=P.useState(null),{data:xe=[]}=rr({queryKey:["academy-categories"],queryFn:async()=>{const{data:Ae,error:nt}=await ee.from("academy_categories").select("*").order("sort_order",{ascending:!0});if(nt)throw nt;return Ae}}),{data:ie=[],isLoading:me}=rr({queryKey:["academy-videos-admin"],queryFn:async()=>{const{data:Ae,error:nt}=await ee.from("academy_videos").select(` *, category:academy_categories(id, name) `).order("publish_date",{ascending:!1});if(nt)throw nt;const{data:Te,error:Xe}=await ee.from("academy_resources").select("*").order("sort_order");if(Xe)throw Xe;return Ae.map(mt=>({...mt,resources:(Te==null?void 0:Te.filter(rt=>rt.video_id===mt.id))||[]}))}}),fe=cr({mutationFn:async Ae=>{const{data:nt,error:Te}=await ee.from("academy_categories").insert({name:Ae,sort_order:xe.length}).select().single();if(Te)throw Te;return nt},onSuccess:Ae=>{n.invalidateQueries({queryKey:["academy-categories"]}),f({...a,category_id:Ae.id}),$(""),q(!1),e({title:"Category added"})},onError:Ae=>{e({title:"Error adding category",description:Ae.message,variant:"destructive"})}}),ve=cr({mutationFn:async Ae=>{let nt=Ae.existingThumbnailUrl;if(Ae.thumbnail){const ge=Ae.thumbnail.name.split(".").pop(),mt=`thumbnails/${Date.now()}-${Math.random().toString(36).substring(7)}.${ge}`,{error:rt}=await ee.storage.from("academy-resources").upload(mt,Ae.thumbnail);if(rt)throw rt;const{data:We}=ee.storage.from("academy-resources").getPublicUrl(mt);nt=We.publicUrl}const Te={title:Ae.video.title,description:Ae.video.description||null,video_url:Ae.video.video_url,video_type:Ae.video.video_type,duration:Ae.video.duration||null,thumbnail_url:nt,category_id:Ae.video.category_id||null,publish_date:Ae.video.publish_date?new Date(Ae.video.publish_date).toISOString():new Date().toISOString(),is_published:Ae.video.is_published,created_by:t==null?void 0:t.id};let Xe=Ae.videoId;if(Xe){const{error:ge}=await ee.from("academy_videos").update(Te).eq("id",Xe);if(ge)throw ge}else{const{data:ge,error:mt}=await ee.from("academy_videos").insert(Te).select().single();if(mt)throw mt;Xe=ge.id,E2t(Ae.video.title,ge.id)}if(Ae.resourcesToDelete.length>0){const{error:ge}=await ee.from("academy_resources").delete().in("id",Ae.resourcesToDelete);if(ge)throw ge}for(let ge=0;ge{n.invalidateQueries({queryKey:["academy-videos-admin"]}),n.invalidateQueries({queryKey:["academy-videos"]}),oe(),i(!1),e({title:o?"Video updated":"Video created"})},onError:Ae=>{e({title:"Error saving video",description:Ae.message,variant:"destructive"})}}),Ie=cr({mutationFn:async Ae=>{const{error:nt}=await ee.from("academy_videos").delete().eq("id",Ae);if(nt)throw nt},onSuccess:()=>{n.invalidateQueries({queryKey:["academy-videos-admin"]}),n.invalidateQueries({queryKey:["academy-videos"]}),e({title:"Video deleted"})},onError:Ae=>{e({title:"Error deleting video",description:Ae.message,variant:"destructive"})}}),Se=cr({mutationFn:async({id:Ae,is_published:nt})=>{const{error:Te}=await ee.from("academy_videos").update({is_published:nt}).eq("id",Ae);if(Te)throw Te},onSuccess:()=>{n.invalidateQueries({queryKey:["academy-videos-admin"]}),n.invalidateQueries({queryKey:["academy-videos"]})},onError:Ae=>{e({title:"Error updating video",description:Ae.message,variant:"destructive"})}}),oe=()=>{f({title:"",description:"",video_url:"",video_type:"bunny_stream",duration:"",category_id:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),y(null),w(""),C([]),T([]),A([]),c(null),q(!1),$(""),K(null),re(0),ue(!1),se(null)},ae=Ae=>{c(Ae),f({title:Ae.title,description:Ae.description||"",video_url:Ae.video_url,video_type:Ae.video_type,duration:Ae.duration||"",category_id:Ae.category_id||"",publish_date:Ae.publish_date?new Date(Ae.publish_date).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],is_published:Ae.is_published}),w(Ae.thumbnail_url||""),T(Ae.resources||[]),C([]),A([]),i(!0)},je=Ae=>{var Te;const nt=(Te=Ae.target.files)==null?void 0:Te[0];nt&&(y(nt),w(URL.createObjectURL(nt)))},Me=Ae=>{const nt=Ae.target.files;if(nt){const Te=Array.from(nt).map(Xe=>({file:Xe,title:Xe.name.replace(/\.[^/.]+$/,"")}));C([...k,...Te])}Ae.target.value=""},Ue=Ae=>{C(k.filter((nt,Te)=>Te!==Ae))},Re=Ae=>{A([...I,Ae]),T(S.filter(nt=>nt.id!==Ae))},$e=async()=>{if(!W)return null;ue(!0),re(0);try{const{data:Ae,error:nt}=await ee.functions.invoke("bunny-upload",{body:{action:"create",title:a.title||W.name}});if(nt)throw new Error(nt.message);const{videoId:Te,libraryId:Xe}=Ae;se(Te);const{data:ge,error:mt}=await ee.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:Te}});if(mt)throw new Error(mt.message);const rt=new XMLHttpRequest;return await new Promise((Ce,et)=>{rt.upload.addEventListener("progress",Fe=>{if(Fe.lengthComputable){const Ke=Math.round(Fe.loaded/Fe.total*100);re(Ke)}}),rt.addEventListener("load",()=>{rt.status>=200&&rt.status<300?Ce():et(new Error(`Upload failed with status ${rt.status}`))}),rt.addEventListener("error",()=>et(new Error("Upload failed"))),rt.open("PUT",ge.uploadUrl),rt.setRequestHeader("AccessKey",ge.apiKey),rt.send(W)}),`https://player.mediadelivery.net/embed/${Xe}/${Te}`}catch(Ae){return console.error("Bunny upload error:",Ae),e({title:"Video upload failed",description:Ae instanceof Error?Ae.message:"Unknown error",variant:"destructive"}),null}finally{ue(!1)}},Pe=async Ae=>{if(Ae.preventDefault(),!a.title.trim()){e({title:"Please enter a video title",variant:"destructive"});return}let nt=a.video_url;if(a.video_type==="bunny_stream"&&W&&!o){const Te=await $e();if(!Te)return;nt=Te}else if(!a.video_url.trim()&&a.video_type!=="bunny_stream"){e({title:"Please enter a video URL",variant:"destructive"});return}else if(a.video_type==="bunny_stream"&&!W&&!a.video_url&&!o){e({title:"Please select a video file to upload",variant:"destructive"});return}ve.mutate({video:{...a,video_url:nt},thumbnail:m,existingThumbnailUrl:(o==null?void 0:o.thumbnail_url)||null,videoId:o==null?void 0:o.id,newResources:k,resourcesToDelete:I})};return r.jsx(Or,{title:"Manage Academy",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ou,{title:"Manage Academy",description:"Create and manage training videos and resources"}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs(Ye,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-muted-foreground",children:"Total Videos"})}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:ie.length})})]}),r.jsxs(Ye,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:ie.filter(Ae=>Ae.is_published).length})})]})]}),r.jsxs($r,{open:s,onOpenChange:Ae=>{i(Ae),Ae||oe()},children:[r.jsx(Lo,{asChild:!0,children:r.jsxs(te,{className:"gap-2",children:[r.jsx(Sn,{className:"h-4 w-4"}),"Add Video"]})}),r.jsxs(zr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Zr,{children:r.jsx(Kr,{children:o?"Edit Video":"Add New Video"})}),r.jsxs("form",{onSubmit:Pe,className:"space-y-6 pt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"title",children:"Title *"}),r.jsx(yt,{id:"title",value:a.title,onChange:Ae=>f({...a,title:Ae.target.value}),placeholder:"Video title",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Description"}),r.jsx(Qy,{content:a.description,onChange:Ae=>f({...a,description:Ae}),placeholder:"Brief description of the video",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Video Type"}),r.jsxs(_n,{value:a.video_type,onValueChange:Ae=>{f({...a,video_type:Ae,video_url:""}),K(null)},disabled:he,children:[r.jsx(xn,{children:r.jsx(bn,{})}),r.jsx(vn,{children:D2t.map(Ae=>r.jsx(er,{value:Ae.value,children:Ae.label},Ae.value))})]})]}),a.video_type==="bunny_stream"?r.jsxs("div",{className:"space-y-3",children:[r.jsxs(Qe,{children:["Upload Video File ",!o&&"*"]}),o&&a.video_url&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Current video: ",r.jsx("a",{href:a.video_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"View"})]}),!o&&r.jsxs(r.Fragment,{children:[r.jsx(yt,{type:"file",accept:"video/*",onChange:Ae=>{var Te;const nt=(Te=Ae.target.files)==null?void 0:Te[0];nt&&K(nt)},disabled:he}),W&&r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Gi,{className:"h-4 w-4"}),W.name," (",(W.size/(1024*1024)).toFixed(1)," MB)"]}),he&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(sn,{className:"h-4 w-4 animate-spin"}),r.jsx("span",{className:"text-sm",children:"Uploading to Bunny.net..."})]}),r.jsx(zc,{value:Z,className:"h-2"}),r.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[Z,"%"]})]})]})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"video_url",children:"Video URL *"}),r.jsx(yt,{id:"video_url",value:a.video_url,onChange:Ae=>f({...a,video_url:Ae.target.value}),placeholder:"https://...",required:!0})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"duration",children:"Duration"}),r.jsx(yt,{id:"duration",value:a.duration,onChange:Ae=>f({...a,duration:Ae.target.value}),placeholder:"e.g., 45:30"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(yt,{id:"publish_date",type:"date",value:a.publish_date,onChange:Ae=>f({...a,publish_date:Ae.target.value})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Category"}),F?r.jsxs("div",{className:"flex gap-2",children:[r.jsx(yt,{value:D,onChange:Ae=>$(Ae.target.value),placeholder:"New category name",className:"flex-1"}),r.jsx(te,{type:"button",size:"sm",onClick:()=>D.trim()&&fe.mutate(D.trim()),disabled:fe.isPending,children:"Add"}),r.jsx(te,{type:"button",size:"sm",variant:"ghost",onClick:()=>{q(!1),$("")},children:r.jsx(Ms,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(_n,{value:a.category_id,onValueChange:Ae=>f({...a,category_id:Ae}),children:[r.jsx(xn,{className:"flex-1",children:r.jsx(bn,{placeholder:"Select category"})}),r.jsx(vn,{children:xe.map(Ae=>r.jsx(er,{value:Ae.id,children:Ae.name},Ae.id))})]}),r.jsx(te,{type:"button",variant:"outline",size:"sm",onClick:()=>q(!0),children:r.jsx(Sn,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Thumbnail Image"}),r.jsxs("div",{className:"flex items-start gap-4",children:[v&&r.jsx("img",{src:v,alt:"Thumbnail preview",className:"w-32 h-20 object-cover rounded-md border"}),r.jsxs("div",{className:"flex-1",children:[r.jsx(yt,{type:"file",accept:"image/*",onChange:je,className:"cursor-pointer"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Recommended: 16:9 aspect ratio"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Qe,{children:"Resource Files"}),r.jsx(te,{type:"button",variant:"outline",size:"sm",asChild:!0,children:r.jsxs("label",{className:"cursor-pointer gap-1",children:[r.jsx(Ao,{className:"h-3 w-3"}),"Add Files",r.jsx("input",{type:"file",multiple:!0,accept:".pdf,.pptx,.ppt,.xlsx,.xls,.docx,.doc,.zip",onChange:Me,className:"hidden"})]})})]}),(S.length>0||k.length>0)&&r.jsxs("div",{className:"space-y-2 mt-2",children:[S.map(Ae=>r.jsxs("div",{className:"flex items-center gap-2 p-2 border rounded-md bg-muted/30",children:[r.jsx(Ai,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"flex-1 text-sm truncate",children:Ae.title}),r.jsx(Rt,{variant:"outline",className:"text-xs",children:Ae.file_type}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>Re(Ae.id),className:"text-destructive hover:text-destructive",children:r.jsx(Ms,{className:"h-4 w-4"})})]},Ae.id)),k.map((Ae,nt)=>r.jsxs("div",{className:"flex items-center gap-2 p-2 border rounded-md bg-muted/30",children:[r.jsx(Ai,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(yt,{value:Ae.title,onChange:Te=>{const Xe=[...k];Xe[nt].title=Te.target.value,C(Xe)},className:"flex-1 h-8",placeholder:"Resource title"}),r.jsx(Rt,{variant:"secondary",className:"text-xs",children:"New"}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>Ue(nt),className:"text-destructive hover:text-destructive",children:r.jsx(Ms,{className:"h-4 w-4"})})]},nt))]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Supported: PDF, PowerPoint, Excel, Word, ZIP"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Zs,{id:"is_published",checked:a.is_published,onCheckedChange:Ae=>f({...a,is_published:Ae})}),r.jsx(Qe,{htmlFor:"is_published",children:"Published"})]}),r.jsxs(ni,{children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>i(!1),disabled:he,children:"Cancel"}),r.jsx(te,{type:"submit",disabled:ve.isPending||he,children:he?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),"Uploading..."]}):ve.isPending?"Saving...":o?"Update Video":"Add Video"})]})]})]})]})]}),r.jsx(Ye,{children:r.jsx(Je,{className:"p-0",children:me?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):ie.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Gi,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No videos yet"}),r.jsx("p",{className:"text-sm",children:"Add your first academy video"})]}):r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"Title"}),r.jsx(At,{children:"Category"}),r.jsx(At,{children:"Duration"}),r.jsx(At,{children:"Resources"}),r.jsx(At,{children:"Publish Date"}),r.jsx(At,{children:"Status"}),r.jsx(At,{className:"w-[120px]",children:"Actions"})]})}),r.jsx(qs,{children:ie.map(Ae=>r.jsxs(Er,{children:[r.jsx(_t,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[Ae.thumbnail_url?r.jsx("img",{src:Ae.thumbnail_url,alt:"",className:"w-16 h-10 object-cover rounded"}):r.jsx("div",{className:"w-16 h-10 bg-muted rounded flex items-center justify-center",children:r.jsx(Gi,{className:"h-4 w-4 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:Ae.title}),r.jsx("p",{className:"text-xs text-muted-foreground capitalize",children:Ae.video_type.replace("_"," ")})]})]})}),r.jsx(_t,{children:Ae.category?r.jsx(Rt,{variant:"outline",children:Ae.category.name}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})}),r.jsx(_t,{children:Ae.duration||"-"}),r.jsx(_t,{children:Ae.resources&&Ae.resources.length>0?r.jsxs(Rt,{variant:"secondary",children:[Ae.resources.length," file(s)"]}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})}),r.jsx(_t,{children:new Date(Ae.publish_date).toLocaleDateString()}),r.jsx(_t,{children:r.jsx(Zs,{checked:Ae.is_published,onCheckedChange:nt=>Se.mutate({id:Ae.id,is_published:nt})})}),r.jsx(_t,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>ae(Ae),children:r.jsx(ma,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>Ie.mutate(Ae.id),className:"text-destructive hover:text-destructive",children:r.jsx(Xn,{className:"h-4 w-4"})})]})})]},Ae.id))})]})})})]})})};function F2t(){var Se,oe,ae;const t=Xr(),[e,n]=Ed(),[s,i]=P.useState(!1),[o,c]=P.useState(null),[a,f]=P.useState({name:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),[m,y]=P.useState(null),[v,w]=P.useState(""),[k,C]=P.useState([]),[S,T]=P.useState([]),[I,A]=P.useState(null),{data:D,isLoading:$}=rr({queryKey:["resource-kits"],queryFn:async()=>{const{data:je,error:Me}=await ee.from("resource_kits").select("*").order("publish_date",{ascending:!1});if(Me)throw Me;return je}}),{data:F}=rr({queryKey:["resource-kit-files"],queryFn:async()=>{const{data:je,error:Me}=await ee.from("resource_kit_files").select("*").order("sort_order",{ascending:!0});if(Me)throw Me;return je}}),{data:q}=rr({queryKey:["resource-kit-links"],queryFn:async()=>{const{data:je,error:Me}=await ee.from("resource_kit_links").select("*").order("sort_order",{ascending:!0});if(Me)throw Me;return je}});P.useEffect(()=>{const je=e.get("edit");if(je&&D&&D.length>0&&F&&q){const Me=D.find(Ue=>Ue.id===je);Me&&(K(Me),n({},{replace:!0}))}},[D,F,q,e]);const W=()=>{f({name:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),y(null),w(""),C([]),T([]),c(null)},K=je=>{c(je),f({name:je.name,description:je.description||"",publish_date:je.publish_date.split("T")[0],is_published:je.is_published}),w(je.featured_image_url||"");const Me=(F==null?void 0:F.filter(Re=>Re.kit_id===je.id))||[];C(Me.map(Re=>({id:Re.id,name:Re.name,file_url:Re.file_url,file_type:Re.file_type,file_size:Re.file_size,sort_order:Re.sort_order})));const Ue=(q==null?void 0:q.filter(Re=>Re.kit_id===je.id))||[];T(Ue.map(Re=>({id:Re.id,title:Re.title,canva_share_link:Re.canva_share_link,sort_order:Re.sort_order}))),i(!0)},Z=je=>{var Ue;const Me=(Ue=je.target.files)==null?void 0:Ue[0];Me&&(y(Me),w(URL.createObjectURL(Me)))},re=()=>{C([...k,{name:"",file_url:"",sort_order:k.length}])},he=je=>{C(k.filter((Me,Ue)=>Ue!==je))},ue=(je,Me,Ue)=>{const Re=[...k];Re[je]={...Re[je],[Me]:Ue},C(Re)},Ne=()=>{T([...S,{title:"",canva_share_link:"",sort_order:S.length}])},se=je=>{T(S.filter((Me,Ue)=>Ue!==je))},xe=(je,Me,Ue)=>{const Re=[...S];Re[je]={...Re[je],[Me]:Ue},T(Re)},ie=(je,Me)=>{var Re;const Ue=(Re=Me.target.files)==null?void 0:Re[0];if(Ue){const $e=[...k],Pe=Ue.name.replace(/\.[^/.]+$/,"");$e[je]={...$e[je],file:Ue,file_type:Ue.type,file_size:Ue.size,name:$e[je].name||Pe},C($e)}},me=cr({mutationFn:async()=>{let je=(o==null?void 0:o.featured_image_url)||null;if(m){const Pe=m.name.split(".").pop(),Ae=`${Date.now()}.${Pe}`,{error:nt}=await ee.storage.from("resource-kits").upload(`featured/${Ae}`,m);if(nt)throw nt;const{data:Te}=ee.storage.from("resource-kits").getPublicUrl(`featured/${Ae}`);je=Te.publicUrl}const Me={name:a.name,description:a.description||null,featured_image_url:je,publish_date:a.publish_date,is_published:a.is_published};let Ue;const Re=!o,$e=(o==null?void 0:o.is_published)||!1;if(o){const{error:Pe}=await ee.from("resource_kits").update(Me).eq("id",o.id);if(Pe)throw Pe;Ue=o.id;const Ae=(F==null?void 0:F.filter(rt=>rt.kit_id===o.id).map(rt=>rt.id))||[],nt=k.filter(rt=>rt.id).map(rt=>rt.id),Te=Ae.filter(rt=>!nt.includes(rt));Te.length>0&&await ee.from("resource_kit_files").delete().in("id",Te);const Xe=(q==null?void 0:q.filter(rt=>rt.kit_id===o.id).map(rt=>rt.id))||[],ge=S.filter(rt=>rt.id).map(rt=>rt.id),mt=Xe.filter(rt=>!ge.includes(rt));mt.length>0&&await ee.from("resource_kit_links").delete().in("id",mt)}else{const{data:Pe,error:Ae}=await ee.from("resource_kits").insert(Me).select().single();if(Ae)throw Ae;Ue=Pe.id}for(let Pe=0;Pe{t.invalidateQueries({queryKey:["resource-kits"]}),t.invalidateQueries({queryKey:["resource-kit-files"]}),t.invalidateQueries({queryKey:["resource-kit-links"]}),Ge.success(o?"Resource kit updated":"Resource kit created"),je.isPublished&&(je.isNewKit||!je.wasPublished)&&P2t(je.kitName,je.kitId),i(!1),W()},onError:je=>{Ge.error("Failed to save resource kit: "+je.message)}}),fe=cr({mutationFn:async je=>{const{error:Me}=await ee.from("resource_kits").delete().eq("id",je);if(Me)throw Me},onSuccess:()=>{t.invalidateQueries({queryKey:["resource-kits"]}),t.invalidateQueries({queryKey:["resource-kit-files"]}),Ge.success("Resource kit deleted")},onError:je=>{Ge.error("Failed to delete: "+je.message)}}),ve=je=>{if(je.preventDefault(),!a.name){Ge.error("Please enter a name");return}me.mutate()},Ie=je=>(F==null?void 0:F.filter(Me=>Me.kit_id===je).length)||0;return r.jsx(Or,{title:"Toolbox Management",description:"Create and manage resource kits for agents",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs(Ye,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-muted-foreground",children:"Total Kits"})}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:(D==null?void 0:D.length)||0})})]}),r.jsxs(Ye,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:(D==null?void 0:D.filter(je=>je.is_published).length)||0})})]})]}),r.jsxs(te,{onClick:()=>{W(),i(!0)},children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Add Resource Kit"]})]}),r.jsx(Ye,{children:r.jsx(Je,{className:"p-0",children:r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"Name"}),r.jsx(At,{children:"Files"}),r.jsx(At,{children:"Publish Date"}),r.jsx(At,{children:"Status"}),r.jsx(At,{className:"text-right",children:"Actions"})]})}),r.jsx(qs,{children:$?r.jsx(Er,{children:r.jsx(_t,{colSpan:5,className:"text-center py-8",children:"Loading..."})}):(D==null?void 0:D.length)===0?r.jsx(Er,{children:r.jsx(_t,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No resource kits yet. Create your first one!"})}):D==null?void 0:D.map(je=>r.jsxs(Er,{children:[r.jsx(_t,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[je.featured_image_url?r.jsx("img",{src:je.featured_image_url,alt:je.name,className:"w-10 h-10 rounded object-cover"}):r.jsx("div",{className:"w-10 h-10 rounded bg-muted flex items-center justify-center",children:r.jsx(Tl,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:je.name}),je.description&&r.jsx("div",{className:"text-sm text-muted-foreground line-clamp-1",children:je.description})]})]})}),r.jsx(_t,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Ai,{className:"h-4 w-4 text-muted-foreground"}),Ie(je.id)]})}),r.jsx(_t,{children:un(new Date(je.publish_date),"MMM d, yyyy")}),r.jsx(_t,{children:r.jsx("span",{className:`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${je.is_published?"bg-green-100 text-green-800":"bg-yellow-100 text-yellow-800"}`,children:je.is_published?"Published":"Draft"})}),r.jsx(_t,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>{const Me=(F==null?void 0:F.filter(Re=>Re.kit_id===je.id))||[],Ue=(q==null?void 0:q.filter(Re=>Re.kit_id===je.id))||[];A({...je,files:Me,links:Ue})},children:r.jsx(Ml,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>K(je),children:r.jsx(ma,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>{confirm("Delete this resource kit?")&&fe.mutate(je.id)},children:r.jsx(Xn,{className:"h-4 w-4 text-destructive"})})]})})]},je.id))})]})})}),r.jsx($r,{open:s,onOpenChange:i,children:r.jsxs(zr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Zr,{children:r.jsx(Kr,{children:o?"Edit Resource Kit":"Add Resource Kit"})}),r.jsxs("form",{onSubmit:ve,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Featured Image"}),r.jsxs("div",{className:"flex items-center gap-4",children:[v?r.jsx("img",{src:v,alt:"Preview",className:"w-24 h-24 rounded object-cover"}):r.jsx("div",{className:"w-24 h-24 rounded bg-muted flex items-center justify-center",children:r.jsx(Tl,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx(yt,{type:"file",accept:"image/*",onChange:Z})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"name",children:"Name *"}),r.jsx(yt,{id:"name",value:a.name,onChange:je=>f({...a,name:je.target.value}),placeholder:"Resource Kit Name"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Description"}),r.jsx(Qy,{content:a.description,onChange:je=>f({...a,description:je}),placeholder:"Brief description of this resource kit",minHeight:"120px"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(yt,{id:"publish_date",type:"date",value:a.publish_date,onChange:je=>f({...a,publish_date:je.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Published"}),r.jsxs("div",{className:"flex items-center space-x-2 pt-2",children:[r.jsx(Zs,{checked:a.is_published,onCheckedChange:je=>f({...a,is_published:je})}),r.jsx("span",{className:"text-sm text-muted-foreground",children:a.is_published?"Visible to agents":"Hidden from agents"})]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(Qe,{children:"Resource Files"}),r.jsxs(te,{type:"button",variant:"outline",size:"sm",onClick:re,children:[r.jsx(Sn,{className:"h-4 w-4 mr-1"}),"Add File"]})]}),k.length===0?r.jsx("div",{className:"text-sm text-muted-foreground py-4 text-center border rounded-md border-dashed",children:'No files added yet. Click "Add File" to include resources.'}):r.jsx("div",{className:"space-y-3",children:k.map((je,Me)=>r.jsxs("div",{className:"border rounded-md p-3 space-y-2",children:[r.jsxs("div",{className:"flex justify-between items-start",children:[r.jsxs("span",{className:"text-sm font-medium",children:["File ",Me+1]}),r.jsx(te,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>he(Me),children:r.jsx(Ms,{className:"h-4 w-4"})})]}),r.jsx(yt,{placeholder:"File name (e.g., Getting Started Guide)",value:je.name,onChange:Ue=>ue(Me,"name",Ue.target.value)}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(yt,{type:"file",onChange:Ue=>ie(Me,Ue),className:"flex-1"}),je.file_url&&!je.file&&r.jsx("a",{href:je.file_url,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary hover:underline whitespace-nowrap",children:"Current file"}),je.file&&r.jsx("span",{className:"text-sm text-green-600 whitespace-nowrap",children:"New file selected"})]})]},Me))})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(Qe,{children:"Canva Links"}),r.jsxs(te,{type:"button",variant:"outline",size:"sm",onClick:Ne,children:[r.jsx(Sn,{className:"h-4 w-4 mr-1"}),"Add Canva Link"]})]}),S.length===0?r.jsx("div",{className:"text-sm text-muted-foreground py-4 text-center border rounded-md border-dashed",children:'No Canva links added yet. Click "Add Canva Link" to include templates.'}):r.jsx("div",{className:"space-y-3",children:S.map((je,Me)=>r.jsxs("div",{className:"border rounded-md p-3 space-y-2",children:[r.jsxs("div",{className:"flex justify-between items-start",children:[r.jsxs("span",{className:"text-sm font-medium",children:["Canva Link ",Me+1]}),r.jsx(te,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>se(Me),children:r.jsx(Ms,{className:"h-4 w-4"})})]}),r.jsx(yt,{placeholder:"Link title (e.g., Social Media Post Template)",value:je.title,onChange:Ue=>xe(Me,"title",Ue.target.value)}),r.jsx(yt,{placeholder:"Canva share link (e.g., https://www.canva.com/design/...)",value:je.canva_share_link,onChange:Ue=>xe(Me,"canva_share_link",Ue.target.value)})]},Me))})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(te,{type:"submit",disabled:me.isPending,children:me.isPending?"Saving...":o?"Update":"Create"})]})]})]})}),r.jsx($r,{open:!!I,onOpenChange:()=>A(null),children:r.jsxs(zr,{className:"max-w-lg",children:[r.jsx(Zr,{children:r.jsx(Kr,{children:I==null?void 0:I.name})}),r.jsxs("div",{className:"space-y-4",children:[(I==null?void 0:I.featured_image_url)&&r.jsx("img",{src:I.featured_image_url,alt:I.name,className:"w-full h-48 object-cover rounded-lg"}),(I==null?void 0:I.description)&&r.jsx("p",{className:"text-muted-foreground",children:I.description}),r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2",children:["Resource Files (",((Se=I==null?void 0:I.files)==null?void 0:Se.length)||0,")"]}),((oe=I==null?void 0:I.files)==null?void 0:oe.length)===0?r.jsx("p",{className:"text-sm text-muted-foreground",children:"No files in this kit"}):r.jsx("div",{className:"space-y-2",children:(ae=I==null?void 0:I.files)==null?void 0:ae.map(je=>r.jsxs("a",{href:je.file_url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-2 rounded-md hover:bg-muted transition-colors",children:[r.jsx(Ai,{className:"h-4 w-4 text-primary"}),r.jsx("span",{className:"text-sm",children:je.name})]},je.id))})]}),(I==null?void 0:I.links)&&I.links.length>0&&r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2",children:["Canva Links (",I.links.length,")"]}),r.jsx("div",{className:"space-y-2",children:I.links.map(je=>r.jsxs("a",{href:je.canva_share_link,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-2 rounded-md hover:bg-muted transition-colors",children:[r.jsx(bo,{className:"h-4 w-4 text-primary"}),r.jsx("span",{className:"text-sm",children:je.title})]},je.id))})]})]})]})})]})})}const z2t=()=>{const{user:t}=Fr(),{toast:e}=la(),n=Xr(),[s,i]=P.useState(!1),[o,c]=P.useState(null),[a,f]=P.useState({title:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1,links:[{title:"",canva_share_link:"",sort_order:0}]}),[m,y]=P.useState(null),[v,w]=P.useState(""),{data:k=[],isLoading:C}=rr({queryKey:["social-swag-admin"],queryFn:async()=>{const{data:K,error:Z}=await ee.from("social_swag").select("*").order("publish_date",{ascending:!1});if(Z)throw Z;const{data:re,error:he}=await ee.from("social_swag_links").select("*").order("sort_order");if(he)throw he;return K.map(Ne=>({...Ne,links:(re==null?void 0:re.filter(se=>se.swag_id===Ne.id))||[]}))}}),S=cr({mutationFn:async K=>{let Z=K.existingImageUrl;if(K.image){const xe=K.image.name.split(".").pop(),ie=`${Date.now()}-${Math.random().toString(36).substring(7)}.${xe}`,{error:me}=await ee.storage.from("template-previews").upload(ie,K.image);if(me)throw me;const{data:fe}=ee.storage.from("template-previews").getPublicUrl(ie);Z=fe.publicUrl}const re={title:K.item.title,description:K.item.description||null,preview_image_url:Z,publish_date:K.item.publish_date?new Date(K.item.publish_date).toISOString():new Date().toISOString(),is_published:K.item.is_published,created_by:t==null?void 0:t.id};let he=K.itemId;const ue=!he,Ne=(o==null?void 0:o.is_published)||!1;if(he){const{error:xe}=await ee.from("social_swag").update(re).eq("id",he);if(xe)throw xe;await ee.from("social_swag_links").delete().eq("swag_id",he)}else{const{data:xe,error:ie}=await ee.from("social_swag").insert(re).select().single();if(ie)throw ie;he=xe.id}const se=K.item.links.filter(xe=>xe.title.trim()&&xe.canva_share_link.trim());if(se.length>0){const xe=se.map((me,fe)=>({swag_id:he,title:me.title.trim(),canva_share_link:me.canva_share_link.trim(),sort_order:fe})),{error:ie}=await ee.from("social_swag_links").insert(xe);if(ie)throw ie}return{itemId:he,itemTitle:K.item.title,isNewItem:ue,wasPublished:Ne,isPublished:K.item.is_published}},onSuccess:K=>{n.invalidateQueries({queryKey:["social-swag-admin"]}),n.invalidateQueries({queryKey:["social-swag"]}),e({title:o?"Item updated":"Item created"}),K.isPublished&&(K.isNewItem||!K.wasPublished)&&Yhe(K.itemTitle,K.itemId),i(!1),I()},onError:K=>{e({title:"Error saving item",description:K.message,variant:"destructive"})}}),T=cr({mutationFn:async K=>{const{error:Z}=await ee.from("social_swag").delete().eq("id",K);if(Z)throw Z},onSuccess:()=>{n.invalidateQueries({queryKey:["social-swag-admin"]}),n.invalidateQueries({queryKey:["social-swag"]}),e({title:"Item deleted"})},onError:K=>{e({title:"Error deleting item",description:K.message,variant:"destructive"})}}),I=()=>{f({title:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1,links:[{title:"",canva_share_link:"",sort_order:0}]}),y(null),w(""),c(null)},A=K=>{c(K),f({title:K.title,description:K.description||"",publish_date:K.publish_date?new Date(K.publish_date).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],is_published:K.is_published,links:K.links&&K.links.length>0?K.links.map(Z=>({id:Z.id,title:Z.title,canva_share_link:Z.canva_share_link,sort_order:Z.sort_order})):[{title:"",canva_share_link:"",sort_order:0}]}),w(K.preview_image_url||""),i(!0)},D=K=>{var re;const Z=(re=K.target.files)==null?void 0:re[0];Z&&(y(Z),w(URL.createObjectURL(Z)))},$=()=>{f({...a,links:[...a.links,{title:"",canva_share_link:"",sort_order:a.links.length}]})},F=K=>{if(a.links.length<=1)return;const Z=a.links.filter((re,he)=>he!==K);f({...a,links:Z})},q=(K,Z,re)=>{const he=[...a.links];he[K]={...he[K],[Z]:re},f({...a,links:he})},W=K=>{if(K.preventDefault(),!a.title.trim()){e({title:"Title is required",variant:"destructive"});return}S.mutate({item:a,image:m,existingImageUrl:(o==null?void 0:o.preview_image_url)||null,itemId:o==null?void 0:o.id})};return r.jsx(Or,{title:"Manage Social Swag",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ou,{title:"Manage Social Swag",description:"Create and manage social media content"}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs(Ye,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-muted-foreground",children:"Total Items"})}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:k.length})})]}),r.jsxs(Ye,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:k.filter(K=>K.is_published).length})})]})]}),r.jsxs($r,{open:s,onOpenChange:K=>{i(K),K||I()},children:[r.jsx(Lo,{asChild:!0,children:r.jsxs(te,{className:"gap-2",children:[r.jsx(Sn,{className:"h-4 w-4"}),"Add Item"]})}),r.jsxs(zr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Zr,{children:r.jsx(Kr,{children:o?"Edit Item":"Add New Item"})}),r.jsxs("form",{onSubmit:W,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"title",children:"Title *"}),r.jsx(yt,{id:"title",value:a.title,onChange:K=>f({...a,title:K.target.value}),placeholder:"Enter title"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Description"}),r.jsx(Qy,{content:a.description,onChange:K=>f({...a,description:K}),placeholder:"Enter description",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(yt,{id:"publish_date",type:"date",value:a.publish_date,onChange:K=>f({...a,publish_date:K.target.value})})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Zs,{id:"is_published",checked:a.is_published,onCheckedChange:K=>f({...a,is_published:K})}),r.jsx(Qe,{htmlFor:"is_published",children:"Published"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Preview Image"}),v?r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:v,alt:"Preview",className:"w-full max-h-48 object-contain rounded-lg border"}),r.jsx(te,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:()=>{y(null),w("")},children:r.jsx(Ms,{className:"h-3 w-3"})})]}):r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-4 text-center",children:[r.jsx(Wo,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx(yt,{type:"file",accept:"image/*",onChange:D,className:"cursor-pointer"})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Qe,{children:"Canva Links"}),r.jsxs(te,{type:"button",variant:"outline",size:"sm",onClick:$,children:[r.jsx(Sn,{className:"h-3 w-3 mr-1"}),"Add Link"]})]}),a.links.map((K,Z)=>r.jsx(Ye,{children:r.jsxs(Je,{className:"pt-4 pb-4 space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["Link ",Z+1]}),a.links.length>1&&r.jsx(te,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>F(Z),children:r.jsx(Ms,{className:"h-3 w-3"})})]}),r.jsx(yt,{placeholder:"Link title (e.g., Instagram Post)",value:K.title,onChange:re=>q(Z,"title",re.target.value)}),r.jsx(yt,{placeholder:"Canva share link",value:K.canva_share_link,onChange:re=>q(Z,"canva_share_link",re.target.value)})]})},Z))]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(te,{type:"submit",disabled:S.isPending,children:S.isPending?"Saving...":o?"Update":"Create"})]})]})]})]})]}),r.jsx(Ye,{children:r.jsx(Je,{className:"p-0",children:C?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):k.length===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'No items yet. Click "Add Item" to create your first one.'}):r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{className:"w-16",children:"Preview"}),r.jsx(At,{children:"Title"}),r.jsx(At,{children:"Links"}),r.jsx(At,{children:"Publish Date"}),r.jsx(At,{children:"Status"}),r.jsx(At,{className:"text-right",children:"Actions"})]})}),r.jsx(qs,{children:k.map(K=>{var Z;return r.jsxs(Er,{children:[r.jsx(_t,{children:K.preview_image_url?r.jsx("img",{src:K.preview_image_url,alt:"",className:"w-12 h-12 object-cover rounded"}):r.jsx("div",{className:"w-12 h-12 bg-muted rounded flex items-center justify-center",children:r.jsx(Wo,{className:"h-4 w-4 text-muted-foreground"})})}),r.jsx(_t,{className:"font-medium",children:K.title}),r.jsxs(_t,{children:[((Z=K.links)==null?void 0:Z.length)||0," links"]}),r.jsx(_t,{children:new Date(K.publish_date).toLocaleDateString()}),r.jsx(_t,{children:r.jsx(Rt,{variant:K.is_published?"default":"secondary",children:K.is_published?"Published":"Draft"})}),r.jsx(_t,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>window.open(`/social-swag/${K.id}`,"_blank"),children:r.jsx(Ml,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>A(K),children:r.jsx(ma,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>{confirm("Are you sure you want to delete this item?")&&T.mutate(K.id)},children:r.jsx(Xn,{className:"h-4 w-4"})})]})})]},K.id)})})]})})})]})})},B2t=()=>{const t=Xr(),[e,n]=P.useState("all"),[s,i]=P.useState(!1),[o,c]=P.useState(un(new Date,"yyyy-MM")),[a,f]=P.useState([]),[m,y]=P.useState(!1),[v,w]=P.useState(null),[k,C]=P.useState(!1),[S,T]=P.useState(un(new Date,"yyyy-MM")),[I,A]=P.useState(null),[D,$]=P.useState(""),[F,q]=P.useState(""),[W,K]=P.useState(""),[Z,re]=P.useState(!1),{data:he=[],isLoading:ue}=rr({queryKey:["admin-social-swag-2"],queryFn:async()=>{const{data:Ae,error:nt}=await ee.from("social_swag_2").select("*").order("month",{ascending:!1}).order("sort_order");if(nt)throw nt;return Ae}}),{data:Ne=[]}=rr({queryKey:["admin-social-swag-2-months"],queryFn:async()=>{const{data:Ae,error:nt}=await ee.from("social_swag_2_months").select("*").order("month",{ascending:!1});if(nt)throw nt;return Ae}}),{data:se=[]}=rr({queryKey:["admin-social-swag-2-reels"],queryFn:async()=>{const{data:Ae,error:nt}=await ee.from("social_swag_2_reels").select("*").order("month",{ascending:!1});if(nt)throw nt;return Ae}}),xe=[...new Set(he.map(Ae=>Ae.month))].sort((Ae,nt)=>nt.localeCompare(Ae)),ie=e==="all"?he:he.filter(Ae=>Ae.month===e),me=Ae=>{const nt=Yge(Ae,"yyyy-MM",new Date);return un(nt,"MMMM yyyy")},fe=Ae=>{const Te=Array.from(Ae.target.files||[]).slice(0,16-a.length).map(Xe=>({file:Xe,preview:URL.createObjectURL(Xe),caption:""}));f(Xe=>[...Xe,...Te].slice(0,16))},ve=Ae=>{f(nt=>{const Te=[...nt];return URL.revokeObjectURL(Te[Ae].preview),Te.splice(Ae,1),Te})},Ie=(Ae,nt)=>{f(Te=>{const Xe=[...Te];return Xe[Ae]={...Xe[Ae],caption:nt},Xe})},Se=async()=>{if(a.length===0){Ge.error("Please add at least one image");return}if(a.filter(nt=>!nt.caption.trim()).length>0){Ge.error("Please add captions to all images");return}y(!0);try{for(let nt=0;nt{const nt=Ae.image_url.split("/social-swag-2/");nt[1]&&await ee.storage.from("social-swag-2").remove([nt[1]]);const{error:Te}=await ee.from("social_swag_2").delete().eq("id",Ae.id);if(Te)throw Te},onSuccess:()=>{Ge.success("Image deleted"),t.invalidateQueries({queryKey:["admin-social-swag-2"]})},onError:()=>{Ge.error("Failed to delete image")}}),ae=cr({mutationFn:async({month:Ae,link:nt})=>{const{error:Te}=await ee.from("social_swag_2_months").upsert({month:Ae,canva_link:nt||null},{onConflict:"month"});if(Te)throw Te},onSuccess:()=>{Ge.success("Canva link updated"),w(null),t.invalidateQueries({queryKey:["admin-social-swag-2-months"]})},onError:()=>{Ge.error("Failed to update Canva link")}}),je=Ae=>{var nt;return((nt=Ne.find(Te=>Te.month===Ae))==null?void 0:nt.canva_link)||""},Me=Ae=>se.find(nt=>nt.month===Ae)||null,Ue=Ae=>{var Te;const nt=(Te=Ae.target.files)==null?void 0:Te[0];nt&&(A(nt),$(URL.createObjectURL(nt)))},Re=()=>{D&&URL.revokeObjectURL(D),A(null),$(""),q(""),K("")},$e=async()=>{if(!I){Ge.error("Please select an image");return}re(!0);try{const Ae=I.name.split(".").pop(),nt=`reels/${S}-${Date.now()}.${Ae}`,{error:Te}=await ee.storage.from("social-swag-2").upload(nt,I);if(Te)throw Te;const{data:{publicUrl:Xe}}=ee.storage.from("social-swag-2").getPublicUrl(nt),{error:ge}=await ee.from("social_swag_2_reels").upsert({month:S,image_url:Xe,canva_link:W||null,caption:F||null},{onConflict:"month"});if(ge)throw ge;Ge.success("Reel uploaded successfully!"),Yhe(`${me(S)} Reel`,"social-swag-2"),Re(),C(!1),t.invalidateQueries({queryKey:["admin-social-swag-2-reels"]})}catch(Ae){console.error("Reel upload error:",Ae),Ge.error("Failed to upload reel")}finally{re(!1)}},Pe=cr({mutationFn:async Ae=>{const nt=Ae.image_url.split("/social-swag-2/");nt[1]&&await ee.storage.from("social-swag-2").remove([nt[1]]);const{error:Te}=await ee.from("social_swag_2_reels").delete().eq("id",Ae.id);if(Te)throw Te},onSuccess:()=>{Ge.success("Reel deleted"),t.invalidateQueries({queryKey:["admin-social-swag-2-reels"]})},onError:()=>{Ge.error("Failed to delete reel")}});return r.jsx(Or,{title:"Admin - Social Swag 2.0",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Social Swag 2.0"}),r.jsx("p",{className:"text-muted-foreground",children:"Manage monthly social media images and captions"})]}),r.jsxs($r,{open:s,onOpenChange:i,children:[r.jsx(Lo,{asChild:!0,children:r.jsxs(te,{className:"gap-2",children:[r.jsx(Sn,{className:"h-4 w-4"}),"Upload Images"]})}),r.jsxs(zr,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Zr,{children:r.jsx(Kr,{children:"Upload Social Swag Images"})}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Month"}),r.jsx(yt,{type:"month",value:o,onChange:Ae=>c(Ae.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Qe,{children:["Images (",a.length,"/16)"]}),r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-6 text-center",children:[r.jsx("input",{type:"file",accept:"image/*",multiple:!0,onChange:fe,className:"hidden",id:"swag-upload",disabled:a.length>=16}),r.jsxs("label",{htmlFor:"swag-upload",className:"cursor-pointer",children:[r.jsx(Ao,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Click to select images (max 16)"})]})]})]}),a.length>0&&r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:a.map((Ae,nt)=>r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"relative aspect-[4/5] rounded-lg overflow-hidden bg-muted",children:[r.jsx("img",{src:Ae.preview,alt:`Upload ${nt+1}`,className:"w-full h-full object-cover"}),r.jsx(te,{variant:"destructive",size:"icon",className:"absolute top-1 right-1 h-6 w-6",onClick:()=>ve(nt),children:r.jsx(Ms,{className:"h-3 w-3"})})]}),r.jsx(ps,{placeholder:"Caption...",value:Ae.caption,onChange:Te=>Ie(nt,Te.target.value),className:"text-xs h-20"})]},nt))}),r.jsx(te,{onClick:Se,disabled:m||a.length===0,className:"w-full gap-2",children:m?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"h-4 w-4 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Ao,{className:"h-4 w-4"}),"Upload ",a.length," Images"]})})]})]})]}),r.jsxs($r,{open:k,onOpenChange:Ae=>{C(Ae),Ae||Re()},children:[r.jsx(Lo,{asChild:!0,children:r.jsxs(te,{variant:"outline",className:"gap-2",children:[r.jsx(wd,{className:"h-4 w-4"}),"Upload Reel"]})}),r.jsxs(zr,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[r.jsx(Zr,{children:r.jsx(Kr,{children:"Upload Monthly Reel"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Month"}),r.jsx(yt,{type:"month",value:S,onChange:Ae=>T(Ae.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Reel Preview Image"}),D?r.jsxs("div",{className:"relative aspect-[9/16] max-w-[120px] mx-auto rounded-lg overflow-hidden bg-muted",children:[r.jsx("img",{src:D,alt:"Reel preview",className:"w-full h-full object-cover"}),r.jsx(te,{variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:()=>{URL.revokeObjectURL(D),A(null),$("")},children:r.jsx(Ms,{className:"h-3 w-3"})})]}):r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-6 text-center",children:[r.jsx("input",{type:"file",accept:"image/*",onChange:Ue,className:"hidden",id:"reel-upload"}),r.jsxs("label",{htmlFor:"reel-upload",className:"cursor-pointer",children:[r.jsx(wd,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Click to select reel preview image"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Canva Download Link"}),r.jsx(yt,{value:W,onChange:Ae=>K(Ae.target.value),placeholder:"https://www.canva.com/..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Caption"}),r.jsx(ps,{value:F,onChange:Ae=>q(Ae.target.value),placeholder:"Enter caption for this reel...",className:"h-24"})]}),r.jsx(te,{onClick:$e,disabled:Z||!I,className:"w-full gap-2",children:Z?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"h-4 w-4 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Ao,{className:"h-4 w-4"}),"Upload Reel"]})})]})]})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsx(Ye,{children:r.jsxs(Je,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:he.length}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Total Images"})]})}),r.jsx(Ye,{children:r.jsxs(Je,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:xe.length}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Months"})]})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx(La,{value:e,onValueChange:n,children:r.jsxs(Ma,{children:[r.jsx(yn,{value:"all",children:"All"}),xe.map(Ae=>r.jsx(yn,{value:Ae,children:me(Ae)},Ae))]})}),e!=="all"&&r.jsx(Ye,{children:r.jsx(Je,{className:"p-4",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(bo,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("div",{className:"flex-1",children:[r.jsxs(Qe,{className:"text-sm text-muted-foreground",children:["Canva Edit Link for ",me(e)]}),(v==null?void 0:v.month)===e?r.jsxs("div",{className:"flex gap-2 mt-1",children:[r.jsx(yt,{value:v.link,onChange:Ae=>w({...v,link:Ae.target.value}),placeholder:"https://www.canva.com/..."}),r.jsx(te,{size:"sm",onClick:()=>ae.mutate(v),children:"Save"}),r.jsx(te,{size:"sm",variant:"outline",onClick:()=>w(null),children:"Cancel"})]}):r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx("span",{className:"text-sm",children:je(e)||"No link set"}),r.jsx(te,{size:"sm",variant:"outline",onClick:()=>w({month:e,link:je(e)}),children:"Edit"})]})]})]})})}),e!=="all"&&r.jsx(Ye,{children:r.jsx(Je,{className:"p-4",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx(wd,{className:"h-4 w-4 text-muted-foreground mt-1"}),r.jsxs("div",{className:"flex-1",children:[r.jsxs(Qe,{className:"text-sm text-muted-foreground",children:["Reel for ",me(e)]}),(()=>{const Ae=Me(e);return Ae?r.jsxs("div",{className:"flex items-center gap-4 mt-2",children:[r.jsx("img",{src:Ae.image_url,alt:"Reel preview",className:"w-16 h-28 object-cover rounded"}),r.jsxs("div",{className:"flex-1 text-sm",children:[r.jsx("p",{className:"line-clamp-2",children:Ae.caption||"No caption"}),Ae.canva_link&&r.jsx("a",{href:Ae.canva_link,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline text-xs",children:"View Canva Link"})]}),r.jsx(te,{variant:"destructive",size:"sm",onClick:()=>Pe.mutate(Ae),children:r.jsx(Xn,{className:"h-4 w-4"})})]}):r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"No reel uploaded for this month"})})()]})]})})})]}),ue?r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading..."}):ie.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Wo,{className:"h-12 w-12 mx-auto text-muted-foreground/50 mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"No images yet. Upload some!"})]}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4",children:ie.map(Ae=>r.jsxs(Ye,{className:"overflow-hidden",children:[r.jsxs("div",{className:"relative aspect-[4/5]",children:[r.jsx("img",{src:Ae.image_url,alt:"Social swag",className:"w-full h-full object-cover"}),r.jsx(te,{variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-8 w-8",onClick:()=>oe.mutate(Ae),children:r.jsx(Xn,{className:"h-4 w-4"})})]}),r.jsx(Je,{className:"p-3",children:r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-3",children:Ae.caption})})]},Ae.id))})]})})},$2t=()=>{const{toast:t}=la(),e=Xr(),[n,s]=P.useState("categories"),[i,o]=P.useState(!1),[c,a]=P.useState(null),[f,m]=P.useState({name:"",description:"",icon:""}),[y,v]=P.useState(!1),[w,k]=P.useState(null),[C,S]=P.useState({name:"",description:"",icon:""}),[T,I]=P.useState(!1),[A,D]=P.useState(null),[$,F]=P.useState(""),{data:q=[],isLoading:W}=rr({queryKey:["admin-community-categories"],queryFn:async()=>{const{data:Pe,error:Ae}=await ee.from("community_categories").select("*").order("sort_order");if(Ae)throw Ae;return Pe}}),{data:K=[],isLoading:Z}=rr({queryKey:["admin-private-groups"],queryFn:async()=>{const{data:Pe,error:Ae}=await ee.from("community_private_groups").select("*").order("sort_order");if(Ae)throw Ae;return Pe}}),{data:re=[]}=rr({queryKey:["admin-group-members",A==null?void 0:A.id],queryFn:async()=>{if(!A)return[];const{data:Pe,error:Ae}=await ee.from("community_private_group_members").select("*").eq("group_id",A.id);if(Ae)throw Ae;return Pe},enabled:!!A}),{data:he=[]}=rr({queryKey:["admin-all-profiles"],queryFn:async()=>{let Ae=[],nt=0,Te=!0;for(;Te;){const{data:Xe,error:ge}=await ee.from("profiles").select("id, name, email, brokerage_id").order("name").range(nt,nt+1e3-1);if(ge)throw ge;Xe&&Xe.length>0?(Ae=[...Ae,...Xe],nt+=1e3,Te=Xe.length===1e3):Te=!1}return Ae}}),{data:ue=[]}=rr({queryKey:["admin-all-brokerages"],queryFn:async()=>{const{data:Pe,error:Ae}=await ee.from("brokerages").select("*").order("name");if(Ae)throw Ae;return Pe}}),Ne=cr({mutationFn:async Pe=>{if(Pe.id){const{error:Ae}=await ee.from("community_categories").update({name:Pe.name,description:Pe.description||null,icon:Pe.icon||null}).eq("id",Pe.id);if(Ae)throw Ae}else{const Ae=Math.max(...q.map(Te=>Te.sort_order),0),{error:nt}=await ee.from("community_categories").insert({name:Pe.name,description:Pe.description||null,icon:Pe.icon||null,sort_order:Ae+1});if(nt)throw nt}},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-community-categories"]}),o(!1),a(null),m({name:"",description:"",icon:""}),t({title:c?"Category updated!":"Category created!"})},onError:Pe=>{t({title:"Error",description:Pe.message,variant:"destructive"})}}),se=cr({mutationFn:async Pe=>{const{error:Ae}=await ee.from("community_categories").delete().eq("id",Pe);if(Ae)throw Ae},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-community-categories"]}),t({title:"Category deleted"})}}),xe=cr({mutationFn:async({id:Pe,direction:Ae})=>{const nt=q.findIndex(Te=>Te.id===Pe);if(Ae==="up"&&nt>0){const Te=q[nt-1],Xe=q[nt];await ee.from("community_categories").update({sort_order:Xe.sort_order}).eq("id",Te.id),await ee.from("community_categories").update({sort_order:Te.sort_order}).eq("id",Xe.id)}else if(Ae==="down"&&nte.invalidateQueries({queryKey:["admin-community-categories"]})}),ie=cr({mutationFn:async Pe=>{if(Pe.id){const{error:Ae}=await ee.from("community_private_groups").update({name:Pe.name,description:Pe.description||null,icon:Pe.icon||null}).eq("id",Pe.id);if(Ae)throw Ae}else{const Ae=Math.max(...K.map(Te=>Te.sort_order),0),{error:nt}=await ee.from("community_private_groups").insert({name:Pe.name,description:Pe.description||null,icon:Pe.icon||null,sort_order:Ae+1});if(nt)throw nt}},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-private-groups"]}),v(!1),k(null),S({name:"",description:"",icon:""}),t({title:w?"Private group updated!":"Private group created!"})},onError:Pe=>{t({title:"Error",description:Pe.message,variant:"destructive"})}}),me=cr({mutationFn:async Pe=>{const{error:Ae}=await ee.from("community_private_groups").delete().eq("id",Pe);if(Ae)throw Ae},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-private-groups"]}),t({title:"Private group deleted"})}}),fe=cr({mutationFn:async({id:Pe,direction:Ae})=>{const nt=K.findIndex(Te=>Te.id===Pe);if(Ae==="up"&&nt>0){const Te=K[nt-1],Xe=K[nt];await ee.from("community_private_groups").update({sort_order:Xe.sort_order}).eq("id",Te.id),await ee.from("community_private_groups").update({sort_order:Te.sort_order}).eq("id",Xe.id)}else if(Ae==="down"&&nte.invalidateQueries({queryKey:["admin-private-groups"]})}),ve=cr({mutationFn:async({groupId:Pe,userId:Ae,isMember:nt})=>{if(nt){const{error:Te}=await ee.from("community_private_group_members").delete().eq("group_id",Pe).eq("user_id",Ae);if(Te)throw Te}else{const{error:Te}=await ee.from("community_private_group_members").insert({group_id:Pe,user_id:Ae});if(Te)throw Te}},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-group-members",A==null?void 0:A.id]})}}),Ie=cr({mutationFn:async({groupId:Pe,brokerageId:Ae,isMember:nt})=>{if(nt){const{error:Te}=await ee.from("community_private_group_members").delete().eq("group_id",Pe).eq("brokerage_id",Ae);if(Te)throw Te}else{const{error:Te}=await ee.from("community_private_group_members").insert({group_id:Pe,brokerage_id:Ae});if(Te)throw Te}},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-group-members",A==null?void 0:A.id]})}}),Se=Pe=>{a(Pe),m({name:Pe.name,description:Pe.description||"",icon:Pe.icon||""}),o(!0)},oe=()=>{a(null),m({name:"",description:"",icon:""}),o(!0)},ae=Pe=>{k(Pe),S({name:Pe.name,description:Pe.description||"",icon:Pe.icon||""}),v(!0)},je=()=>{k(null),S({name:"",description:"",icon:""}),v(!0)},Me=Pe=>{D(Pe),F(""),I(!0)},Ue=Pe=>re.some(Ae=>Ae.user_id===Pe),Re=Pe=>re.some(Ae=>Ae.brokerage_id===Pe),$e=he.filter(Pe=>Pe.name.toLowerCase().includes($.toLowerCase())||Pe.email.toLowerCase().includes($.toLowerCase()));return r.jsx(Or,{title:"Community Management",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ou,{title:"Community Management",description:"Manage categories and private groups for community discussions"}),r.jsxs(La,{value:n,onValueChange:s,children:[r.jsxs(Ma,{children:[r.jsx(yn,{value:"categories",children:"Public Categories"}),r.jsxs(yn,{value:"private-groups",children:[r.jsx(Ff,{className:"h-4 w-4 mr-1"}),"Private Groups"]})]}),r.jsxs($n,{value:"categories",className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Categories visible to all community members"}),r.jsxs(te,{onClick:oe,children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Add Category"]})]}),r.jsx(Ye,{children:r.jsx(Je,{className:"pt-6",children:r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{className:"w-[50px]",children:"Order"}),r.jsx(At,{className:"w-[80px]",children:"Icon"}),r.jsx(At,{children:"Name"}),r.jsx(At,{children:"Description"}),r.jsx(At,{className:"w-[100px]",children:"Actions"})]})}),r.jsx(qs,{children:W?r.jsx(Er,{children:r.jsx(_t,{colSpan:5,className:"text-center py-8",children:"Loading..."})}):q.length===0?r.jsx(Er,{children:r.jsx(_t,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No categories yet. Create your first one!"})}):q.map((Pe,Ae)=>r.jsxs(Er,{children:[r.jsx(_t,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:Ae===0,onClick:()=>xe.mutate({id:Pe.id,direction:"up"}),children:"↑"}),r.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:Ae===q.length-1,onClick:()=>xe.mutate({id:Pe.id,direction:"down"}),children:"↓"})]})}),r.jsx(_t,{className:"text-2xl",children:Pe.icon||"📁"}),r.jsx(_t,{className:"font-medium",children:Pe.name}),r.jsx(_t,{className:"text-muted-foreground",children:Pe.description||"—"}),r.jsx(_t,{children:r.jsxs("div",{className:"flex gap-1",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>Se(Pe),children:r.jsx(ma,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",className:"text-destructive",onClick:()=>{confirm("Delete this category? Posts will be uncategorized.")&&se.mutate(Pe.id)},children:r.jsx(Xn,{className:"h-4 w-4"})})]})})]},Pe.id))})]})})})]}),r.jsxs($n,{value:"private-groups",className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Private groups visible only to assigned members or brokerages"}),r.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[r.jsx(ra,{className:"h-3 w-3"}),"Brokerage groups are created automatically and sync with brokerage names"]})]}),r.jsxs(te,{onClick:je,children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Add Private Group"]})]}),r.jsx(Ye,{children:r.jsx(Je,{className:"pt-6",children:r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{className:"w-[50px]",children:"Order"}),r.jsx(At,{className:"w-[80px]",children:"Icon"}),r.jsx(At,{children:"Name"}),r.jsx(At,{children:"Description"}),r.jsx(At,{className:"w-[120px]",children:"Members"}),r.jsx(At,{className:"w-[140px]",children:"Actions"})]})}),r.jsx(qs,{children:Z?r.jsx(Er,{children:r.jsx(_t,{colSpan:6,className:"text-center py-8",children:"Loading..."})}):K.length===0?r.jsx(Er,{children:r.jsx(_t,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No private groups yet. Create your first one!"})}):K.map((Pe,Ae)=>r.jsxs(Er,{children:[r.jsx(_t,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:Ae===0,onClick:()=>fe.mutate({id:Pe.id,direction:"up"}),children:"↑"}),r.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:Ae===K.length-1,onClick:()=>fe.mutate({id:Pe.id,direction:"down"}),children:"↓"})]})}),r.jsx(_t,{className:"text-2xl",children:Pe.icon||"🔒"}),r.jsx(_t,{className:"font-medium",children:r.jsxs("div",{className:"flex items-center gap-2",children:[Pe.name,Pe.brokerage_id?r.jsxs(Rt,{variant:"outline",className:"text-xs bg-blue-50 text-blue-700 border-blue-200",children:[r.jsx(ra,{className:"h-3 w-3 mr-1"}),"Auto-managed"]}):r.jsxs(Rt,{variant:"secondary",className:"text-xs",children:[r.jsx(Ff,{className:"h-3 w-3 mr-1"}),"Private"]})]})}),r.jsx(_t,{className:"text-muted-foreground",children:Pe.description||"—"}),r.jsx(_t,{children:r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>Me(Pe),children:[r.jsx(hs,{className:"h-4 w-4 mr-1"}),"Manage"]})}),r.jsx(_t,{children:r.jsxs("div",{className:"flex gap-1",children:[!Pe.brokerage_id&&r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>ae(Pe),children:r.jsx(ma,{className:"h-4 w-4"})}),!Pe.brokerage_id&&r.jsx(te,{variant:"ghost",size:"icon",className:"text-destructive",onClick:()=>{confirm("Delete this private group? All posts in this group will be deleted.")&&me.mutate(Pe.id)},children:r.jsx(Xn,{className:"h-4 w-4"})}),Pe.brokerage_id&&r.jsx("span",{className:"text-xs text-muted-foreground italic",children:"Managed via brokerage"})]})})]},Pe.id))})]})})})]})]}),r.jsx($r,{open:i,onOpenChange:o,children:r.jsxs(zr,{children:[r.jsx(Zr,{children:r.jsx(Kr,{children:c?"Edit Category":"Create Category"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Icon (emoji)"}),r.jsx(yt,{value:f.icon,onChange:Pe=>m(Ae=>({...Ae,icon:Pe.target.value})),placeholder:"💬",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Name *"}),r.jsx(yt,{value:f.name,onChange:Pe=>m(Ae=>({...Ae,name:Pe.target.value})),placeholder:"Category name",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Description"}),r.jsx(ps,{value:f.description,onChange:Pe=>m(Ae=>({...Ae,description:Pe.target.value})),placeholder:"Brief description of this category",className:"mt-1"})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"outline",onClick:()=>o(!1),children:"Cancel"}),r.jsx(te,{onClick:()=>Ne.mutate({...f,id:c==null?void 0:c.id}),disabled:!f.name.trim(),children:c?"Save Changes":"Create Category"})]})]})]})}),r.jsx($r,{open:y,onOpenChange:v,children:r.jsxs(zr,{children:[r.jsx(Zr,{children:r.jsx(Kr,{children:w?"Edit Private Group":"Create Private Group"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Icon (emoji)"}),r.jsx(yt,{value:C.icon,onChange:Pe=>S(Ae=>({...Ae,icon:Pe.target.value})),placeholder:"🔒",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Name *"}),r.jsx(yt,{value:C.name,onChange:Pe=>S(Ae=>({...Ae,name:Pe.target.value})),placeholder:"e.g., Pioneers",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Description"}),r.jsx(ps,{value:C.description,onChange:Pe=>S(Ae=>({...Ae,description:Pe.target.value})),placeholder:"Brief description of this private group",className:"mt-1"})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"outline",onClick:()=>v(!1),children:"Cancel"}),r.jsx(te,{onClick:()=>ie.mutate({...C,id:w==null?void 0:w.id}),disabled:!C.name.trim(),children:w?"Save Changes":"Create Private Group"})]})]})]})}),r.jsx($r,{open:T,onOpenChange:I,children:r.jsxs(zr,{className:"max-w-2xl",children:[r.jsx(Zr,{children:r.jsxs(Kr,{children:["Manage Members: ",A==null?void 0:A.name]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs(La,{defaultValue:"brokerages",children:[r.jsxs(Ma,{className:"w-full",children:[r.jsx(yn,{value:"brokerages",className:"flex-1",children:"By Brokerage"}),r.jsx(yn,{value:"users",className:"flex-1",children:"Individual Users"})]}),r.jsxs($n,{value:"brokerages",className:"space-y-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Select brokerages to grant all their agents access to this private group."}),r.jsx(xl,{className:"h-[300px] border rounded-md p-4",children:r.jsxs("div",{className:"space-y-2",children:[ue.map(Pe=>r.jsxs("div",{className:"flex items-center justify-between p-2 hover:bg-muted rounded-md",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(_c,{checked:Re(Pe.id),onCheckedChange:()=>{A&&Ie.mutate({groupId:A.id,brokerageId:Pe.id,isMember:Re(Pe.id)})}}),r.jsx("span",{className:"font-medium",children:Pe.name})]}),r.jsxs(Rt,{variant:"secondary",children:[he.filter(Ae=>Ae.brokerage_id===Pe.id).length," agents"]})]},Pe.id)),ue.length===0&&r.jsx("p",{className:"text-center text-muted-foreground py-4",children:"No brokerages found"})]})})]}),r.jsxs($n,{value:"users",className:"space-y-4",children:[r.jsxs("div",{className:"relative",children:[r.jsx(Ti,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(yt,{placeholder:"Search users...",value:$,onChange:Pe=>F(Pe.target.value),className:"pl-9"})]}),r.jsx(xl,{className:"h-[300px] border rounded-md p-4",children:r.jsxs("div",{className:"space-y-2",children:[$e.map(Pe=>r.jsx("div",{className:"flex items-center justify-between p-2 hover:bg-muted rounded-md",children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(_c,{checked:Ue(Pe.id),onCheckedChange:()=>{A&&ve.mutate({groupId:A.id,userId:Pe.id,isMember:Ue(Pe.id)})}}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Pe.name}),r.jsx("div",{className:"text-sm text-muted-foreground",children:Pe.email})]})]})},Pe.id)),$e.length===0&&r.jsx("p",{className:"text-center text-muted-foreground py-4",children:"No users found"})]})})]})]}),r.jsx("div",{className:"flex justify-end",children:r.jsx(te,{onClick:()=>I(!1),children:"Done"})})]})]})})]})})},RNe=t=>{switch(t){case"academy_video":return r.jsx(wc,{className:"h-3 w-3"});case"template":return r.jsx(Ai,{className:"h-3 w-3"});case"toolbox":return r.jsx(Tl,{className:"h-3 w-3"});case"newsletter":return r.jsx(Ay,{className:"h-3 w-3"});case"social_swag":return r.jsx(Mi,{className:"h-3 w-3"});default:return r.jsx(Fs,{className:"h-3 w-3"})}},U2t=t=>{switch(t){case"academy_video":return"Academy";case"template":return"Template";case"toolbox":return"Toolbox";case"newsletter":return"Newsletter";case"social_swag":return"Social Swag";default:return t}},q2t=t=>{switch(t){case"view":return"Viewed";case"click_canva":return"Clicked Canva";case"click_pdf":return"Downloaded PDF";case"click_video":return"Watched Video";case"click_link":return"Clicked Link";case"click_drive":return"Clicked Drive";default:return t}},V2t=()=>{const{toast:t}=la(),[e,n]=P.useState([]),[s,i]=P.useState([]),[o,c]=P.useState([]),[a,f]=P.useState(!0),[m,y]=P.useState(""),[v,w]=P.useState(null),[k,C]=P.useState([]),[S,T]=P.useState([]);P.useEffect(()=>{I()},[]);const I=async()=>{try{f(!0);const{data:F,error:q}=await ee.from("activity_logs").select(` id, user_id, app_name, launched_at, profiles ( name, email, brokerages ( name ) ) `).order("launched_at",{ascending:!1}).limit(5e3);if(q)throw q;const{data:W,error:K}=await ee.from("content_engagement_logs").select(` id, user_id, resource_type, resource_id, resource_title, action_type, created_at `).order("created_at",{ascending:!1}).limit(5e3);if(K)throw K;const Z=[...new Set((W==null?void 0:W.map(ie=>ie.user_id))||[])],{data:re}=await ee.from("profiles").select(` id, name, email, brokerages ( name ) `).in("id",Z),he=new Map((re==null?void 0:re.map(ie=>[ie.id,ie]))||[]),ue=(F==null?void 0:F.map(ie=>{var me,fe,ve,Ie;return{id:ie.id,user_id:ie.user_id,app_name:ie.app_name,launched_at:ie.launched_at,user_name:((me=ie.profiles)==null?void 0:me.name)||"Unknown",user_email:((fe=ie.profiles)==null?void 0:fe.email)||"Unknown",brokerage_name:((Ie=(ve=ie.profiles)==null?void 0:ve.brokerages)==null?void 0:Ie.name)||null}}))||[],Ne=(W==null?void 0:W.map(ie=>{var fe;const me=he.get(ie.user_id);return{id:ie.id,user_id:ie.user_id,resource_type:ie.resource_type,resource_id:ie.resource_id,resource_title:ie.resource_title,action_type:ie.action_type,created_at:ie.created_at,user_name:(me==null?void 0:me.name)||"Unknown",user_email:(me==null?void 0:me.email)||"Unknown",brokerage_name:((fe=me==null?void 0:me.brokerages)==null?void 0:fe.name)||null}}))||[];n(ue),i(Ne);const se=new Map;ue.forEach(ie=>{if(!se.has(ie.user_id))se.set(ie.user_id,{user_id:ie.user_id,user_name:ie.user_name,user_email:ie.user_email,brokerage_name:ie.brokerage_name,last_activity_type:"app",last_activity_name:ie.app_name,last_activity_at:ie.launched_at,total_app_launches:1,total_content_views:0});else{const me=se.get(ie.user_id);me.total_app_launches++,new Date(ie.launched_at)>new Date(me.last_activity_at)&&(me.last_activity_type="app",me.last_activity_name=ie.app_name,me.last_activity_at=ie.launched_at)}}),Ne.forEach(ie=>{if(!se.has(ie.user_id))se.set(ie.user_id,{user_id:ie.user_id,user_name:ie.user_name,user_email:ie.user_email,brokerage_name:ie.brokerage_name,last_activity_type:ie.resource_type,last_activity_name:ie.resource_title,last_activity_at:ie.created_at,total_app_launches:0,total_content_views:1});else{const me=se.get(ie.user_id);me.total_content_views++,new Date(ie.created_at)>new Date(me.last_activity_at)&&(me.last_activity_type=ie.resource_type,me.last_activity_name=ie.resource_title,me.last_activity_at=ie.created_at)}});const xe=Array.from(se.values()).sort((ie,me)=>new Date(me.last_activity_at).getTime()-new Date(ie.last_activity_at).getTime());c(xe)}catch(F){console.error("Error loading activity:",F),t({title:"Error",description:"Failed to load activity logs",variant:"destructive"})}finally{f(!1)}},A=F=>{w({id:F.user_id,name:F.user_name,email:F.user_email});const q=e.filter(K=>K.user_id===F.user_id),W=s.filter(K=>K.user_id===F.user_id);C(q),T(W)},D=()=>{w(null),C([]),T([])},$=o.filter(F=>{var W;if(!m)return!0;const q=m.toLowerCase();return F.user_name.toLowerCase().includes(q)||F.user_email.toLowerCase().includes(q)||((W=F.brokerage_name)==null?void 0:W.toLowerCase().includes(q))});return a?r.jsx(Ye,{children:r.jsx(Je,{className:"flex items-center justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs(r.Fragment,{children:[r.jsxs(Ye,{children:[r.jsxs(Ht,{children:[r.jsx(Yt,{children:"User Activity"}),r.jsx(An,{children:"App launches and content engagement - click to see full history"})]}),r.jsxs(Je,{children:[r.jsx("div",{className:"mb-4",children:r.jsxs("div",{className:"relative",children:[r.jsx(Ti,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),r.jsx(yt,{placeholder:"Search by name, email, or brokerage...",value:m,onChange:F=>y(F.target.value),className:"pl-9"})]})}),r.jsx("div",{className:"rounded-md border",children:r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"User"}),r.jsx(At,{children:"Brokerage"}),r.jsx(At,{children:"Last Activity"}),r.jsx(At,{children:"Last Active"}),r.jsx(At,{className:"text-right",children:"Apps"}),r.jsx(At,{className:"text-right",children:"Content"})]})}),r.jsx(qs,{children:$.length===0?r.jsx(Er,{children:r.jsx(_t,{colSpan:6,className:"text-center text-muted-foreground",children:"No activity found"})}):$.map(F=>r.jsxs(Er,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>A(F),children:[r.jsx(_t,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:F.user_name}),r.jsx("div",{className:"text-sm text-muted-foreground",children:F.user_email})]})}),r.jsx(_t,{children:F.brokerage_name?r.jsx(Rt,{variant:"outline",children:F.brokerage_name}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})}),r.jsx(_t,{children:r.jsx("div",{className:"flex items-center gap-2",children:F.last_activity_type==="app"?r.jsxs(Rt,{variant:"secondary",children:[r.jsx(Fs,{className:"h-3 w-3 mr-1"}),F.last_activity_name]}):r.jsxs(Rt,{variant:"outline",className:"flex items-center gap-1",children:[RNe(F.last_activity_type),r.jsx("span",{className:"max-w-32 truncate",children:F.last_activity_name})]})})}),r.jsx(_t,{className:"text-sm text-muted-foreground",children:Yd(new Date(F.last_activity_at),{addSuffix:!0})}),r.jsx(_t,{className:"text-right",children:r.jsx(Rt,{variant:"outline",children:F.total_app_launches})}),r.jsx(_t,{className:"text-right",children:r.jsx(Rt,{variant:"outline",children:F.total_content_views})})]},F.user_id))})]})})]})]}),r.jsx($r,{open:!!v,onOpenChange:F=>!F&&D(),children:r.jsxs(zr,{className:"max-w-3xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsxs(Zr,{children:[r.jsxs(Kr,{children:[v==null?void 0:v.name,"'s Activity"]}),r.jsx(ls,{children:v==null?void 0:v.email})]}),r.jsxs(La,{defaultValue:"content",className:"flex-1 overflow-hidden flex flex-col",children:[r.jsxs(Ma,{className:"grid w-full grid-cols-2",children:[r.jsxs(yn,{value:"content",children:["Content (",S.length,")"]}),r.jsxs(yn,{value:"apps",children:["App Launches (",k.length,")"]})]}),r.jsx($n,{value:"content",className:"flex-1 overflow-auto mt-4",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"Type"}),r.jsx(At,{children:"Resource"}),r.jsx(At,{children:"Action"}),r.jsx(At,{children:"Time"})]})}),r.jsx(qs,{children:S.length===0?r.jsx(Er,{children:r.jsx(_t,{colSpan:4,className:"text-center text-muted-foreground",children:"No content engagement"})}):S.map(F=>r.jsxs(Er,{children:[r.jsx(_t,{children:r.jsxs(Rt,{variant:"outline",className:"flex items-center gap-1 w-fit",children:[RNe(F.resource_type),U2t(F.resource_type)]})}),r.jsx(_t,{className:"max-w-48",children:r.jsx("span",{className:"truncate block",children:F.resource_title})}),r.jsx(_t,{children:r.jsx(Rt,{variant:"secondary",children:q2t(F.action_type)})}),r.jsx(_t,{className:"text-sm text-muted-foreground",children:Yd(new Date(F.created_at),{addSuffix:!0})})]},F.id))})]})})}),r.jsx($n,{value:"apps",className:"flex-1 overflow-auto mt-4",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"App"}),r.jsx(At,{children:"Time"})]})}),r.jsx(qs,{children:k.length===0?r.jsx(Er,{children:r.jsx(_t,{colSpan:2,className:"text-center text-muted-foreground",children:"No app launches"})}):k.map(F=>r.jsxs(Er,{children:[r.jsx(_t,{children:r.jsx(Rt,{variant:"secondary",children:F.app_name})}),r.jsx(_t,{className:"text-sm text-muted-foreground",children:Yd(new Date(F.launched_at),{addSuffix:!0})})]},F.id))})]})})})]})]})})]})},H2t=()=>{const{toast:t}=la(),[e,n]=P.useState({totalUsers:0,activeUsers:0,pendingUsers:0,totalBrokerages:0,totalLaunches:0,launchesThisWeek:0,launchesThisMonth:0,uniqueActiveThisWeek:0}),[s,i]=P.useState(!0);P.useEffect(()=>{o()},[]);const o=async()=>{try{i(!0);const{count:c}=await ee.from("profiles").select("*",{count:"exact",head:!0}),{count:a}=await ee.from("profiles").select("*",{count:"exact",head:!0}).not("last_login","is",null),f=(c||0)-(a||0),{count:m}=await ee.from("brokerages").select("*",{count:"exact",head:!0}),{count:y}=await ee.from("activity_logs").select("*",{count:"exact",head:!0}),v=new Date;v.setDate(v.getDate()-7);const{count:w}=await ee.from("activity_logs").select("*",{count:"exact",head:!0}).gte("launched_at",v.toISOString()),k=new Date;k.setMonth(k.getMonth()-1);const{count:C}=await ee.from("activity_logs").select("*",{count:"exact",head:!0}).gte("launched_at",k.toISOString()),{data:S}=await ee.from("activity_logs").select("user_id").gte("launched_at",v.toISOString()),T=new Set(S==null?void 0:S.map(I=>I.user_id)).size;n({totalUsers:c||0,activeUsers:a||0,pendingUsers:f,totalBrokerages:m||0,totalLaunches:y||0,launchesThisWeek:w||0,launchesThisMonth:C||0,uniqueActiveThisWeek:T})}catch(c){console.error("Error loading analytics:",c),t({title:"Error",description:"Failed to load analytics",variant:"destructive"})}finally{i(!1)}};return s?r.jsx(Ye,{children:r.jsx(Je,{className:"flex items-center justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Yt,{className:"text-sm font-medium",children:"Total Users"}),r.jsx(hs,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Je,{children:[r.jsx("div",{className:"text-2xl font-bold",children:e.totalUsers}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[e.activeUsers," active, ",e.pendingUsers," pending"]})]})]}),r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Yt,{className:"text-sm font-medium",children:"Active Users"}),r.jsx(za,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Je,{children:[r.jsx("div",{className:"text-2xl font-bold",children:e.activeUsers}),r.jsx("p",{className:"text-xs text-muted-foreground",children:e.totalUsers>0?`${Math.round(e.activeUsers/e.totalUsers*100)}% of total`:"0% of total"})]})]}),r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Yt,{className:"text-sm font-medium",children:"Pending Invites"}),r.jsx(Xi,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Je,{children:[r.jsx("div",{className:"text-2xl font-bold",children:e.pendingUsers}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Awaiting setup"})]})]}),r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Yt,{className:"text-sm font-medium",children:"Brokerages"}),r.jsx(ra,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Je,{children:[r.jsx("div",{className:"text-2xl font-bold",children:e.totalBrokerages}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Total brokerages"})]})]}),r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Yt,{className:"text-sm font-medium",children:"Total App Launches"}),r.jsx(ig,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Je,{children:[r.jsx("div",{className:"text-2xl font-bold",children:e.totalLaunches}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"All time"})]})]}),r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Yt,{className:"text-sm font-medium",children:"Launches This Week"}),r.jsx(ig,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Je,{children:[r.jsx("div",{className:"text-2xl font-bold",children:e.launchesThisWeek}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Last 7 days"})]})]}),r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Yt,{className:"text-sm font-medium",children:"Launches This Month"}),r.jsx(ig,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Je,{children:[r.jsx("div",{className:"text-2xl font-bold",children:e.launchesThisMonth}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Last 30 days"})]})]}),r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Yt,{className:"text-sm font-medium",children:"Active This Week"}),r.jsx(Bf,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Je,{children:[r.jsx("div",{className:"text-2xl font-bold",children:e.uniqueActiveThisWeek}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Unique users"})]})]})]})},FNe={event:"Event",template:"Template",academy_video:"Academy Video",resource_kit:"Resource Kit",newsletter:"Newsletter",social_swag:"Social Swag"},zNe={event:"bg-blue-100 text-blue-800",template:"bg-purple-100 text-purple-800",academy_video:"bg-green-100 text-green-800",resource_kit:"bg-orange-100 text-orange-800",newsletter:"bg-pink-100 text-pink-800",social_swag:"bg-yellow-100 text-yellow-800"};function eze({brokerageOnly:t=!1,brokerageId:e}){const[n,s]=P.useState([]),[i,o]=P.useState(!0),[c,a]=P.useState(""),[f,m]=P.useState("all");P.useEffect(()=>{y()},[e]);const y=async()=>{o(!0);try{let I=[];if(t&&e){const{data:Z}=await ee.from("profiles").select("id").eq("brokerage_id",e);if(I=(Z==null?void 0:Z.map(re=>re.id))||[],I.length===0){s([]),o(!1);return}}let A=ee.from("resource_shares").select("*").order("created_at",{ascending:!1});t&&I.length>0&&(A=A.or(`sender_id.in.(${I.join(",")}),recipient_id.in.(${I.join(",")})`));const{data:D,error:$}=await A;if($)throw $;const F=new Set;D==null||D.forEach(Z=>{F.add(Z.sender_id),F.add(Z.recipient_id)});const{data:q}=await ee.from("profiles").select("id, name, email").in("id",Array.from(F)),W=new Map((q==null?void 0:q.map(Z=>[Z.id,Z]))||[]),K=(D==null?void 0:D.map(Z=>({...Z,sender:W.get(Z.sender_id),recipient:W.get(Z.recipient_id)})))||[];s(K)}catch(I){console.error("Error loading shares:",I)}finally{o(!1)}},v=n.filter(I=>{var $,F;const A=c===""||I.resource_title.toLowerCase().includes(c.toLowerCase())||(($=I.sender)==null?void 0:$.name.toLowerCase().includes(c.toLowerCase()))||((F=I.recipient)==null?void 0:F.name.toLowerCase().includes(c.toLowerCase())),D=f==="all"||I.resource_type===f;return A&&D}),w=n.length,k=new Set(n.map(I=>I.sender_id)).size,C=new Set(n.map(I=>I.recipient_id)).size,S=n.length>0?Math.round(n.filter(I=>I.is_read).length/n.length*100):0,T=n.reduce((I,A)=>(I[A.resource_type]=(I[A.resource_type]||0)+1,I),{});return i?r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"grid gap-4 md:grid-cols-4",children:[...Array(4)].map((I,A)=>r.jsxs(Ye,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Gr,{className:"h-4 w-20"})}),r.jsx(Je,{children:r.jsx(Gr,{className:"h-8 w-16"})})]},A))}),r.jsx(Ye,{children:r.jsx(Je,{className:"p-6",children:r.jsx(Gr,{className:"h-[300px]"})})})]}):r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-4 md:grid-cols-4",children:[r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Yt,{className:"text-sm font-medium",children:"Total Shares"}),r.jsx(Kd,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:w})})]}),r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Yt,{className:"text-sm font-medium",children:"Active Sharers"}),r.jsx(hs,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:k})})]}),r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Yt,{className:"text-sm font-medium",children:"Recipients Reached"}),r.jsx(Bf,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:C})})]}),r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Yt,{className:"text-sm font-medium",children:"Read Rate"}),r.jsx(Ai,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(Je,{children:r.jsxs("div",{className:"text-2xl font-bold",children:[S,"%"]})})]})]}),r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsx(Yt,{className:"text-sm font-medium",children:"Shares by Resource Type"})}),r.jsx(Je,{children:r.jsxs("div",{className:"flex flex-wrap gap-2",children:[Object.entries(T).map(([I,A])=>r.jsxs(Rt,{variant:"secondary",className:zNe[I],children:[FNe[I],": ",A]},I)),Object.keys(T).length===0&&r.jsx("span",{className:"text-muted-foreground text-sm",children:"No shares yet"})]})})]}),r.jsxs(Ye,{children:[r.jsxs(Ht,{children:[r.jsx(Yt,{children:"Share History"}),r.jsxs(An,{children:["All resource shares ",t?"in your brokerage":"across the platform"]})]}),r.jsxs(Je,{children:[r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Ti,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(yt,{placeholder:"Search by resource, sender, or recipient...",value:c,onChange:I=>a(I.target.value),className:"pl-9"})]}),r.jsxs(_n,{value:f,onValueChange:m,children:[r.jsx(xn,{className:"w-[180px]",children:r.jsx(bn,{placeholder:"Resource type"})}),r.jsxs(vn,{children:[r.jsx(er,{value:"all",children:"All Types"}),r.jsx(er,{value:"event",children:"Events"}),r.jsx(er,{value:"template",children:"Templates"}),r.jsx(er,{value:"academy_video",children:"Academy Videos"}),r.jsx(er,{value:"resource_kit",children:"Resource Kits"}),r.jsx(er,{value:"newsletter",children:"Newsletters"}),r.jsx(er,{value:"social_swag",children:"Social Swag"})]})]})]}),r.jsx(xl,{className:"h-[400px]",children:r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"Resource"}),r.jsx(At,{children:"Type"}),r.jsx(At,{children:"Sender"}),r.jsx(At,{children:"Recipient"}),r.jsx(At,{children:"Status"}),r.jsx(At,{children:"Date"})]})}),r.jsx(qs,{children:v.length===0?r.jsx(Er,{children:r.jsx(_t,{colSpan:6,className:"text-center text-muted-foreground py-8",children:"No shares found"})}):v.map(I=>{var A,D;return r.jsxs(Er,{children:[r.jsx(_t,{className:"font-medium max-w-[200px] truncate",children:I.resource_title}),r.jsx(_t,{children:r.jsx(Rt,{variant:"secondary",className:zNe[I.resource_type],children:FNe[I.resource_type]})}),r.jsx(_t,{children:((A=I.sender)==null?void 0:A.name)||"Unknown"}),r.jsx(_t,{children:((D=I.recipient)==null?void 0:D.name)||"Unknown"}),r.jsx(_t,{children:r.jsx(Rt,{variant:I.is_read?"default":"outline",children:I.is_read?"Read":"Unread"})}),r.jsx(_t,{className:"text-muted-foreground",children:un(new Date(I.created_at),"MMM d, yyyy")})]},I.id)})})]})})]})]})]})}const W2t=()=>r.jsx(Or,{title:"Analytics",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Analytics & Activity"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Platform-wide usage statistics and user activity"})]}),r.jsxs(La,{defaultValue:"analytics",className:"space-y-4",children:[r.jsxs(Ma,{children:[r.jsx(yn,{value:"analytics",children:"Analytics"}),r.jsx(yn,{value:"activity",children:"Activity"}),r.jsx(yn,{value:"shares",children:"Shares"})]}),r.jsx($n,{value:"analytics",className:"space-y-4",children:r.jsx(H2t,{})}),r.jsx($n,{value:"activity",className:"space-y-4",children:r.jsx(V2t,{})}),r.jsx($n,{value:"shares",className:"space-y-4",children:r.jsx(eze,{})})]})]})});function G2t(){const t=Xr(),[e,n]=P.useState(!1),[s,i]=P.useState(null),[o,c]=P.useState({title:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1,category_id:""}),[a,f]=P.useState(null),[m,y]=P.useState(""),[v,w]=P.useState([]),[k,C]=P.useState([]),[S,T]=P.useState([]),[I,A]=P.useState(!1),[D,$]=P.useState(null),[F,q]=P.useState(""),{data:W,isLoading:K}=rr({queryKey:["brokerage-resources"],queryFn:async()=>{const{data:Te,error:Xe}=await ee.from("brokerage_resources").select("*").order("publish_date",{ascending:!1});if(Xe)throw Xe;return Te}}),{data:Z}=rr({queryKey:["brokerage-resource-pdfs"],queryFn:async()=>{const{data:Te,error:Xe}=await ee.from("brokerage_resource_pdfs").select("*").order("sort_order",{ascending:!0});if(Xe)throw Xe;return Te}}),{data:re}=rr({queryKey:["brokerage-resource-videos"],queryFn:async()=>{const{data:Te,error:Xe}=await ee.from("brokerage_resource_videos").select("*").order("sort_order",{ascending:!0});if(Xe)throw Xe;return Te}}),{data:he}=rr({queryKey:["brokerage-resource-links"],queryFn:async()=>{const{data:Te,error:Xe}=await ee.from("brokerage_resource_links").select("*").order("sort_order",{ascending:!0});if(Xe)throw Xe;return Te}}),{data:ue,isLoading:Ne}=rr({queryKey:["brokerage-resource-categories"],queryFn:async()=>{const{data:Te,error:Xe}=await ee.from("brokerage_resource_categories").select("*").order("sort_order",{ascending:!0});if(Xe)throw Xe;return Te}}),se=()=>{c({title:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1,category_id:""}),f(null),y(""),w([]),C([]),T([]),i(null),q("")},xe=Te=>{i(Te),c({title:Te.title,description:Te.description||"",publish_date:Te.publish_date.split("T")[0],is_published:Te.is_published,category_id:Te.category_id||""}),y(Te.preview_image_url||""),q("");const Xe=(Z==null?void 0:Z.filter(rt=>rt.resource_id===Te.id))||[];w(Xe.map(rt=>({id:rt.id,name:rt.name,file_url:rt.file_url,file_size:rt.file_size,sort_order:rt.sort_order})));const ge=(re==null?void 0:re.filter(rt=>rt.resource_id===Te.id))||[];C(ge.map(rt=>({id:rt.id,title:rt.title,video_url:rt.video_url,sort_order:rt.sort_order})));const mt=(he==null?void 0:he.filter(rt=>rt.resource_id===Te.id))||[];T(mt.map(rt=>({id:rt.id,title:rt.title,canva_share_link:rt.canva_share_link,sort_order:rt.sort_order}))),n(!0)},ie=Te=>{var ge;const Xe=(ge=Te.target.files)==null?void 0:ge[0];Xe&&(f(Xe),y(URL.createObjectURL(Xe)))},me=()=>{w([...v,{name:"",file_url:"",sort_order:v.length}])},fe=Te=>{w(v.filter((Xe,ge)=>ge!==Te))},ve=(Te,Xe,ge)=>{const mt=[...v];if(Xe==="file"&&ge instanceof File){const rt=ge.name.replace(/\.[^/.]+$/,"");mt[Te]={...mt[Te],file:ge,file_size:ge.size,name:mt[Te].name||rt}}else mt[Te]={...mt[Te],[Xe]:ge};w(mt)},Ie=()=>{C([...k,{title:"",video_url:"",sort_order:k.length}])},Se=Te=>{C(k.filter((Xe,ge)=>ge!==Te))},oe=(Te,Xe,ge)=>{const mt=[...k];Xe==="file"&&ge instanceof File?mt[Te]={...mt[Te],file:ge}:mt[Te]={...mt[Te],[Xe]:ge},C(mt)},ae=()=>{T([...S,{title:"",canva_share_link:"",sort_order:S.length}])},je=Te=>{T(S.filter((Xe,ge)=>ge!==Te))},Me=(Te,Xe,ge)=>{const mt=[...S];mt[Te]={...mt[Te],[Xe]:ge},T(mt)},Ue=async(Te,Xe)=>{try{const ge=await ee.functions.invoke("bunny-upload",{body:{action:"create",title:Te.name}});if(ge.error)throw ge.error;const{videoId:mt,uploadUrl:rt,libraryId:We}=ge.data,Ce=await ee.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:mt,libraryId:We}});if(Ce.error)throw Ce.error;const{uploadUrl:et,apiKey:Fe}=Ce.data,Ke=new XMLHttpRequest;return Ke.open("PUT",et,!0),Ke.setRequestHeader("AccessKey",Fe),Ke.upload.onprogress=Le=>{if(Le.lengthComputable){const ft=Math.round(Le.loaded/Le.total*100),Nt=[...k];Nt[Xe]={...Nt[Xe],uploadProgress:ft},C(Nt)}},await new Promise((Le,ft)=>{Ke.onload=()=>Ke.status>=200&&Ke.status<300?Le():ft(new Error("Upload failed")),Ke.onerror=()=>ft(new Error("Upload failed")),Ke.send(Te)}),`https://iframe.mediadelivery.net/embed/${We}/${mt}`}catch(ge){throw console.error("Bunny upload error:",ge),ge}},Re=cr({mutationFn:async Te=>{const{data:Xe,error:ge}=await ee.from("brokerage_resource_categories").insert({name:Te,sort_order:(ue==null?void 0:ue.length)||0}).select().single();if(ge)throw ge;return Xe},onSuccess:Te=>{t.invalidateQueries({queryKey:["brokerage-resource-categories"]}),c({...o,category_id:Te.id}),q(""),Ge.success("Category created")},onError:Te=>{Ge.error("Failed to create category: "+Te.message)}}),$e=cr({mutationFn:async()=>{A(!0);let Te=(s==null?void 0:s.preview_image_url)||null;if(a){const mt=a.name.split(".").pop(),rt=`${Date.now()}.${mt}`,{error:We}=await ee.storage.from("brokerage-resources").upload(`previews/${rt}`,a);if(We)throw We;const{data:Ce}=ee.storage.from("brokerage-resources").getPublicUrl(`previews/${rt}`);Te=Ce.publicUrl}const Xe={title:o.title,description:o.description||null,preview_image_url:Te,publish_date:o.publish_date,is_published:o.is_published,category_id:o.category_id||null};let ge;if(s){const{error:mt}=await ee.from("brokerage_resources").update(Xe).eq("id",s.id);if(mt)throw mt;ge=s.id;const rt=(Z==null?void 0:Z.filter(Mt=>Mt.resource_id===s.id).map(Mt=>Mt.id))||[],We=v.filter(Mt=>Mt.id).map(Mt=>Mt.id),Ce=rt.filter(Mt=>!We.includes(Mt));Ce.length>0&&await ee.from("brokerage_resource_pdfs").delete().in("id",Ce);const et=(re==null?void 0:re.filter(Mt=>Mt.resource_id===s.id).map(Mt=>Mt.id))||[],Fe=k.filter(Mt=>Mt.id).map(Mt=>Mt.id),Ke=et.filter(Mt=>!Fe.includes(Mt));Ke.length>0&&await ee.from("brokerage_resource_videos").delete().in("id",Ke);const Le=(he==null?void 0:he.filter(Mt=>Mt.resource_id===s.id).map(Mt=>Mt.id))||[],ft=S.filter(Mt=>Mt.id).map(Mt=>Mt.id),Nt=Le.filter(Mt=>!ft.includes(Mt));Nt.length>0&&await ee.from("brokerage_resource_links").delete().in("id",Nt)}else{const{data:mt,error:rt}=await ee.from("brokerage_resources").insert(Xe).select().single();if(rt)throw rt;ge=mt.id}for(let mt=0;mt{t.invalidateQueries({queryKey:["brokerage-resources"]}),t.invalidateQueries({queryKey:["brokerage-resource-pdfs"]}),t.invalidateQueries({queryKey:["brokerage-resource-videos"]}),t.invalidateQueries({queryKey:["brokerage-resource-links"]}),Ge.success(s?"Resource updated":"Resource created"),n(!1),se(),A(!1)},onError:Te=>{Ge.error("Failed to save resource: "+Te.message),A(!1)}}),Pe=cr({mutationFn:async Te=>{const{error:Xe}=await ee.from("brokerage_resources").delete().eq("id",Te);if(Xe)throw Xe},onSuccess:()=>{t.invalidateQueries({queryKey:["brokerage-resources"]}),t.invalidateQueries({queryKey:["brokerage-resource-pdfs"]}),t.invalidateQueries({queryKey:["brokerage-resource-videos"]}),t.invalidateQueries({queryKey:["brokerage-resource-links"]}),Ge.success("Resource deleted")},onError:Te=>{Ge.error("Failed to delete: "+Te.message)}}),Ae=Te=>{if(Te.preventDefault(),!o.title){Ge.error("Please enter a title");return}$e.mutate()},nt=Te=>{const Xe=(Z==null?void 0:Z.filter(rt=>rt.resource_id===Te).length)||0,ge=(re==null?void 0:re.filter(rt=>rt.resource_id===Te).length)||0,mt=(he==null?void 0:he.filter(rt=>rt.resource_id===Te).length)||0;return{pdfCount:Xe,videoCount:ge,linkCount:mt}};return r.jsx(Or,{title:"Brokerage Resources Management",description:"Create and manage resources for brokerage managers",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs(Ye,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-muted-foreground",children:"Total Resources"})}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:(W==null?void 0:W.length)||0})})]}),r.jsxs(Ye,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:(W==null?void 0:W.filter(Te=>Te.is_published).length)||0})})]})]}),r.jsxs(te,{onClick:()=>{se(),n(!0)},children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Add Resource"]})]}),r.jsx(Ye,{children:r.jsx(Je,{className:"p-0",children:r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"Title"}),r.jsx(At,{children:"Category"}),r.jsx(At,{children:"Content"}),r.jsx(At,{children:"Publish Date"}),r.jsx(At,{children:"Status"}),r.jsx(At,{className:"text-right",children:"Actions"})]})}),r.jsx(qs,{children:K?r.jsx(Er,{children:r.jsx(_t,{colSpan:6,className:"text-center py-8",children:"Loading..."})}):(W==null?void 0:W.length)===0?r.jsx(Er,{children:r.jsx(_t,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No brokerage resources yet. Create your first one!"})}):W==null?void 0:W.map(Te=>{const{pdfCount:Xe,videoCount:ge,linkCount:mt}=nt(Te.id),rt=ue==null?void 0:ue.find(We=>We.id===Te.category_id);return r.jsxs(Er,{children:[r.jsx(_t,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[Te.preview_image_url?r.jsx("img",{src:Te.preview_image_url,alt:Te.title,className:"w-10 h-10 rounded object-cover"}):r.jsx("div",{className:"w-10 h-10 rounded bg-muted flex items-center justify-center",children:r.jsx(dh,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Te.title}),Te.description&&r.jsx("div",{className:"text-sm text-muted-foreground line-clamp-1",children:Te.description})]})]})}),r.jsx(_t,{children:rt?r.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-muted",children:rt.name}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(_t,{children:r.jsxs("div",{className:"flex items-center gap-3 text-sm text-muted-foreground",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ai,{className:"h-3.5 w-3.5"}),Xe]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Gi,{className:"h-3.5 w-3.5"}),ge]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(bo,{className:"h-3.5 w-3.5"}),mt]})]})}),r.jsx(_t,{children:un(new Date(Te.publish_date),"MMM d, yyyy")}),r.jsx(_t,{children:r.jsx("span",{className:`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${Te.is_published?"bg-green-100 text-green-800":"bg-yellow-100 text-yellow-800"}`,children:Te.is_published?"Published":"Draft"})}),r.jsx(_t,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>{const We=(Z==null?void 0:Z.filter(Fe=>Fe.resource_id===Te.id))||[],Ce=(re==null?void 0:re.filter(Fe=>Fe.resource_id===Te.id))||[],et=(he==null?void 0:he.filter(Fe=>Fe.resource_id===Te.id))||[];$({...Te,pdfs:We,videos:Ce,links:et})},children:r.jsx(Ml,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>xe(Te),children:r.jsx(ma,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>{confirm("Delete this resource?")&&Pe.mutate(Te.id)},children:r.jsx(Xn,{className:"h-4 w-4 text-destructive"})})]})})]},Te.id)})})]})})}),r.jsx($r,{open:e,onOpenChange:n,children:r.jsxs(zr,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Zr,{children:r.jsx(Kr,{children:s?"Edit Brokerage Resource":"Add Brokerage Resource"})}),r.jsxs("form",{onSubmit:Ae,className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Preview Image"}),r.jsxs("div",{className:"flex items-center gap-4",children:[m?r.jsx("img",{src:m,alt:"Preview",className:"w-24 h-24 rounded object-cover"}):r.jsx("div",{className:"w-24 h-24 rounded bg-muted flex items-center justify-center",children:r.jsx(dh,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx(yt,{type:"file",accept:"image/*",onChange:ie})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"title",children:"Title *"}),r.jsx(yt,{id:"title",value:o.title,onChange:Te=>c({...o,title:Te.target.value}),placeholder:"Resource Title"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Qe,{className:"flex items-center gap-2",children:[r.jsx(Gw,{className:"h-4 w-4"}),"Category"]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(_n,{value:o.category_id,onValueChange:Te=>c({...o,category_id:Te}),children:[r.jsx(xn,{className:"flex-1",children:r.jsx(bn,{placeholder:"Select a category"})}),r.jsx(vn,{children:ue==null?void 0:ue.map(Te=>r.jsx(er,{value:Te.id,children:Te.name},Te.id))})]}),o.category_id&&r.jsx(te,{type:"button",variant:"ghost",size:"icon",onClick:()=>c({...o,category_id:""}),children:r.jsx(Ms,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(yt,{placeholder:"Or create new category...",value:F,onChange:Te=>q(Te.target.value),className:"flex-1"}),r.jsxs(te,{type:"button",variant:"outline",size:"sm",disabled:!F.trim()||Re.isPending,onClick:()=>Re.mutate(F.trim()),children:[r.jsx(Sn,{className:"h-4 w-4 mr-1"}),"Add"]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Description"}),r.jsx(Qy,{content:o.description,onChange:Te=>c({...o,description:Te}),placeholder:"Brief description of this resource",minHeight:"120px"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(yt,{id:"publish_date",type:"date",value:o.publish_date,onChange:Te=>c({...o,publish_date:Te.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Published"}),r.jsxs("div",{className:"flex items-center space-x-2 pt-2",children:[r.jsx(Zs,{checked:o.is_published,onCheckedChange:Te=>c({...o,is_published:Te})}),r.jsx("span",{className:"text-sm text-muted-foreground",children:o.is_published?"Visible to brokerage managers":"Hidden from brokerage managers"})]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Qe,{className:"flex items-center gap-2",children:[r.jsx(Ai,{className:"h-4 w-4"}),"PDF Documents (",v.length,")"]}),r.jsxs(te,{type:"button",variant:"outline",size:"sm",onClick:me,children:[r.jsx(Sn,{className:"h-4 w-4 mr-1"}),"Add PDF"]})]}),v.map((Te,Xe)=>r.jsxs("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-muted/50",children:[r.jsx(yt,{placeholder:"PDF Name",value:Te.name,onChange:ge=>ve(Xe,"name",ge.target.value),className:"flex-1"}),r.jsx(yt,{type:"file",accept:".pdf",onChange:ge=>{var rt;const mt=(rt=ge.target.files)==null?void 0:rt[0];mt&&ve(Xe,"file",mt)},className:"flex-1"}),Te.file_url&&!Te.file&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Uploaded"}),r.jsx(te,{type:"button",variant:"ghost",size:"icon",onClick:()=>fe(Xe),children:r.jsx(Ms,{className:"h-4 w-4"})})]},Xe))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Qe,{className:"flex items-center gap-2",children:[r.jsx(Gi,{className:"h-4 w-4"}),"Videos (",k.length,")"]}),r.jsxs(te,{type:"button",variant:"outline",size:"sm",onClick:Ie,children:[r.jsx(Sn,{className:"h-4 w-4 mr-1"}),"Add Video"]})]}),k.map((Te,Xe)=>r.jsxs("div",{className:"space-y-2 p-3 border rounded-lg bg-muted/50",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(yt,{placeholder:"Video Title",value:Te.title,onChange:ge=>oe(Xe,"title",ge.target.value),className:"flex-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"icon",onClick:()=>Se(Xe),children:r.jsx(Ms,{className:"h-4 w-4"})})]}),r.jsx(yt,{type:"file",accept:"video/*",onChange:ge=>{var rt;const mt=(rt=ge.target.files)==null?void 0:rt[0];mt&&oe(Xe,"file",mt)}}),Te.uploadProgress!==void 0&&Te.uploadProgress>0&&r.jsx("div",{className:"w-full bg-muted rounded-full h-2",children:r.jsx("div",{className:"bg-primary h-2 rounded-full transition-all",style:{width:`${Te.uploadProgress}%`}})}),Te.video_url&&!Te.file&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Video uploaded"})]},Xe))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Qe,{className:"flex items-center gap-2",children:[r.jsx(bo,{className:"h-4 w-4"}),"Canva Links (",S.length,")"]}),r.jsxs(te,{type:"button",variant:"outline",size:"sm",onClick:ae,children:[r.jsx(Sn,{className:"h-4 w-4 mr-1"}),"Add Link"]})]}),S.map((Te,Xe)=>r.jsxs("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-muted/50",children:[r.jsx(yt,{placeholder:"Link Title",value:Te.title,onChange:ge=>Me(Xe,"title",ge.target.value),className:"flex-1"}),r.jsx(yt,{placeholder:"Canva Share Link",value:Te.canva_share_link,onChange:ge=>Me(Xe,"canva_share_link",ge.target.value),className:"flex-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"icon",onClick:()=>je(Xe),children:r.jsx(Ms,{className:"h-4 w-4"})})]},Xe))]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>n(!1),children:"Cancel"}),r.jsx(te,{type:"submit",disabled:$e.isPending||I,children:$e.isPending||I?"Saving...":s?"Update":"Create"})]})]})]})}),r.jsx($r,{open:!!D,onOpenChange:()=>$(null),children:r.jsxs(zr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Zr,{children:r.jsx(Kr,{children:D==null?void 0:D.title})}),D&&r.jsxs("div",{className:"space-y-4",children:[D.preview_image_url&&r.jsx("img",{src:D.preview_image_url,alt:D.title,className:"w-full h-48 object-cover rounded-lg"}),D.description&&r.jsx("p",{className:"text-muted-foreground",children:D.description}),D.pdfs&&D.pdfs.length>0&&r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2 flex items-center gap-2",children:[r.jsx(Ai,{className:"h-4 w-4"}),"PDF Documents (",D.pdfs.length,")"]}),r.jsx("div",{className:"space-y-1",children:D.pdfs.map(Te=>r.jsx("a",{href:Te.file_url,target:"_blank",rel:"noopener noreferrer",className:"block p-2 border rounded hover:bg-muted",children:Te.name},Te.id))})]}),D.videos&&D.videos.length>0&&r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2 flex items-center gap-2",children:[r.jsx(Gi,{className:"h-4 w-4"}),"Videos (",D.videos.length,")"]}),r.jsx("div",{className:"space-y-2",children:D.videos.map(Te=>r.jsx("div",{className:"p-2 border rounded",children:r.jsx("p",{className:"font-medium text-sm",children:Te.title})},Te.id))})]}),D.links&&D.links.length>0&&r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2 flex items-center gap-2",children:[r.jsx(bo,{className:"h-4 w-4"}),"Canva Links (",D.links.length,")"]}),r.jsx("div",{className:"space-y-1",children:D.links.map(Te=>r.jsx("a",{href:Te.canva_share_link,target:"_blank",rel:"noopener noreferrer",className:"block p-2 border rounded hover:bg-muted",children:Te.title},Te.id))})]})]})]})})]})})}const tze=[{value:"events",label:"After Events Section"},{value:"academy",label:"After Academy Section"},{value:"toolbox",label:"After Toolbox Section"},{value:"templates",label:"After Templates Section"},{value:"apps",label:"After Apps Section"}];function K2t(){const[t,e]=P.useState([]),[n,s]=P.useState(!0),[i,o]=P.useState(!1),[c,a]=P.useState(!1),[f,m]=P.useState(null),[y,v]=P.useState(!1),[w,k]=P.useState(!1),[C,S]=P.useState(""),[T,I]=P.useState(""),[A,D]=P.useState(""),[$,F]=P.useState(""),[q,W]=P.useState("Learn More"),[K,Z]=P.useState("top"),[re,he]=P.useState(""),[ue,Ne]=P.useState(!0),[se,xe]=P.useState(""),[ie,me]=P.useState("");P.useEffect(()=>{fe()},[]);const fe=async()=>{try{const{data:Re,error:$e}=await ee.from("dashboard_banners").select("*").order("placement").order("sort_order");if($e)throw $e;e(Re||[])}catch(Re){Ge.error("Failed to load banners: "+Re.message)}finally{s(!1)}},ve=()=>{S(""),I(""),D(""),F(""),W("Learn More"),Z("top"),he(""),Ne(!0),xe(""),me(""),m(null)},Ie=Re=>{m(Re),S(Re.title),I(Re.description||""),D(Re.image_url),F(Re.link_url||""),W(Re.link_text||"Learn More"),Z(Re.placement),he(Re.section_after||""),Ne(Re.is_active),xe(Re.start_date?un(new Date(Re.start_date),"yyyy-MM-dd'T'HH:mm"):""),me(Re.end_date?un(new Date(Re.end_date),"yyyy-MM-dd'T'HH:mm"):""),o(!0)},Se=async Re=>{var Pe;const $e=(Pe=Re.target.files)==null?void 0:Pe[0];if($e){v(!0);try{const Ae=$e.name.split(".").pop(),nt=`${Date.now()}.${Ae}`,{error:Te}=await ee.storage.from("banner-images").upload(nt,$e);if(Te)throw Te;const{data:{publicUrl:Xe}}=ee.storage.from("banner-images").getPublicUrl(nt);D(Xe),Ge.success("Image uploaded successfully")}catch(Ae){Ge.error("Failed to upload image: "+Ae.message)}finally{v(!1)}}},oe=async()=>{if(!C.trim()||!A){Ge.error("Please fill in required fields (title and image)");return}k(!0);try{const Re={title:C.trim(),description:T.trim()||null,image_url:A,link_url:$.trim()||null,link_text:q.trim()||"Learn More",placement:K,section_after:K==="between"?re:null,is_active:ue,start_date:se?new Date(se).toISOString():null,end_date:ie?new Date(ie).toISOString():null};if(f){const{error:$e}=await ee.from("dashboard_banners").update(Re).eq("id",f.id);if($e)throw $e;Ge.success("Banner updated successfully")}else{const $e=t.filter(Ae=>Ae.placement===K).length,{error:Pe}=await ee.from("dashboard_banners").insert({...Re,sort_order:$e});if(Pe)throw Pe;Ge.success("Banner created successfully")}o(!1),ve(),fe()}catch(Re){Ge.error("Failed to save banner: "+Re.message)}finally{k(!1)}},ae=async()=>{if(f)try{const{error:Re}=await ee.from("dashboard_banners").delete().eq("id",f.id);if(Re)throw Re;Ge.success("Banner deleted successfully"),a(!1),m(null),fe()}catch(Re){Ge.error("Failed to delete banner: "+Re.message)}},je=async Re=>{try{const{error:$e}=await ee.from("dashboard_banners").update({is_active:!Re.is_active}).eq("id",Re.id);if($e)throw $e;Ge.success(Re.is_active?"Banner deactivated":"Banner activated"),fe()}catch($e){Ge.error("Failed to update banner: "+$e.message)}},Me=t.filter(Re=>Re.placement==="top"),Ue=t.filter(Re=>Re.placement==="between");return n?r.jsx(Or,{title:"Dashboard Management",children:r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})})}):r.jsxs(Or,{title:"Dashboard Management",description:"Configure dashboard modules and banners",children:[r.jsxs("div",{className:"space-y-8",children:[r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(Wo,{className:"h-5 w-5"}),"Hero Banners (Top of Dashboard)"]}),r.jsx(An,{children:"These banners appear in a rotating carousel at the top of the dashboard"})]}),r.jsxs($r,{open:i&&K==="top",onOpenChange:Re=>{Re||ve(),o(Re),Re&&Z("top")},children:[r.jsx(Lo,{asChild:!0,children:r.jsxs(te,{onClick:()=>{ve(),Z("top")},children:[r.jsx(Sn,{className:"mr-2 h-4 w-4"}),"Add Hero Banner"]})}),r.jsxs(zr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(Zr,{children:[r.jsxs(Kr,{children:[f?"Edit":"Create"," Banner"]}),r.jsx(ls,{children:"Configure the banner's content and display settings"})]}),r.jsx(BNe,{title:C,setTitle:S,description:T,setDescription:I,imageUrl:A,linkUrl:$,setLinkUrl:F,linkText:q,setLinkText:W,placement:K,setPlacement:Z,sectionAfter:re,setSectionAfter:he,isActive:ue,setIsActive:Ne,startDate:se,setStartDate:xe,endDate:ie,setEndDate:me,handleImageUpload:Se,uploading:y,showPlacementOptions:!1}),r.jsxs(ni,{children:[r.jsx(te,{variant:"outline",onClick:()=>{o(!1),ve()},children:"Cancel"}),r.jsx(te,{onClick:oe,disabled:w,children:w?"Saving...":f?"Update Banner":"Create Banner"})]})]})]})]}),r.jsx(Je,{children:Me.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No hero banners yet. Add your first banner above."}):r.jsx("div",{className:"space-y-3",children:Me.map(Re=>r.jsx($Ne,{banner:Re,onEdit:()=>Ie(Re),onDelete:()=>{m(Re),a(!0)},onToggleActive:()=>je(Re)},Re.id))})})]}),r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(Wo,{className:"h-5 w-5"}),"Section Banners"]}),r.jsx(An,{children:"These banners appear between dashboard content sections"})]}),r.jsxs($r,{open:i&&K==="between",onOpenChange:Re=>{Re||ve(),o(Re),Re&&Z("between")},children:[r.jsx(Lo,{asChild:!0,children:r.jsxs(te,{onClick:()=>{ve(),Z("between")},children:[r.jsx(Sn,{className:"mr-2 h-4 w-4"}),"Add Section Banner"]})}),r.jsxs(zr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(Zr,{children:[r.jsxs(Kr,{children:[f?"Edit":"Create"," Section Banner"]}),r.jsx(ls,{children:"Configure where this banner appears between sections"})]}),r.jsx(BNe,{title:C,setTitle:S,description:T,setDescription:I,imageUrl:A,linkUrl:$,setLinkUrl:F,linkText:q,setLinkText:W,placement:K,setPlacement:Z,sectionAfter:re,setSectionAfter:he,isActive:ue,setIsActive:Ne,startDate:se,setStartDate:xe,endDate:ie,setEndDate:me,handleImageUpload:Se,uploading:y,showPlacementOptions:!0}),r.jsxs(ni,{children:[r.jsx(te,{variant:"outline",onClick:()=>{o(!1),ve()},children:"Cancel"}),r.jsx(te,{onClick:oe,disabled:w,children:w?"Saving...":f?"Update Banner":"Create Banner"})]})]})]})]}),r.jsx(Je,{children:Ue.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No section banners yet. Add your first banner above."}):r.jsx("div",{className:"space-y-3",children:Ue.map(Re=>r.jsx($Ne,{banner:Re,onEdit:()=>Ie(Re),onDelete:()=>{m(Re),a(!0)},onToggleActive:()=>je(Re),showSection:!0},Re.id))})})]})]}),r.jsx($r,{open:c,onOpenChange:a,children:r.jsxs(zr,{children:[r.jsxs(Zr,{children:[r.jsx(Kr,{children:"Delete Banner"}),r.jsxs(ls,{children:['Are you sure you want to delete "',f==null?void 0:f.title,'"? This action cannot be undone.']})]}),r.jsxs(ni,{children:[r.jsx(te,{variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsx(te,{variant:"destructive",onClick:ae,children:"Delete"})]})]})})]})}function BNe({title:t,setTitle:e,description:n,setDescription:s,imageUrl:i,linkUrl:o,setLinkUrl:c,linkText:a,setLinkText:f,placement:m,setPlacement:y,sectionAfter:v,setSectionAfter:w,isActive:k,setIsActive:C,startDate:S,setStartDate:T,endDate:I,setEndDate:A,handleImageUpload:D,uploading:$,showPlacementOptions:F}){return r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"title",children:"Title *"}),r.jsx(yt,{id:"title",placeholder:"Banner headline...",value:t,onChange:q=>e(q.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",placeholder:"Optional banner description...",value:n,onChange:q=>s(q.target.value),rows:2})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Banner Image *"}),r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(yt,{type:"file",accept:"image/*",onChange:D,disabled:$,className:"flex-1"}),$&&r.jsx("span",{className:"text-sm text-muted-foreground",children:"Uploading..."})]}),i&&r.jsx("div",{className:"mt-2 relative rounded-lg overflow-hidden border",children:r.jsx("img",{src:i,alt:"Preview",className:"w-full h-40 object-cover"})})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"linkUrl",children:"Link URL (optional)"}),r.jsx(yt,{id:"linkUrl",placeholder:"https://...",value:o,onChange:q=>c(q.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"linkText",children:"Button Text"}),r.jsx(yt,{id:"linkText",placeholder:"Learn More",value:a,onChange:q=>f(q.target.value)})]})]}),F&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Placement"}),r.jsxs(_n,{value:v,onValueChange:w,children:[r.jsx(xn,{children:r.jsx(bn,{placeholder:"Select section placement..."})}),r.jsx(vn,{children:tze.map(q=>r.jsx(er,{value:q.value,children:q.label},q.value))})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Qe,{htmlFor:"startDate",className:"flex items-center gap-2",children:[r.jsx(li,{className:"h-4 w-4"}),"Start Date (optional)"]}),r.jsx(yt,{id:"startDate",type:"datetime-local",value:S,onChange:q=>T(q.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Qe,{htmlFor:"endDate",className:"flex items-center gap-2",children:[r.jsx(li,{className:"h-4 w-4"}),"End Date (optional)"]}),r.jsx(yt,{id:"endDate",type:"datetime-local",value:I,onChange:q=>A(q.target.value)})]})]}),r.jsx("div",{className:"flex items-center justify-between pt-2",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Zs,{id:"isActive",checked:k,onCheckedChange:C}),r.jsx(Qe,{htmlFor:"isActive",children:"Active"})]})})]})}function $Ne({banner:t,onEdit:e,onDelete:n,onToggleActive:s,showSection:i=!1}){var c;const o=(c=tze.find(a=>a.value===t.section_after))==null?void 0:c.label;return r.jsxs("div",{className:"flex items-center gap-4 p-3 border rounded-lg bg-card hover:bg-accent/50 transition-colors",children:[r.jsx(DS,{className:"h-5 w-5 text-muted-foreground cursor-grab"}),r.jsx("img",{src:t.image_url,alt:t.title,className:"w-24 h-14 object-cover rounded"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h4",{className:"font-medium truncate",children:t.title}),!t.is_active&&r.jsx(Rt,{variant:"secondary",children:"Inactive"}),t.start_date&&new Date(t.start_date)>new Date&&r.jsx(Rt,{variant:"outline",children:"Scheduled"})]}),t.description&&r.jsx("p",{className:"text-sm text-muted-foreground truncate",children:t.description}),i&&o&&r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:o})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[t.link_url&&r.jsx("a",{href:t.link_url,target:"_blank",rel:"noopener noreferrer",children:r.jsx(te,{variant:"ghost",size:"icon",children:r.jsx(Fs,{className:"h-4 w-4"})})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:s,children:t.is_active?r.jsx(Ml,{className:"h-4 w-4"}):r.jsx($w,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:e,children:r.jsx(ma,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:n,children:r.jsx(Xn,{className:"h-4 w-4 text-destructive"})})]})]})}const xL={open:{label:"Open",icon:Xi,color:"bg-yellow-500"},in_progress:{label:"In Progress",icon:Hl,color:"bg-blue-500"},resolved:{label:"Resolved",icon:za,color:"bg-green-500"},closed:{label:"Closed",icon:Lc,color:"bg-muted-foreground"}},UNe={general:"General Support",technology:"Technology Support",crm:"CRM Support",marketing:"Marketing Support"};function Z2t(){var q,W;const{user:t}=Fr(),e=Xr(),[n,s]=P.useState(null),[i,o]=P.useState(""),[c,a]=P.useState("all"),[f,m]=P.useState("all"),[y,v]=P.useState(!1),{data:w=[],isLoading:k}=rr({queryKey:["admin-support-tickets",c,f],queryFn:async()=>{let K=ee.from("support_tickets").select("*, profiles!support_tickets_user_id_fkey(name, email)").order("created_at",{ascending:!1});c!=="all"&&(K=K.eq("status",c)),f!=="all"&&(K=K.eq("category",f));const{data:Z,error:re}=await K;if(re)throw re;return Z}}),{data:C=[]}=rr({queryKey:["admin-users-notifications"],queryFn:async()=>{const{data:K,error:Z}=await ee.from("user_roles").select("user_id").eq("role","admin");if(Z)throw Z;const re=K.map(ie=>ie.user_id),{data:he,error:ue}=await ee.from("profiles").select("id, name, email").in("id",re);if(ue)throw ue;const{data:Ne,error:se}=await ee.from("support_notification_settings").select("user_id, receive_notifications");if(se)throw se;const xe=new Map((Ne==null?void 0:Ne.map(ie=>[ie.user_id,ie.receive_notifications]))||[]);return he.map(ie=>({...ie,receives_notifications:xe.get(ie.id)||!1}))}}),{data:S=[]}=rr({queryKey:["admin-ticket-replies",n==null?void 0:n.id],queryFn:async()=>{if(!n)return[];const{data:K,error:Z}=await ee.from("support_ticket_replies").select("*, profiles(name)").eq("ticket_id",n.id).order("created_at",{ascending:!0});if(Z)throw Z;return K},enabled:!!n}),T=cr({mutationFn:async({userId:K,enabled:Z})=>{const{data:re}=await ee.from("support_notification_settings").select("id").eq("user_id",K).maybeSingle();if(re){const{error:he}=await ee.from("support_notification_settings").update({receive_notifications:Z}).eq("user_id",K);if(he)throw he}else{const{error:he}=await ee.from("support_notification_settings").insert({user_id:K,receive_notifications:Z});if(he)throw he}},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-users-notifications"]}),Ge.success("Notification settings updated")},onError:()=>{Ge.error("Failed to update settings")}}),I=cr({mutationFn:async({ticketId:K,status:Z})=>{const{error:re}=await ee.from("support_tickets").update({status:Z}).eq("id",K);if(re)throw re},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-support-tickets"]}),n&&s({...n,status:n.status}),Ge.success("Status updated")},onError:()=>{Ge.error("Failed to update status")}}),A=cr({mutationFn:async({ticketId:K,assignedTo:Z})=>{const{error:re}=await ee.from("support_tickets").update({assigned_to:Z}).eq("id",K);if(re)throw re},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-support-tickets"]}),Ge.success("Ticket assigned")},onError:()=>{Ge.error("Failed to assign ticket")}}),D=cr({mutationFn:async K=>{var re,he;if(!n||!t)throw new Error("Missing data");const{error:Z}=await ee.from("support_ticket_replies").insert({ticket_id:n.id,user_id:t.id,content:K,is_admin_reply:!0});if(Z)throw Z;try{await ee.functions.invoke("support-reply-notify",{body:{ticketId:n.id,ticketSubject:n.subject,replyContent:K,userEmail:(re=n.profiles)==null?void 0:re.email,userName:(he=n.profiles)==null?void 0:he.name}})}catch(ue){console.error("Failed to send reply notification:",ue)}},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-ticket-replies",n==null?void 0:n.id]}),o(""),Ge.success("Reply sent!")},onError:()=>{Ge.error("Failed to send reply")}}),$=()=>{i.trim()&&D.mutate(i)};P.useEffect(()=>{const K=ee.channel("admin-tickets").on("postgres_changes",{event:"*",schema:"public",table:"support_tickets"},()=>{e.invalidateQueries({queryKey:["admin-support-tickets"]})}).subscribe();return()=>{ee.removeChannel(K)}},[e]);const F=w.filter(K=>K.status==="open").length;return n?(xL[n.status].icon,r.jsx(Or,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>s(null),children:r.jsx(Va,{className:"h-5 w-5"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h1",{className:"text-2xl font-bold",children:n.subject}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx(Rt,{variant:"secondary",children:UNe[n.category]}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:["from ",((q=n.profiles)==null?void 0:q.name)||"Unknown"," (",(W=n.profiles)==null?void 0:W.email,")"]})]})]})]}),r.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[r.jsxs(Ye,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm",children:"Status"})}),r.jsx(Je,{children:r.jsxs(_n,{value:n.status,onValueChange:K=>{I.mutate({ticketId:n.id,status:K}),s({...n,status:K})},children:[r.jsx(xn,{children:r.jsx(bn,{})}),r.jsxs(vn,{children:[r.jsx(er,{value:"open",children:"Open"}),r.jsx(er,{value:"in_progress",children:"In Progress"}),r.jsx(er,{value:"resolved",children:"Resolved"}),r.jsx(er,{value:"closed",children:"Closed"})]})]})})]}),r.jsxs(Ye,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm",children:"Assigned To"})}),r.jsx(Je,{children:r.jsxs(_n,{value:n.assigned_to||"unassigned",onValueChange:K=>{const Z=K==="unassigned"?null:K;A.mutate({ticketId:n.id,assignedTo:Z}),s({...n,assigned_to:Z})},children:[r.jsx(xn,{children:r.jsx(bn,{placeholder:"Unassigned"})}),r.jsxs(vn,{children:[r.jsx(er,{value:"unassigned",children:"Unassigned"}),C.map(K=>r.jsx(er,{value:K.id,children:K.name},K.id))]})]})})]})]}),r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsxs(An,{children:["Created on ",un(new Date(n.created_at),"MMM d, yyyy 'at' h:mm a")]})}),r.jsx(Je,{children:r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:n.description})})]}),r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsx(Yt,{className:"text-lg",children:"Conversation"})}),r.jsxs(Je,{children:[r.jsx(xl,{className:"h-[300px] pr-4",children:S.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No replies yet"}):r.jsx("div",{className:"space-y-4",children:S.map(K=>{var Z,re;return r.jsxs("div",{className:`p-4 rounded-lg ${K.is_admin_reply?"bg-primary/10 ml-4":"bg-muted mr-4"}`,children:[r.jsxs("div",{className:"flex justify-between items-start mb-2",children:[r.jsx("span",{className:"font-medium text-sm",children:K.is_admin_reply?`${((Z=K.profiles)==null?void 0:Z.name)||"Admin"} (Support)`:((re=K.profiles)==null?void 0:re.name)||"User"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:un(new Date(K.created_at),"MMM d, h:mm a")})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:K.content})]},K.id)})})}),r.jsx(Vd,{className:"my-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ps,{placeholder:"Type your reply...",value:i,onChange:K=>o(K.target.value),className:"min-h-[80px]"}),r.jsx(te,{onClick:$,disabled:!i.trim()||D.isPending,className:"self-end",children:r.jsx(To,{className:"h-4 w-4"})})]})]})]})]})})):r.jsx(Or,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Support Tickets"}),r.jsxs("p",{className:"text-muted-foreground",children:["Manage support requests from agents",F>0&&r.jsxs(Rt,{variant:"destructive",className:"ml-2",children:[F," open"]})]})]}),r.jsxs($r,{open:y,onOpenChange:v,children:[r.jsx(Lo,{asChild:!0,children:r.jsxs(te,{variant:"outline",children:[r.jsx(id,{className:"h-4 w-4 mr-2"}),"Notification Settings"]})}),r.jsxs(zr,{children:[r.jsxs(Zr,{children:[r.jsx(Kr,{children:"Email Notification Settings"}),r.jsx(ls,{children:"Choose which admins receive email notifications for new support tickets."})]}),r.jsx("div",{className:"space-y-4 mt-4",children:C.map(K=>r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(jc,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:K.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:K.email})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[K.receives_notifications?r.jsx(ag,{className:"h-4 w-4 text-primary"}):r.jsx(Ow,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(Zs,{checked:K.receives_notifications,onCheckedChange:Z=>T.mutate({userId:K.id,enabled:Z})})]})]},K.id))})]})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-4 items-center",children:[r.jsx(La,{value:c,onValueChange:a,className:"w-auto",children:r.jsxs(Ma,{children:[r.jsx(yn,{value:"all",children:"All"}),r.jsx(yn,{value:"open",children:"Open"}),r.jsx(yn,{value:"in_progress",children:"In Progress"}),r.jsx(yn,{value:"resolved",children:"Resolved"}),r.jsx(yn,{value:"closed",children:"Closed"})]})}),r.jsxs(_n,{value:f,onValueChange:m,children:[r.jsx(xn,{className:"w-[180px]",children:r.jsx(bn,{placeholder:"All Categories"})}),r.jsxs(vn,{children:[r.jsx(er,{value:"all",children:"All Categories"}),r.jsx(er,{value:"general",children:"General Support"}),r.jsx(er,{value:"technology",children:"Technology Support"}),r.jsx(er,{value:"crm",children:"CRM Support"}),r.jsx(er,{value:"marketing",children:"Marketing Support"})]})]})]}),r.jsx("div",{className:"mt-4",children:k?r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading tickets..."}):w.length===0?r.jsx(Ye,{children:r.jsxs(Je,{className:"text-center py-12",children:[r.jsx(Hl,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No tickets found"}),r.jsx("p",{className:"text-muted-foreground",children:"No support tickets match the current filters."})]})}):r.jsx("div",{className:"space-y-3",children:w.map(K=>{var re,he;const Z=xL[K.status].icon;return r.jsx(Ye,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>s(K),children:r.jsx(Je,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-medium truncate",children:K.subject}),r.jsxs("div",{className:"flex items-center gap-2 mt-1 flex-wrap",children:[r.jsx(Rt,{variant:"outline",className:"text-xs",children:UNe[K.category]}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[(re=K.profiles)==null?void 0:re.name," • ",un(new Date(K.created_at),"MMM d, yyyy")]}),K.assigned_to&&r.jsxs(Rt,{variant:"secondary",className:"text-xs gap-1",children:[r.jsx(jc,{className:"h-3 w-3"}),((he=C.find(ue=>ue.id===K.assigned_to))==null?void 0:he.name)||"Assigned"]})]})]}),r.jsxs(Rt,{className:xL[K.status].color,children:[r.jsx(Z,{className:"h-3 w-3 mr-1"}),xL[K.status].label]})]})})},K.id)})})})]})]})})}const Y2t=Ad.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;return(e=t.style.color)===null||e===void 0?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}});function X2t({content:t,onChange:e,variables:n}){const s=OFe({extensions:[$Fe,XFe.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),QFe.configure({types:["heading","paragraph"]}),JFe,Y2t],content:t,onUpdate:({editor:c})=>{e(c.getHTML())}});P.useEffect(()=>{s&&t!==s.getHTML()&&s.commands.setContent(t)},[t,s]);const i=c=>{s&&s.chain().focus().insertContent(`{{${c.key}}}`).run()},o=()=>{if(!s)return;const c=s.getAttributes("link").href,a=window.prompt("URL",c);if(a!==null){if(a===""){s.chain().focus().extendMarkRange("link").unsetLink().run();return}s.chain().focus().extendMarkRange("link").setLink({href:a}).run()}};return s?r.jsxs("div",{className:"border rounded-lg overflow-hidden",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-1 p-2 border-b bg-muted/30",children:[r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleBold().run(),className:s.isActive("bold")?"bg-muted":"",children:r.jsx(IS,{className:"h-4 w-4"})}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleItalic().run(),className:s.isActive("italic")?"bg-muted":"",children:r.jsx(BS,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleBulletList().run(),className:s.isActive("bulletList")?"bg-muted":"",children:r.jsx(rm,{className:"h-4 w-4"})}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleOrderedList().run(),className:s.isActive("orderedList")?"bg-muted":"",children:r.jsx(VS,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().setTextAlign("left").run(),className:s.isActive({textAlign:"left"})?"bg-muted":"",children:r.jsx(TS,{className:"h-4 w-4"})}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().setTextAlign("center").run(),className:s.isActive({textAlign:"center"})?"bg-muted":"",children:r.jsx(MS,{className:"h-4 w-4"})}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().setTextAlign("right").run(),className:s.isActive({textAlign:"right"})?"bg-muted":"",children:r.jsx(AS,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:o,className:s.isActive("link")?"bg-muted":"",children:r.jsx(bo,{className:"h-4 w-4"})}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleCodeBlock().run(),className:s.isActive("codeBlock")?"bg-muted":"",children:r.jsx(zw,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().undo().run(),disabled:!s.can().undo(),children:r.jsx(QS,{className:"h-4 w-4"})}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().redo().run(),disabled:!s.can().redo(),children:r.jsx(YS,{className:"h-4 w-4"})}),r.jsx("div",{className:"flex-1"}),n.length>0&&r.jsxs(fm,{children:[r.jsx(pm,{asChild:!0,children:r.jsxs(te,{type:"button",variant:"outline",size:"sm",className:"gap-2",children:[r.jsx(ET,{className:"h-4 w-4"}),"Insert Variable"]})}),r.jsx(Xf,{align:"end",className:"w-64",children:n.map(c=>r.jsxs(uo,{onClick:()=>i(c),className:"flex flex-col items-start",children:[r.jsx("span",{className:"font-medium",children:c.label}),r.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:`{{${c.key}}}`}),c.description&&r.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:c.description})]},c.key))})]})]}),r.jsx(PFe,{editor:s,className:"prose prose-sm max-w-none p-4 min-h-[300px] focus:outline-none [&_.ProseMirror]:outline-none [&_.ProseMirror]:min-h-[280px]"}),n.length>0&&r.jsxs("div",{className:"border-t p-3 bg-muted/20",children:[r.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Available variables (click to copy):"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:n.map(c=>r.jsx(Rt,{variant:"secondary",className:"cursor-pointer hover:bg-secondary/80 font-mono text-xs",onClick:()=>{navigator.clipboard.writeText(`{{${c.key}}}`)},children:`{{${c.key}}}`},c.key))})]})]}):null}function Q2t(){const t=Xr(),[e,n]=P.useState(null),[s,i]=P.useState(null),[o,c]=P.useState(""),[a,f]=P.useState(""),[m,y]=P.useState(""),[v,w]=P.useState(!0),[k,C]=P.useState("visual"),{data:S,isLoading:T}=rr({queryKey:["email-templates"],queryFn:async()=>{const{data:F,error:q}=await ee.from("email_templates").select("*").order("name");if(q)throw q;return F.map(W=>({...W,available_variables:W.available_variables||[]}))}}),I=cr({mutationFn:async F=>{const{error:q}=await ee.from("email_templates").update({subject:F.subject,body_html:F.body_html,description:F.description,is_active:F.is_active}).eq("id",F.id);if(q)throw q},onSuccess:()=>{t.invalidateQueries({queryKey:["email-templates"]}),Ge.success("Email template updated successfully"),n(null)},onError:F=>{Ge.error("Failed to update template: "+F.message)}}),A=F=>{n(F),c(F.subject),f(F.body_html),y(F.description||""),w(F.is_active),C("visual")},D=()=>{e&&I.mutate({id:e.id,subject:o,body_html:a,description:m,is_active:v})},$=(F,q)=>{let W=F;return q.forEach(K=>{const Z=`{{${K.key}}}`,re=`[${K.label}]`;W=W.replace(new RegExp(Z.replace(/[{}]/g,"\\$&"),"g"),re)}),W};return e?r.jsxs(Or,{title:"Edit Email Template",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs(te,{variant:"ghost",onClick:()=>n(null),children:[r.jsx(Va,{className:"h-4 w-4 mr-2"}),"Back to Templates"]}),r.jsx("div",{className:"flex-1"}),r.jsxs(te,{variant:"outline",onClick:()=>i(e),children:[r.jsx(Ml,{className:"h-4 w-4 mr-2"}),"Preview"]}),r.jsxs(te,{onClick:D,disabled:I.isPending,children:[r.jsx(dg,{className:"h-4 w-4 mr-2"}),I.isPending?"Saving...":"Save Changes"]})]}),r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(di,{className:"h-5 w-5"}),e.name]}),r.jsxs(An,{className:"mt-1",children:["Template slug: ",r.jsx("code",{className:"bg-muted px-1 rounded",children:e.slug})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Qe,{htmlFor:"active-toggle",children:"Active"}),r.jsx(Zs,{id:"active-toggle",checked:v,onCheckedChange:w})]})]})}),r.jsxs(Je,{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",value:m,onChange:F=>y(F.target.value),placeholder:"Brief description of when this email is sent",rows:2})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"subject",children:"Email Subject"}),r.jsx(yt,{id:"subject",value:o,onChange:F=>c(F.target.value),placeholder:"Email subject line"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["You can use variables like ","{{name}}"," in the subject"]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Qe,{children:"Email Body"}),r.jsx(La,{value:k,onValueChange:F=>C(F),children:r.jsxs(Ma,{className:"h-8",children:[r.jsxs(yn,{value:"visual",className:"text-xs px-3 h-6",children:[r.jsx(GS,{className:"h-3 w-3 mr-1"}),"Visual"]}),r.jsxs(yn,{value:"html",className:"text-xs px-3 h-6",children:[r.jsx(zw,{className:"h-3 w-3 mr-1"}),"HTML"]})]})})]}),k==="visual"?r.jsx(X2t,{content:a,onChange:f,variables:e.available_variables}):r.jsx(ps,{value:a,onChange:F=>f(F.target.value),className:"font-mono text-sm min-h-[400px]",placeholder:"HTML email body"})]})]})]})]}),r.jsx($r,{open:!!s,onOpenChange:()=>i(null),children:r.jsxs(zr,{className:"max-w-3xl max-h-[90vh] overflow-auto",children:[r.jsxs(Zr,{children:[r.jsx(Kr,{children:"Email Preview"}),r.jsxs(ls,{children:["Subject: ",o.replace(/\{\{(\w+)\}\}/g,"[$1]")]})]}),r.jsx("div",{className:"border rounded-lg p-4 bg-white",children:r.jsx("div",{dangerouslySetInnerHTML:{__html:$(a,e.available_variables)}})})]})})]}):r.jsx(Or,{title:"Email Templates",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Email Templates"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Manage and customize system email templates"})]}),T?r.jsx("div",{className:"grid gap-4",children:[...Array(4)].map((F,q)=>r.jsx(Ye,{children:r.jsxs(Ht,{children:[r.jsx(Gr,{className:"h-5 w-48"}),r.jsx(Gr,{className:"h-4 w-96"})]})},q))}):r.jsx("div",{className:"grid gap-4",children:S==null?void 0:S.map(F=>r.jsxs(Ye,{className:"hover:shadow-md transition-shadow",children:[r.jsx(Ht,{children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs(Yt,{className:"flex items-center gap-2 text-lg",children:[r.jsx(di,{className:"h-5 w-5 text-muted-foreground"}),F.name,!F.is_active&&r.jsx(Rt,{variant:"secondary",children:"Inactive"})]}),r.jsx(An,{children:F.description})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>i(F),children:[r.jsx(Ml,{className:"h-4 w-4 mr-2"}),"Preview"]}),r.jsxs(te,{size:"sm",onClick:()=>A(F),children:[r.jsx(Jl,{className:"h-4 w-4 mr-2"}),"Edit"]})]})]})}),r.jsx(Je,{children:r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Subject:"}),r.jsx("code",{className:"bg-muted px-2 py-0.5 rounded text-sm",children:F.subject})]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Variables:"}),r.jsx("div",{className:"flex flex-wrap gap-1",children:F.available_variables.map(q=>r.jsx(Rt,{variant:"outline",className:"font-mono text-xs",children:`{{${q.key}}}`},q.key))})]})]})})]},F.id))}),r.jsx($r,{open:!!s&&!e,onOpenChange:()=>i(null),children:r.jsxs(zr,{className:"max-w-3xl max-h-[90vh] overflow-auto",children:[r.jsxs(Zr,{children:[r.jsxs(Kr,{children:["Email Preview: ",s==null?void 0:s.name]}),r.jsxs(ls,{children:["Subject: ",s==null?void 0:s.subject.replace(/\{\{(\w+)\}\}/g,"[$1]")]})]}),s&&r.jsx("div",{className:"border rounded-lg p-4 bg-white",children:r.jsx("div",{dangerouslySetInnerHTML:{__html:$(s.body_html,s.available_variables)}})})]})})]})})}const J2t=({brokerageId:t})=>{var ba,Ka;const{toast:e}=la(),[n,s]=P.useState([]),[i,o]=P.useState(!0),[c,a]=P.useState(""),[f,m]=P.useState("all"),[y,v]=P.useState(new Set),[w,k]=P.useState(!1),[C,S]=P.useState(!1),[T,I]=P.useState(!1),[A,D]=P.useState({email:"",name:"",password:"",phone:""}),[$,F]=P.useState(!1),[q,W]=P.useState(null),[K,Z]=P.useState(!1),[re,he]=P.useState(!1),[ue,Ne]=P.useState(!1),[se,xe]=P.useState(""),[ie,me]=P.useState(!1),[fe,ve]=P.useState([]),[Ie,Se]=P.useState(!1),[oe,ae]=P.useState(!1),[je,Me]=P.useState(null),[Ue,Re]=P.useState({name:"",phone:"",email:""}),[$e,Pe]=P.useState(!1),[Ae,nt]=P.useState(!1),[Te,Xe]=P.useState(null),[ge,mt]=P.useState("asc"),[rt,We]=P.useState(!1),[Ce,et]=P.useState(null),[Fe,Ke]=P.useState(!1),[Le,ft]=P.useState(null),[Nt,Mt]=P.useState(""),[It,tr]=P.useState(!1),[Mr,pn]=P.useState(null);P.useEffect(()=>{Qn(),fs()},[t]);const fs=async()=>{try{const{data:dr,error:Ln}=await ee.from("brokerage_manager_assignments").select("user_id").eq("brokerage_id",t);if(Ln)throw Ln;ve((dr==null?void 0:dr.map(xt=>xt.user_id))||[])}catch(dr){console.error("Error loading brokerage managers:",dr)}},Qn=async()=>{try{o(!0);const{data:dr,error:Ln}=await ee.functions.invoke("get-brokerage-agents",{body:{brokerageId:t}});if(Ln)throw Ln;s(dr.agents||[])}catch(dr){console.error("Error loading agents:",dr),e({title:"Error",description:"Failed to load agents",variant:"destructive"})}finally{o(!1)}},js=async()=>{if(!A.email||!A.name||!A.password){e({title:"Error",description:"Please fill in all fields",variant:"destructive"});return}I(!0);try{const{data:{session:dr}}=await ee.auth.getSession(),Ln=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/create-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${dr==null?void 0:dr.access_token}`},body:JSON.stringify({...A,brokerageId:t})}),xt=await Ln.json();if(!Ln.ok)throw new Error(xt.error||"Failed to create agent");e({title:"Success",description:`Agent ${A.email} created successfully`}),D({email:"",name:"",password:"",phone:""}),S(!1),Qn()}catch(dr){console.error("Error creating agent:",dr),e({title:"Error",description:dr.message||"Failed to create agent",variant:"destructive"})}finally{I(!1)}},Qs=async dr=>{try{const{data:{session:Ln}}=await ee.auth.getSession(),xt=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Ln==null?void 0:Ln.access_token}`},body:JSON.stringify({userId:dr})}),_e=await xt.json();if(!xt.ok)throw new Error(_e.error||"Failed to resend welcome email");e({title:"Success",description:"Welcome email sent successfully"})}catch(Ln){console.error("Error resending welcome email:",Ln),e({title:"Error",description:Ln.message||"Failed to resend welcome email",variant:"destructive"})}},si=async(dr,Ln)=>{try{const{error:xt}=await ee.functions.invoke("send-password-reset",{body:{email:dr,redirectTo:window.location.origin}});if(xt)throw xt;e({title:"Password Reset Sent",description:`Password reset email sent to ${Ln}`})}catch(xt){console.error("Error sending password reset:",xt),e({title:"Error",description:xt.message||"Failed to send password reset email",variant:"destructive"})}},wr=dr=>{W(dr),F(!0)},Ts=dr=>{Me(dr),Re({name:dr.name,phone:dr.phone||"",email:dr.email}),ae(!0)},ii=async()=>{if(!je)return;if(!Ue.name.trim()){e({title:"Error",description:"Name is required",variant:"destructive"});return}const dr=Ue.email.trim().toLowerCase()!==je.email.toLowerCase();Pe(!0);try{if(dr){if(!Ue.email.trim())throw new Error("Email is required");nt(!0);const{data:{session:xt}}=await ee.auth.getSession(),_e=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/update-agent-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${xt==null?void 0:xt.access_token}`},body:JSON.stringify({agentId:je.id,newEmail:Ue.email.trim(),brokerageId:t})}),ze=await _e.json();if(nt(!1),!_e.ok)throw new Error(ze.error||"Failed to update email")}const{error:Ln}=await ee.from("profiles").update({name:Ue.name.trim(),phone:Ue.phone.trim()||null}).eq("id",je.id);if(Ln)throw Ln;e({title:"Success",description:"Agent profile updated successfully"}),ae(!1),Me(null),Qn()}catch(Ln){console.error("Error updating agent:",Ln),e({title:"Error",description:Ln.message||"Failed to update agent",variant:"destructive"})}finally{Pe(!1),nt(!1)}},mi=async()=>{if(!se){e({title:"Error",description:"Please select an agent to promote",variant:"destructive"});return}me(!0);try{const{data:{session:dr}}=await ee.auth.getSession(),Ln=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${dr==null?void 0:dr.access_token}`},body:JSON.stringify({userId:se,role:"brokerage_manager",action:"add",brokerageId:t})}),xt=await Ln.json();if(!Ln.ok)throw new Error(xt.error||"Failed to add brokerage manager");e({title:"Success",description:"Brokerage manager added successfully"}),Ne(!1),xe(""),fs()}catch(dr){console.error("Error adding brokerage manager:",dr),e({title:"Error",description:dr.message||"Failed to add brokerage manager",variant:"destructive"})}finally{me(!1)}},Ta=async dr=>{try{const{data:{session:Ln}}=await ee.auth.getSession(),xt=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Ln==null?void 0:Ln.access_token}`},body:JSON.stringify({userId:dr,role:"brokerage_manager",action:"remove",brokerageId:t})}),_e=await xt.json();if(!xt.ok)throw new Error(_e.error||"Failed to remove brokerage manager");e({title:"Success",description:"Brokerage manager role removed"}),fs()}catch(Ln){console.error("Error removing brokerage manager:",Ln),e({title:"Error",description:Ln.message||"Failed to remove brokerage manager",variant:"destructive"})}},ga=dr=>fe.includes(dr),vl=dr=>{ft(dr),Mt(""),Ke(!0)},Yo=async()=>{if(!(!Le||!Nt)){if(Nt.length<6){e({title:"Error",description:"Password must be at least 6 characters",variant:"destructive"});return}tr(!0);try{const{data:{session:dr}}=await ee.auth.getSession(),Ln=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/update-agent-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${dr==null?void 0:dr.access_token}`},body:JSON.stringify({agentId:Le.id,brokerageId:t,action:"set_password",newPassword:Nt})}),xt=await Ln.json();if(!Ln.ok)throw new Error(xt.error||"Failed to set password");e({title:"Success",description:`Password set for ${Le.name}`}),Ke(!1),ft(null),Mt("")}catch(dr){console.error("Error setting password:",dr),e({title:"Error",description:dr.message||"Failed to set password",variant:"destructive"})}finally{tr(!1)}}},Ds=async dr=>{pn(dr.id);try{const{data:{session:Ln}}=await ee.auth.getSession(),xt=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/update-agent-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Ln==null?void 0:Ln.access_token}`},body:JSON.stringify({agentId:dr.id,brokerageId:t,action:"claim_account"})}),_e=await xt.json();if(!xt.ok)throw new Error(_e.error||"Failed to claim account");e({title:"Success",description:`Account claimed for ${dr.name}`}),Qn()}catch(Ln){console.error("Error claiming account:",Ln),e({title:"Error",description:Ln.message||"Failed to claim account",variant:"destructive"})}finally{pn(null)}},Ki=async()=>{if(q){Z(!0);try{const{data:{session:dr}}=await ee.auth.getSession(),Ln=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/remove-agent",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${dr==null?void 0:dr.access_token}`},body:JSON.stringify({userId:q.id,brokerageId:t})}),xt=await Ln.json();if(!Ln.ok)throw new Error(xt.error||"Failed to remove agent");e({title:"Success",description:`${q.name} has been removed from your brokerage`}),F(!1),W(null),Qn()}catch(dr){console.error("Error removing agent:",dr),e({title:"Error",description:dr.message||"Failed to remove agent",variant:"destructive"})}finally{Z(!1)}}},_s=dr=>{const Ln=dr.trim().split(" ");return Ln.length>1?Ln[Ln.length-1].toLowerCase():dr.toLowerCase()},yi=dr=>{Te===dr?mt(ge==="asc"?"desc":"asc"):(Xe(dr),mt("asc"))},Ni=dr=>Te!==dr?r.jsx(B0,{className:"ml-1 h-4 w-4"}):ge==="asc"?r.jsx($0,{className:"ml-1 h-4 w-4"}):r.jsx(ES,{className:"ml-1 h-4 w-4"}),Oo=n.filter(dr=>{if(f==="active"&&!dr.claimed||f==="pending"&&dr.claimed)return!1;if(!c)return!0;const Ln=c.toLowerCase();return dr.name.toLowerCase().includes(Ln)||dr.email.toLowerCase().includes(Ln)}),sr=[...Oo].sort((dr,Ln)=>{if(!Te)return 0;let xt=0;return Te==="name"?xt=_s(dr.name).localeCompare(_s(Ln.name)):Te==="status"&&(xt=dr.claimed===Ln.claimed?0:dr.claimed?-1:1),ge==="asc"?xt:-xt});Oo.filter(dr=>dr.claimed&&!ga(dr.id));const fo=dr=>{v(Ln=>{const xt=new Set(Ln);return xt.has(dr)?xt.delete(dr):xt.add(dr),xt})},lc=()=>{y.size===sr.length?v(new Set):v(new Set(sr.map(dr=>dr.id)))},po=()=>{v(new Set)},Qr=async()=>{const dr=Array.from(y);if(dr.length===0)return;k(!0);let Ln=0,xt=0;try{const{data:{session:_e}}=await ee.auth.getSession();for(const ze of dr)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${_e==null?void 0:_e.access_token}`},body:JSON.stringify({userId:ze})})).ok?Ln++:xt++}catch{xt++}Ln>0?e({title:"Success",description:`Welcome emails sent to ${Ln} agent${Ln>1?"s":""}${xt>0?` (${xt} failed)`:""}`}):e({title:"Error",description:"Failed to send welcome emails",variant:"destructive"}),po()}catch(_e){console.error("Error bulk sending welcome emails:",_e),e({title:"Error",description:_e.message||"Failed to send welcome emails",variant:"destructive"})}finally{k(!1)}};return i?r.jsx(Ye,{children:r.jsx(Je,{className:"flex items-center justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs(r.Fragment,{children:[r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Yt,{children:"Agents"}),r.jsx(An,{children:"Manage your brokerage's agents"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(te,{variant:"outline",onClick:()=>Ne(!0),children:[r.jsx(sm,{className:"mr-2 h-4 w-4"}),"Add Brokerage Manager"]}),r.jsxs(te,{variant:"outline",onClick:()=>he(!0),children:[r.jsx(H0,{className:"mr-2 h-4 w-4"}),"Import CSV"]}),r.jsxs(te,{onClick:()=>S(!0),children:[r.jsx(J0,{className:"mr-2 h-4 w-4"}),"Add Agent"]})]})]})}),r.jsxs(Je,{children:[r.jsxs("div",{className:"mb-4 flex flex-col gap-4 sm:flex-row sm:items-center",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Ti,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),r.jsx(yt,{placeholder:"Search agents...",value:c,onChange:dr=>a(dr.target.value),className:"pl-9"})]}),r.jsxs(_n,{value:f,onValueChange:dr=>m(dr),children:[r.jsx(xn,{className:"w-[160px]",children:r.jsx(bn,{placeholder:"Filter by status"})}),r.jsxs(vn,{children:[r.jsx(er,{value:"all",children:"All Agents"}),r.jsx(er,{value:"active",children:"Active"}),r.jsx(er,{value:"pending",children:"Pending"})]})]})]}),y.size>0&&r.jsxs("div",{className:"mb-4 flex items-center gap-3 rounded-lg border bg-muted/50 p-3",children:[r.jsxs("span",{className:"text-sm font-medium",children:[y.size," agent",y.size>1?"s":""," selected"]}),r.jsx("div",{className:"flex-1"}),r.jsxs(te,{size:"sm",variant:"outline",onClick:Qr,disabled:w,children:[r.jsx(di,{className:"mr-2 h-4 w-4"}),w?"Sending...":"Resend Welcome Email"]}),r.jsx(te,{size:"sm",variant:"ghost",onClick:po,children:"Clear"})]}),r.jsx("div",{className:"rounded-md border",children:r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{className:"w-[40px]",children:r.jsx(_c,{checked:sr.length>0&&y.size===sr.length,onCheckedChange:lc,"aria-label":"Select all"})}),r.jsx(At,{children:r.jsxs(te,{variant:"ghost",size:"sm",className:"-ml-3 h-8 hover:bg-transparent",onClick:()=>yi("name"),children:["Name (Last)",Ni("name")]})}),r.jsx(At,{children:"Email"}),r.jsx(At,{children:r.jsxs(te,{variant:"ghost",size:"sm",className:"-ml-3 h-8 hover:bg-transparent",onClick:()=>yi("status"),children:["Status",Ni("status")]})}),r.jsx(At,{children:"Actions"})]})}),r.jsx(qs,{children:sr.length===0?r.jsx(Er,{children:r.jsx(_t,{colSpan:5,className:"text-center text-muted-foreground",children:"No agents found"})}):sr.map(dr=>r.jsxs(Er,{children:[r.jsx(_t,{children:r.jsx(_c,{checked:y.has(dr.id),onCheckedChange:()=>fo(dr.id),"aria-label":`Select ${dr.name}`})}),r.jsx(_t,{className:"font-medium",children:dr.name}),r.jsx(_t,{children:dr.email}),r.jsx(_t,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[dr.claimed?r.jsx(Rt,{variant:"default",children:"Active"}):r.jsx(Rt,{variant:"secondary",children:"Pending"}),ga(dr.id)&&r.jsxs(Rt,{variant:"outline",className:"border-primary text-primary",children:[r.jsx(jT,{className:"mr-1 h-3 w-3"}),"Manager"]})]})}),r.jsx(_t,{children:r.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>{et(dr),We(!0)},title:"Send celebration",className:"text-yellow-500 hover:text-yellow-600 hover:bg-yellow-50",children:r.jsx($h,{className:"h-4 w-4"})}),r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>Ts(dr),title:"Edit agent",children:r.jsx(ma,{className:"h-4 w-4"})}),!dr.claimed&&r.jsxs(r.Fragment,{children:[r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>Qs(dr.id),title:"Resend welcome email",children:r.jsx(di,{className:"h-4 w-4"})}),r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>Ds(dr),title:"Claim account for agent",disabled:Mr===dr.id,className:"text-green-600 hover:text-green-700 hover:bg-green-50",children:r.jsx(Zw,{className:"h-4 w-4"})})]}),r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>vl(dr),title:"Set password",className:"text-blue-600 hover:text-blue-700 hover:bg-blue-50",children:r.jsx(Ff,{className:"h-4 w-4"})}),r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>si(dr.email,dr.name),title:"Send password reset email",children:r.jsx(Vw,{className:"h-4 w-4"})}),ga(dr.id)&&r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>Ta(dr.id),title:"Remove manager role",className:"text-orange-500 hover:text-orange-600",children:r.jsx(sm,{className:"h-4 w-4"})}),r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>wr(dr),className:"text-destructive hover:text-destructive",title:"Remove agent",children:r.jsx(Xn,{className:"h-4 w-4"})})]})})]},dr.id))})]})})]})]}),r.jsx($r,{open:C,onOpenChange:S,children:r.jsxs(zr,{children:[r.jsxs(Zr,{children:[r.jsx(Kr,{children:"Add New Agent"}),r.jsx(ls,{children:"Create a new agent account. They'll receive an email to set up their account."})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"name",children:"Name"}),r.jsx(yt,{id:"name",value:A.name,onChange:dr=>D({...A,name:dr.target.value}),placeholder:"John Doe"})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"email",children:"Email"}),r.jsx(yt,{id:"email",type:"email",value:A.email,onChange:dr=>D({...A,email:dr.target.value}),placeholder:"john@example.com"})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"phone",children:"Phone (optional)"}),r.jsx(yt,{id:"phone",type:"tel",value:A.phone,onChange:dr=>D({...A,phone:dr.target.value}),placeholder:"555-123-4567"})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"password",children:"Temporary Password"}),r.jsx(yt,{id:"password",type:"password",value:A.password,onChange:dr=>D({...A,password:dr.target.value}),placeholder:"Temporary password"})]})]}),r.jsxs(ni,{children:[r.jsx(te,{variant:"outline",onClick:()=>S(!1),children:"Cancel"}),r.jsx(te,{onClick:js,disabled:T,children:T?"Creating...":"Create Agent"})]})]})}),r.jsx($r,{open:$,onOpenChange:F,children:r.jsxs(zr,{children:[r.jsxs(Zr,{children:[r.jsx(Kr,{children:"Remove Agent"}),r.jsxs(ls,{children:["Are you sure you want to remove ",r.jsx("strong",{children:q==null?void 0:q.name})," from your brokerage? This will revoke their access to the dashboard."]})]}),r.jsxs(ni,{children:[r.jsx(te,{variant:"outline",onClick:()=>F(!1),children:"Cancel"}),r.jsx(te,{variant:"destructive",onClick:Ki,disabled:K,children:K?"Removing...":"Remove Agent"})]})]})}),r.jsx(H8e,{open:re,onOpenChange:he,fixedBrokerageId:t,onSuccess:Qn}),r.jsx($r,{open:ue,onOpenChange:Ne,children:r.jsxs(zr,{children:[r.jsxs(Zr,{children:[r.jsx(Kr,{children:"Add Brokerage Manager"}),r.jsx(ls,{children:"Promote an existing active agent to brokerage manager. They will be able to manage agents and view analytics."})]}),r.jsx("div",{className:"space-y-4",children:r.jsxs("div",{children:[r.jsx(Qe,{children:"Select Agent"}),r.jsxs(Zh,{open:Ie,onOpenChange:Se,children:[r.jsx(Yh,{asChild:!0,children:r.jsxs(te,{variant:"outline",role:"combobox","aria-expanded":Ie,className:"w-full justify-between",children:[se?((ba=n.find(dr=>dr.id===se))==null?void 0:ba.name)+" ("+((Ka=n.find(dr=>dr.id===se))==null?void 0:Ka.email)+")":"Select an agent to promote...",r.jsx(Fw,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(mh,{className:"w-full p-0",align:"start",children:r.jsxs(gj,{children:[r.jsx(yj,{placeholder:"Search by name or email..."}),r.jsxs(xj,{className:"max-h-[200px]",children:[r.jsx(vj,{children:"No eligible agents found."}),r.jsx(_j,{children:n.filter(dr=>!ga(dr.id)).map(dr=>r.jsxs(bj,{value:`${dr.name} ${dr.email}`,onSelect:()=>{xe(dr.id),Se(!1)},children:[r.jsx(Ba,{className:`mr-2 h-4 w-4 ${se===dr.id?"opacity-100":"opacity-0"}`}),dr.name," (",dr.email,")"]},dr.id))})]})]})})]}),n.filter(dr=>!ga(dr.id)).length===0&&r.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"All agents are already brokerage managers."})]})}),r.jsxs(ni,{children:[r.jsx(te,{variant:"outline",onClick:()=>Ne(!1),children:"Cancel"}),r.jsx(te,{onClick:mi,disabled:ie||!se,children:ie?"Adding...":"Add as Manager"})]})]})}),r.jsx($r,{open:oe,onOpenChange:ae,children:r.jsxs(zr,{children:[r.jsxs(Zr,{children:[r.jsx(Kr,{children:"Edit Agent"}),r.jsxs(ls,{children:["Update profile information for ",je==null?void 0:je.name]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"edit-name",children:"Name"}),r.jsx(yt,{id:"edit-name",value:Ue.name,onChange:dr=>Re({...Ue,name:dr.target.value}),placeholder:"Agent name"})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"edit-email",children:"Email"}),r.jsx(yt,{id:"edit-email",type:"email",value:Ue.email,onChange:dr=>Re({...Ue,email:dr.target.value}),placeholder:"agent@example.com"}),Ue.email.trim().toLowerCase()!==(je==null?void 0:je.email.toLowerCase())&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Changing email will update their login credentials"})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"edit-phone",children:"Phone"}),r.jsx(yt,{id:"edit-phone",type:"tel",value:Ue.phone,onChange:dr=>Re({...Ue,phone:dr.target.value}),placeholder:"555-123-4567"})]})]}),r.jsxs(ni,{children:[r.jsx(te,{variant:"outline",onClick:()=>ae(!1),children:"Cancel"}),r.jsx(te,{onClick:ii,disabled:$e||Ae,children:Ae?"Updating email...":$e?"Saving...":"Save Changes"})]})]})}),Ce&&r.jsx(W8e,{open:rt,onOpenChange:dr=>{We(dr),dr||et(null)},userId:Ce.id,userName:Ce.name}),r.jsx($r,{open:Fe,onOpenChange:Ke,children:r.jsxs(zr,{children:[r.jsxs(Zr,{children:[r.jsx(Kr,{children:"Set Password"}),r.jsxs(ls,{children:["Set a new password for ",Le==null?void 0:Le.name,". They will be able to log in with this password immediately."]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"new-password",children:"New Password"}),r.jsx(yt,{id:"new-password",type:"password",value:Nt,onChange:dr=>Mt(dr.target.value),placeholder:"Enter new password (min 6 characters)"})]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Make sure to communicate this password to the agent through a secure channel."})]}),r.jsxs(ni,{children:[r.jsx(te,{variant:"outline",onClick:()=>Ke(!1),children:"Cancel"}),r.jsx(te,{onClick:Yo,disabled:It||!Nt||Nt.length<6,children:It?"Setting...":"Set Password"})]})]})})]})},ebt={academy_video:"Academy Video",template:"Template",toolbox:"Toolbox Resource",newsletter:"Newsletter",social_swag:"Social Swag",event:"Event"},tbt={view:"Viewed",click_canva:"Opened Canva",click_pdf:"Downloaded PDF",click_video:"Watched Video",click_link:"Clicked Link",register:"Registered"},rbt=t=>{switch(t){case"academy_video":return r.jsx(Gi,{className:"h-4 w-4"});case"template":return r.jsx(Ai,{className:"h-4 w-4"});case"toolbox":return r.jsx(Ai,{className:"h-4 w-4"});case"newsletter":return r.jsx(Ay,{className:"h-4 w-4"});case"social_swag":return r.jsx(Mi,{className:"h-4 w-4"});case"event":return r.jsx(li,{className:"h-4 w-4"});default:return r.jsx(Fs,{className:"h-4 w-4"})}},nbt=({brokerageId:t})=>{const{toast:e}=la(),[n,s]=P.useState([]),[i,o]=P.useState([]),[c,a]=P.useState([]),[f,m]=P.useState(!0),[y,v]=P.useState(null);P.useEffect(()=>{w()},[t]);const w=async()=>{try{m(!0);const{data:S,error:T}=await ee.from("profiles").select("id, name, email").eq("brokerage_id",t);if(T)throw T;const I=S.map(he=>he.id),A=new Map(S.map(he=>[he.id,he]));if(I.length===0){s([]),o([]),a([]);return}const{data:D,error:$}=await ee.from("activity_logs").select("*").in("user_id",I).order("launched_at",{ascending:!1});if($)throw $;const F=D.map(he=>{var ue,Ne;return{id:he.id,user_id:he.user_id,app_name:he.app_name,launched_at:he.launched_at,user_name:((ue=A.get(he.user_id))==null?void 0:ue.name)||"Unknown",user_email:((Ne=A.get(he.user_id))==null?void 0:Ne.email)||"Unknown"}});s(F);const{data:q,error:W}=await ee.from("content_engagement_logs").select("*").in("user_id",I).order("created_at",{ascending:!1});if(W)throw W;const K=(q||[]).map(he=>{var ue,Ne;return{id:he.id,user_id:he.user_id,resource_type:he.resource_type,resource_id:he.resource_id,resource_title:he.resource_title,action_type:he.action_type,created_at:he.created_at,user_name:((ue=A.get(he.user_id))==null?void 0:ue.name)||"Unknown",user_email:((Ne=A.get(he.user_id))==null?void 0:Ne.email)||"Unknown"}});o(K);const Z=new Map;S.forEach(he=>{Z.set(he.id,{user_id:he.id,user_name:he.name,user_email:he.email,app_launches:0,content_views:0,last_activity:""})}),F.forEach(he=>{const ue=Z.get(he.user_id);ue&&(ue.app_launches++,(!ue.last_activity||new Date(he.launched_at)>new Date(ue.last_activity))&&(ue.last_activity=he.launched_at))}),K.forEach(he=>{const ue=Z.get(he.user_id);ue&&(ue.content_views++,(!ue.last_activity||new Date(he.created_at)>new Date(ue.last_activity))&&(ue.last_activity=he.created_at))});const re=Array.from(Z.values()).filter(he=>he.app_launches>0||he.content_views>0).sort((he,ue)=>new Date(ue.last_activity).getTime()-new Date(he.last_activity).getTime());a(re)}catch(S){console.error("Error loading activity:",S),e({title:"Error",description:"Failed to load activity logs",variant:"destructive"})}finally{m(!1)}},k=S=>n.filter(T=>T.user_id===S),C=S=>i.filter(T=>T.user_id===S);return f?r.jsx(Ye,{children:r.jsx(Je,{className:"flex items-center justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs(r.Fragment,{children:[r.jsxs(Ye,{children:[r.jsxs(Ht,{children:[r.jsx(Yt,{children:"Agent Activity"}),r.jsx(An,{children:"Track app usage and content engagement - click an agent for details"})]}),r.jsx(Je,{children:r.jsx("div",{className:"rounded-md border",children:r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"Agent"}),r.jsx(At,{className:"text-center",children:"App Launches"}),r.jsx(At,{className:"text-center",children:"Content Views"}),r.jsx(At,{children:"Last Active"})]})}),r.jsx(qs,{children:c.length===0?r.jsx(Er,{children:r.jsx(_t,{colSpan:4,className:"text-center text-muted-foreground",children:"No activity yet"})}):c.map(S=>r.jsxs(Er,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>v({id:S.user_id,name:S.user_name,email:S.user_email}),children:[r.jsx(_t,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:S.user_name}),r.jsx("div",{className:"text-sm text-muted-foreground",children:S.user_email})]})}),r.jsx(_t,{className:"text-center",children:r.jsxs(Rt,{variant:"outline",className:"gap-1",children:[r.jsx(wc,{className:"h-3 w-3"}),S.app_launches]})}),r.jsx(_t,{className:"text-center",children:r.jsxs(Rt,{variant:"secondary",className:"gap-1",children:[r.jsx(Ai,{className:"h-3 w-3"}),S.content_views]})}),r.jsx(_t,{className:"text-sm text-muted-foreground",children:S.last_activity&&Yd(new Date(S.last_activity),{addSuffix:!0})})]},S.user_id))})]})})})]}),r.jsx($r,{open:!!y,onOpenChange:S=>!S&&v(null),children:r.jsxs(zr,{className:"max-w-3xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsxs(Zr,{children:[r.jsxs(Kr,{children:[y==null?void 0:y.name,"'s Activity"]}),r.jsx(ls,{children:y==null?void 0:y.email})]}),r.jsxs(La,{defaultValue:"content",className:"flex-1 overflow-hidden flex flex-col",children:[r.jsxs(Ma,{className:"grid w-full grid-cols-2",children:[r.jsx(yn,{value:"content",children:"Content Engagement"}),r.jsx(yn,{value:"apps",children:"App Launches"})]}),r.jsx($n,{value:"content",className:"flex-1 overflow-auto",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"Resource"}),r.jsx(At,{children:"Type"}),r.jsx(At,{children:"Action"}),r.jsx(At,{children:"Time"})]})}),r.jsx(qs,{children:y&&C(y.id).length===0?r.jsx(Er,{children:r.jsx(_t,{colSpan:4,className:"text-center text-muted-foreground",children:"No content engagement yet"})}):y&&C(y.id).map(S=>r.jsxs(Er,{children:[r.jsx(_t,{className:"max-w-[200px] truncate font-medium",children:S.resource_title}),r.jsx(_t,{children:r.jsxs(Rt,{variant:"outline",className:"gap-1",children:[rbt(S.resource_type),ebt[S.resource_type]||S.resource_type]})}),r.jsx(_t,{children:r.jsx("span",{className:"text-sm text-muted-foreground",children:tbt[S.action_type]||S.action_type})}),r.jsx(_t,{className:"text-sm text-muted-foreground",children:Yd(new Date(S.created_at),{addSuffix:!0})})]},S.id))})]})})}),r.jsx($n,{value:"apps",className:"flex-1 overflow-auto",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"App"}),r.jsx(At,{children:"Time"})]})}),r.jsx(qs,{children:y&&k(y.id).length===0?r.jsx(Er,{children:r.jsx(_t,{colSpan:2,className:"text-center text-muted-foreground",children:"No app launches yet"})}):y&&k(y.id).map(S=>r.jsxs(Er,{children:[r.jsx(_t,{children:r.jsx(Rt,{variant:"outline",children:S.app_name})}),r.jsx(_t,{className:"text-sm text-muted-foreground",children:Yd(new Date(S.launched_at),{addSuffix:!0})})]},S.id))})]})})})]})]})})]})},sbt=({brokerageId:t})=>{const{toast:e}=la(),[n,s]=P.useState({totalAgents:0,activeAgents:0,pendingAgents:0,totalLaunches:0,launchesThisWeek:0,launchesThisMonth:0}),[i,o]=P.useState(!0);P.useEffect(()=>{c()},[t]);const c=async()=>{try{o(!0);const{data:a,error:f}=await ee.from("profiles").select("id").eq("brokerage_id",t);if(f)throw f;const m=a.map(F=>F.id),y=m.length;if(m.length===0){o(!1);return}const{data:v,error:w}=await ee.from("profiles").select("id, email").in("id",m);if(w)throw w;const{count:k}=await ee.from("profiles").select("*",{count:"exact",head:!0}).eq("brokerage_id",t).not("last_login","is",null),C=k||0,S=y-C,{count:T}=await ee.from("activity_logs").select("*",{count:"exact",head:!0}).in("user_id",m),I=new Date;I.setDate(I.getDate()-7);const{count:A}=await ee.from("activity_logs").select("*",{count:"exact",head:!0}).in("user_id",m).gte("launched_at",I.toISOString()),D=new Date;D.setMonth(D.getMonth()-1);const{count:$}=await ee.from("activity_logs").select("*",{count:"exact",head:!0}).in("user_id",m).gte("launched_at",D.toISOString());s({totalAgents:y,activeAgents:C,pendingAgents:S,totalLaunches:T||0,launchesThisWeek:A||0,launchesThisMonth:$||0})}catch(a){console.error("Error loading analytics:",a),e({title:"Error",description:"Failed to load analytics",variant:"destructive"})}finally{o(!1)}};return i?r.jsx(Ye,{children:r.jsx(Je,{className:"flex items-center justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Yt,{className:"text-sm font-medium",children:"Total Agents"}),r.jsx(hs,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Je,{children:[r.jsx("div",{className:"text-2xl font-bold",children:n.totalAgents}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[n.activeAgents," active, ",n.pendingAgents," pending"]})]})]}),r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Yt,{className:"text-sm font-medium",children:"Active Agents"}),r.jsx(za,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Je,{children:[r.jsx("div",{className:"text-2xl font-bold",children:n.activeAgents}),r.jsx("p",{className:"text-xs text-muted-foreground",children:n.totalAgents>0?`${Math.round(n.activeAgents/n.totalAgents*100)}% of total`:"0% of total"})]})]}),r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Yt,{className:"text-sm font-medium",children:"Pending Invites"}),r.jsx(Xi,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Je,{children:[r.jsx("div",{className:"text-2xl font-bold",children:n.pendingAgents}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Awaiting setup"})]})]}),r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Yt,{className:"text-sm font-medium",children:"Total App Launches"}),r.jsx(ig,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Je,{children:[r.jsx("div",{className:"text-2xl font-bold",children:n.totalLaunches}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"All time"})]})]}),r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Yt,{className:"text-sm font-medium",children:"This Week"}),r.jsx(ig,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Je,{children:[r.jsx("div",{className:"text-2xl font-bold",children:n.launchesThisWeek}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Last 7 days"})]})]}),r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Yt,{className:"text-sm font-medium",children:"This Month"}),r.jsx(ig,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Je,{children:[r.jsx("div",{className:"text-2xl font-bold",children:n.launchesThisMonth}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Last 30 days"})]})]})]})},ibt=({brokerageId:t})=>{const[e,n]=P.useState([]),[s,i]=P.useState(!0),[o,c]=P.useState(!1),[a,f]=P.useState(!1),[m,y]=P.useState({description:"",maxUses:""});P.useEffect(()=>{v()},[t]);const v=async()=>{try{const{data:I,error:A}=await ee.from("invite_codes").select("*").eq("brokerage_id",t).order("created_at",{ascending:!1});if(A)throw A;n(I||[])}catch(I){console.error("Error loading invite codes:",I),Ge.error("Failed to load invite links")}finally{i(!1)}},w=()=>Math.random().toString(36).substring(2,8).toUpperCase(),k=async()=>{c(!0);try{const I=w(),{error:A}=await ee.from("invite_codes").insert({code:I,description:m.description||null,max_uses:m.maxUses?parseInt(m.maxUses):null,brokerage_id:t,is_active:!0});if(A)throw A;Ge.success("Invite link created!"),f(!1),y({description:"",maxUses:""}),v()}catch(I){console.error("Error creating invite code:",I),Ge.error("Failed to create invite link")}finally{c(!1)}},C=async I=>{try{const{error:A}=await ee.from("invite_codes").delete().eq("id",I);if(A)throw A;Ge.success("Invite link deleted"),n(e.filter(D=>D.id!==I))}catch(A){console.error("Error deleting invite code:",A),Ge.error("Failed to delete invite link")}},S=async(I,A)=>{try{const{error:D}=await ee.from("invite_codes").update({is_active:!A}).eq("id",I);if(D)throw D;n(e.map($=>$.id===I?{...$,is_active:!A}:$)),Ge.success(`Invite link ${A?"deactivated":"activated"}`)}catch(D){console.error("Error toggling invite code:",D),Ge.error("Failed to update invite link")}},T=I=>{const A=`${window.location.origin}/join?code=${I}`;navigator.clipboard.writeText(A),Ge.success("Link copied to clipboard!")};return s?r.jsx(Ye,{children:r.jsx(Je,{className:"flex items-center justify-center py-8",children:r.jsx(sn,{className:"h-6 w-6 animate-spin text-muted-foreground"})})}):r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(bo,{className:"h-5 w-5"}),"Agent Invite Links"]}),r.jsx(An,{children:"Create shareable links for agents to join your brokerage"})]}),r.jsxs($r,{open:a,onOpenChange:f,children:[r.jsx(Lo,{asChild:!0,children:r.jsxs(te,{size:"sm",children:[r.jsx(Sn,{className:"mr-2 h-4 w-4"}),"Create Link"]})}),r.jsxs(zr,{children:[r.jsxs(Zr,{children:[r.jsx(Kr,{children:"Create Invite Link"}),r.jsx(ls,{children:"Create a new invite link for agents to join your brokerage"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"description",children:"Description (optional)"}),r.jsx(yt,{id:"description",placeholder:"e.g., New agent recruiting campaign",value:m.description,onChange:I=>y({...m,description:I.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"maxUses",children:"Max Uses (optional)"}),r.jsx(yt,{id:"maxUses",type:"number",placeholder:"Leave empty for unlimited",value:m.maxUses,onChange:I=>y({...m,maxUses:I.target.value})})]}),r.jsx(te,{onClick:k,disabled:o,className:"w-full",children:o?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Invite Link"})]})]})]})]}),r.jsx(Je,{children:e.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(bo,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No invite links yet"}),r.jsx("p",{className:"text-sm",children:"Create one to start inviting agents"})]}):r.jsx("div",{className:"space-y-3",children:e.map(I=>r.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-card",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("code",{className:"text-sm font-mono bg-muted px-2 py-0.5 rounded",children:I.code}),r.jsx(Rt,{variant:I.is_active?"default":"secondary",children:I.is_active?"Active":"Inactive"})]}),I.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1 truncate",children:I.description}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[I.uses_count," uses",I.max_uses&&` / ${I.max_uses} max`]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>T(I.code),title:"Copy link",children:r.jsx(Ul,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>S(I.id,I.is_active),title:I.is_active?"Deactivate":"Activate",children:I.is_active?"Disable":"Enable"}),r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>C(I.id),className:"text-destructive hover:text-destructive",title:"Delete",children:r.jsx(Xn,{className:"h-4 w-4"})})]})]},I.id))})})]})},abt=({open:t,onOpenChange:e,referralCode:n,brokerageId:s,senderName:i,brokerageName:o,onInvitesSent:c})=>{const[a,f]=P.useState(""),[m,y]=P.useState([]),[v,w]=P.useState(""),[k,C]=P.useState(!1),S=$=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test($),T=()=>{const $=a.trim().toLowerCase();if($&&S($)&&!m.includes($)){if(m.length>=10){Ge.error("Maximum 10 emails per invite");return}y([...m,$]),f("")}else $&&!S($)?Ge.error("Please enter a valid email address"):m.includes($)&&Ge.error("Email already added")},I=$=>{y(m.filter(F=>F!==$))},A=$=>{($.key==="Enter"||$.key===",")&&($.preventDefault(),T())},D=async()=>{if(m.length===0){Ge.error("Please add at least one email address");return}C(!0);try{const{data:$,error:F}=await ee.functions.invoke("send-referral-invite",{body:{emails:m,personalMessage:v.trim()||void 0,referralCode:n,brokerageId:s,senderName:i,brokerageName:o}});if(F)throw F;$.successCount===$.totalCount?Ge.success(`${$.successCount} invite${$.successCount>1?"s":""} sent successfully!`):Ge.warning(`${$.successCount} of ${$.totalCount} invites sent. Some failed.`),y([]),w(""),e(!1),c==null||c()}catch($){console.error("Error sending invites:",$),Ge.error("Failed to send invites. Please try again.")}finally{C(!1)}};return r.jsx($r,{open:t,onOpenChange:e,children:r.jsxs(zr,{className:"sm:max-w-[550px]",children:[r.jsxs(Zr,{children:[r.jsxs(Kr,{className:"flex items-center gap-2",children:[r.jsx(di,{className:"h-5 w-5 text-primary"}),"Invite Broker Friends"]}),r.jsx(ls,{children:"Send a personalized email invitation to broker owners you know. They'll receive a beautiful email highlighting LevelUp's features."})]}),r.jsxs("div",{className:"bg-gradient-to-r from-primary/10 to-primary/5 border border-primary/20 rounded-lg p-4 flex items-center gap-3",children:[r.jsx("div",{className:"bg-primary/20 rounded-full p-2",children:r.jsx(Qa,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold text-sm",children:"Earn $25/month for each referral!"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"When they sign up and stay for 30 days, you save on your membership forever."})]})]}),r.jsxs("div",{className:"space-y-4 py-2",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"email",children:"Email Addresses (up to 10)"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(yt,{id:"email",type:"email",placeholder:"Enter email and press Enter",value:a,onChange:$=>f($.target.value),onKeyDown:A,onBlur:T}),r.jsx(te,{type:"button",variant:"secondary",onClick:T,children:"Add"})]}),m.length>0&&r.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:m.map($=>r.jsxs(Rt,{variant:"secondary",className:"flex items-center gap-1 pr-1",children:[$,r.jsx("button",{type:"button",onClick:()=>I($),className:"ml-1 rounded-full p-0.5 hover:bg-muted",children:r.jsx(Ms,{className:"h-3 w-3"})})]},$))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"message",children:"Personal Message (optional)"}),r.jsx(ps,{id:"message",placeholder:"Add a personal note that will appear at the top of the email...",value:v,onChange:$=>w($.target.value),rows:3,maxLength:500}),r.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[v.length,"/500 characters"]})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[r.jsx(Mi,{className:"h-4 w-4 text-primary"}),"What they'll receive:"]}),r.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1",children:[r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-1 h-1 rounded-full bg-primary"}),"Beautiful branded email from you"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-1 h-1 rounded-full bg-primary"}),"Your personal message (if added)"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-1 h-1 rounded-full bg-primary"}),"Key LevelUp features for brokerages"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-1 h-1 rounded-full bg-primary"}),"Direct signup link with your referral code"]})]})]})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[r.jsx(te,{variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsx(te,{onClick:D,disabled:m.length===0||k,children:k?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent mr-2"}),"Sending..."]}):r.jsxs(r.Fragment,{children:[r.jsx(To,{className:"h-4 w-4 mr-2"}),"Send ",m.length>0&&`(${m.length})`," Invite",m.length!==1?"s":""]})})]})]})})},obt=({brokerageId:t,refreshTrigger:e})=>{const[n,s]=P.useState([]),[i,o]=P.useState(!0);P.useEffect(()=>{c()},[t,e]);const c=async()=>{try{const{data:f,error:m}=await ee.from("referral_invites").select("*").eq("referrer_brokerage_id",t).order("sent_at",{ascending:!1}).limit(20);if(m)throw m;s(f||[])}catch(f){console.error("Error fetching invites:",f)}finally{o(!1)}},a=f=>{switch(f){case"signed_up":return r.jsxs(Rt,{className:"bg-green-100 text-green-800 gap-1",children:[r.jsx(za,{className:"h-3 w-3"}),"Signed Up"]});case"expired":return r.jsxs(Rt,{variant:"outline",className:"text-muted-foreground gap-1",children:[r.jsx(Lc,{className:"h-3 w-3"}),"Expired"]});default:return r.jsxs(Rt,{variant:"secondary",className:"gap-1",children:[r.jsx(Xi,{className:"h-3 w-3"}),"Pending"]})}};return i?r.jsx("div",{className:"flex justify-center py-4",children:r.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-primary border-t-transparent"})}):n.length===0?r.jsxs("div",{className:"text-center py-6 text-muted-foreground",children:[r.jsx(di,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),r.jsx("p",{className:"text-sm",children:"No invites sent yet"}),r.jsx("p",{className:"text-xs",children:"Start inviting broker friends to earn rewards!"})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium mb-3",children:"Recent Invites"}),n.map(f=>r.jsxs("div",{className:"flex items-center justify-between p-2.5 bg-muted/30 rounded-lg",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:f.recipient_email}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Sent ",un(new Date(f.sent_at),"MMM d, yyyy")]})]}),a(f.status)]},f.id))]})},lbt=()=>{const{brokerageId:t,user:e}=Fr(),[n,s]=P.useState(null),[i,o]=P.useState(""),[c,a]=P.useState(""),[f,m]=P.useState([]),[y,v]=P.useState(!0),[w,k]=P.useState(!1),[C,S]=P.useState(0);P.useEffect(()=>{t&&T()},[t]);const T=async()=>{try{const[q,W]=await Promise.all([ee.from("brokerages").select("name").eq("id",t).single(),e?ee.from("profiles").select("name").eq("id",e.id).single():Promise.resolve({data:null})]);q.data&&o(q.data.name),W.data&&a(W.data.name||"A LevelUp Member");const{data:K}=await ee.from("referral_codes").select("code").eq("brokerage_id",t).single();if(K)s(K.code);else{const re=`REF${t==null?void 0:t.slice(0,8).toUpperCase()}`;await ee.from("referral_codes").insert({brokerage_id:t,code:re}),s(re)}const{data:Z}=await ee.from("referrals").select(` *, referred_user:profiles!referred_user_id(name, email), referred_brokerage:brokerages!referred_brokerage_id(name) `).eq("referrer_brokerage_id",t).order("created_at",{ascending:!1});m(Z||[])}catch(q){console.error("Error fetching referral data:",q)}finally{v(!1)}},I=()=>{const q=`https://dashboard.relevelup.com/?ref=${n}`;navigator.clipboard.writeText(q),Ge.success("Referral link copied to clipboard!")},A=f.filter(q=>q.status==="qualified").length,D=f.filter(q=>q.status==="pending").length,$=A*25,F=Math.max(0,Math.ceil((299-$)/25));return y?null:r.jsxs(r.Fragment,{children:[r.jsxs(Ye,{className:"overflow-hidden",children:[r.jsx("div",{className:"bg-gradient-to-r from-primary/10 via-primary/5 to-background border-b",children:r.jsxs("div",{className:"px-6 py-6",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[r.jsx("div",{className:"bg-primary/20 rounded-full p-2",children:r.jsx(Qa,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-bold",children:"Referral Rewards Program"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Earn $25/month off your membership for every broker you refer"})]})]}),r.jsx("div",{className:"mt-4 bg-background/80 rounded-lg p-4 border",children:r.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-4",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs("div",{className:"text-center",children:[r.jsxs("p",{className:"text-3xl font-bold text-primary",children:["$",$]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Monthly Savings"})]}),$>0&&r.jsxs("div",{className:"flex items-center gap-1 text-green-600",children:[r.jsx(za,{className:"h-4 w-4"}),r.jsx("span",{className:"text-sm font-medium",children:"Active"})]})]}),F>0&&$<299&&r.jsxs("div",{className:"text-right",children:[r.jsxs("p",{className:"text-sm font-medium",children:["Refer ",F," more = ",r.jsx("span",{className:"text-primary",children:"FREE membership!"})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Your membership could cost $0/month"})]}),$>=299&&r.jsxs("div",{className:"flex items-center gap-2 text-primary",children:[r.jsx(Mi,{className:"h-5 w-5"}),r.jsx("span",{className:"font-bold",children:"FREE Membership Unlocked!"})]})]})})]})}),r.jsxs(Je,{className:"pt-6 space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[r.jsxs(te,{onClick:()=>k(!0),className:"w-full",size:"lg",children:[r.jsx(di,{className:"h-4 w-4 mr-2"}),"Invite Broker Friends"]}),r.jsxs(te,{onClick:I,variant:"outline",className:"w-full",size:"lg",children:[r.jsx(Ul,{className:"h-4 w-4 mr-2"}),"Copy Referral Link"]})]}),r.jsxs("div",{className:"p-4 bg-muted/50 rounded-lg",children:[r.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Your Referral Link"}),r.jsxs("code",{className:"block px-3 py-2 bg-background rounded border text-sm break-all",children:["https://dashboard.relevelup.com/?ref=",n]})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsxs("div",{className:"text-center p-4 bg-green-50 dark:bg-green-950/20 rounded-lg border border-green-200 dark:border-green-900",children:[r.jsx(Cd,{className:"h-5 w-5 mx-auto text-green-600 mb-1"}),r.jsxs("p",{className:"text-2xl font-bold text-green-700 dark:text-green-400",children:["$",$]}),r.jsx("p",{className:"text-xs text-green-600 dark:text-green-500",children:"Monthly Savings"})]}),r.jsxs("div",{className:"text-center p-4 bg-primary/5 rounded-lg border border-primary/20",children:[r.jsx(hs,{className:"h-5 w-5 mx-auto text-primary mb-1"}),r.jsx("p",{className:"text-2xl font-bold",children:A}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Qualified Referrals"})]}),r.jsxs("div",{className:"text-center p-4 bg-amber-50 dark:bg-amber-950/20 rounded-lg border border-amber-200 dark:border-amber-900",children:[r.jsx(Xi,{className:"h-5 w-5 mx-auto text-amber-600 mb-1"}),r.jsx("p",{className:"text-2xl font-bold text-amber-700 dark:text-amber-400",children:D}),r.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-500",children:"Pending (30 days)"})]})]}),r.jsxs("div",{className:"bg-muted/30 rounded-lg p-4",children:[r.jsx("h4",{className:"font-semibold text-sm mb-3",children:"How It Works"}),r.jsxs("div",{className:"space-y-2 text-sm text-muted-foreground",children:[r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"bg-primary text-primary-foreground rounded-full w-5 h-5 flex items-center justify-center text-xs shrink-0",children:"1"}),r.jsx("p",{children:"Share your referral link or send an invite email to broker friends"})]}),r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"bg-primary text-primary-foreground rounded-full w-5 h-5 flex items-center justify-center text-xs shrink-0",children:"2"}),r.jsx("p",{children:"They sign up and subscribe to LevelUp"})]}),r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"bg-primary text-primary-foreground rounded-full w-5 h-5 flex items-center justify-center text-xs shrink-0",children:"3"}),r.jsx("p",{children:"After 30 days, you get $25/month off your membership - forever!"})]})]})]}),r.jsx(obt,{brokerageId:t,refreshTrigger:C}),f.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium",children:"Your Referrals"}),f.slice(0,5).map(q=>{var W,K;return r.jsxs("div",{className:"flex items-center justify-between p-2.5 bg-muted/30 rounded-lg",children:[r.jsx("span",{className:"text-sm truncate",children:((W=q.referred_brokerage)==null?void 0:W.name)||((K=q.referred_user)==null?void 0:K.email)||"Pending setup"}),r.jsxs(Rt,{variant:q.status==="qualified"?"default":q.status==="pending"?"secondary":"destructive",className:q.status==="qualified"?"bg-green-600":"",children:[q.status==="qualified"&&r.jsx(za,{className:"h-3 w-3 mr-1"}),q.status]})]},q.id)})]})]})]}),r.jsx(abt,{open:w,onOpenChange:k,referralCode:n||"",brokerageId:t||"",senderName:c||"A LevelUp Member",brokerageName:i,onInvitesSent:()=>S(q=>q+1)})]})},cbt=()=>{const{user:t,isBrokerageManager:e,brokerageId:n,isAdmin:s,managedBrokerages:i,selectedBrokerageId:o,setSelectedBrokerageId:c}=Fr(),a=es(),{toast:f}=la(),[m,y]=P.useState(""),[v,w]=P.useState(!0),k=o||(i.length>0?i[0].id:n);P.useEffect(()=>{if(!t||!e&&!s){a("/dashboard");return}!o&&i.length>0&&c(i[0].id),k?C():i.length===0&&!n&&w(!1)},[t,e,s,k,a,i,o]);const C=async()=>{if(!k){w(!1);return}try{const{data:S,error:T}=await ee.from("brokerages").select("name").eq("id",k).single();if(T)throw T;y(S.name)}catch(S){console.error("Error loading brokerage info:",S),f({title:"Error",description:"Failed to load brokerage information",variant:"destructive"})}finally{w(!1)}};return v?r.jsx(Or,{title:"Manage Brokerages",description:"Loading brokerage information...",children:r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):k?r.jsx(Or,{title:m||"Manage Brokerages",description:"Brokerage Management Dashboard",children:r.jsxs("div",{className:"space-y-6",children:[i.length>1&&r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:"Managing:"}),r.jsxs(_n,{value:o||"",onValueChange:c,children:[r.jsxs(xn,{className:"w-[280px]",children:[r.jsx(ra,{className:"mr-2 h-4 w-4"}),r.jsx(bn,{placeholder:"Select brokerage"})]}),r.jsx(vn,{children:i.map(S=>r.jsx(er,{value:S.id,children:S.name},S.id))})]})]}),r.jsxs(La,{defaultValue:"agents",className:"space-y-4",children:[r.jsxs(Ma,{className:"grid w-full grid-cols-3 md:grid-cols-7",children:[r.jsx(yn,{value:"agents",children:"Agents"}),r.jsx(yn,{value:"invite",children:"Invite Links"}),r.jsx(yn,{value:"referrals",children:"Referrals"}),r.jsx(yn,{value:"leaderboard",children:"Leaderboard"}),r.jsx(yn,{value:"activity",children:"Activity"}),r.jsx(yn,{value:"analytics",children:"Analytics"}),r.jsx(yn,{value:"shares",children:"Shares"})]}),r.jsx($n,{value:"agents",className:"space-y-4",children:r.jsx(J2t,{brokerageId:k})}),r.jsx($n,{value:"invite",className:"space-y-4",children:r.jsx(ibt,{brokerageId:k})}),r.jsx($n,{value:"referrals",className:"space-y-4",children:r.jsx(lbt,{})}),r.jsx($n,{value:"leaderboard",className:"space-y-4",children:r.jsx(HDe,{brokerageId:k,title:`${m} Event Leaderboard`,showUserStats:!1})}),r.jsx($n,{value:"activity",className:"space-y-4",children:r.jsx(nbt,{brokerageId:k})}),r.jsx($n,{value:"analytics",className:"space-y-4",children:r.jsx(sbt,{brokerageId:k})}),r.jsx($n,{value:"shares",className:"space-y-4",children:r.jsx(eze,{brokerageOnly:!0,brokerageId:k})})]})]})}):r.jsx(Or,{title:"Manage Brokerages",description:"Brokerage Management",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(ra,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h2",{className:"text-xl font-semibold mb-2",children:"No Brokerage Assigned"}),r.jsx("p",{className:"text-muted-foreground",children:"You don't have any brokerages to manage."})]})})};function dbt({brokerageId:t,canManage:e}){const{user:n}=Fr(),[s,i]=P.useState([]),[o,c]=P.useState(!0),[a,f]=P.useState(!1),[m,y]=P.useState(null),[v,w]=P.useState(null),[k,C]=P.useState(!1),[S,T]=P.useState(""),[I,A]=P.useState(""),[D,$]=P.useState(!1),F=async()=>{try{const{data:re,error:he}=await ee.from("brokerage_announcements").select("*").eq("brokerage_id",t).order("is_pinned",{ascending:!1}).order("pinned_at",{ascending:!1,nullsFirst:!1}).order("created_at",{ascending:!1});if(he)throw he;const ue=re;if(ue&&ue.length>0){const Ne=[...new Set(ue.map(me=>me.created_by))],{data:se}=await ee.from("profiles").select("id, name, avatar_url").in("id",Ne),xe=new Map((se==null?void 0:se.map(me=>[me.id,me]))||[]),ie=ue.map(me=>({...me,author:xe.get(me.created_by)||{name:"Unknown",avatar_url:null}}));i(ie)}else i([])}catch(re){console.error("Error fetching announcements:",re)}finally{c(!1)}};P.useEffect(()=>{F()},[t]);const q=()=>{T(""),A(""),$(!1),y(null)},W=re=>{re?(y(re),T(re.title),A(re.content),$(re.is_pinned)):q(),f(!0)},K=async()=>{if(!S.trim()||!I.trim()){Ge.error("Please fill in all fields");return}C(!0);try{if(m){const{error:re}=await ee.from("brokerage_announcements").update({title:S.trim(),content:I.trim(),is_pinned:D,pinned_at:D?new Date().toISOString():null}).eq("id",m.id);if(re)throw re;Ge.success("Announcement updated")}else{const{error:re}=await ee.from("brokerage_announcements").insert({brokerage_id:t,created_by:n==null?void 0:n.id,title:S.trim(),content:I.trim(),is_pinned:D,pinned_at:D?new Date().toISOString():null});if(re)throw re;Ge.success("Announcement created")}f(!1),q(),F()}catch(re){console.error("Error saving announcement:",re),Ge.error("Failed to save announcement")}finally{C(!1)}},Z=async()=>{if(v)try{const{error:re}=await ee.from("brokerage_announcements").delete().eq("id",v);if(re)throw re;Ge.success("Announcement deleted"),F()}catch(re){console.error("Error deleting announcement:",re),Ge.error("Failed to delete announcement")}finally{w(null)}};return o?r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(nm,{className:"h-5 w-5"}),"Announcements"]})}),r.jsx(Je,{children:r.jsx("div",{className:"animate-pulse space-y-3",children:r.jsx("div",{className:"h-20 bg-muted rounded"})})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-4",children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(nm,{className:"h-5 w-5 text-primary"}),"Announcements"]}),e&&r.jsxs(te,{size:"sm",onClick:()=>W(),className:"gap-1",children:[r.jsx(Sn,{className:"h-4 w-4"}),"New"]})]}),r.jsx(Je,{children:s.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No announcements yet"}):r.jsx("div",{className:"space-y-4",children:s.map(re=>{var he,ue,Ne,se;return r.jsx("div",{className:`p-4 rounded-lg border ${re.is_pinned?"bg-primary/5 border-primary/20":"bg-muted/30"}`,children:r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[re.is_pinned&&r.jsx(X0,{className:"h-3.5 w-3.5 text-primary shrink-0"}),r.jsx("h4",{className:"font-semibold truncate",children:re.title})]}),r.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:re.content}),r.jsxs("div",{className:"flex items-center gap-2 mt-3 text-xs text-muted-foreground",children:[r.jsxs(Li,{className:"h-5 w-5",children:[r.jsx(Io,{src:((he=re.author)==null?void 0:he.avatar_url)||void 0}),r.jsx(Oi,{className:"text-[10px]",children:((Ne=(ue=re.author)==null?void 0:ue.name)==null?void 0:Ne.charAt(0))||"?"})]}),r.jsx("span",{children:(se=re.author)==null?void 0:se.name}),r.jsx("span",{children:"•"}),r.jsx("span",{children:un(new Date(re.created_at),"MMM d, yyyy")})]})]}),e&&r.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[r.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>W(re),children:r.jsx(ma,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive",onClick:()=>w(re.id),children:r.jsx(Xn,{className:"h-4 w-4"})})]})]})},re.id)})})})]}),r.jsx($r,{open:a,onOpenChange:f,children:r.jsxs(zr,{children:[r.jsx(Zr,{children:r.jsx(Kr,{children:m?"Edit Announcement":"New Announcement"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"title",children:"Title"}),r.jsx(yt,{id:"title",value:S,onChange:re=>T(re.target.value),placeholder:"Announcement title..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"content",children:"Content"}),r.jsx(ps,{id:"content",value:I,onChange:re=>A(re.target.value),placeholder:"Write your announcement...",rows:4})]}),r.jsx("div",{className:"flex items-center justify-between",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Zs,{id:"pinned",checked:D,onCheckedChange:$}),r.jsxs(Qe,{htmlFor:"pinned",className:"flex items-center gap-1 cursor-pointer",children:[r.jsx(X0,{className:"h-4 w-4"}),"Pin to top"]})]})}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"outline",onClick:()=>f(!1),children:"Cancel"}),r.jsx(te,{onClick:K,disabled:k,children:k?"Saving...":m?"Update":"Create"})]})]})]})}),r.jsx(ih,{open:!!v,onOpenChange:()=>w(null),children:r.jsxs(yu,{children:[r.jsxs(xu,{children:[r.jsx(_u,{children:"Delete Announcement"}),r.jsx(bu,{children:"Are you sure you want to delete this announcement? This action cannot be undone."})]}),r.jsxs(vu,{children:[r.jsx(wu,{children:"Cancel"}),r.jsx(Hd,{onClick:Z,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}function ubt({brokerageId:t}){const[e,n]=P.useState([]),[s,i]=P.useState(!0),[o,c]=P.useState("");P.useEffect(()=>{(async()=>{try{const{data:m,error:y}=await ee.from("profiles").select("id, name, email, phone, avatar_url, title, bio, areas_served, years_experience, instagram_url, facebook_url, linkedin_url").eq("brokerage_id",t).order("name");if(y)throw y;n(m||[])}catch(m){console.error("Error fetching agents:",m)}finally{i(!1)}})()},[t]);const a=e.filter(f=>{var m,y;return f.name.toLowerCase().includes(o.toLowerCase())||f.email.toLowerCase().includes(o.toLowerCase())||((m=f.title)==null?void 0:m.toLowerCase().includes(o.toLowerCase()))||((y=f.areas_served)==null?void 0:y.toLowerCase().includes(o.toLowerCase()))});return s?r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(hs,{className:"h-5 w-5"}),"Agent Roster"]})}),r.jsx(Je,{children:r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:[1,2,3,4].map(f=>r.jsx("div",{className:"animate-pulse",children:r.jsx("div",{className:"h-48 bg-muted rounded-lg"})},f))})})]}):r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 space-y-0",children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(hs,{className:"h-5 w-5 text-primary"}),"Agent Roster",r.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:["(",e.length,")"]})]}),r.jsxs("div",{className:"relative w-full sm:w-64",children:[r.jsx(Ti,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(yt,{placeholder:"Search agents...",value:o,onChange:f=>c(f.target.value),className:"pl-9"})]})]}),r.jsx(Je,{children:a.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:o?"No agents match your search":"No agents in this brokerage yet"}):r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:a.map(f=>r.jsx(hbt,{agent:f},f.id))})})]})}function hbt({agent:t}){const e=t.name.split(" ").map(n=>n[0]).join("").toUpperCase().slice(0,2);return r.jsxs("div",{className:"group relative bg-card border rounded-xl p-4 hover:shadow-md transition-shadow",children:[r.jsxs("div",{className:"flex flex-col items-center text-center mb-3",children:[r.jsxs(Li,{className:"h-20 w-20 mb-3 ring-2 ring-background shadow-md",children:[r.jsx(Io,{src:t.avatar_url||void 0,alt:t.name}),r.jsx(Oi,{className:"text-lg bg-primary/10 text-primary",children:e})]}),r.jsx("h3",{className:"font-semibold text-sm leading-tight",children:t.name}),t.title&&r.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:t.title})]}),t.bio&&r.jsx("p",{className:"text-xs text-muted-foreground text-center line-clamp-2 mb-3",children:t.bio}),r.jsxs("div",{className:"space-y-1.5 mb-3",children:[t.areas_served&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx(yl,{className:"h-3 w-3 shrink-0"}),r.jsx("span",{className:"truncate",children:t.areas_served})]}),t.years_experience&&r.jsxs("p",{className:"text-xs text-muted-foreground text-center",children:[t.years_experience," ",t.years_experience===1?"year":"years"," experience"]})]}),r.jsxs("div",{className:"flex items-center justify-center gap-2",children:[t.phone&&r.jsx(te,{variant:"outline",size:"icon",className:"h-8 w-8",asChild:!0,children:r.jsx("a",{href:`tel:${t.phone}`,title:`Call ${t.name}`,children:r.jsx(Wa,{className:"h-4 w-4"})})}),r.jsx(te,{variant:"outline",size:"icon",className:"h-8 w-8",asChild:!0,children:r.jsx("a",{href:`mailto:${t.email}`,title:`Email ${t.name}`,children:r.jsx(di,{className:"h-4 w-4"})})}),t.linkedin_url&&r.jsx(te,{variant:"outline",size:"icon",className:"h-8 w-8",asChild:!0,children:r.jsx("a",{href:t.linkedin_url,target:"_blank",rel:"noopener noreferrer",title:"LinkedIn",children:r.jsx(tm,{className:"h-4 w-4"})})}),t.instagram_url&&r.jsx(te,{variant:"outline",size:"icon",className:"h-8 w-8",asChild:!0,children:r.jsx("a",{href:t.instagram_url,target:"_blank",rel:"noopener noreferrer",title:"Instagram",children:r.jsx(Wd,{className:"h-4 w-4"})})})]})]})}function fbt({brokerageId:t}){const[e,n]=P.useState([]),[s,i]=P.useState(!0);if(P.useEffect(()=>{(async()=>{try{const{data:f,error:m}=await ee.from("profiles").select("id, name, avatar_url").eq("brokerage_id",t);if(m)throw m;if(!f||f.length===0){n([]),i(!1);return}const y=f.map(S=>S.id),{data:v,error:w}=await ee.from("agent_attendance_stats").select("user_id, total_points").in("user_id",y).order("total_points",{ascending:!1});if(w)throw w;const k=new Map(f.map(S=>[S.id,S])),C=(v||[]).filter(S=>S.total_points>0).map(S=>{const T=k.get(S.user_id);return{user_id:S.user_id,total_points:S.total_points,name:(T==null?void 0:T.name)||"Unknown",avatar_url:(T==null?void 0:T.avatar_url)||null}});n(C)}catch(f){console.error("Error fetching leaderboard:",f)}finally{i(!1)}})()},[t]),s)return r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(qa,{className:"h-5 w-5"}),"Team Leaderboard"]})}),r.jsx(Je,{children:r.jsx("div",{className:"animate-pulse space-y-3",children:[1,2,3].map(a=>r.jsx("div",{className:"h-12 bg-muted rounded"},a))})})]});const o=a=>a===1?"text-yellow-500":a===2?"text-gray-400":a===3?"text-amber-600":"text-muted-foreground",c=a=>a<=3?r.jsx(Ty,{className:zt("h-5 w-5",o(a))}):r.jsx("span",{className:"w-5 text-center text-sm text-muted-foreground",children:a});return r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(qa,{className:"h-5 w-5 text-primary"}),"Team Leaderboard"]})}),r.jsx(Je,{children:e.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No points earned yet. Attend events to earn points!"}):r.jsx("div",{className:"space-y-2",children:e.slice(0,10).map((a,f)=>{const m=a.name.split(" ").map(v=>v[0]).join("").toUpperCase().slice(0,2),y=f+1;return r.jsxs("div",{className:zt("flex items-center gap-3 p-2 rounded-lg",y<=3&&"bg-muted/50"),children:[r.jsx("div",{className:"w-6 flex justify-center",children:c(y)}),r.jsxs(Li,{className:"h-8 w-8",children:[r.jsx(Io,{src:a.avatar_url||void 0}),r.jsx(Oi,{className:"text-xs",children:m})]}),r.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:a.name}),r.jsxs("span",{className:"text-sm font-semibold text-primary",children:[a.total_points.toLocaleString()," pts"]})]},a.user_id)})})})]})}function pbt({brokerageId:t}){const e=es(),[n,s]=P.useState([]),[i,o]=P.useState(!0);P.useEffect(()=>{(async()=>{try{const{data:f,error:m}=await ee.from("profiles").select("id, name, avatar_url").eq("brokerage_id",t);if(m)throw m;if(!f||f.length===0){s([]),o(!1);return}const y=f.map(S=>S.id),v=new Map(f.map(S=>[S.id,S])),{data:w,error:k}=await ee.from("listings").select(` id, slug, property_address, city, price, property_type, agent_id, listing_photos(photo_url) `).in("agent_id",y).eq("status","active").order("created_at",{ascending:!1}).limit(6);if(k)throw k;const C=(w||[]).map(S=>({id:S.id,slug:S.slug,property_address:S.property_address,city:S.city,price:S.price,property_type:S.property_type,agent_id:S.agent_id,agent:v.get(S.agent_id)||null,photos:S.listing_photos||[]}));s(C)}catch(f){console.error("Error fetching listings:",f)}finally{o(!1)}})()},[t]);const c=a=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(a);return i?r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(Hi,{className:"h-5 w-5"}),"Brokerage Listings"]})}),r.jsx(Je,{children:r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[1,2].map(a=>r.jsx("div",{className:"animate-pulse",children:r.jsx("div",{className:"h-32 bg-muted rounded-lg"})},a))})})]}):r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-4",children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(Hi,{className:"h-5 w-5 text-primary"}),"Brokerage Listings"]}),r.jsxs(te,{size:"sm",variant:"outline",onClick:()=>e("/innercircle/listing-exchange"),className:"gap-1",children:[r.jsx(Sn,{className:"h-4 w-4"}),"Add Listing"]})]}),r.jsxs(Je,{children:[n.length===0?r.jsxs("div",{className:"text-center py-8",children:[r.jsx(Hi,{className:"h-10 w-10 text-muted-foreground mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"No active listings from your brokerage yet"}),r.jsxs(te,{size:"sm",onClick:()=>e("/innercircle/listing-exchange/new"),className:"gap-1",children:[r.jsx(Sn,{className:"h-4 w-4"}),"Add Your First Listing"]})]}):r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:n.map(a=>r.jsxs("div",{onClick:()=>window.open(`https://listings.relevelup.com/${a.slug||a.id}`,"_blank"),className:"group cursor-pointer border rounded-lg overflow-hidden hover:shadow-md transition-shadow",children:[r.jsxs("div",{className:"relative h-24 bg-muted",children:[a.photos&&a.photos.length>0?r.jsx("img",{src:a.photos[0].photo_url,alt:a.property_address||"Listing",className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Hi,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx("div",{className:"absolute top-2 left-2",children:r.jsx("span",{className:"text-[10px] font-medium bg-primary text-primary-foreground px-1.5 py-0.5 rounded uppercase",children:a.property_type.replace("_"," ")})})]}),r.jsxs("div",{className:"p-2.5",children:[r.jsx("p",{className:"font-semibold text-sm text-primary",children:c(a.price)}),r.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:a.property_address||"Address not available"}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:a.city}),a.agent&&r.jsxs("p",{className:"text-[10px] text-muted-foreground mt-1.5 truncate",children:["Listed by ",a.agent.name]})]})]},a.id))}),n.length>0&&r.jsxs(te,{variant:"ghost",size:"sm",className:"w-full mt-3",onClick:()=>e("/innercircle/listing-exchange"),children:["View All Listings",r.jsx(Fs,{className:"h-3 w-3 ml-1"})]})]})]})}function mbt(){const{user:t,isAdmin:e,isBrokerageManager:n}=Fr(),s=es(),[i,o]=P.useState(!0),[c,a]=P.useState(null),[f,m]=P.useState(""),[y,v]=P.useState(0),[w,k]=P.useState(!1),[C,S]=P.useState(!1);return P.useEffect(()=>{(async()=>{if(t)try{const{data:I}=await ee.from("profiles").select("brokerage_id").eq("id",t.id).maybeSingle();if(!(I!=null&&I.brokerage_id)){o(!1);return}a(I.brokerage_id);const{data:A}=await ee.from("brokerages").select("name").eq("id",I.brokerage_id).maybeSingle();A&&m(A.name);const{count:D}=await ee.from("profiles").select("id",{count:"exact",head:!0}).eq("brokerage_id",I.brokerage_id);if(v(D||0),e)k(!0),S(!0);else if(n){const{data:$}=await ee.from("brokerage_manager_assignments").select("id").eq("user_id",t.id).eq("brokerage_id",I.brokerage_id).maybeSingle();k(!!$),S(!!$)}}catch(I){console.error("Error fetching brokerage info:",I)}finally{o(!1)}})()},[t,e,n]),i?r.jsx(Or,{title:"My Brokerage",description:"Loading...",children:r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):c?r.jsx(Or,{title:f||"My Brokerage",description:"Team Hub",children:r.jsxs("div",{className:"space-y-8",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[r.jsxs("div",{className:"flex items-center gap-2 bg-muted/50 rounded-lg px-4 py-2",children:[r.jsx(hs,{className:"h-5 w-5 text-primary"}),r.jsxs("span",{className:"font-medium",children:[y," ",y===1?"Agent":"Agents"]})]}),C&&r.jsxs(te,{onClick:()=>s(`/innercircle/listing/new?brokerage=${c}`),children:[r.jsx(Hi,{className:"h-4 w-4 mr-2"}),"Add Listing"]})]}),r.jsx(dbt,{brokerageId:c,canManage:w}),r.jsx(ubt,{brokerageId:c}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[r.jsx(fbt,{brokerageId:c}),r.jsx(pbt,{brokerageId:c})]})]})}):r.jsx(Or,{title:"My Brokerage",description:"Team Hub",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(ra,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h2",{className:"text-xl font-semibold mb-2",children:"No Brokerage Assigned"}),r.jsx("p",{className:"text-muted-foreground",children:"You're not currently part of a brokerage team."})]})})}function gbt(){const t=es(),[e,n]=P.useState(""),[s,i]=P.useState("grid"),{data:o,isLoading:c}=rr({queryKey:["newsletters"],queryFn:async()=>{const{data:k,error:C}=await ee.from("newsletter_content").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(C)throw C;return k}}),{data:a}=rr({queryKey:["newsletter-likes-all"],queryFn:async()=>{const{data:k}=await ee.from("newsletter_likes").select("newsletter_id");return k||[]}}),{data:f}=rr({queryKey:["newsletter-comments-all"],queryFn:async()=>{const{data:k}=await ee.from("newsletter_comments").select("newsletter_id");return k||[]}}),m=k=>(a==null?void 0:a.filter(C=>C.newsletter_id===k).length)||0,y=k=>(f==null?void 0:f.filter(C=>C.newsletter_id===k).length)||0,v=o==null?void 0:o.filter(k=>{var C;return k.title.toLowerCase().includes(e.toLowerCase())||((C=k.description)==null?void 0:C.toLowerCase().includes(e.toLowerCase()))}),w=k=>{t(`/newsletters/${k}`)};return r.jsx(Or,{title:"Newsletter Content",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"font-bold text-foreground text-5xl",children:"Newsletter Content"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Monthly newsletter templates and resources"})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(Ti,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(yt,{placeholder:"Search newsletters...",value:e,onChange:k=>n(k.target.value),className:"pl-9"})]}),r.jsxs("div",{className:"flex gap-2",children:[e&&r.jsx(te,{variant:"outline",size:"sm",onClick:()=>n(""),children:"Clear"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(te,{variant:s==="grid"?"secondary":"outline",size:"icon",onClick:()=>i("grid"),className:"rounded-full",children:r.jsx(lg,{className:"h-4 w-4"})}),r.jsx(te,{variant:s==="list"?"secondary":"outline",size:"icon",onClick:()=>i("list"),className:"rounded-full",children:r.jsx(rm,{className:"h-4 w-4"})})]})]})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[(v==null?void 0:v.length)||0," item",(v==null?void 0:v.length)!==1?"s":""," found"]}),c&&r.jsx("div",{className:s==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:[...Array(8)].map((k,C)=>r.jsx(Ye,{children:r.jsxs(Je,{className:"p-4",children:[r.jsx(Gr,{className:"aspect-[4/3] w-full rounded-lg mb-4"}),r.jsx(Gr,{className:"h-5 w-3/4 mb-2"}),r.jsx(Gr,{className:"h-4 w-full mb-4"})]})},C))}),!c&&(v==null?void 0:v.length)===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Ai,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("div",{className:"text-muted-foreground mb-4",children:e?"No newsletters match your search":"No newsletters available yet"}),e&&r.jsx(te,{variant:"outline",onClick:()=>n(""),children:"Clear Search"})]}),!c&&v&&v.length>0&&r.jsx("div",{className:s==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:v.map(k=>r.jsxs(Ye,{className:`group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer ${s==="list"?"flex flex-row":""}`,onClick:()=>w(k.id),children:[r.jsx("div",{className:`relative overflow-hidden bg-muted ${s==="list"?"w-48 shrink-0":"aspect-[3/2]"}`,children:k.preview_image_url?r.jsx("img",{src:k.preview_image_url,alt:k.title,className:"w-full h-full object-contain group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:r.jsx(Ai,{className:"h-16 w-16"})})}),r.jsxs(Je,{className:`p-4 flex flex-col ${s==="list"?"flex-1":""}`,children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:k.title}),k.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3 flex-1",children:k.description.replace(/<[^>]*>/g,"")}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground mb-3",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Zd,{className:"h-3.5 w-3.5"}),m(k.id)]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Hl,{className:"h-3.5 w-3.5"}),y(k.id)]})]}),r.jsxs(te,{size:"sm",className:"w-full gap-2",onClick:C=>{C.stopPropagation(),w(k.id)},children:[r.jsx(Fs,{className:"h-4 w-4"}),"View Details"]})]})]},k.id))})]})})}function ybt(){const{id:t}=dd(),e=es(),{user:n}=Fr(),{toast:s}=la(),i=Xr(),{trackEngagement:o}=oI(),[c,a]=P.useState(""),{data:f,isLoading:m}=rr({queryKey:["newsletter",t],queryFn:async()=>{const{data:F,error:q}=await ee.from("newsletter_content").select("*").eq("id",t).single();if(q)throw q;return F},enabled:!!t});P.useEffect(()=>{f&&o("newsletter",f.id,f.title,"view")},[f==null?void 0:f.id]);const{data:y}=rr({queryKey:["newsletter-drives",t],queryFn:async()=>{const{data:F}=await ee.from("newsletter_drive_links").select("*").eq("newsletter_id",t).order("sort_order");return F||[]},enabled:!!t}),{data:v}=rr({queryKey:["newsletter-pdfs",t],queryFn:async()=>{const{data:F}=await ee.from("newsletter_pdfs").select("*").eq("newsletter_id",t).order("sort_order");return F||[]},enabled:!!t}),{data:w}=rr({queryKey:["newsletter-videos",t],queryFn:async()=>{const{data:F}=await ee.from("newsletter_videos").select("*").eq("newsletter_id",t).order("sort_order");return F||[]},enabled:!!t}),{data:k}=rr({queryKey:["newsletter-canva-links",t],queryFn:async()=>{const{data:F}=await ee.from("newsletter_canva_links").select("*").eq("newsletter_id",t).order("sort_order");return F||[]},enabled:!!t}),{data:C}=rr({queryKey:["newsletter-likes",t],queryFn:async()=>{const{data:F}=await ee.from("newsletter_likes").select("*").eq("newsletter_id",t);return F||[]},enabled:!!t}),{data:S}=rr({queryKey:["newsletter-comments",t],queryFn:async()=>{const{data:F}=await ee.from("newsletter_comments").select("*, profiles:user_id(name)").eq("newsletter_id",t).order("created_at",{ascending:!1});return F||[]},enabled:!!t}),T=C==null?void 0:C.some(F=>F.user_id===(n==null?void 0:n.id)),I=cr({mutationFn:async()=>{T?await ee.from("newsletter_likes").delete().eq("newsletter_id",t).eq("user_id",n==null?void 0:n.id):await ee.from("newsletter_likes").insert({newsletter_id:t,user_id:n==null?void 0:n.id})},onSuccess:()=>{i.invalidateQueries({queryKey:["newsletter-likes",t]})}}),A=cr({mutationFn:async F=>{const{error:q}=await ee.from("newsletter_comments").insert({newsletter_id:t,user_id:n==null?void 0:n.id,content:F});if(q)throw q},onSuccess:()=>{i.invalidateQueries({queryKey:["newsletter-comments",t]}),a(""),s({title:"Comment added"})}}),D=cr({mutationFn:async F=>{const{error:q}=await ee.from("newsletter_comments").delete().eq("id",F);if(q)throw q},onSuccess:()=>{i.invalidateQueries({queryKey:["newsletter-comments",t]}),s({title:"Comment deleted"})}}),$=F=>{if(F.includes("player.mediadelivery.net")||F.includes("iframe.mediadelivery.net")){const q=F.match(/embed\/(\d+)\/([a-f0-9-]+)/);if(q)return r.jsx("div",{className:"relative w-full pt-[56.25%]",children:r.jsx("iframe",{src:`https://iframe.mediadelivery.net/embed/${q[1]}/${q[2]}?autoplay=false`,className:"absolute inset-0 w-full h-full rounded-lg",allow:"accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0})})}if(F.includes("youtube.com")||F.includes("youtu.be")){const q=F.match(/(?:youtube\.com\/(?:watch\?v=|embed\/)|youtu\.be\/)([^&\s]+)/);if(q)return r.jsx("div",{className:"relative w-full pt-[56.25%]",children:r.jsx("iframe",{src:`https://www.youtube.com/embed/${q[1]}`,className:"absolute inset-0 w-full h-full rounded-lg",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})}return r.jsxs("a",{href:F,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 text-primary hover:underline",children:[r.jsx(wc,{className:"h-4 w-4"})," Watch Video"]})};return m?r.jsx(Or,{title:"",description:"",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Gr,{className:"h-8 w-32"}),r.jsx(Gr,{className:"h-64 w-full"}),r.jsx(Gr,{className:"h-32 w-full"})]})}):f?r.jsx(Or,{title:"",description:"",children:r.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[r.jsxs(te,{variant:"ghost",onClick:()=>e("/newsletters"),className:"mb-4",children:[r.jsx(Va,{className:"mr-2 h-4 w-4"})," Back to Newsletters"]}),f.preview_image_url&&r.jsx("img",{src:f.preview_image_url,alt:f.title,className:"w-full h-64 md:h-80 object-cover rounded-lg"}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-3xl font-bold",children:f.title}),r.jsx("p",{className:"text-muted-foreground mt-1",children:un(new Date(f.publish_date),"MMMM d, yyyy")})]}),f.description&&r.jsx("div",{className:"text-lg text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:f.description}}),r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(HC,{resourceType:"newsletter",resourceId:f.id,resourceTitle:f.title}),r.jsxs(te,{variant:T?"default":"outline",size:"sm",onClick:()=>I.mutate(),children:[r.jsx(ql,{className:`h-4 w-4 mr-1 ${T?"fill-current":""}`}),(C==null?void 0:C.length)||0," ",(C==null?void 0:C.length)===1?"Like":"Likes"]})]}),k&&k.length>0&&r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsx(Yt,{className:"text-lg",children:"Canva Templates"})}),r.jsx(Je,{className:"space-y-2",children:k.map(F=>r.jsxs("a",{href:F.canva_share_link,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("newsletter",f.id,f.title,"click_canva"),className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted transition-colors",children:[r.jsx(Gd,{className:"h-5 w-5 text-purple-500"}),r.jsx("span",{className:"font-medium",children:F.title}),r.jsx(Fs,{className:"h-4 w-4 text-muted-foreground ml-auto"})]},F.id))})]}),y&&y.length>0&&r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsx(Yt,{className:"text-lg",children:"Google Drive Files"})}),r.jsx(Je,{className:"space-y-2",children:y.map(F=>r.jsxs("a",{href:F.drive_url,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("newsletter",f.id,f.title,"click_link"),className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted transition-colors",children:[r.jsx(Fs,{className:"h-5 w-5 text-primary"}),r.jsx("span",{className:"font-medium",children:F.title})]},F.id))})]}),v&&v.length>0&&r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsx(Yt,{className:"text-lg",children:"PDF Downloads"})}),r.jsx(Je,{className:"space-y-2",children:v.map(F=>r.jsxs("a",{href:F.file_url,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("newsletter",f.id,f.title,"click_pdf"),className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted transition-colors",children:[r.jsx(Ai,{className:"h-5 w-5 text-red-500"}),r.jsx("span",{className:"font-medium flex-1",children:F.name}),r.jsx(Mo,{className:"h-4 w-4 text-muted-foreground"})]},F.id))})]}),w&&w.length>0&&r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsx(Yt,{className:"text-lg",children:"Videos"})}),r.jsx(Je,{className:"space-y-6",children:w.map(F=>r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"font-medium",children:F.title}),$(F.video_url)]},F.id))})]}),r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsxs(Yt,{className:"text-lg",children:["Comments (",(S==null?void 0:S.length)||0,")"]})}),r.jsxs(Je,{className:"space-y-4",children:[r.jsxs("div",{className:"flex gap-3",children:[r.jsx(ps,{placeholder:"Write a comment...",value:c,onChange:F=>a(F.target.value),className:"flex-1"}),r.jsx(te,{onClick:()=>c.trim()&&A.mutate(c),disabled:!c.trim()||A.isPending,children:r.jsx(To,{className:"h-4 w-4"})})]}),r.jsx("div",{className:"space-y-4",children:S==null?void 0:S.map(F=>{var q,W,K;return r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Li,{className:"h-8 w-8",children:r.jsx(Oi,{children:((W=(q=F.profiles)==null?void 0:q.name)==null?void 0:W[0])||"U"})}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"font-medium text-sm",children:((K=F.profiles)==null?void 0:K.name)||"User"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:un(new Date(F.created_at),"MMM d, yyyy")}),F.user_id===(n==null?void 0:n.id)&&r.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>D.mutate(F.id),children:r.jsx(Xn,{className:"h-3 w-3"})})]})]}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:F.content})]})]},F.id)})})]})]})]})}):r.jsx(Or,{title:"Not Found",description:"",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx("p",{className:"text-muted-foreground",children:"Newsletter not found"}),r.jsx(te,{variant:"link",onClick:()=>e("/newsletters"),children:"Back to Newsletters"})]})})}function xbt(){const{toast:t}=la(),e=Xr(),[n,s]=P.useState(!1),[i,o]=P.useState(null),[c,a]=P.useState({title:"",description:"",publish_date:un(new Date,"yyyy-MM-dd'T'HH:mm"),is_published:!1}),[f,m]=P.useState(null),[y,v]=P.useState(null),[w,k]=P.useState([]),[C,S]=P.useState([]),[T,I]=P.useState([]),[A,D]=P.useState([]),[$,F]=P.useState([]),[q,W]=P.useState(!1),{data:K,isLoading:Z}=rr({queryKey:["admin-newsletters"],queryFn:async()=>{const{data:oe,error:ae}=await ee.from("newsletter_content").select("*").order("publish_date",{ascending:!1});if(ae)throw ae;return oe}}),re=cr({mutationFn:async oe=>{const{data:ae,error:je}=await ee.from("newsletter_content").insert({title:oe.title,description:oe.description||null,preview_image_url:oe.preview_image_url,publish_date:oe.publish_date,is_published:oe.is_published}).select().single();if(je)throw je;return ae},onSuccess:async oe=>{await Ne(oe.id),e.invalidateQueries({queryKey:["admin-newsletters"]}),t({title:"Newsletter created successfully"}),xe()},onError:oe=>{t({title:"Error creating newsletter",description:oe.message,variant:"destructive"})}}),he=cr({mutationFn:async oe=>{const{error:ae}=await ee.from("newsletter_content").update({title:oe.title,description:oe.description||null,preview_image_url:oe.preview_image_url,publish_date:oe.publish_date,is_published:oe.is_published}).eq("id",oe.id);if(ae)throw ae;return oe.id},onSuccess:async oe=>{await Ne(oe),e.invalidateQueries({queryKey:["admin-newsletters"]}),t({title:"Newsletter updated successfully"}),xe()},onError:oe=>{t({title:"Error updating newsletter",description:oe.message,variant:"destructive"})}}),ue=cr({mutationFn:async oe=>{const{error:ae}=await ee.from("newsletter_content").delete().eq("id",oe);if(ae)throw ae},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-newsletters"]}),t({title:"Newsletter deleted successfully"})},onError:oe=>{t({title:"Error deleting newsletter",description:oe.message,variant:"destructive"})}}),Ne=async oe=>{await ee.from("newsletter_drive_links").delete().eq("newsletter_id",oe),await ee.from("newsletter_pdfs").delete().eq("newsletter_id",oe),await ee.from("newsletter_videos").delete().eq("newsletter_id",oe),await ee.from("newsletter_canva_links").delete().eq("newsletter_id",oe);for(const ae of $){const je=`${oe}/${Date.now()}-${ae.file.name}`,{error:Me}=await ee.storage.from("newsletter-content").upload(je,ae.file);if(!Me){const{data:Ue}=ee.storage.from("newsletter-content").getPublicUrl(je);C.push({name:ae.name,file_url:Ue.publicUrl,file_size:ae.file.size,sort_order:C.length})}}w.length>0&&await ee.from("newsletter_drive_links").insert(w.map((ae,je)=>({newsletter_id:oe,title:ae.title,drive_url:ae.drive_url,sort_order:je}))),C.length>0&&await ee.from("newsletter_pdfs").insert(C.map((ae,je)=>({newsletter_id:oe,name:ae.name,file_url:ae.file_url,file_size:ae.file_size||null,sort_order:je}))),T.length>0&&await ee.from("newsletter_videos").insert(T.map((ae,je)=>({newsletter_id:oe,title:ae.title,video_url:ae.video_url,sort_order:je}))),A.length>0&&await ee.from("newsletter_canva_links").insert(A.map((ae,je)=>({newsletter_id:oe,title:ae.title,canva_share_link:ae.canva_share_link,sort_order:je})))},se=async oe=>{o(oe),a({title:oe.title,description:oe.description||"",publish_date:un(new Date(oe.publish_date),"yyyy-MM-dd'T'HH:mm"),is_published:oe.is_published}),v(oe.preview_image_url);const[ae,je,Me,Ue]=await Promise.all([ee.from("newsletter_drive_links").select("*").eq("newsletter_id",oe.id).order("sort_order"),ee.from("newsletter_pdfs").select("*").eq("newsletter_id",oe.id).order("sort_order"),ee.from("newsletter_videos").select("*").eq("newsletter_id",oe.id).order("sort_order"),ee.from("newsletter_canva_links").select("*").eq("newsletter_id",oe.id).order("sort_order")]);k(ae.data||[]),S(je.data||[]),I(Me.data||[]),D(Ue.data||[]),F([]),s(!0)},xe=()=>{s(!1),o(null),a({title:"",description:"",publish_date:un(new Date,"yyyy-MM-dd'T'HH:mm"),is_published:!1}),m(null),v(null),k([]),S([]),I([]),D([]),F([])},ie=async oe=>{var je;const ae=(je=oe.target.files)==null?void 0:je[0];ae&&(m(ae),v(URL.createObjectURL(ae)))},me=async()=>{if(!c.title){t({title:"Title is required",variant:"destructive"});return}W(!0);let oe=y;if(f){const ae=`previews/${Date.now()}-${f.name}`,{error:je}=await ee.storage.from("newsletter-content").upload(ae,f);if(!je){const{data:Me}=ee.storage.from("newsletter-content").getPublicUrl(ae);oe=Me.publicUrl}}i?he.mutate({id:i.id,...c,preview_image_url:oe}):re.mutate({...c,preview_image_url:oe}),W(!1)},fe=()=>{k([...w,{title:"",drive_url:"",sort_order:w.length}])},ve=()=>{I([...T,{title:"",video_url:"",sort_order:T.length}])},Ie=()=>{D([...A,{title:"",canva_share_link:"",sort_order:A.length}])},Se=oe=>{const ae=oe.target.files;if(!ae)return;const je=Array.from(ae).map(Me=>({file:Me,name:Me.name.replace(/\.[^/.]+$/,"")}));F([...$,...je])};return r.jsx(Or,{title:"Newsletter Content",description:"Manage monthly newsletter templates and resources",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ou,{title:"Newsletter Content",description:"Manage monthly newsletter templates and resources"}),r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs(Ye,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-muted-foreground",children:"Total Newsletters"})}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:(K==null?void 0:K.length)||0})})]}),r.jsxs(Ye,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:(K==null?void 0:K.filter(oe=>oe.is_published).length)||0})})]})]}),r.jsxs($r,{open:n,onOpenChange:oe=>!oe&&xe(),children:[r.jsx(Lo,{asChild:!0,children:r.jsxs(te,{onClick:()=>s(!0),children:[r.jsx(Sn,{className:"mr-2 h-4 w-4"})," Add Newsletter"]})}),r.jsxs(zr,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Zr,{children:r.jsx(Kr,{children:i?"Edit Newsletter":"Add Newsletter"})}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Title *"}),r.jsx(yt,{value:c.title,onChange:oe=>a({...c,title:oe.target.value}),placeholder:"Newsletter title"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Publish Date"}),r.jsx(yt,{type:"datetime-local",value:c.publish_date,onChange:oe=>a({...c,publish_date:oe.target.value})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Description"}),r.jsx(Qy,{content:c.description,onChange:oe=>a({...c,description:oe}),placeholder:"Newsletter description",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Preview Image"}),r.jsxs("div",{className:"flex items-center gap-4",children:[y&&r.jsx("img",{src:y,alt:"Preview",className:"h-20 w-32 object-cover rounded-md"}),r.jsxs("div",{children:[r.jsx(yt,{type:"file",accept:"image/*",onChange:ie,className:"hidden",id:"preview-upload"}),r.jsx(te,{variant:"outline",asChild:!0,children:r.jsxs("label",{htmlFor:"preview-upload",className:"cursor-pointer",children:[r.jsx(Ao,{className:"mr-2 h-4 w-4"})," Upload Image"]})})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Zs,{checked:c.is_published,onCheckedChange:oe=>a({...c,is_published:oe})}),r.jsx(Qe,{children:"Published"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Qe,{className:"text-base font-medium",children:"Google Drive Links"}),r.jsxs(te,{type:"button",variant:"outline",size:"sm",onClick:fe,children:[r.jsx(Sn,{className:"mr-1 h-3 w-3"})," Add Link"]})]}),w.map((oe,ae)=>r.jsxs("div",{className:"flex gap-2 items-center",children:[r.jsx(yt,{placeholder:"Link title",value:oe.title,onChange:je=>{const Me=[...w];Me[ae].title=je.target.value,k(Me)},className:"w-1/3"}),r.jsx(yt,{placeholder:"Google Drive URL",value:oe.drive_url,onChange:je=>{const Me=[...w];Me[ae].drive_url=je.target.value,k(Me)},className:"flex-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"icon",onClick:()=>k(w.filter((je,Me)=>Me!==ae)),children:r.jsx(Ms,{className:"h-4 w-4"})})]},ae))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Qe,{className:"text-base font-medium",children:"PDF Files"}),r.jsxs("div",{children:[r.jsx(yt,{type:"file",accept:".pdf",multiple:!0,onChange:Se,className:"hidden",id:"pdf-upload"}),r.jsx(te,{variant:"outline",size:"sm",asChild:!0,children:r.jsxs("label",{htmlFor:"pdf-upload",className:"cursor-pointer",children:[r.jsx(Ao,{className:"mr-1 h-3 w-3"})," Upload PDF"]})})]})]}),C.map((oe,ae)=>r.jsxs("div",{className:"flex gap-2 items-center bg-muted/50 p-2 rounded",children:[r.jsx(Ai,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"flex-1 text-sm",children:oe.name}),r.jsx(te,{type:"button",variant:"ghost",size:"icon",onClick:()=>S(C.filter((je,Me)=>Me!==ae)),children:r.jsx(Ms,{className:"h-4 w-4"})})]},`existing-${ae}`)),$.map((oe,ae)=>r.jsxs("div",{className:"flex gap-2 items-center bg-muted/50 p-2 rounded",children:[r.jsx(Ai,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(yt,{value:oe.name,onChange:je=>{const Me=[...$];Me[ae].name=je.target.value,F(Me)},className:"flex-1 h-8",placeholder:"PDF name"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"(new)"}),r.jsx(te,{type:"button",variant:"ghost",size:"icon",onClick:()=>F($.filter((je,Me)=>Me!==ae)),children:r.jsx(Ms,{className:"h-4 w-4"})})]},`pending-${ae}`))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Qe,{className:"text-base font-medium",children:"Video Links"}),r.jsxs(te,{type:"button",variant:"outline",size:"sm",onClick:ve,children:[r.jsx(Sn,{className:"mr-1 h-3 w-3"})," Add Video"]})]}),T.map((oe,ae)=>r.jsxs("div",{className:"flex gap-2 items-center",children:[r.jsx(yt,{placeholder:"Video title",value:oe.title,onChange:je=>{const Me=[...T];Me[ae].title=je.target.value,I(Me)},className:"w-1/3"}),r.jsx(yt,{placeholder:"Video URL (YouTube, Vimeo, etc.)",value:oe.video_url,onChange:je=>{const Me=[...T];Me[ae].video_url=je.target.value,I(Me)},className:"flex-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"icon",onClick:()=>I(T.filter((je,Me)=>Me!==ae)),children:r.jsx(Ms,{className:"h-4 w-4"})})]},ae))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Qe,{className:"text-base font-medium",children:"Canva Links"}),r.jsxs(te,{type:"button",variant:"outline",size:"sm",onClick:Ie,children:[r.jsx(Sn,{className:"mr-1 h-3 w-3"})," Add Canva Link"]})]}),A.map((oe,ae)=>r.jsxs("div",{className:"flex gap-2 items-center",children:[r.jsx(yt,{placeholder:"Link title",value:oe.title,onChange:je=>{const Me=[...A];Me[ae].title=je.target.value,D(Me)},className:"w-1/3"}),r.jsx(yt,{placeholder:"Canva share link",value:oe.canva_share_link,onChange:je=>{const Me=[...A];Me[ae].canva_share_link=je.target.value,D(Me)},className:"flex-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"icon",onClick:()=>D(A.filter((je,Me)=>Me!==ae)),children:r.jsx(Ms,{className:"h-4 w-4"})})]},ae))]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"outline",onClick:xe,children:"Cancel"}),r.jsx(te,{onClick:me,disabled:q||re.isPending||he.isPending,children:q?"Uploading...":i?"Update":"Create"})]})]})]})]})]}),r.jsx(Ye,{children:r.jsx(Je,{className:"p-0",children:r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"Name"}),r.jsx(At,{children:"Publish Date"}),r.jsx(At,{children:"Status"}),r.jsx(At,{className:"text-right",children:"Actions"})]})}),r.jsx(qs,{children:Z?r.jsx(Er,{children:r.jsx(_t,{colSpan:4,className:"text-center py-8",children:"Loading..."})}):(K==null?void 0:K.length)===0?r.jsx(Er,{children:r.jsx(_t,{colSpan:4,className:"text-center py-8 text-muted-foreground",children:"No newsletters yet. Create your first one!"})}):K==null?void 0:K.map(oe=>r.jsxs(Er,{children:[r.jsx(_t,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[oe.preview_image_url?r.jsx("img",{src:oe.preview_image_url,alt:oe.title,className:"w-10 h-10 rounded object-cover"}):r.jsx("div",{className:"w-10 h-10 rounded bg-muted flex items-center justify-center",children:r.jsx(Ai,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:oe.title}),oe.description&&r.jsx("div",{className:"text-sm text-muted-foreground line-clamp-1",children:oe.description})]})]})}),r.jsx(_t,{children:un(new Date(oe.publish_date),"MMM d, yyyy")}),r.jsx(_t,{children:r.jsx("span",{className:`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${oe.is_published?"bg-green-100 text-green-800":"bg-yellow-100 text-yellow-800"}`,children:oe.is_published?"Published":"Draft"})}),r.jsx(_t,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>se(oe),children:r.jsx(Ml,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>se(oe),children:r.jsx(ma,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",onClick:()=>{confirm("Are you sure you want to delete this newsletter?")&&ue.mutate(oe.id)},children:r.jsx(Xn,{className:"h-4 w-4"})})]})})]},oe.id))})]})})})]})})}const qNe={open:{label:"Open",color:"bg-blue-100 text-blue-800"},under_review:{label:"Under Review",color:"bg-yellow-100 text-yellow-800"},planned:{label:"Planned",color:"bg-purple-100 text-purple-800"},in_progress:{label:"In Progress",color:"bg-orange-100 text-orange-800"},launched:{label:"Launched",color:"bg-green-100 text-green-800"},declined:{label:"Declined",color:"bg-gray-100 text-gray-800"}};function vbt(){const{user:t}=Fr(),{toast:e}=la(),n=es(),s=Xr(),[i,o]=P.useState(""),[c,a]=P.useState("popular"),[f,m]=P.useState(!1),[y,v]=P.useState(""),[w,k]=P.useState(""),[C,S]=P.useState(!1),{data:T=[],isLoading:I}=rr({queryKey:["wishlist-items",c,C],queryFn:async()=>{let q=ee.from("wishlist_items").select("*");C&&t&&(q=q.eq("user_id",t.id)),c==="latest"?q=q.order("created_at",{ascending:!1}):c==="popular"?q=q.order("vote_count",{ascending:!1}):c==="trending"&&(q=q.order("vote_count",{ascending:!1}));const{data:W,error:K}=await q;if(K)throw K;const Z=[...new Set((W==null?void 0:W.map(ie=>ie.user_id))||[])],{data:re}=await ee.from("profiles").select("id, name").in("id",Z),he=new Map((re==null?void 0:re.map(ie=>[ie.id,ie]))||[]);let ue=[];if(t){const{data:ie}=await ee.from("wishlist_votes").select("item_id").eq("user_id",t.id);ue=(ie==null?void 0:ie.map(me=>me.item_id))||[]}const Ne=(W==null?void 0:W.map(ie=>ie.id))||[],{data:se}=await ee.from("wishlist_comments").select("item_id").in("item_id",Ne),xe=new Map;return se==null||se.forEach(ie=>{xe.set(ie.item_id,(xe.get(ie.item_id)||0)+1)}),W==null?void 0:W.map(ie=>{const me=he.get(ie.user_id),fe=(me==null?void 0:me.name)||"Unknown";return{...ie,user_name:fe,user_initials:fe.split(" ").map(ve=>ve[0]).join("").toUpperCase().slice(0,2),has_voted:ue.includes(ie.id),comment_count:xe.get(ie.id)||0}})}}),A=cr({mutationFn:async({title:q,description:W})=>{const{error:K}=await ee.from("wishlist_items").insert({user_id:t.id,title:q,description:W});if(K)throw K},onSuccess:()=>{s.invalidateQueries({queryKey:["wishlist-items"]}),m(!1),v(""),k(""),e({title:"Idea submitted!",description:"Your idea has been added to the wishlist."})},onError:q=>{e({title:"Error",description:q.message,variant:"destructive"})}}),D=cr({mutationFn:async({itemId:q,hasVoted:W})=>{if(W){const{error:K}=await ee.from("wishlist_votes").delete().eq("item_id",q).eq("user_id",t.id);if(K)throw K;return{itemId:q,wasAdded:!1}}else{const{error:K}=await ee.from("wishlist_votes").insert({item_id:q,user_id:t.id});if(K)throw K;return{itemId:q,wasAdded:!0}}},onSuccess:async q=>{if(s.invalidateQueries({queryKey:["wishlist-items"]}),q!=null&&q.wasAdded){const W=T.find(Z=>Z.id===q.itemId),K=((W==null?void 0:W.vote_count)||0)+1;ee.functions.invoke("wishlist-notify",{body:{itemId:q.itemId,voteCount:K}}).catch(console.error)}},onError:q=>{e({title:"Error",description:q.message,variant:"destructive"})}}),$=T.filter(q=>q.title.toLowerCase().includes(i.toLowerCase())||q.description.toLowerCase().includes(i.toLowerCase())),F=()=>{if(!y.trim()||!w.trim()){e({title:"Error",description:"Please fill in both title and description.",variant:"destructive"});return}A.mutate({title:y.trim(),description:w.trim()})};return r.jsx(Or,{title:"Wishlist",children:r.jsxs("div",{className:"max-w-4xl mx-auto",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 mb-6",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(K0,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-5xl font-bold",children:"Wishlist"}),r.jsx("p",{className:"text-muted-foreground text-sm",children:"Share ideas and vote on what we build next"})]})]}),r.jsxs($r,{open:f,onOpenChange:m,children:[r.jsx(Lo,{asChild:!0,children:r.jsxs(te,{className:"gap-2",children:[r.jsx(Sn,{className:"h-4 w-4"}),"Add Idea"]})}),r.jsxs(zr,{children:[r.jsx(Zr,{children:r.jsx(Kr,{children:"Submit a New Idea"})}),r.jsxs("div",{className:"space-y-4 pt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"title",children:"Title"}),r.jsx(yt,{id:"title",placeholder:"Give your idea a clear title...",value:y,onChange:q=>v(q.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",placeholder:"Describe your idea in detail. What problem does it solve? How would it help agents?",value:w,onChange:q=>k(q.target.value),rows:4})]}),r.jsx(te,{onClick:F,className:"w-full",disabled:A.isPending,children:A.isPending?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),"Submitting..."]}):"Submit Idea"})]})]})]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-6",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Ti,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(yt,{placeholder:"Search ideas...",value:i,onChange:q=>o(q.target.value),className:"pl-10"})]}),r.jsx("div",{className:"flex gap-2",children:r.jsx(La,{value:c,onValueChange:q=>a(q),children:r.jsxs(Ma,{children:[r.jsx(yn,{value:"popular",children:"Most Popular"}),r.jsx(yn,{value:"latest",children:"Latest"}),r.jsx(yn,{value:"trending",children:"Trending"})]})})})]}),r.jsx("div",{className:"flex items-center gap-2 mb-4",children:r.jsx(te,{variant:C?"default":"outline",size:"sm",onClick:()=>S(!C),children:C?"Show All Ideas":"My Ideas"})}),I?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(sn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):$.length===0?r.jsxs("div",{className:"text-center py-12 bg-muted/30 rounded-lg",children:[r.jsx(K0,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No ideas yet"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Be the first to submit an idea!"}),r.jsxs(te,{onClick:()=>m(!0),children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Add Idea"]})]}):r.jsx("div",{className:"space-y-3",children:$.map(q=>r.jsx("div",{className:"bg-card border rounded-lg p-4 hover:shadow-md transition-shadow cursor-pointer",onClick:()=>n(`/wishlist/${q.id}`),children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsxs("button",{onClick:W=>{W.stopPropagation(),D.mutate({itemId:q.id,hasVoted:q.has_voted||!1})},className:zt("flex flex-col items-center justify-center min-w-[50px] py-2 px-3 rounded-lg border transition-colors",q.has_voted?"bg-primary/10 border-primary text-primary":"bg-muted/50 border-border hover:bg-muted"),children:[r.jsx($0,{className:zt("h-4 w-4",q.has_voted&&"fill-current")}),r.jsx("span",{className:"text-sm font-semibold",children:q.vote_count})]}),r.jsx(Li,{className:"h-10 w-10 bg-primary/20",children:r.jsx(Oi,{className:"bg-primary/20 text-primary text-sm font-medium",children:q.user_initials})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:q.title}),r.jsx(Rt,{className:zt("text-xs",qNe[q.status].color),children:qNe[q.status].label})]}),r.jsx("p",{className:"text-muted-foreground text-sm line-clamp-2",children:q.description}),r.jsxs("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[r.jsx("span",{children:q.user_name}),r.jsx("span",{children:"•"}),r.jsx("span",{children:new Date(q.created_at).toLocaleDateString()})]})]}),r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(Wl,{className:"h-4 w-4"}),r.jsx("span",{className:"text-sm",children:q.comment_count})]})]})},q.id))})]})})}const VNe={open:{label:"Open",color:"bg-blue-100 text-blue-800"},under_review:{label:"Under Review",color:"bg-yellow-100 text-yellow-800"},planned:{label:"Planned",color:"bg-purple-100 text-purple-800"},in_progress:{label:"In Progress",color:"bg-orange-100 text-orange-800"},launched:{label:"Launched",color:"bg-green-100 text-green-800"},declined:{label:"Declined",color:"bg-gray-100 text-gray-800"}};function _bt(){const{itemId:t}=dd(),e=es(),{user:n}=Fr(),{toast:s}=la(),i=Xr(),[o,c]=P.useState(""),{data:a=!1}=rr({queryKey:["user-is-admin",n==null?void 0:n.id],queryFn:async()=>{if(!n)return!1;const{data:T,error:I}=await ee.from("user_roles").select("role").eq("user_id",n.id).eq("role","admin").maybeSingle();return!I&&!!T},enabled:!!n}),{data:f,isLoading:m}=rr({queryKey:["wishlist-item",t],queryFn:async()=>{const{data:T,error:I}=await ee.from("wishlist_items").select("*").eq("id",t).single();if(I)throw I;const{data:A}=await ee.from("profiles").select("name").eq("id",T.user_id).single();let D=!1;if(n){const{data:$}=await ee.from("wishlist_votes").select("id").eq("item_id",t).eq("user_id",n.id).maybeSingle();D=!!$}return{...T,user_name:(A==null?void 0:A.name)||"Unknown",user_initials:((A==null?void 0:A.name)||"U").split(" ").map($=>$[0]).join("").toUpperCase().slice(0,2),has_voted:D}}}),{data:y=[],isLoading:v}=rr({queryKey:["wishlist-comments",t],queryFn:async()=>{const{data:T,error:I}=await ee.from("wishlist_comments").select("*").eq("item_id",t).order("created_at",{ascending:!0});if(I)throw I;const A=[...new Set((T==null?void 0:T.map(F=>F.user_id))||[])],{data:D}=await ee.from("profiles").select("id, name").in("id",A),$=new Map((D==null?void 0:D.map(F=>[F.id,F]))||[]);return T==null?void 0:T.map(F=>{const q=$.get(F.user_id),W=(q==null?void 0:q.name)||"Unknown";return{...F,user_name:W,user_initials:W.split(" ").map(K=>K[0]).join("").toUpperCase().slice(0,2)}})}}),w=cr({mutationFn:async T=>{if(T){const{error:I}=await ee.from("wishlist_votes").delete().eq("item_id",t).eq("user_id",n.id);if(I)throw I;return{wasAdded:!1}}else{const{error:I}=await ee.from("wishlist_votes").insert({item_id:t,user_id:n.id});if(I)throw I;return{wasAdded:!0}}},onSuccess:async T=>{if(i.invalidateQueries({queryKey:["wishlist-item",t]}),i.invalidateQueries({queryKey:["wishlist-items"]}),T!=null&&T.wasAdded&&f){const I=(f.vote_count||0)+1;ee.functions.invoke("wishlist-notify",{body:{itemId:t,voteCount:I}}).catch(console.error)}},onError:T=>{s({title:"Error",description:T.message,variant:"destructive"})}}),k=cr({mutationFn:async T=>{const{error:I}=await ee.from("wishlist_comments").insert({item_id:t,user_id:n.id,content:T});if(I)throw I},onSuccess:()=>{i.invalidateQueries({queryKey:["wishlist-comments",t]}),c(""),s({title:"Comment added!"})},onError:T=>{s({title:"Error",description:T.message,variant:"destructive"})}}),C=cr({mutationFn:async T=>{const{error:I}=await ee.from("wishlist_comments").delete().eq("id",T);if(I)throw I},onSuccess:()=>{i.invalidateQueries({queryKey:["wishlist-comments",t]}),s({title:"Comment deleted"})},onError:T=>{s({title:"Error",description:T.message,variant:"destructive"})}}),S=()=>{o.trim()&&k.mutate(o.trim())};return m?r.jsx(Or,{title:"Wishlist",children:r.jsxs("div",{className:"max-w-3xl mx-auto",children:[r.jsx(Gr,{className:"h-8 w-32 mb-6"}),r.jsx(Gr,{className:"h-48 w-full mb-6"}),r.jsx(Gr,{className:"h-32 w-full"})]})}):f?r.jsx(Or,{title:"Wishlist",children:r.jsxs("div",{className:"max-w-3xl mx-auto",children:[r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>e("/wishlist"),className:"mb-4",children:[r.jsx(Va,{className:"h-4 w-4 mr-2"}),"Back to Wishlist"]}),r.jsx("div",{className:"bg-card border rounded-lg p-6 mb-6",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsxs("button",{onClick:()=>w.mutate(f.has_voted),className:zt("flex flex-col items-center justify-center min-w-[60px] py-3 px-4 rounded-lg border transition-colors",f.has_voted?"bg-primary/10 border-primary text-primary":"bg-muted/50 border-border hover:bg-muted"),children:[r.jsx($0,{className:zt("h-5 w-5",f.has_voted&&"fill-current")}),r.jsx("span",{className:"text-lg font-bold",children:f.vote_count}),r.jsx("span",{className:"text-xs",children:"votes"})]}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("h1",{className:"text-xl font-bold",children:f.title}),r.jsx(Rt,{className:zt("text-xs",VNe[f.status].color),children:VNe[f.status].label})]}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap mb-4",children:f.description}),r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Li,{className:"h-6 w-6",children:r.jsx(Oi,{className:"bg-primary/20 text-primary text-xs",children:f.user_initials})}),r.jsx("span",{children:f.user_name}),r.jsx("span",{children:"•"}),r.jsx("span",{children:new Date(f.created_at).toLocaleDateString()})]})]})]})}),r.jsxs("div",{className:"bg-card border rounded-lg p-6",children:[r.jsxs("h2",{className:"text-lg font-semibold mb-4",children:["Comments (",y.length,")"]}),r.jsxs("div",{className:"flex gap-3 mb-6",children:[r.jsx(xte,{placeholder:a?"Share your thoughts... Use # to link templates":"Share your thoughts on this idea...",value:o,onChange:c,minHeight:"60px",mentionFormat:"encoded",enableTemplateMentions:a}),r.jsx(te,{onClick:S,disabled:!o.trim()||k.isPending,size:"icon",className:"h-auto",children:k.isPending?r.jsx(sn,{className:"h-4 w-4 animate-spin"}):r.jsx(To,{className:"h-4 w-4"})})]}),v?r.jsx("div",{className:"space-y-4",children:[1,2].map(T=>r.jsx(Gr,{className:"h-20 w-full"},T))}):y.length===0?r.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No comments yet. Be the first to share your thoughts!"}):r.jsx("div",{className:"space-y-4",children:y.map(T=>r.jsxs("div",{className:"flex gap-3 p-3 bg-muted/30 rounded-lg",children:[r.jsx(Li,{className:"h-8 w-8",children:r.jsx(Oi,{className:"bg-primary/20 text-primary text-xs",children:T.user_initials})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"font-medium text-sm",children:T.user_name}),r.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(T.created_at).toLocaleDateString()})]}),r.jsx(wye,{content:T.content,className:"text-sm text-foreground"})]}),(n==null?void 0:n.id)===T.user_id&&r.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:()=>C.mutate(T.id),children:r.jsx(Xn,{className:"h-4 w-4"})})]},T.id))})]})]})}):r.jsx(Or,{title:"Wishlist",children:r.jsxs("div",{className:"max-w-3xl mx-auto text-center py-12",children:[r.jsx("p",{className:"text-muted-foreground",children:"Item not found"}),r.jsx(te,{variant:"link",onClick:()=>e("/wishlist"),children:"Go back to Wishlist"})]})})}const HNe={open:{label:"Open",color:"bg-blue-100 text-blue-800"},under_review:{label:"Under Review",color:"bg-yellow-100 text-yellow-800"},planned:{label:"Planned",color:"bg-purple-100 text-purple-800"},in_progress:{label:"In Progress",color:"bg-orange-100 text-orange-800"},launched:{label:"Launched",color:"bg-green-100 text-green-800"},declined:{label:"Declined",color:"bg-gray-100 text-gray-800"}},WNe=["open","under_review","planned","in_progress","launched","declined"];function bbt(){const{toast:t}=la(),e=es(),n=Xr(),[s,i]=P.useState(""),[o,c]=P.useState("all"),[a,f]=P.useState(!1),[m,y]=P.useState(null),{data:v=[],isLoading:w}=rr({queryKey:["admin-wishlist-items"],queryFn:async()=>{const{data:I,error:A}=await ee.from("wishlist_items").select("*").order("vote_count",{ascending:!1});if(A)throw A;const D=[...new Set((I==null?void 0:I.map(Z=>Z.user_id))||[])],{data:$}=await ee.from("profiles").select("id, name, email").in("id",D),F=new Map(($==null?void 0:$.map(Z=>[Z.id,Z]))||[]),q=(I==null?void 0:I.map(Z=>Z.id))||[],{data:W}=await ee.from("wishlist_comments").select("item_id").in("item_id",q),K=new Map;return W==null||W.forEach(Z=>{K.set(Z.item_id,(K.get(Z.item_id)||0)+1)}),I==null?void 0:I.map(Z=>{const re=F.get(Z.user_id);return{...Z,user_name:(re==null?void 0:re.name)||"Unknown",user_email:(re==null?void 0:re.email)||"",comment_count:K.get(Z.id)||0}})}}),k=cr({mutationFn:async({itemId:I,status:A})=>{const{error:D}=await ee.from("wishlist_items").update({status:A}).eq("id",I);if(D)throw D},onSuccess:()=>{n.invalidateQueries({queryKey:["admin-wishlist-items"]}),t({title:"Status updated!"})},onError:I=>{t({title:"Error",description:I.message,variant:"destructive"})}}),C=cr({mutationFn:async I=>{const{error:A}=await ee.from("wishlist_items").delete().eq("id",I);if(A)throw A},onSuccess:()=>{n.invalidateQueries({queryKey:["admin-wishlist-items"]}),f(!1),y(null),t({title:"Item deleted!"})},onError:I=>{t({title:"Error",description:I.message,variant:"destructive"})}}),S=v.filter(I=>{const A=I.title.toLowerCase().includes(s.toLowerCase())||I.description.toLowerCase().includes(s.toLowerCase())||I.user_name.toLowerCase().includes(s.toLowerCase()),D=o==="all"||I.status===o;return A&&D}),T={total:v.length,open:v.filter(I=>I.status==="open").length,inProgress:v.filter(I=>I.status==="in_progress").length,launched:v.filter(I=>I.status==="launched").length,highVotes:v.filter(I=>I.vote_count>=10).length};return r.jsx(Or,{title:"Admin - Wishlist",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>e("/admin"),children:r.jsx(Va,{className:"h-5 w-5"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Wishlist Management"}),r.jsx("p",{className:"text-muted-foreground",children:"Review and manage community ideas"})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[r.jsxs("div",{className:"bg-card border rounded-lg p-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Ideas"}),r.jsx("p",{className:"text-2xl font-bold",children:T.total})]}),r.jsxs("div",{className:"bg-card border rounded-lg p-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Open"}),r.jsx("p",{className:"text-2xl font-bold text-blue-600",children:T.open})]}),r.jsxs("div",{className:"bg-card border rounded-lg p-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"In Progress"}),r.jsx("p",{className:"text-2xl font-bold text-orange-600",children:T.inProgress})]}),r.jsxs("div",{className:"bg-card border rounded-lg p-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Launched"}),r.jsx("p",{className:"text-2xl font-bold text-green-600",children:T.launched})]}),r.jsxs("div",{className:"bg-card border rounded-lg p-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"10+ Votes"}),r.jsx("p",{className:"text-2xl font-bold text-primary",children:T.highVotes})]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Ti,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(yt,{placeholder:"Search ideas, users...",value:s,onChange:I=>i(I.target.value),className:"pl-10"})]}),r.jsxs(_n,{value:o,onValueChange:I=>c(I),children:[r.jsx(xn,{className:"w-[180px]",children:r.jsx(bn,{placeholder:"Filter by status"})}),r.jsxs(vn,{children:[r.jsx(er,{value:"all",children:"All Statuses"}),WNe.map(I=>r.jsx(er,{value:I,children:HNe[I].label},I))]})]})]}),w?r.jsx("div",{className:"space-y-2",children:[1,2,3,4,5].map(I=>r.jsx(Gr,{className:"h-16 w-full"},I))}):r.jsx("div",{className:"bg-card border rounded-lg overflow-hidden",children:r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{className:"w-[60px]",children:"Votes"}),r.jsx(At,{children:"Title"}),r.jsx(At,{className:"hidden md:table-cell",children:"Submitted By"}),r.jsx(At,{className:"hidden sm:table-cell",children:"Comments"}),r.jsx(At,{children:"Status"}),r.jsx(At,{className:"w-[100px]",children:"Actions"})]})}),r.jsx(qs,{children:S.length===0?r.jsx(Er,{children:r.jsx(_t,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No items found"})}):S.map(I=>r.jsxs(Er,{className:zt(I.vote_count>=10&&"bg-primary/5"),children:[r.jsx(_t,{children:r.jsx(Rt,{variant:I.vote_count>=10?"default":"secondary",children:I.vote_count})}),r.jsx(_t,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium line-clamp-1",children:I.title}),r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:I.description})]})}),r.jsx(_t,{className:"hidden md:table-cell",children:r.jsxs("div",{children:[r.jsx("p",{className:"text-sm",children:I.user_name}),r.jsx("p",{className:"text-xs text-muted-foreground",children:I.user_email})]})}),r.jsx(_t,{className:"hidden sm:table-cell",children:I.comment_count}),r.jsx(_t,{children:r.jsxs(_n,{value:I.status,onValueChange:A=>k.mutate({itemId:I.id,status:A}),children:[r.jsx(xn,{className:"w-[140px] h-8",children:r.jsx(bn,{})}),r.jsx(vn,{children:WNe.map(A=>r.jsx(er,{value:A,children:HNe[A].label},A))})]})}),r.jsx(_t,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>window.open(`/wishlist/${I.id}`,"_blank"),children:r.jsx(Fs,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",className:"text-destructive",onClick:()=>{y(I.id),f(!0)},children:r.jsx(Xn,{className:"h-4 w-4"})})]})})]},I.id))})]})}),r.jsx($r,{open:a,onOpenChange:f,children:r.jsxs(zr,{children:[r.jsx(Zr,{children:r.jsx(Kr,{children:"Delete Wishlist Item"})}),r.jsx("p",{className:"text-muted-foreground",children:"Are you sure you want to delete this idea? This will also delete all votes and comments."}),r.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[r.jsx(te,{variant:"outline",onClick:()=>f(!1),children:"Cancel"}),r.jsx(te,{variant:"destructive",onClick:()=>m&&C.mutate(m),disabled:C.isPending,children:C.isPending?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),"Deleting..."]}):"Delete"})]})]})})]})})}function wbt(){const{user:t}=Fr(),[e,n]=P.useState([]),[s,i]=P.useState(!0),[o,c]=P.useState(!1),[a,f]=P.useState(null),[m,y]=P.useState(!1),[v,w]=P.useState(null),[k,C]=P.useState(""),[S,T]=P.useState(""),[I,A]=P.useState(""),[D,$]=P.useState(!1),[F,q]=P.useState(""),[W,K]=P.useState("once"),[Z,re]=P.useState([]),[he,ue]=P.useState([]),[Ne,se]=P.useState(!1),[xe,ie]=P.useState([]),[me,fe]=P.useState({total:0,dismissed:0});P.useEffect(()=>{ve()},[]);const ve=async()=>{const{data:We,error:Ce}=await ee.from("levelup_briefs").select("*").order("created_at",{ascending:!1});Ce?(Ge.error("Failed to fetch briefs"),console.error(Ce)):n(We||[]),i(!1)},Ie=()=>{C(""),T(""),A(""),$(!1),q(new Date().toISOString().slice(0,16)),K("once"),re([]),ue([]),f(null)},Se=()=>{Ie(),c(!0)},oe=async We=>{f(We),C(We.title),T(We.description||""),A(We.video_url||""),$(We.is_published),q(We.publish_date.slice(0,16)),K(We.show_frequency);const{data:Ce}=await ee.from("levelup_brief_links").select("*").eq("brief_id",We.id).order("sort_order");re((Ce==null?void 0:Ce.map(Fe=>({title:Fe.title,url:Fe.url})))||[]);const{data:et}=await ee.from("levelup_brief_polls").select("*").eq("brief_id",We.id).order("sort_order");if(et){const Fe=[];for(const Ke of et){const{data:Le}=await ee.from("levelup_brief_poll_options").select("*").eq("poll_id",Ke.id).order("sort_order");Fe.push({question:Ke.question,poll_type:Ke.poll_type,options:(Le==null?void 0:Le.map(ft=>ft.option_text))||[]})}ue(Fe)}c(!0)},ae=async We=>{var et;const Ce=(et=We.target.files)==null?void 0:et[0];if(Ce){se(!0);try{const Fe=await ee.functions.invoke("bunny-upload",{body:{action:"create",title:Ce.name.replace(/\.[^/.]+$/,"")}});if(Fe.error)throw Fe.error;const{videoId:Ke,libraryId:Le}=Fe.data,ft=await ee.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:Ke}});if(ft.error)throw ft.error;const{uploadUrl:Nt,apiKey:Mt}=ft.data,It=new XMLHttpRequest;await new Promise((Mr,pn)=>{It.upload.addEventListener("progress",fs=>{if(fs.lengthComputable){const Qn=Math.round(fs.loaded/fs.total*100);console.log("Upload progress:",Qn)}}),It.addEventListener("load",()=>{It.status>=200&&It.status<300?Mr():pn(new Error(`Upload failed with status ${It.status}`))}),It.addEventListener("error",()=>pn(new Error("Upload failed"))),It.open("PUT",Nt),It.setRequestHeader("AccessKey",Mt),It.send(Ce)});const tr=`https://player.mediadelivery.net/embed/${Le}/${Ke}`;A(tr),Ge.success("Video uploaded successfully! It may take a few minutes to process.")}catch(Fe){console.error("Upload error:",Fe),Ge.error("Failed to upload video")}finally{se(!1)}}},je=async()=>{if(!k.trim()){Ge.error("Title is required");return}try{let We;if(a){const{error:Ce}=await ee.from("levelup_briefs").update({title:k,description:S||null,video_url:I||null,is_published:D,publish_date:F,show_frequency:W}).eq("id",a.id);if(Ce)throw Ce;We=a.id,await ee.from("levelup_brief_links").delete().eq("brief_id",We);const{data:et}=await ee.from("levelup_brief_polls").select("id").eq("brief_id",We);if(et)for(const Fe of et)await ee.from("levelup_brief_poll_options").delete().eq("poll_id",Fe.id);await ee.from("levelup_brief_polls").delete().eq("brief_id",We)}else{const{data:Ce,error:et}=await ee.from("levelup_briefs").insert({title:k,description:S||null,video_url:I||null,is_published:D,publish_date:F,show_frequency:W,created_by:t==null?void 0:t.id}).select().single();if(et)throw et;We=Ce.id}if(Z.length>0){const Ce=Z.map((et,Fe)=>({brief_id:We,title:et.title,url:et.url,sort_order:Fe}));await ee.from("levelup_brief_links").insert(Ce)}for(let Ce=0;Ce0){const Le=et.options.map((ft,Nt)=>({poll_id:Fe.id,option_text:ft,sort_order:Nt}));await ee.from("levelup_brief_poll_options").insert(Le)}}Ge.success(a?"Brief updated":"Brief created"),c(!1),Ie(),ve()}catch(We){console.error("Error saving brief:",We),Ge.error("Failed to save brief")}},Me=async We=>{if(confirm("Are you sure you want to delete this brief?"))try{const{error:Ce}=await ee.from("levelup_briefs").delete().eq("id",We);if(Ce)throw Ce;Ge.success("Brief deleted"),ve()}catch(Ce){console.error("Error deleting brief:",Ce),Ge.error("Failed to delete brief")}},Ue=async We=>{w(We);const{count:Ce}=await ee.from("levelup_brief_views").select("*",{count:"exact",head:!0}).eq("brief_id",We.id),{count:et}=await ee.from("levelup_brief_views").select("*",{count:"exact",head:!0}).eq("brief_id",We.id).not("dismissed_at","is",null);fe({total:Ce||0,dismissed:et||0});const{data:Fe}=await ee.from("levelup_brief_polls").select("*").eq("brief_id",We.id).order("sort_order");if(Fe){const Ke=[];for(const Le of Fe){const{data:ft}=await ee.from("levelup_brief_poll_options").select("*").eq("poll_id",Le.id).order("sort_order"),{data:Nt}=await ee.from("levelup_brief_poll_responses").select("option_id").eq("poll_id",Le.id),Mt={};let It=0;ft&&ft.forEach(tr=>{const Mr=(Nt==null?void 0:Nt.filter(pn=>pn.option_id===tr.id).length)||0;Mt[tr.id]=Mr,It+=Mr}),Ke.push({...Le,options:ft||[],results:Mt,totalResponses:Le.poll_type==="single"?new Set(Nt==null?void 0:Nt.map(tr=>tr.option_id)).size:It})}ie(Ke)}y(!0)},Re=()=>{re([...Z,{title:"",url:""}])},$e=(We,Ce,et)=>{const Fe=[...Z];Fe[We][Ce]=et,re(Fe)},Pe=We=>{re(Z.filter((Ce,et)=>et!==We))},Ae=()=>{ue([...he,{question:"",poll_type:"single",options:["",""]}])},nt=(We,Ce)=>{const et=[...he];et[We].question=Ce,ue(et)},Te=(We,Ce)=>{const et=[...he];et[We].poll_type=Ce,ue(et)},Xe=We=>{const Ce=[...he];Ce[We].options.push(""),ue(Ce)},ge=(We,Ce,et)=>{const Fe=[...he];Fe[We].options[Ce]=et,ue(Fe)},mt=(We,Ce)=>{const et=[...he];et[We].options=et[We].options.filter((Fe,Ke)=>Ke!==Ce),ue(et)},rt=We=>{ue(he.filter((Ce,et)=>et!==We))};return r.jsxs(Or,{title:"The LevelUp Brief",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ou,{title:"The LevelUp Brief",description:"Create engaging popup briefs for your agents",children:r.jsxs(te,{onClick:Se,children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Create Brief"]})}),r.jsx(Ye,{children:r.jsx(Je,{className:"p-0",children:r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"Title"}),r.jsx(At,{children:"Status"}),r.jsx(At,{children:"Frequency"}),r.jsx(At,{children:"Publish Date"}),r.jsx(At,{className:"text-right",children:"Actions"})]})}),r.jsx(qs,{children:s?r.jsx(Er,{children:r.jsx(_t,{colSpan:5,className:"text-center py-8",children:"Loading..."})}):e.length===0?r.jsx(Er,{children:r.jsx(_t,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No briefs created yet"})}):e.map(We=>r.jsxs(Er,{children:[r.jsx(_t,{className:"font-medium",children:We.title}),r.jsx(_t,{children:r.jsx(Rt,{variant:We.is_published?"default":"secondary",children:We.is_published?"Published":"Draft"})}),r.jsx(_t,{className:"capitalize",children:We.show_frequency.replace("_"," ")}),r.jsx(_t,{children:un(new Date(We.publish_date),"MMM d, yyyy h:mm a")}),r.jsx(_t,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>Ue(We),children:r.jsx(xc,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>oe(We),children:r.jsx(Jl,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>Me(We.id),children:r.jsx(Xn,{className:"h-4 w-4 text-destructive"})})]})})]},We.id))})]})})})]}),r.jsx($r,{open:o,onOpenChange:c,children:r.jsxs(zr,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Zr,{children:r.jsx(Kr,{children:a?"Edit Brief":"Create New Brief"})}),r.jsxs(La,{defaultValue:"content",className:"w-full",children:[r.jsxs(Ma,{className:"grid w-full grid-cols-4",children:[r.jsx(yn,{value:"content",children:"Content"}),r.jsx(yn,{value:"video",children:"Video"}),r.jsx(yn,{value:"links",children:"Links"}),r.jsx(yn,{value:"polls",children:"Polls"})]}),r.jsxs($n,{value:"content",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Title *"}),r.jsx(yt,{value:k,onChange:We=>C(We.target.value),placeholder:"What's happening at LevelUp..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Description"}),r.jsx(Qy,{content:S,onChange:We=>T(We),placeholder:"Brief overview for agents...",minHeight:"120px"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Publish Date"}),r.jsx(yt,{type:"datetime-local",value:F,onChange:We=>q(We.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Show Frequency"}),r.jsxs(_n,{value:W,onValueChange:K,children:[r.jsx(xn,{children:r.jsx(bn,{})}),r.jsxs(vn,{children:[r.jsx(er,{value:"once",children:"Once (until dismissed)"}),r.jsx(er,{value:"every_login",children:"Every login"}),r.jsx(er,{value:"daily",children:"Daily"})]})]})]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Zs,{checked:D,onCheckedChange:$}),r.jsx(Qe,{children:"Publish immediately"})]})]}),r.jsxs($n,{value:"video",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Upload Video to Bunny.net"}),r.jsx("div",{className:"flex gap-2",children:r.jsx(yt,{type:"file",accept:"video/*",onChange:ae,disabled:Ne})}),Ne&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"Uploading..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Or paste embed URL"}),r.jsx(yt,{value:I,onChange:We=>A(We.target.value),placeholder:"https://iframe.mediadelivery.net/embed/..."})]}),I&&r.jsx("div",{className:"aspect-video rounded-lg overflow-hidden bg-muted",children:r.jsx("iframe",{src:I,className:"w-full h-full",allow:"autoplay; fullscreen",allowFullScreen:!0})})]}),r.jsxs($n,{value:"links",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(Qe,{children:"Quick Links"}),r.jsxs(te,{variant:"outline",size:"sm",onClick:Re,children:[r.jsx(Sn,{className:"h-4 w-4 mr-1"}),"Add Link"]})]}),Z.map((We,Ce)=>r.jsxs("div",{className:"flex gap-2 items-start",children:[r.jsx(yt,{value:We.title,onChange:et=>$e(Ce,"title",et.target.value),placeholder:"Link title",className:"flex-1"}),r.jsx(yt,{value:We.url,onChange:et=>$e(Ce,"url",et.target.value),placeholder:"https://...",className:"flex-[2]"}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>Pe(Ce),children:r.jsx(Xn,{className:"h-4 w-4 text-destructive"})})]},Ce)),Z.length===0&&r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No links added yet"})]}),r.jsxs($n,{value:"polls",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(Qe,{children:"Polls"}),r.jsxs(te,{variant:"outline",size:"sm",onClick:Ae,children:[r.jsx(Sn,{className:"h-4 w-4 mr-1"}),"Add Poll"]})]}),he.map((We,Ce)=>r.jsx(Ye,{className:"p-4",children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(yt,{value:We.question,onChange:et=>nt(Ce,et.target.value),placeholder:"Poll question...",className:"flex-1 mr-2"}),r.jsxs(_n,{value:We.poll_type,onValueChange:et=>Te(Ce,et),children:[r.jsx(xn,{className:"w-32",children:r.jsx(bn,{})}),r.jsxs(vn,{children:[r.jsx(er,{value:"single",children:"Single"}),r.jsx(er,{value:"multi",children:"Multi-select"})]})]}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>rt(Ce),children:r.jsx(Xn,{className:"h-4 w-4 text-destructive"})})]}),r.jsxs("div",{className:"space-y-2 pl-4",children:[We.options.map((et,Fe)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx(yt,{value:et,onChange:Ke=>ge(Ce,Fe,Ke.target.value),placeholder:`Option ${Fe+1}`}),We.options.length>2&&r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>mt(Ce,Fe),children:r.jsx(Xn,{className:"h-4 w-4 text-muted-foreground"})})]},Fe)),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>Xe(Ce),children:[r.jsx(Sn,{className:"h-4 w-4 mr-1"}),"Add Option"]})]})]})},Ce)),he.length===0&&r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No polls added yet"})]})]}),r.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[r.jsx(te,{variant:"outline",onClick:()=>c(!1),children:"Cancel"}),r.jsx(te,{onClick:je,children:a?"Update Brief":"Create Brief"})]})]})}),r.jsx($r,{open:m,onOpenChange:y,children:r.jsxs(zr,{className:"max-w-2xl",children:[r.jsx(Zr,{children:r.jsxs(Kr,{children:["Results: ",v==null?void 0:v.title]})}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs(Ye,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-muted-foreground",children:"Total Views"})}),r.jsx(Je,{children:r.jsx("p",{className:"text-2xl font-bold",children:me.total})})]}),r.jsxs(Ye,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-muted-foreground",children:"Dismissed"})}),r.jsx(Je,{children:r.jsx("p",{className:"text-2xl font-bold",children:me.dismissed})})]})]}),xe.length>0?r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"font-semibold",children:"Poll Results"}),xe.map(We=>r.jsxs(Ye,{className:"p-4",children:[r.jsx("h4",{className:"font-medium mb-3",children:We.question}),r.jsx("div",{className:"space-y-2",children:We.options.map(Ce=>{const et=We.results[Ce.id]||0,Fe=We.totalResponses>0?Math.round(et/We.totalResponses*100):0;return r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{children:Ce.option_text}),r.jsxs("span",{className:"text-muted-foreground",children:[et," (",Fe,"%)"]})]}),r.jsx("div",{className:"h-2 bg-muted rounded-full overflow-hidden",children:r.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${Fe}%`}})})]},Ce.id)})})]},We.id))]}):r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No polls in this brief"})]})]})})]})}const jbt=()=>{const{user:t}=Fr(),{toast:e}=la(),n=Xr(),[s,i]=P.useState(!1),[o,c]=P.useState(null),[a,f]=P.useState({name:"",description:"",signup_link_url:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),[m,y]=P.useState(null),[v,w]=P.useState(""),{data:k=[],isLoading:C}=rr({queryKey:["additional-services-admin"],queryFn:async()=>{const{data:F,error:q}=await ee.from("additional_services").select("*").order("publish_date",{ascending:!1});if(q)throw q;return F}}),S=cr({mutationFn:async F=>{let q=F.existingImageUrl;if(F.image){const K=F.image.name.split(".").pop(),Z=`${Date.now()}-${Math.random().toString(36).substring(7)}.${K}`,{error:re}=await ee.storage.from("service-images").upload(Z,F.image);if(re)throw re;const{data:he}=ee.storage.from("service-images").getPublicUrl(Z);q=he.publicUrl}const W={name:F.item.name,description:F.item.description||null,preview_image_url:q,signup_link_url:F.item.signup_link_url,publish_date:F.item.publish_date?new Date(F.item.publish_date).toISOString():new Date().toISOString(),is_published:F.item.is_published,created_by:t==null?void 0:t.id};if(F.itemId){const{error:K}=await ee.from("additional_services").update(W).eq("id",F.itemId);if(K)throw K}else{const{error:K}=await ee.from("additional_services").insert(W);if(K)throw K}},onSuccess:()=>{n.invalidateQueries({queryKey:["additional-services-admin"]}),n.invalidateQueries({queryKey:["additional-services"]}),e({title:o?"Service updated":"Service created"}),i(!1),I()},onError:F=>{e({title:"Error saving service",description:F.message,variant:"destructive"})}}),T=cr({mutationFn:async F=>{const{error:q}=await ee.from("additional_services").delete().eq("id",F);if(q)throw q},onSuccess:()=>{n.invalidateQueries({queryKey:["additional-services-admin"]}),n.invalidateQueries({queryKey:["additional-services"]}),e({title:"Service deleted"})},onError:F=>{e({title:"Error deleting service",description:F.message,variant:"destructive"})}}),I=()=>{f({name:"",description:"",signup_link_url:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),y(null),w(""),c(null)},A=F=>{c(F),f({name:F.name,description:F.description||"",signup_link_url:F.signup_link_url,publish_date:F.publish_date?new Date(F.publish_date).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],is_published:F.is_published}),w(F.preview_image_url||""),i(!0)},D=F=>{var W;const q=(W=F.target.files)==null?void 0:W[0];q&&(y(q),w(URL.createObjectURL(q)))},$=F=>{if(F.preventDefault(),!a.name.trim()){e({title:"Name is required",variant:"destructive"});return}if(!a.signup_link_url.trim()){e({title:"Signup link URL is required",variant:"destructive"});return}S.mutate({item:a,image:m,existingImageUrl:(o==null?void 0:o.preview_image_url)||null,itemId:o==null?void 0:o.id})};return r.jsx(Or,{title:"Manage Additional Services",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs(Ye,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-muted-foreground",children:"Total Services"})}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:k.length})})]}),r.jsxs(Ye,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(Je,{children:r.jsx("div",{className:"text-2xl font-bold",children:k.filter(F=>F.is_published).length})})]})]}),r.jsxs($r,{open:s,onOpenChange:F=>{i(F),F||I()},children:[r.jsx(Lo,{asChild:!0,children:r.jsxs(te,{className:"gap-2",children:[r.jsx(Sn,{className:"h-4 w-4"}),"Add Service"]})}),r.jsxs(zr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Zr,{children:r.jsx(Kr,{children:o?"Edit Service":"Add New Service"})}),r.jsxs("form",{onSubmit:$,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"name",children:"Name *"}),r.jsx(yt,{id:"name",value:a.name,onChange:F=>f({...a,name:F.target.value}),placeholder:"Enter service name"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Description"}),r.jsx(Qy,{content:a.description,onChange:F=>f({...a,description:F}),placeholder:"Enter description",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"signup_link_url",children:"Signup Link URL *"}),r.jsx(yt,{id:"signup_link_url",type:"url",value:a.signup_link_url,onChange:F=>f({...a,signup_link_url:F.target.value}),placeholder:"https://example.com/signup"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(yt,{id:"publish_date",type:"date",value:a.publish_date,onChange:F=>f({...a,publish_date:F.target.value})})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Zs,{id:"is_published",checked:a.is_published,onCheckedChange:F=>f({...a,is_published:F})}),r.jsx(Qe,{htmlFor:"is_published",children:"Published"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Preview Image"}),v?r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:v,alt:"Preview",className:"w-full max-h-48 object-contain rounded-lg border"}),r.jsx(te,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:()=>{y(null),w("")},children:r.jsx(Ms,{className:"h-3 w-3"})})]}):r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-4 text-center",children:[r.jsx(Wo,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx(yt,{type:"file",accept:"image/*",onChange:D,className:"cursor-pointer"})]})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(te,{type:"submit",disabled:S.isPending,children:S.isPending?"Saving...":o?"Update":"Create"})]})]})]})]})]}),r.jsx(Ye,{children:r.jsx(Je,{className:"p-0",children:C?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):k.length===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'No services yet. Click "Add Service" to create your first one.'}):r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{className:"w-16",children:"Preview"}),r.jsx(At,{children:"Name"}),r.jsx(At,{children:"Signup Link"}),r.jsx(At,{children:"Publish Date"}),r.jsx(At,{children:"Status"}),r.jsx(At,{className:"text-right",children:"Actions"})]})}),r.jsx(qs,{children:k.map(F=>r.jsxs(Er,{children:[r.jsx(_t,{children:F.preview_image_url?r.jsx("img",{src:F.preview_image_url,alt:"",className:"w-12 h-12 object-cover rounded"}):r.jsx("div",{className:"w-12 h-12 bg-muted rounded flex items-center justify-center",children:r.jsx(Wo,{className:"h-5 w-5 text-muted-foreground"})})}),r.jsx(_t,{className:"font-medium",children:F.name}),r.jsx(_t,{children:r.jsxs("a",{href:F.signup_link_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline flex items-center gap-1",children:[r.jsx(Fs,{className:"h-3 w-3"}),"Link"]})}),r.jsx(_t,{children:new Date(F.publish_date).toLocaleDateString()}),r.jsx(_t,{children:r.jsx(Rt,{variant:F.is_published?"default":"secondary",children:F.is_published?"Published":"Draft"})}),r.jsx(_t,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>A(F),children:r.jsx(ma,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>{confirm("Are you sure you want to delete this service?")&&T.mutate(F.id)},children:r.jsx(Xn,{className:"h-4 w-4 text-destructive"})})]})})]},F.id))})]})})})]})})};function kbt(){const{toast:t}=la(),[e,n]=P.useState([]),[s,i]=P.useState(!0),[o,c]=P.useState(!1),[a,f]=P.useState(!1),[m,y]=P.useState({name:"",promotionCode:"",discountType:"percent",percentOff:"",amountOff:"",duration:"once",durationInMonths:""});P.useEffect(()=>{v()},[]);const v=async()=>{try{const{data:T,error:I}=await ee.functions.invoke("stripe-manage-coupons",{body:{action:"list"}});if(I)throw I;n(T.coupons||[])}catch(T){console.error("Error fetching coupons:",T),t({title:"Error",description:"Failed to load coupons",variant:"destructive"})}finally{i(!1)}},w=async()=>{if(!m.name){t({title:"Error",description:"Please enter a coupon name",variant:"destructive"});return}if(m.discountType==="percent"&&!m.percentOff){t({title:"Error",description:"Please enter a percent off value",variant:"destructive"});return}if(m.discountType==="amount"&&!m.amountOff){t({title:"Error",description:"Please enter an amount off value",variant:"destructive"});return}if(m.duration==="repeating"&&!m.durationInMonths){t({title:"Error",description:"Please enter duration in months",variant:"destructive"});return}c(!0);try{const T={action:"create",name:m.name,duration:m.duration,promotion_code:m.promotionCode.trim()||void 0};m.discountType==="percent"?T.percent_off=parseFloat(m.percentOff):(T.amount_off=Math.round(parseFloat(m.amountOff)*100),T.currency="usd"),m.duration==="repeating"&&(T.duration_in_months=parseInt(m.durationInMonths));const{data:I,error:A}=await ee.functions.invoke("stripe-manage-coupons",{body:T});if(A)throw A;t({title:"Success",description:"Coupon created successfully"}),f(!1),y({name:"",promotionCode:"",discountType:"percent",percentOff:"",amountOff:"",duration:"once",durationInMonths:""}),v()}catch(T){console.error("Error creating coupon:",T),t({title:"Error",description:T.message||"Failed to create coupon",variant:"destructive"})}finally{c(!1)}},k=async T=>{if(confirm("Are you sure you want to delete this coupon?"))try{const{error:I}=await ee.functions.invoke("stripe-manage-coupons",{body:{action:"delete",couponId:T}});if(I)throw I;t({title:"Success",description:"Coupon deleted successfully"}),v()}catch(I){console.error("Error deleting coupon:",I),t({title:"Error",description:I.message||"Failed to delete coupon",variant:"destructive"})}},C=T=>T.percent_off?`${T.percent_off}% off`:T.amount_off?`$${(T.amount_off/100).toFixed(2)} off`:"N/A",S=T=>{switch(T.duration){case"once":return"Once";case"forever":return"Forever";case"repeating":return`${T.duration_in_months} months`;default:return T.duration}};return r.jsx(Or,{title:"Subscription Discounts",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ou,{title:"Subscription Discounts",description:"Create and manage discount coupons for subscriptions",children:r.jsxs($r,{open:a,onOpenChange:f,children:[r.jsx(Lo,{asChild:!0,children:r.jsxs(te,{children:[r.jsx(Sn,{className:"mr-2 h-4 w-4"}),"Create Coupon"]})}),r.jsxs(zr,{children:[r.jsxs(Zr,{children:[r.jsx(Kr,{children:"Create New Coupon"}),r.jsx(ls,{children:"Create a discount coupon that can be applied to subscriptions"})]}),r.jsxs("div",{className:"space-y-4 pt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Promotion Code (what users will type)"}),r.jsx(yt,{placeholder:"e.g., BROKERAGE50",value:m.promotionCode,onChange:T=>y({...m,promotionCode:T.target.value.toUpperCase().replace(/[^A-Z0-9]/g,"")}),className:"font-mono uppercase"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Letters and numbers only. This is the code users enter at checkout."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Coupon Name (internal label)"}),r.jsx(yt,{placeholder:"e.g., 50% Off Brokerage Launch",value:m.name,onChange:T=>y({...m,name:T.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Discount Type"}),r.jsxs(_n,{value:m.discountType,onValueChange:T=>{const I=T==="amount"&&m.duration==="forever"?"once":m.duration;y({...m,discountType:T,duration:I})},children:[r.jsx(xn,{children:r.jsx(bn,{})}),r.jsxs(vn,{children:[r.jsx(er,{value:"percent",children:r.jsxs("span",{className:"flex items-center",children:[r.jsx(ZS,{className:"mr-2 h-4 w-4"}),"Percentage Off"]})}),r.jsx(er,{value:"amount",children:r.jsxs("span",{className:"flex items-center",children:[r.jsx(Cd,{className:"mr-2 h-4 w-4"}),"Fixed Amount Off"]})})]})]})]}),m.discountType==="percent"?r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Percent Off"}),r.jsxs("div",{className:"relative",children:[r.jsx(yt,{type:"number",min:"1",max:"100",placeholder:"20",value:m.percentOff,onChange:T=>y({...m,percentOff:T.target.value})}),r.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"%"})]})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Amount Off (USD)"}),r.jsxs("div",{className:"relative",children:[r.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"$"}),r.jsx(yt,{type:"number",min:"1",placeholder:"10.00",className:"pl-7",value:m.amountOff,onChange:T=>y({...m,amountOff:T.target.value})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Duration"}),r.jsxs(_n,{value:m.duration,onValueChange:T=>y({...m,duration:T}),children:[r.jsx(xn,{children:r.jsx(bn,{})}),r.jsxs(vn,{children:[r.jsx(er,{value:"once",children:"Once (first payment only)"}),r.jsx(er,{value:"repeating",children:"Multiple months"}),r.jsxs(er,{value:"forever",disabled:m.discountType==="amount",children:["Forever ",m.discountType==="amount"&&"(% discounts only)"]})]})]}),m.discountType==="amount"&&r.jsx("p",{className:"text-xs text-muted-foreground",children:'Note: "Forever" duration is only available for percentage-based discounts.'})]}),m.duration==="repeating"&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Number of Months"}),r.jsx(yt,{type:"number",min:"1",placeholder:"3",value:m.durationInMonths,onChange:T=>y({...m,durationInMonths:T.target.value})})]}),r.jsx(te,{onClick:w,disabled:o,className:"w-full",children:o?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Coupon"})]})]})]})}),r.jsxs(Ye,{children:[r.jsxs(Ht,{children:[r.jsx(Yt,{children:"Active Coupons"}),r.jsx(An,{children:"Share coupon codes with users to give them discounts on subscriptions"})]}),r.jsx(Je,{children:s?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(sn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):e.length===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No coupons created yet. Create your first coupon to get started."}):r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"Promo Code"}),r.jsx(At,{children:"Name"}),r.jsx(At,{children:"Discount"}),r.jsx(At,{children:"Duration"}),r.jsx(At,{children:"Redemptions"}),r.jsx(At,{children:"Status"}),r.jsx(At,{className:"text-right",children:"Actions"})]})}),r.jsx(qs,{children:e.map(T=>{var I;return r.jsxs(Er,{children:[r.jsx(_t,{className:"font-mono font-medium",children:((I=T.promotion_codes)==null?void 0:I.length)>0?T.promotion_codes.join(", "):r.jsx("span",{className:"text-muted-foreground text-xs",children:"No promo code"})}),r.jsx(_t,{children:T.name||"-"}),r.jsx(_t,{children:C(T)}),r.jsx(_t,{children:S(T)}),r.jsx(_t,{children:T.times_redeemed}),r.jsx(_t,{children:r.jsx(Rt,{variant:T.valid?"default":"secondary",children:T.valid?"Active":"Inactive"})}),r.jsx(_t,{className:"text-right",children:r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>k(T.id),children:r.jsx(Xn,{className:"h-4 w-4 text-destructive"})})})]},T.id)})})]})})]}),r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsx(Yt,{children:"How to Use Coupons"})}),r.jsxs(Je,{className:"text-sm text-muted-foreground space-y-2",children:[r.jsx("p",{children:"1. Create a coupon above with your desired discount."}),r.jsx("p",{children:'2. Share the coupon code (shown in the "Code" column) with users.'}),r.jsx("p",{children:"3. Users can enter the code during checkout to receive the discount."}),r.jsx("p",{children:"4. Alternatively, you can create a promotion code in Stripe dashboard for public-facing promotions."})]})]})]})})}const jce={prod_Tc07cYplXUGNkm:{name:"Individual Agent",price:"$39/mo",type:"individual"},prod_Tc08MupgoVySDG:{name:"Brokerage (Under 25)",price:"$299/mo",type:"brokerage"},prod_Tc09N1tJ4RrAFn:{name:"Brokerage (Over 25)",price:"$499/mo",type:"brokerage"}};function Nbt(){const[t,e]=P.useState(""),[n,s]=P.useState("all"),[i,o]=P.useState(null),{data:c,isLoading:a,refetch:f}=rr({queryKey:["admin-subscriptions"],queryFn:async()=>{const{data:C,error:S}=await ee.from("profiles").select(` *, brokerages:brokerage_id (id, name) `).order("created_at",{ascending:!1});if(S)throw S;return C}}),{data:m}=rr({queryKey:["admin-brokerages-subscriptions"],queryFn:async()=>{const{data:C,error:S}=await ee.from("brokerages").select("*").order("name");if(S)throw S;return await Promise.all((C||[]).map(async I=>{const{data:A}=await ee.from("profiles").select("id, name, email, subscription_status, subscription_product_id").eq("brokerage_id",I.id),{data:D}=await ee.from("user_roles").select("user_id").eq("role","brokerage_manager"),$=(D==null?void 0:D.map(W=>W.user_id))||[],F=(A==null?void 0:A.filter(W=>$.includes(W.id)))||[],q=(A==null?void 0:A.length)||0;return{...I,managers:F,agentCount:q}}))}}),y=C=>{if(C.is_grandfathered)return{status:"Grandfathered",badge:"Legacy",variant:"secondary"};if(C.brokerage_id&&!C.subscription_product_id)return{status:"Brokerage",badge:"Team Member",variant:"outline"};if(C.is_trial&&C.trial_expires_at)return new Date(C.trial_expires_at)>new Date?{status:"Trial",badge:"Active Trial",variant:"default"}:{status:"Trial Expired",badge:"Expired",variant:"destructive"};if(C.subscription_status==="active"||C.subscription_status==="trialing"){const S=jce[C.subscription_product_id];return{status:(S==null?void 0:S.name)||"Active",badge:C.subscription_status==="trialing"?"Trial":"Active",variant:"default"}}return C.subscription_status==="canceled"||C.subscription_status==="past_due"?{status:"Canceled",badge:"Inactive",variant:"destructive"}:{status:"None",badge:"No Subscription",variant:"outline"}},v=c==null?void 0:c.filter(C=>{var T,I;if(!(((T=C.name)==null?void 0:T.toLowerCase().includes(t.toLowerCase()))||((I=C.email)==null?void 0:I.toLowerCase().includes(t.toLowerCase()))))return!1;switch(y(C),n){case"active":return C.subscription_status==="active";case"trialing":return C.subscription_status==="trialing"||C.is_trial&&new Date(C.trial_expires_at)>new Date;case"grandfathered":return C.is_grandfathered;case"brokerage":return C.brokerage_id&&!C.subscription_product_id&&!C.is_grandfathered;case"expired":return C.subscription_status==="canceled"||C.subscription_status==="past_due"||C.is_trial&&new Date(C.trial_expires_at)<=new Date;case"none":return!C.subscription_status||C.subscription_status==="none";default:return!0}}),w={totalUsers:(c==null?void 0:c.length)||0,activeSubscriptions:(c==null?void 0:c.filter(C=>C.subscription_status==="active").length)||0,trials:(c==null?void 0:c.filter(C=>C.subscription_status==="trialing"||C.is_trial&&new Date(C.trial_expires_at)>new Date).length)||0,grandfathered:(c==null?void 0:c.filter(C=>C.is_grandfathered).length)||0,brokerageMembers:(c==null?void 0:c.filter(C=>C.brokerage_id&&!C.subscription_product_id&&!C.is_grandfathered).length)||0,individualSubscribers:(c==null?void 0:c.filter(C=>C.subscription_status==="active"&&C.subscription_product_id==="prod_Tc07cYplXUGNkm").length)||0,brokerageSubscribers:(c==null?void 0:c.filter(C=>C.subscription_status==="active"&&(C.subscription_product_id==="prod_Tc08MupgoVySDG"||C.subscription_product_id==="prod_Tc09N1tJ4RrAFn")).length)||0},k=C=>{window.open(`https://dashboard.stripe.com/customers/${C}`,"_blank")};return r.jsx(Or,{title:"Subscription Management",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ou,{title:"Subscription Management",description:"Track and manage all subscriptions",children:r.jsxs(te,{onClick:()=>f(),variant:"outline",size:"sm",children:[r.jsx(Dl,{className:"h-4 w-4 mr-2"}),"Refresh"]})}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-7 gap-4",children:[r.jsx(Ye,{children:r.jsxs(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(hs,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Total Users"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:w.totalUsers})]})}),r.jsx(Ye,{className:"border-green-500/50",children:r.jsxs(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(q0,{className:"h-4 w-4 text-green-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Active Paid"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1 text-green-600",children:w.activeSubscriptions})]})}),r.jsx(Ye,{className:"border-blue-500/50",children:r.jsxs(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Xi,{className:"h-4 w-4 text-blue-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Trials"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1 text-blue-600",children:w.trials})]})}),r.jsx(Ye,{className:"border-purple-500/50",children:r.jsxs(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Bw,{className:"h-4 w-4 text-purple-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Grandfathered"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1 text-purple-600",children:w.grandfathered})]})}),r.jsx(Ye,{className:"border-orange-500/50",children:r.jsxs(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ra,{className:"h-4 w-4 text-orange-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Brokerage Members"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1 text-orange-600",children:w.brokerageMembers})]})}),r.jsx(Ye,{children:r.jsxs(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Zw,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Individual"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:w.individualSubscribers})]})}),r.jsx(Ye,{children:r.jsxs(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ra,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Brokerage Subs"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:w.brokerageSubscribers})]})})]}),r.jsxs(La,{defaultValue:"users",className:"space-y-4",children:[r.jsxs(Ma,{children:[r.jsx(yn,{value:"users",children:"All Users"}),r.jsx(yn,{value:"brokerages",children:"Brokerages"})]}),r.jsxs($n,{value:"users",className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Ti,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(yt,{placeholder:"Search by name or email...",value:t,onChange:C=>e(C.target.value),className:"pl-9"})]}),r.jsxs(_n,{value:n,onValueChange:C=>s(C),children:[r.jsx(xn,{className:"w-[200px]",children:r.jsx(bn,{placeholder:"Filter by status"})}),r.jsxs(vn,{children:[r.jsx(er,{value:"all",children:"All Users"}),r.jsx(er,{value:"active",children:"Active Subscriptions"}),r.jsx(er,{value:"trialing",children:"Trials"}),r.jsx(er,{value:"grandfathered",children:"Grandfathered"}),r.jsx(er,{value:"brokerage",children:"Brokerage Members"}),r.jsx(er,{value:"expired",children:"Expired/Canceled"}),r.jsx(er,{value:"none",children:"No Subscription"})]})]})]}),r.jsx(Ye,{children:r.jsx(Je,{className:"p-0",children:r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"User"}),r.jsx(At,{children:"Status"}),r.jsx(At,{children:"Plan"}),r.jsx(At,{children:"Brokerage"}),r.jsx(At,{children:"End Date"}),r.jsx(At,{className:"text-right",children:"Actions"})]})}),r.jsx(qs,{children:a?r.jsx(Er,{children:r.jsx(_t,{colSpan:6,className:"text-center py-8",children:"Loading subscriptions..."})}):(v==null?void 0:v.length)===0?r.jsx(Er,{children:r.jsx(_t,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No users found"})}):v==null?void 0:v.map(C=>{var I,A;const S=y(C),T=jce[C.subscription_product_id];return r.jsxs(Er,{children:[r.jsx(_t,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:C.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:C.email})]})}),r.jsx(_t,{children:r.jsx(Rt,{variant:S.variant,children:S.badge})}),r.jsx(_t,{children:r.jsx("span",{className:"text-sm",children:C.is_grandfathered?"Legacy Access":C.brokerage_id&&!C.subscription_product_id?"Brokerage Subscription":(T==null?void 0:T.name)||S.status})}),r.jsx(_t,{children:(I=C.brokerages)!=null&&I.name?r.jsx("span",{className:"text-sm",children:C.brokerages.name}):r.jsx("span",{className:"text-sm text-muted-foreground",children:"—"})}),r.jsx(_t,{children:C.subscription_end_date?r.jsx("span",{className:"text-sm",children:un(new Date(C.subscription_end_date),"MMM d, yyyy")}):C.trial_expires_at?r.jsxs("span",{className:"text-sm text-blue-600",children:["Trial: ",un(new Date(C.trial_expires_at),"MMM d, yyyy")]}):r.jsx("span",{className:"text-sm text-muted-foreground",children:"—"})}),r.jsx(_t,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[C.stripe_customer_id&&r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>k(C.stripe_customer_id),children:r.jsx(Fs,{className:"h-4 w-4"})}),r.jsxs($r,{children:[r.jsx(Lo,{asChild:!0,children:r.jsx(te,{variant:"outline",size:"sm",onClick:()=>o(C),children:"Details"})}),r.jsxs(zr,{children:[r.jsxs(Zr,{children:[r.jsx(Kr,{children:"Subscription Details"}),r.jsxs(ls,{children:[C.name," (",C.email,")"]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Status"}),r.jsx(Rt,{variant:S.variant,className:"mt-1",children:S.badge})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Plan"}),r.jsx("p",{className:"font-medium",children:C.is_grandfathered?"Grandfathered (Legacy)":C.brokerage_id&&!C.subscription_product_id?"Brokerage Subscription":(T==null?void 0:T.name)||"None"})]}),C.brokerage_id&&r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Brokerage"}),r.jsx("p",{className:"font-medium",children:((A=C.brokerages)==null?void 0:A.name)||"Unknown"})]}),C.subscription_end_date&&r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Current Period End"}),r.jsx("p",{className:"font-medium",children:un(new Date(C.subscription_end_date),"MMMM d, yyyy")})]}),C.trial_expires_at&&r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Trial Expires"}),r.jsx("p",{className:"font-medium",children:un(new Date(C.trial_expires_at),"MMMM d, yyyy")})]}),C.stripe_customer_id&&r.jsxs("div",{className:"col-span-2",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Stripe Customer ID"}),r.jsx("p",{className:"font-mono text-sm",children:C.stripe_customer_id})]})]}),C.stripe_customer_id&&r.jsxs(te,{className:"w-full",onClick:()=>k(C.stripe_customer_id),children:[r.jsx(Fs,{className:"h-4 w-4 mr-2"}),"View in Stripe Dashboard"]})]})]})]})]})})]},C.id)})})]})})})]}),r.jsx($n,{value:"brokerages",className:"space-y-4",children:r.jsx("div",{className:"grid gap-4",children:m==null?void 0:m.map(C=>{var T,I;const S=(T=C.managers)==null?void 0:T.some(A=>A.subscription_status==="active"&&(A.subscription_product_id==="prod_Tc08MupgoVySDG"||A.subscription_product_id==="prod_Tc09N1tJ4RrAFn"));return r.jsxs(Ye,{children:[r.jsx(Ht,{className:"pb-3",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center",children:r.jsx(ra,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Yt,{className:"text-lg",children:C.name}),r.jsxs(An,{children:[C.agentCount," agents"]})]})]}),r.jsx(Rt,{variant:S?"default":"outline",children:S?"Active Subscription":"No Active Subscription"})]})}),r.jsx(Je,{children:((I=C.managers)==null?void 0:I.length)>0?r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Managers:"}),C.managers.map(A=>{const D=jce[A.subscription_product_id];return r.jsxs("div",{className:"flex items-center justify-between p-2 rounded-lg bg-muted/50",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:A.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:A.email})]}),r.jsx("div",{className:"text-right",children:D?r.jsxs("div",{children:[r.jsx(Rt,{variant:"default",children:D.name}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:D.price})]}):r.jsx(Rt,{variant:"outline",children:"No Subscription"})})]},A.id)})]}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No managers assigned"})})]},C.id)})})})]})]})})}function Sbt(){const[t,e]=P.useState([]),[n,s]=P.useState(!0),[i,o]=P.useState(""),[c,a]=P.useState("all"),[f,m]=P.useState({total:0,qualified:0,pending:0,cancelled:0,totalDiscounts:0});P.useEffect(()=>{y()},[]);const y=async()=>{try{const{data:C,error:S}=await ee.from("referrals").select(` *, referrer_brokerage:brokerages!referrer_brokerage_id(name), referred_brokerage:brokerages!referred_brokerage_id(name), referred_user:profiles!referred_user_id(name, email) `).order("created_at",{ascending:!1});if(S)throw S;e(C||[]);const T=(C==null?void 0:C.filter(D=>D.status==="qualified").length)||0,I=(C==null?void 0:C.filter(D=>D.status==="pending").length)||0,A=(C==null?void 0:C.filter(D=>D.status==="cancelled").length)||0;m({total:(C==null?void 0:C.length)||0,qualified:T,pending:I,cancelled:A,totalDiscounts:T*25})}catch(C){console.error("Error fetching referrals:",C),Ge.error("Failed to load referrals")}finally{s(!1)}},v=async()=>{try{Ge.loading("Processing qualifications...");const{error:C}=await ee.functions.invoke("process-referral-qualifications");if(C)throw C;Ge.dismiss(),Ge.success("Qualifications processed successfully"),y()}catch(C){Ge.dismiss(),console.error("Error processing qualifications:",C),Ge.error("Failed to process qualifications")}},w=t.filter(C=>{var I,A,D,$,F,q;const S=((A=(I=C.referrer_brokerage)==null?void 0:I.name)==null?void 0:A.toLowerCase().includes(i.toLowerCase()))||(($=(D=C.referred_brokerage)==null?void 0:D.name)==null?void 0:$.toLowerCase().includes(i.toLowerCase()))||((q=(F=C.referred_user)==null?void 0:F.email)==null?void 0:q.toLowerCase().includes(i.toLowerCase())),T=c==="all"||C.status===c;return S&&T}),k=C=>{switch(C){case"qualified":return r.jsxs(Rt,{className:"bg-green-100 text-green-800",children:[r.jsx(za,{className:"h-3 w-3 mr-1"}),"Qualified"]});case"pending":return r.jsxs(Rt,{variant:"secondary",children:[r.jsx(Xi,{className:"h-3 w-3 mr-1"}),"Pending"]});case"cancelled":return r.jsxs(Rt,{variant:"destructive",children:[r.jsx(Lc,{className:"h-3 w-3 mr-1"}),"Cancelled"]});default:return r.jsx(Rt,{children:C})}};return r.jsx(Or,{title:"Referral Program",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ou,{title:"Referral Program",description:"Track and manage brokerage referrals",children:r.jsxs(te,{onClick:v,variant:"outline",children:[r.jsx(Dl,{className:"h-4 w-4 mr-2"}),"Process Qualifications"]})}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-5 gap-4",children:[r.jsx(Ye,{children:r.jsx(Je,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(hs,{className:"h-5 w-5 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:f.total}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Referrals"})]})]})})}),r.jsx(Ye,{children:r.jsx(Je,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(za,{className:"h-5 w-5 text-green-600"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:f.qualified}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Qualified"})]})]})})}),r.jsx(Ye,{children:r.jsx(Je,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Xi,{className:"h-5 w-5 text-amber-600"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:f.pending}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Pending"})]})]})})}),r.jsx(Ye,{children:r.jsx(Je,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Lc,{className:"h-5 w-5 text-red-600"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:f.cancelled}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Cancelled"})]})]})})}),r.jsx(Ye,{children:r.jsx(Je,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Cd,{className:"h-5 w-5 text-green-600"}),r.jsxs("div",{children:[r.jsxs("p",{className:"text-2xl font-bold",children:["$",f.totalDiscounts]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Monthly Discounts"})]})]})})})]}),r.jsxs(Ye,{children:[r.jsxs(Ht,{children:[r.jsx(Yt,{children:"All Referrals"}),r.jsx(An,{children:"View and manage all referral relationships"})]}),r.jsxs(Je,{children:[r.jsxs("div",{className:"flex gap-4 mb-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Ti,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(yt,{placeholder:"Search by brokerage or email...",value:i,onChange:C=>o(C.target.value),className:"pl-10"})]}),r.jsxs(_n,{value:c,onValueChange:a,children:[r.jsx(xn,{className:"w-[180px]",children:r.jsx(bn,{placeholder:"Filter by status"})}),r.jsxs(vn,{children:[r.jsx(er,{value:"all",children:"All Statuses"}),r.jsx(er,{value:"pending",children:"Pending"}),r.jsx(er,{value:"qualified",children:"Qualified"}),r.jsx(er,{value:"cancelled",children:"Cancelled"})]})]})]}),n?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"Referrer"}),r.jsx(At,{children:"Referred"}),r.jsx(At,{children:"Signup Date"}),r.jsx(At,{children:"Status"}),r.jsx(At,{children:"Qualified Date"}),r.jsx(At,{children:"Discount"})]})}),r.jsx(qs,{children:w.length===0?r.jsx(Er,{children:r.jsx(_t,{colSpan:6,className:"text-center text-muted-foreground py-8",children:"No referrals found"})}):w.map(C=>{var S,T,I,A;return r.jsxs(Er,{children:[r.jsx(_t,{className:"font-medium",children:((S=C.referrer_brokerage)==null?void 0:S.name)||"Unknown"}),r.jsx(_t,{children:r.jsxs("div",{children:[r.jsx("p",{children:((T=C.referred_brokerage)==null?void 0:T.name)||((I=C.referred_user)==null?void 0:I.name)||"Pending setup"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(A=C.referred_user)==null?void 0:A.email})]})}),r.jsx(_t,{children:un(new Date(C.signup_date),"MMM d, yyyy")}),r.jsx(_t,{children:k(C.status)}),r.jsx(_t,{children:C.qualified_date?un(new Date(C.qualified_date),"MMM d, yyyy"):"-"}),r.jsx(_t,{children:C.discount_applied?r.jsx(Rt,{variant:"outline",className:"text-green-600",children:"$25/mo applied"}):r.jsx("span",{className:"text-muted-foreground",children:"-"})})]},C.id)})})]})]})]})]})})}const kce=[{value:"add_agent",label:"Add Agent"},{value:"share_resource",label:"Share Resource"},{value:"post_community",label:"Post in Community"},{value:"register_event",label:"Register for Event"},{value:"view_template",label:"View Template"},{value:"watch_academy",label:"Watch Academy Video"},{value:"use_toolbox",label:"Use Toolbox"},{value:"launch_app",label:"Launch App"},{value:"add_contact",label:"Add Contact"},{value:"add_plan",label:"Add Touchpoint Plan"},{value:"create_video",label:"Create Video"},{value:"complete_touch",label:"Complete Touch"},{value:"add_transaction",label:"Add Transaction"},{value:"add_listing",label:"Add Listing"},{value:"schedule_popby",label:"Schedule Pop-by"}],Cbt=[{value:"brokerage_manager",label:"Brokerage Manager"},{value:"agent",label:"Agent"}];function Mbt(){const[t,e]=P.useState([]),[n,s]=P.useState(!0),[i,o]=P.useState(!1),[c,a]=P.useState(null),[f,m]=P.useState({title:"",description:"",action_type:"view_template",target_role:"agent",is_active:!0});P.useEffect(()=>{y()},[]);const y=async()=>{try{const{data:A,error:D}=await ee.from("onboarding_checklist_items").select("*").order("target_role").order("sort_order");if(D)throw D;e(A||[])}catch(A){console.error("Error fetching checklist items:",A),Ge.error("Failed to load checklist items")}finally{s(!1)}},v=()=>{a(null),m({title:"",description:"",action_type:"view_template",target_role:"agent",is_active:!0}),o(!0)},w=A=>{a(A),m({title:A.title,description:A.description||"",action_type:A.action_type,target_role:A.target_role,is_active:A.is_active}),o(!0)},k=async()=>{if(!f.title.trim()){Ge.error("Title is required");return}try{if(c){const{error:A}=await ee.from("onboarding_checklist_items").update({title:f.title,description:f.description||null,action_type:f.action_type,target_role:f.target_role,is_active:f.is_active}).eq("id",c.id);if(A)throw A;Ge.success("Checklist item updated")}else{const A=t.filter($=>$.target_role===f.target_role).reduce(($,F)=>Math.max($,F.sort_order),-1),{error:D}=await ee.from("onboarding_checklist_items").insert({title:f.title,description:f.description||null,action_type:f.action_type,target_role:f.target_role,is_active:f.is_active,sort_order:A+1});if(D)throw D;Ge.success("Checklist item created")}o(!1),y()}catch(A){console.error("Error saving checklist item:",A),Ge.error("Failed to save checklist item")}},C=async A=>{if(confirm("Are you sure you want to delete this checklist item?"))try{const{error:D}=await ee.from("onboarding_checklist_items").delete().eq("id",A);if(D)throw D;Ge.success("Checklist item deleted"),y()}catch(D){console.error("Error deleting checklist item:",D),Ge.error("Failed to delete checklist item")}},S=async A=>{try{const{error:D}=await ee.from("onboarding_checklist_items").update({is_active:!A.is_active}).eq("id",A.id);if(D)throw D;Ge.success(A.is_active?"Item deactivated":"Item activated"),y()}catch(D){console.error("Error toggling item:",D),Ge.error("Failed to update item")}},T=t.filter(A=>A.target_role==="brokerage_manager"),I=t.filter(A=>A.target_role==="agent");return r.jsxs(Or,{title:"Onboarding Checklist",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-2xl font-bold",children:"Onboarding Checklist"}),r.jsx("p",{className:"text-muted-foreground",children:"Manage checklist items shown to new users on their dashboard"})]}),r.jsxs(te,{onClick:v,className:"gap-2",children:[r.jsx(Sn,{className:"h-4 w-4"}),"Add Item"]})]}),r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(Rt,{variant:"secondary",children:"Brokerage Manager"}),"Checklist Items"]})}),r.jsx(Je,{children:T.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No checklist items for brokerage managers"}):r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{className:"w-12",children:"#"}),r.jsx(At,{children:"Title"}),r.jsx(At,{children:"Action Type"}),r.jsx(At,{children:"Status"}),r.jsx(At,{className:"text-right",children:"Actions"})]})}),r.jsx(qs,{children:T.map((A,D)=>{var $;return r.jsxs(Er,{children:[r.jsx(_t,{className:"text-muted-foreground",children:D+1}),r.jsx(_t,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:A.title}),A.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:A.description})]})}),r.jsx(_t,{children:r.jsx(Rt,{variant:"outline",children:(($=kce.find(F=>F.value===A.action_type))==null?void 0:$.label)||A.action_type})}),r.jsx(_t,{children:r.jsx(Zs,{checked:A.is_active,onCheckedChange:()=>S(A)})}),r.jsx(_t,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>w(A),children:r.jsx(ma,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>C(A.id),children:r.jsx(Xn,{className:"h-4 w-4 text-destructive"})})]})})]},A.id)})})]})})]}),r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(Rt,{variant:"secondary",children:"Agent"}),"Checklist Items"]})}),r.jsx(Je,{children:I.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No checklist items for agents"}):r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{className:"w-12",children:"#"}),r.jsx(At,{children:"Title"}),r.jsx(At,{children:"Action Type"}),r.jsx(At,{children:"Status"}),r.jsx(At,{className:"text-right",children:"Actions"})]})}),r.jsx(qs,{children:I.map((A,D)=>{var $;return r.jsxs(Er,{children:[r.jsx(_t,{className:"text-muted-foreground",children:D+1}),r.jsx(_t,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:A.title}),A.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:A.description})]})}),r.jsx(_t,{children:r.jsx(Rt,{variant:"outline",children:(($=kce.find(F=>F.value===A.action_type))==null?void 0:$.label)||A.action_type})}),r.jsx(_t,{children:r.jsx(Zs,{checked:A.is_active,onCheckedChange:()=>S(A)})}),r.jsx(_t,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>w(A),children:r.jsx(ma,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>C(A.id),children:r.jsx(Xn,{className:"h-4 w-4 text-destructive"})})]})})]},A.id)})})]})})]})]}),r.jsx($r,{open:i,onOpenChange:o,children:r.jsxs(zr,{children:[r.jsx(Zr,{children:r.jsx(Kr,{children:c?"Edit Checklist Item":"Add Checklist Item"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"title",children:"Title *"}),r.jsx(yt,{id:"title",value:f.title,onChange:A=>m({...f,title:A.target.value}),placeholder:"e.g., Watch your first academy video"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",value:f.description,onChange:A=>m({...f,description:A.target.value}),placeholder:"Optional description for the checklist item",rows:2})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Target Role"}),r.jsxs(_n,{value:f.target_role,onValueChange:A=>m({...f,target_role:A}),children:[r.jsx(xn,{children:r.jsx(bn,{})}),r.jsx(vn,{children:Cbt.map(A=>r.jsx(er,{value:A.value,children:A.label},A.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Action Type"}),r.jsxs(_n,{value:f.action_type,onValueChange:A=>m({...f,action_type:A}),children:[r.jsx(xn,{children:r.jsx(bn,{})}),r.jsx(vn,{children:kce.map(A=>r.jsx(er,{value:A.value,children:A.label},A.value))})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Zs,{id:"is_active",checked:f.is_active,onCheckedChange:A=>m({...f,is_active:A})}),r.jsx(Qe,{htmlFor:"is_active",children:"Active"})]})]}),r.jsxs(ni,{children:[r.jsx(te,{variant:"outline",onClick:()=>o(!1),children:"Cancel"}),r.jsx(te,{onClick:k,children:c?"Save Changes":"Create Item"})]})]})})]})}function Tbt(){const[t,e]=P.useState(""),[n,s]=P.useState("all"),[i,o]=P.useState("name"),[c,a]=P.useState("asc"),[f,m]=P.useState(""),[y,v]=P.useState(""),[w,k]=P.useState(""),[C,S]=P.useState(""),{data:T}=rr({queryKey:["admin-brokerages"],queryFn:async()=>{const{data:Z,error:re}=await ee.from("brokerages").select("id, name").order("name");if(re)throw re;return Z}}),I=async Z=>{let he=[],ue=0,Ne=!0;for(;Ne;){const{data:se,error:xe}=await Z(ue,ue+1e3-1);if(xe)throw xe;se&&se.length>0?(he=[...he,...se],ue+=1e3,Ne=se.length===1e3):Ne=!1}return he},{data:A,isLoading:D}=rr({queryKey:["admin-agent-os-user-stats"],queryFn:async()=>{const Z=await I((Se,oe)=>ee.from("profiles").select("id, name, email, brokerage_id, created_at").range(Se,oe)),{data:re}=await ee.from("brokerages").select("id, name"),he=new Map((re==null?void 0:re.map(Se=>[Se.id,Se.name]))||[]),{data:ue}=await ee.rpc("get_admin_contact_counts"),Ne=new Map;ue==null||ue.forEach(Se=>{Ne.set(Se.owner_user_id,Se.contact_count)});const{data:se}=await ee.rpc("get_admin_video_counts"),xe=new Map;se==null||se.forEach(Se=>{xe.set(Se.owner_user_id,Se.video_count)});const{data:ie}=await ee.rpc("get_admin_popby_counts"),me=new Map;ie==null||ie.forEach(Se=>{me.set(Se.owner_user_id,Se.popby_count)});const{data:fe}=await ee.rpc("get_admin_listing_counts"),ve=new Map;return fe==null||fe.forEach(Se=>{ve.set(Se.agent_id,Se.listing_count)}),Z.map(Se=>({id:Se.id,name:Se.name||"Unknown",email:Se.email||"",brokerage_id:Se.brokerage_id,brokerage_name:Se.brokerage_id&&he.get(Se.brokerage_id)||null,contact_count:Ne.get(Se.id)||0,video_count:xe.get(Se.id)||0,popby_count:me.get(Se.id)||0,listing_count:ve.get(Se.id)||0,created_at:Se.created_at}))}}),$=P.useMemo(()=>{if(!A)return[];let Z=A.filter(re=>{const he=t.toLowerCase(),ue=!t||re.name.toLowerCase().includes(he)||re.email.toLowerCase().includes(he),Ne=n==="all"||n==="none"&&!re.brokerage_id||re.brokerage_id===n,se=parseInt(f)||0,xe=parseInt(y)||0,ie=parseInt(w)||0,me=parseInt(C)||0,fe=re.contact_count>=se&&re.video_count>=xe&&re.popby_count>=ie&&re.listing_count>=me;return ue&&Ne&&fe});return Z.sort((re,he)=>{let ue=0;return i==="name"?ue=re.name.localeCompare(he.name):ue=re[i]-he[i],c==="asc"?ue:-ue}),Z},[A,t,n,i,c,f,y,w,C]),F=Z=>{i===Z?a(c==="asc"?"desc":"asc"):(o(Z),a("desc"))},q=()=>{const Z=["Name","Email","Brokerage","Contacts","Videos","Popbys","Listings"],re=$.map(xe=>[xe.name,xe.email,xe.brokerage_name||"None",xe.contact_count,xe.video_count,xe.popby_count,xe.listing_count]),he=[Z.join(","),...re.map(xe=>xe.map(ie=>`"${ie}"`).join(","))].join(` `),ue=new Blob([he],{type:"text/csv"}),Ne=URL.createObjectURL(ue),se=document.createElement("a");se.href=Ne,se.download=`agent-os-user-stats-${new Date().toISOString().split("T")[0]}.csv`,se.click(),URL.revokeObjectURL(Ne)},W=P.useMemo(()=>$.length?$.reduce((Z,re)=>({contacts:Z.contacts+re.contact_count,videos:Z.videos+re.video_count,popbys:Z.popbys+re.popby_count,listings:Z.listings+re.listing_count}),{contacts:0,videos:0,popbys:0,listings:0}):{contacts:0,videos:0,popbys:0,listings:0},[$]),K=({field:Z,children:re})=>r.jsx(At,{className:"cursor-pointer hover:bg-muted/50 select-none",onClick:()=>F(Z),children:r.jsxs("div",{className:"flex items-center gap-1",children:[re,r.jsx(B0,{className:`h-3 w-3 ${i===Z?"text-primary":"text-muted-foreground"}`})]})});return r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(hs,{className:"h-5 w-5"}),"User Activity Analytics"]}),r.jsx(An,{children:"View all users and their Agent OS usage metrics"})]}),r.jsxs(te,{variant:"outline",size:"sm",onClick:q,children:[r.jsx(Mo,{className:"h-4 w-4 mr-2"}),"Export CSV"]})]})}),r.jsxs(Je,{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-4 md:grid-cols-6",children:[r.jsx("div",{className:"md:col-span-2",children:r.jsxs("div",{className:"relative",children:[r.jsx(Ti,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(yt,{placeholder:"Search by name or email...",value:t,onChange:Z=>e(Z.target.value),className:"pl-9"})]})}),r.jsx("div",{children:r.jsxs(_n,{value:n,onValueChange:s,children:[r.jsxs(xn,{children:[r.jsx(ra,{className:"h-4 w-4 mr-2 text-muted-foreground"}),r.jsx(bn,{placeholder:"Brokerage"})]}),r.jsxs(vn,{children:[r.jsx(er,{value:"all",children:"All Brokerages"}),r.jsx(er,{value:"none",children:"No Brokerage"}),T==null?void 0:T.map(Z=>r.jsx(er,{value:Z.id,children:Z.name},Z.id))]})]})}),r.jsx("div",{children:r.jsx(yt,{type:"number",placeholder:"Min contacts",value:f,onChange:Z=>m(Z.target.value),min:"0"})}),r.jsx("div",{children:r.jsx(yt,{type:"number",placeholder:"Min videos",value:y,onChange:Z=>v(Z.target.value),min:"0"})}),r.jsx("div",{children:r.jsx(yt,{type:"number",placeholder:"Min popbys",value:w,onChange:Z=>k(Z.target.value),min:"0"})})]}),r.jsxs("div",{className:"grid gap-4 md:grid-cols-5 text-sm",children:[r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:$.length}),r.jsx("div",{className:"text-muted-foreground",children:"Users"})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:W.contacts.toLocaleString()}),r.jsx("div",{className:"text-muted-foreground",children:"Total Contacts"})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:W.videos.toLocaleString()}),r.jsx("div",{className:"text-muted-foreground",children:"Total Videos"})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:W.popbys.toLocaleString()}),r.jsx("div",{className:"text-muted-foreground",children:"Total Popbys"})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:W.listings.toLocaleString()}),r.jsx("div",{className:"text-muted-foreground",children:"Total Listings"})]})]}),D?r.jsx("div",{className:"flex justify-center py-12",children:r.jsx(sn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsx("div",{className:"rounded-md border",children:r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(K,{field:"name",children:"Name"}),r.jsx(At,{children:"Email"}),r.jsx(At,{children:"Brokerage"}),r.jsx(K,{field:"contact_count",children:"Contacts"}),r.jsx(K,{field:"video_count",children:"Videos"}),r.jsx(K,{field:"popby_count",children:"Popbys"}),r.jsx(K,{field:"listing_count",children:"Listings"})]})}),r.jsx(qs,{children:$.length===0?r.jsx(Er,{children:r.jsx(_t,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"No users found matching your filters"})}):$.map(Z=>r.jsxs(Er,{children:[r.jsx(_t,{className:"font-medium",children:Z.name}),r.jsx(_t,{className:"text-muted-foreground",children:Z.email}),r.jsx(_t,{children:Z.brokerage_name?r.jsx(Rt,{variant:"secondary",children:Z.brokerage_name}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(_t,{children:r.jsx(Rt,{variant:Z.contact_count>0?"default":"outline",children:Z.contact_count})}),r.jsx(_t,{children:r.jsx(Rt,{variant:Z.video_count>0?"default":"outline",children:Z.video_count})}),r.jsx(_t,{children:r.jsx(Rt,{variant:Z.popby_count>0?"default":"outline",children:Z.popby_count})}),r.jsx(_t,{children:r.jsx(Rt,{variant:Z.listing_count>0?"default":"outline",children:Z.listing_count})})]},Z.id))})]})})]})]})}function Abt(){la(),Xr();const[t,e]=P.useState("user-analytics"),{data:n}=rr({queryKey:["admin-feature-flags"],queryFn:async()=>{const{data:k,error:C}=await ee.from("feature_flags").select("*").order("key");if(C)throw C;return k}}),{data:s,isLoading:i}=rr({queryKey:["admin-relationship-types"],queryFn:async()=>{const{data:k,error:C}=await ee.from("relationship_types").select("*").order("sort_order");if(C)throw C;return k}}),{data:o,isLoading:c}=rr({queryKey:["admin-action-types"],queryFn:async()=>{const{data:k,error:C}=await ee.from("action_types").select("*").order("sort_order");if(C)throw C;return k}}),{data:a,isLoading:f}=rr({queryKey:["admin-action-scripts"],queryFn:async()=>{const{data:k,error:C}=await ee.from("action_scripts").select("*, action_type:action_types(*)");if(C)throw C;return k}}),{data:m,isLoading:y}=rr({queryKey:["admin-touchpoint-plans"],queryFn:async()=>{const{data:k,error:C}=await ee.from("touchpoint_plans").select("*").order("name");if(C)throw C;return k}}),{data:v,isLoading:w}=rr({queryKey:["admin-popby-items"],queryFn:async()=>{const{data:k,error:C}=await ee.from("popby_items").select("*").is("owner_user_id",null).order("name");if(C)throw C;return k}});return r.jsx(Or,{title:"Agent OS Control Center",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ou,{title:"Agent OS Control Center",description:"Manage InnerCircle settings, scripts, and touchpoint plans"}),r.jsxs(La,{value:t,onValueChange:e,children:[r.jsxs(Ma,{className:"grid w-full grid-cols-9",children:[r.jsxs(yn,{value:"user-analytics",className:"gap-2",children:[r.jsx(xc,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Users"})]}),r.jsxs(yn,{value:"relationship-types",className:"gap-2",children:[r.jsx(hs,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Relationships"})]}),r.jsxs(yn,{value:"action-types",className:"gap-2",children:[r.jsx(Wa,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Actions"})]}),r.jsxs(yn,{value:"scripts",className:"gap-2",children:[r.jsx(Ai,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Scripts"})]}),r.jsxs(yn,{value:"video-scripts",className:"gap-2",children:[r.jsx(wd,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Video Scripts"})]}),r.jsxs(yn,{value:"plans",className:"gap-2",children:[r.jsx(li,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Plans"})]}),r.jsxs(yn,{value:"popbys",className:"gap-2",children:[r.jsx(Qa,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Popbys"})]}),r.jsxs(yn,{value:"settings",className:"gap-2",children:[r.jsx(id,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Settings"})]}),r.jsxs(yn,{value:"feature-flags",className:"gap-2",children:[r.jsx(lT,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Flags"})]})]}),r.jsx($n,{value:"user-analytics",className:"mt-6",children:r.jsx(Tbt,{})}),r.jsx($n,{value:"relationship-types",className:"mt-6",children:r.jsx(Ebt,{types:s||[],isLoading:i})}),r.jsx($n,{value:"action-types",className:"mt-6",children:r.jsx(Ibt,{types:o||[],isLoading:c})}),r.jsx($n,{value:"scripts",className:"mt-6",children:r.jsx(Pbt,{scripts:a||[],actionTypes:o||[],isLoading:f})}),r.jsx($n,{value:"video-scripts",className:"mt-6",children:r.jsx(Rbt,{})}),r.jsx($n,{value:"plans",className:"mt-6",children:r.jsx(Lbt,{plans:m||[],actionTypes:o||[],scripts:a||[],isLoading:y})}),r.jsx($n,{value:"popbys",className:"mt-6",children:r.jsx(Dbt,{items:v||[],isLoading:w})}),r.jsx($n,{value:"settings",className:"mt-6",children:r.jsx(Fbt,{})}),r.jsx($n,{value:"feature-flags",className:"mt-6",children:r.jsx(Obt,{flags:n||[]})})]})]})})}function Ebt({types:t,isLoading:e}){const{toast:n}=la(),s=Xr(),[i,o]=P.useState(null),[c,a]=P.useState(!1),f=cr({mutationFn:async y=>{if(y.id){const{error:v}=await ee.from("relationship_types").update({name:y.name,description:y.description,icon:y.icon}).eq("id",y.id);if(v)throw v}else{const{error:v}=await ee.from("relationship_types").insert([{name:y.name,description:y.description,icon:y.icon,sort_order:t.length}]);if(v)throw v}},onSuccess:()=>{s.invalidateQueries({queryKey:["admin-relationship-types"]}),a(!1),o(null),n({title:"Saved successfully"})},onError:y=>{n({title:"Error",description:y.message,variant:"destructive"})}}),m=async y=>{await ee.from("relationship_types").update({active:!y.active}).eq("id",y.id),s.invalidateQueries({queryKey:["admin-relationship-types"]})};return r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Yt,{children:"Relationship Types"}),r.jsx(An,{children:"Define the relationship categories for InnerCircle contacts"})]}),r.jsxs(te,{onClick:()=>{o(null),a(!0)},children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Add Type"]})]}),r.jsx(Je,{children:e?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(sn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{className:"w-12"}),r.jsx(At,{children:"Name"}),r.jsx(At,{children:"Description"}),r.jsx(At,{children:"Status"}),r.jsx(At,{className:"w-24",children:"Actions"})]})}),r.jsx(qs,{children:t.map(y=>r.jsxs(Er,{children:[r.jsx(_t,{children:r.jsx(DS,{className:"h-4 w-4 text-muted-foreground cursor-grab"})}),r.jsx(_t,{className:"font-medium",children:y.name}),r.jsx(_t,{className:"text-muted-foreground",children:y.description}),r.jsx(_t,{children:r.jsx(Zs,{checked:y.active,onCheckedChange:()=>m(y)})}),r.jsx(_t,{children:r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>{o(y),a(!0)},children:r.jsx(ma,{className:"h-4 w-4"})})})]},y.id))})]})}),r.jsx($r,{open:c,onOpenChange:a,children:r.jsxs(zr,{children:[r.jsx(Zr,{children:r.jsxs(Kr,{children:[i?"Edit":"Add"," Relationship Type"]})}),r.jsxs("form",{onSubmit:y=>{y.preventDefault();const v=new FormData(y.currentTarget);f.mutate({id:i==null?void 0:i.id,name:v.get("name"),description:v.get("description"),icon:v.get("icon")})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"name",children:"Name"}),r.jsx(yt,{id:"name",name:"name",defaultValue:i==null?void 0:i.name,required:!0})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",name:"description",defaultValue:(i==null?void 0:i.description)||""})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"icon",children:"Icon"}),r.jsx(yt,{id:"icon",name:"icon",defaultValue:(i==null?void 0:i.icon)||"",placeholder:"e.g., star, heart, user"})]})]}),r.jsxs(ni,{className:"mt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsxs(te,{type:"submit",disabled:f.isPending,children:[f.isPending&&r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function Ibt({types:t,isLoading:e}){const{toast:n}=la(),s=Xr(),[i,o]=P.useState(null),[c,a]=P.useState(!1),f=cr({mutationFn:async y=>{if(y.id){const{error:v}=await ee.from("action_types").update({name:y.name,description:y.description,icon:y.icon,color:y.color}).eq("id",y.id);if(v)throw v}else{const{error:v}=await ee.from("action_types").insert([{name:y.name,description:y.description,icon:y.icon,color:y.color,sort_order:t.length}]);if(v)throw v}},onSuccess:()=>{s.invalidateQueries({queryKey:["admin-action-types"]}),a(!1),o(null),n({title:"Saved successfully"})},onError:y=>{n({title:"Error",description:y.message,variant:"destructive"})}}),m=async y=>{await ee.from("action_types").update({active:!y.active}).eq("id",y.id),s.invalidateQueries({queryKey:["admin-action-types"]})};return r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Yt,{children:"Action Types"}),r.jsx(An,{children:"Define the types of touchpoint actions agents can take"})]}),r.jsxs(te,{onClick:()=>{o(null),a(!0)},children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Add Action"]})]}),r.jsx(Je,{children:e?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(sn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"Name"}),r.jsx(At,{children:"Description"}),r.jsx(At,{children:"Color"}),r.jsx(At,{children:"Status"}),r.jsx(At,{className:"w-24",children:"Actions"})]})}),r.jsx(qs,{children:t.map(y=>r.jsxs(Er,{children:[r.jsx(_t,{className:"font-medium",children:y.name}),r.jsx(_t,{className:"text-muted-foreground",children:y.description}),r.jsx(_t,{children:y.color&&r.jsx("div",{className:"w-6 h-6 rounded",style:{backgroundColor:y.color}})}),r.jsx(_t,{children:r.jsx(Zs,{checked:y.active,onCheckedChange:()=>m(y)})}),r.jsx(_t,{children:r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>{o(y),a(!0)},children:r.jsx(ma,{className:"h-4 w-4"})})})]},y.id))})]})}),r.jsx($r,{open:c,onOpenChange:a,children:r.jsxs(zr,{children:[r.jsx(Zr,{children:r.jsxs(Kr,{children:[i?"Edit":"Add"," Action Type"]})}),r.jsxs("form",{onSubmit:y=>{y.preventDefault();const v=new FormData(y.currentTarget);f.mutate({id:i==null?void 0:i.id,name:v.get("name"),description:v.get("description"),icon:v.get("icon"),color:v.get("color")})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"name",children:"Name"}),r.jsx(yt,{id:"name",name:"name",defaultValue:i==null?void 0:i.name,required:!0})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",name:"description",defaultValue:(i==null?void 0:i.description)||""})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"icon",children:"Icon"}),r.jsx(yt,{id:"icon",name:"icon",defaultValue:(i==null?void 0:i.icon)||"",placeholder:"e.g., phone, message"})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"color",children:"Color"}),r.jsx(yt,{id:"color",name:"color",type:"color",defaultValue:(i==null?void 0:i.color)||"#6366f1"})]})]}),r.jsxs(ni,{className:"mt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsxs(te,{type:"submit",disabled:f.isPending,children:[f.isPending&&r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function Pbt({scripts:t,actionTypes:e,isLoading:n}){const{toast:s}=la(),i=Xr(),[o,c]=P.useState(null),[a,f]=P.useState(!1),m=cr({mutationFn:async v=>{if(v.id){const{error:w}=await ee.from("action_scripts").update({title:v.title,action_type_id:v.action_type_id,tone:v.tone,script_body:v.script_body,active:v.active}).eq("id",v.id);if(w)throw w}else{const{error:w}=await ee.from("action_scripts").insert([{title:v.title,action_type_id:v.action_type_id,tone:v.tone,script_body:v.script_body,active:!0}]);if(w)throw w}},onSuccess:()=>{i.invalidateQueries({queryKey:["admin-action-scripts"]}),f(!1),c(null),s({title:"Saved successfully"})},onError:v=>{s({title:"Error",description:v.message,variant:"destructive"})}}),y=cr({mutationFn:async v=>{const{error:w}=await ee.from("action_scripts").delete().eq("id",v);if(w)throw w},onSuccess:()=>{i.invalidateQueries({queryKey:["admin-action-scripts"]}),s({title:"Deleted successfully"})}});return r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Yt,{children:"Script Library"}),r.jsx(An,{children:"Create and manage scripts for each action type"})]}),r.jsxs(te,{onClick:()=>{c(null),f(!0)},children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Add Script"]})]}),r.jsx(Je,{children:n?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(sn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"Title"}),r.jsx(At,{children:"Action Type"}),r.jsx(At,{children:"Tone"}),r.jsx(At,{children:"Status"}),r.jsx(At,{className:"w-24",children:"Actions"})]})}),r.jsx(qs,{children:t.map(v=>{var w;return r.jsxs(Er,{children:[r.jsx(_t,{className:"font-medium",children:v.title}),r.jsx(_t,{children:r.jsx(Rt,{variant:"outline",children:((w=v.action_type)==null?void 0:w.name)||"Unknown"})}),r.jsx(_t,{className:"text-muted-foreground",children:v.tone}),r.jsx(_t,{children:r.jsx(Rt,{variant:v.active?"default":"secondary",children:v.active?"Active":"Inactive"})}),r.jsxs(_t,{className:"flex gap-1",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>{c(v),f(!0)},children:r.jsx(ma,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>y.mutate(v.id),children:r.jsx(Xn,{className:"h-4 w-4 text-destructive"})})]})]},v.id)})})]})}),r.jsx($r,{open:a,onOpenChange:f,children:r.jsxs(zr,{className:"max-w-2xl",children:[r.jsx(Zr,{children:r.jsxs(Kr,{children:[o?"Edit":"Add"," Script"]})}),r.jsxs("form",{onSubmit:v=>{v.preventDefault();const w=new FormData(v.currentTarget);m.mutate({id:o==null?void 0:o.id,title:w.get("title"),action_type_id:w.get("action_type_id"),tone:w.get("tone"),script_body:w.get("script_body"),active:!0})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"title",children:"Title"}),r.jsx(yt,{id:"title",name:"title",defaultValue:o==null?void 0:o.title,required:!0})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"action_type_id",children:"Action Type"}),r.jsxs(_n,{name:"action_type_id",defaultValue:o==null?void 0:o.action_type_id,children:[r.jsx(xn,{children:r.jsx(bn,{placeholder:"Select action type"})}),r.jsx(vn,{children:e.map(v=>r.jsx(er,{value:v.id,children:v.name},v.id))})]})]})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"tone",children:"Tone (optional)"}),r.jsx(yt,{id:"tone",name:"tone",defaultValue:(o==null?void 0:o.tone)||"",placeholder:"e.g., Friendly, Professional, Casual"})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"script_body",children:"Script Body"}),r.jsx(ps,{id:"script_body",name:"script_body",defaultValue:o==null?void 0:o.script_body,rows:8,required:!0,placeholder:`Use {{FirstName}}, {{LastName}}, and {{AgentName}} as placeholders. Example: Hey {{FirstName}}, it's {{AgentName}}. I was thinking about you and wanted to check in...`})]})]}),r.jsxs(ni,{className:"mt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>f(!1),children:"Cancel"}),r.jsxs(te,{type:"submit",disabled:m.isPending,children:[m.isPending&&r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function Lbt({plans:t,actionTypes:e,scripts:n,isLoading:s}){const{toast:i}=la(),o=Xr(),[c,a]=P.useState(null),[f,m]=P.useState(!1),[y,v]=P.useState(null),[w,k]=P.useState(!1),[C,S]=P.useState(null),[T,I]=P.useState(null),{data:A}=rr({queryKey:["plan-items",y],queryFn:async()=>{if(!y)return[];const{data:Z,error:re}=await ee.from("touchpoint_plan_items").select("*").eq("plan_id",y).order("month_number");if(re)throw re;return Z},enabled:!!y}),D=cr({mutationFn:async Z=>{if(Z.id){const{error:re}=await ee.from("touchpoint_plans").update({name:Z.name,description:Z.description,active:Z.active}).eq("id",Z.id);if(re)throw re}else{const{error:re}=await ee.from("touchpoint_plans").insert([{name:Z.name,description:Z.description,active:!0}]);if(re)throw re}},onSuccess:()=>{o.invalidateQueries({queryKey:["admin-touchpoint-plans"]}),m(!1),a(null),i({title:"Saved successfully"})},onError:Z=>{i({title:"Error",description:Z.message,variant:"destructive"})}}),$=cr({mutationFn:async Z=>{if(Z.id){const{error:re}=await ee.from("touchpoint_plan_items").update({action_type_id:Z.action_type_id,default_script_id:Z.default_script_id,notes:Z.notes}).eq("id",Z.id);if(re)throw re}else{const{error:re}=await ee.from("touchpoint_plan_items").insert([{plan_id:Z.plan_id,month_number:Z.month_number,action_type_id:Z.action_type_id,default_script_id:Z.default_script_id,notes:Z.notes}]);if(re)throw re}},onSuccess:()=>{o.invalidateQueries({queryKey:["plan-items",y]}),i({title:"Item saved"})}}),F=cr({mutationFn:async Z=>{const{error:re}=await ee.from("touchpoint_plan_items").delete().eq("id",Z);if(re)throw re},onSuccess:()=>{o.invalidateQueries({queryKey:["plan-items",y]})}}),q=cr({mutationFn:async Z=>{const{data:re,error:he}=await ee.from("action_scripts").insert([{...Z,active:!0}]).select().single();if(he)throw he;return re},onSuccess:async Z=>{o.invalidateQueries({queryKey:["admin-action-scripts"]}),C&&await $.mutateAsync({id:C.itemId,plan_id:y,month_number:C.month,action_type_id:C.actionTypeId,default_script_id:Z.id}),k(!1),S(null),i({title:"Script created and assigned"})},onError:Z=>{i({title:"Error",description:Z.message,variant:"destructive"})}}),W=(Z,re,he)=>{S({month:Z,actionTypeId:re,itemId:he}),k(!0)},K=Z=>n.find(re=>re.id===Z);return r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Yt,{children:"Touchpoint Plans"}),r.jsx(An,{children:"Create annual touchpoint plans that agents can apply to their contacts"})]}),r.jsxs(te,{onClick:()=>{a(null),m(!0)},children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Add Plan"]})]}),r.jsx(Je,{children:s?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(sn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:t.map(Z=>r.jsxs(Ye,{className:`cursor-pointer transition-colors ${y===Z.id?"border-primary":""}`,onClick:()=>v(Z.id),children:[r.jsx(Ht,{className:"pb-2",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Yt,{className:"text-base",children:Z.name}),r.jsx(te,{variant:"ghost",size:"icon",onClick:re=>{re.stopPropagation(),a(Z),m(!0)},children:r.jsx(ma,{className:"h-4 w-4"})})]})}),r.jsxs(Je,{children:[r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:Z.description}),r.jsx(Rt,{variant:Z.active?"default":"secondary",className:"mt-2",children:Z.active?"Active":"Inactive"})]})]},Z.id))})})]}),y&&r.jsxs(Ye,{children:[r.jsxs(Ht,{children:[r.jsx(Yt,{children:"Plan Schedule"}),r.jsx(An,{children:"Configure the monthly touchpoint schedule. Select an action type for each month, then assign or create a script."})]}),r.jsx(Je,{children:r.jsx("div",{className:"grid gap-3",children:Array.from({length:12},(Z,re)=>re+1).map(Z=>{const re=A==null?void 0:A.find(Ne=>Ne.month_number===Z),he=re!=null&&re.default_script_id?K(re.default_script_id):null,ue=n.filter(Ne=>Ne.action_type_id===(re==null?void 0:re.action_type_id)&&Ne.active);return r.jsxs("div",{className:"p-4 border rounded-lg space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs("div",{className:"w-20 font-medium text-sm",children:["Month ",Z]}),r.jsxs(_n,{value:(re==null?void 0:re.action_type_id)||"none",onValueChange:Ne=>{Ne==="none"&&re?F.mutate(re.id):Ne!=="none"&&$.mutate({id:re==null?void 0:re.id,plan_id:y,month_number:Z,action_type_id:Ne,default_script_id:null})},children:[r.jsx(xn,{className:"w-40",children:r.jsx(bn,{placeholder:"No action"})}),r.jsxs(vn,{children:[r.jsx(er,{value:"none",children:"No action"}),e.filter(Ne=>Ne.active).map(Ne=>r.jsx(er,{value:Ne.id,children:r.jsxs("span",{className:"flex items-center gap-2",children:[Ne.color&&r.jsx("span",{className:"w-3 h-3 rounded-full",style:{backgroundColor:Ne.color}}),Ne.name]})},Ne.id))]})]}),re&&r.jsxs(r.Fragment,{children:[r.jsxs(_n,{value:re.default_script_id||"none",onValueChange:Ne=>{I(null),$.mutate({id:re.id,default_script_id:Ne==="none"?null:Ne})},children:[r.jsx(xn,{className:"w-56",children:r.jsx(bn,{placeholder:"Select script"})}),r.jsxs(vn,{children:[r.jsx(er,{value:"none",children:"No default script"}),ue.map(Ne=>r.jsxs(er,{value:Ne.id,children:[Ne.title," ",Ne.tone&&`(${Ne.tone})`]},Ne.id))]})]}),r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>W(Z,re.action_type_id,re.id),children:[r.jsx(Sn,{className:"h-3 w-3 mr-1"}),"New Script"]}),he&&r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>I((T==null?void 0:T.id)===he.id?null:he),children:(T==null?void 0:T.id)===he.id?"Hide":"Preview"})]})]}),T&&(re==null?void 0:re.default_script_id)===T.id&&r.jsxs("div",{className:"ml-24 p-3 bg-muted rounded-lg text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(Rt,{variant:"outline",children:T.title}),T.tone&&r.jsx(Rt,{variant:"secondary",children:T.tone})]}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:T.script_body})]})]},Z)})})})]}),r.jsx($r,{open:f,onOpenChange:m,children:r.jsxs(zr,{children:[r.jsx(Zr,{children:r.jsxs(Kr,{children:[c?"Edit":"Add"," Touchpoint Plan"]})}),r.jsxs("form",{onSubmit:Z=>{Z.preventDefault();const re=new FormData(Z.currentTarget);D.mutate({id:c==null?void 0:c.id,name:re.get("name"),description:re.get("description"),active:!0})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"name",children:"Name"}),r.jsx(yt,{id:"name",name:"name",defaultValue:c==null?void 0:c.name,required:!0})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",name:"description",defaultValue:(c==null?void 0:c.description)||"",rows:3})]})]}),r.jsxs(ni,{className:"mt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>m(!1),children:"Cancel"}),r.jsxs(te,{type:"submit",disabled:D.isPending,children:[D.isPending&&r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})}),r.jsx($r,{open:w,onOpenChange:k,children:r.jsxs(zr,{className:"max-w-2xl",children:[r.jsxs(Zr,{children:[r.jsx(Kr,{children:"Create New Script"}),r.jsxs(ls,{children:["Create a script for Month ",C==null?void 0:C.month,". Use ","{{FirstName}}",", ","{{LastName}}",", and ","{{AgentName}}"," as placeholders."]})]}),r.jsxs("form",{onSubmit:Z=>{Z.preventDefault();const re=new FormData(Z.currentTarget);q.mutate({title:re.get("title"),action_type_id:C.actionTypeId,tone:re.get("tone"),script_body:re.get("script_body")})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"script_title",children:"Title"}),r.jsx(yt,{id:"script_title",name:"title",placeholder:"e.g., Warm Check-In",required:!0})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"script_tone",children:"Tone"}),r.jsx(yt,{id:"script_tone",name:"tone",placeholder:"e.g., Friendly, Professional"})]})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"script_body",children:"Script Body"}),r.jsx(ps,{id:"script_body",name:"script_body",rows:6,required:!0,placeholder:"Hey {{FirstName}}, it's {{AgentName}}. I was thinking about you and wanted to check in..."})]})]}),r.jsxs(ni,{className:"mt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>k(!1),children:"Cancel"}),r.jsxs(te,{type:"submit",disabled:q.isPending,children:[q.isPending&&r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),"Create & Assign"]})]})]})]})})]})}function Obt({flags:t}){const{toast:e}=la(),n=Xr(),s=async(i,o)=>{const{error:c}=await ee.from("feature_flags").update({...o,updated_at:new Date().toISOString()}).eq("id",i.id);c?e({title:"Error",description:c.message,variant:"destructive"}):(n.invalidateQueries({queryKey:["admin-feature-flags"]}),e({title:"Flag updated"}))};return r.jsxs(Ye,{children:[r.jsxs(Ht,{children:[r.jsx(Yt,{children:"Feature Flags"}),r.jsx(An,{children:"Control which features are enabled for members"})]}),r.jsx(Je,{children:r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"Flag"}),r.jsx(At,{children:"Status"}),r.jsx(At,{children:"Notes"}),r.jsx(At,{children:"Last Updated"})]})}),r.jsx(qs,{children:t.map(i=>r.jsxs(Er,{children:[r.jsx(_t,{className:"font-mono text-sm",children:i.key}),r.jsx(_t,{children:r.jsx(Zs,{checked:i.enabled,onCheckedChange:o=>s(i,{enabled:o})})}),r.jsx(_t,{children:r.jsx(yt,{defaultValue:i.notes||"",placeholder:"Add notes...",className:"max-w-xs",onBlur:o=>{o.target.value!==i.notes&&s(i,{notes:o.target.value})}})}),r.jsx(_t,{className:"text-muted-foreground text-sm",children:new Date(i.updated_at).toLocaleDateString()})]},i.id))})]})})]})}function Dbt({items:t,isLoading:e}){const{toast:n}=la(),s=Xr(),[i,o]=P.useState(null),[c,a]=P.useState(!1),f=cr({mutationFn:async v=>{if(v.id){const{error:w}=await ee.from("popby_items").update({name:v.name,description:v.description}).eq("id",v.id);if(w)throw w}else{const{error:w}=await ee.from("popby_items").insert([{name:v.name,description:v.description,owner_user_id:null}]);if(w)throw w}},onSuccess:()=>{s.invalidateQueries({queryKey:["admin-popby-items"]}),s.invalidateQueries({queryKey:["popby-items"]}),a(!1),o(null),n({title:"Saved successfully"})},onError:v=>{n({title:"Error",description:v.message,variant:"destructive"})}}),m=async v=>{await ee.from("popby_items").update({is_active:!v.is_active}).eq("id",v.id),s.invalidateQueries({queryKey:["admin-popby-items"]}),s.invalidateQueries({queryKey:["popby-items"]})},y=async v=>{await ee.from("popby_items").delete().eq("id",v),s.invalidateQueries({queryKey:["admin-popby-items"]}),s.invalidateQueries({queryKey:["popby-items"]}),n({title:"Deleted successfully"})};return r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Yt,{children:"Popby Ideas"}),r.jsx(An,{children:"Manage global popby ideas that all agents can see"})]}),r.jsxs(te,{onClick:()=>{o(null),a(!0)},children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Add Popby Idea"]})]}),r.jsx(Je,{children:e?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(sn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):t.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Qa,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No popby ideas yet. Add your first one!"})]}):r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"Name"}),r.jsx(At,{children:"Description"}),r.jsx(At,{children:"Status"}),r.jsx(At,{className:"w-24",children:"Actions"})]})}),r.jsx(qs,{children:t.map(v=>r.jsxs(Er,{children:[r.jsx(_t,{className:"font-medium",children:v.name}),r.jsx(_t,{className:"text-muted-foreground",children:v.description}),r.jsx(_t,{children:r.jsx(Zs,{checked:v.is_active,onCheckedChange:()=>m(v)})}),r.jsx(_t,{children:r.jsxs("div",{className:"flex gap-1",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>{o(v),a(!0)},children:r.jsx(ma,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>y(v.id),children:r.jsx(Xn,{className:"h-4 w-4 text-destructive"})})]})})]},v.id))})]})}),r.jsx($r,{open:c,onOpenChange:a,children:r.jsxs(zr,{children:[r.jsx(Zr,{children:r.jsxs(Kr,{children:[i?"Edit":"Add"," Popby Idea"]})}),r.jsxs("form",{onSubmit:v=>{v.preventDefault();const w=new FormData(v.currentTarget);f.mutate({id:i==null?void 0:i.id,name:w.get("name"),description:w.get("description")})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"name",children:"Name"}),r.jsx(yt,{id:"name",name:"name",defaultValue:i==null?void 0:i.name,required:!0,placeholder:"e.g., Homemade Cookies"})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",name:"description",defaultValue:(i==null?void 0:i.description)||"",placeholder:"Brief description of the popby idea..."})]})]}),r.jsxs(ni,{className:"mt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsxs(te,{type:"submit",disabled:f.isPending,children:[f.isPending&&r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function Rbt(){var k;const{toast:t}=la(),e=Xr(),[n,s]=P.useState(null),[i,o]=P.useState(!1),{data:c,isLoading:a}=rr({queryKey:["admin-video-script-categories"],queryFn:async()=>{const{data:C,error:S}=await ee.from("video_script_categories").select("*").order("sort_order");if(S)throw S;return C}}),{data:f,isLoading:m}=rr({queryKey:["admin-video-scripts"],queryFn:async()=>{const{data:C,error:S}=await ee.from("video_scripts").select("*, category:video_script_categories(*)").order("title");if(S)throw S;return C}}),y=cr({mutationFn:async C=>{var S,T;if(C.id){const{error:I}=await ee.from("video_scripts").update({title:C.title,script_text:C.script_text,category_id:C.category_id,tags:((S=C.tags)==null?void 0:S.split(",").map(A=>A.trim()).filter(Boolean))||[]}).eq("id",C.id);if(I)throw I}else{const{error:I}=await ee.from("video_scripts").insert([{title:C.title,script_text:C.script_text,category_id:C.category_id||null,tags:((T=C.tags)==null?void 0:T.split(",").map(A=>A.trim()).filter(Boolean))||[]}]);if(I)throw I}},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-video-scripts"]}),o(!1),s(null),t({title:"Video script saved!"})},onError:C=>t({title:"Error",description:C.message,variant:"destructive"})}),v=async C=>{await ee.from("video_scripts").update({is_active:!C.is_active}).eq("id",C.id),e.invalidateQueries({queryKey:["admin-video-scripts"]})},w=async C=>{confirm("Delete this video script?")&&(await ee.from("video_scripts").delete().eq("id",C),e.invalidateQueries({queryKey:["admin-video-scripts"]}),t({title:"Script deleted"}))};return r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Yt,{children:"Video Scripts"}),r.jsx(An,{children:"Manage teleprompter scripts for Quick Video Touch"})]}),r.jsxs(te,{onClick:()=>{s(null),o(!0)},children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Add Script"]})]}),r.jsx(Je,{children:m?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(sn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"Title"}),r.jsx(At,{children:"Category"}),r.jsx(At,{children:"Status"}),r.jsx(At,{className:"w-24",children:"Actions"})]})}),r.jsx(qs,{children:f==null?void 0:f.map(C=>{var S;return r.jsxs(Er,{children:[r.jsx(_t,{className:"font-medium",children:C.title}),r.jsx(_t,{className:"text-muted-foreground",children:((S=C.category)==null?void 0:S.name)||"Uncategorized"}),r.jsx(_t,{children:r.jsx(Zs,{checked:C.is_active,onCheckedChange:()=>v(C)})}),r.jsxs(_t,{className:"flex gap-1",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>{s(C),o(!0)},children:r.jsx(ma,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>w(C.id),children:r.jsx(Xn,{className:"h-4 w-4"})})]})]},C.id)})})]})}),r.jsx($r,{open:i,onOpenChange:o,children:r.jsxs(zr,{className:"max-w-2xl",children:[r.jsx(Zr,{children:r.jsxs(Kr,{children:[n?"Edit":"Add"," Video Script"]})}),r.jsxs("form",{onSubmit:C=>{C.preventDefault();const S=new FormData(C.currentTarget);y.mutate({id:n==null?void 0:n.id,title:S.get("title"),script_text:S.get("script_text"),category_id:S.get("category_id")||null,tags:S.get("tags")})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"title",children:"Title"}),r.jsx(yt,{id:"title",name:"title",defaultValue:n==null?void 0:n.title,required:!0})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"category_id",children:"Category"}),r.jsxs(_n,{name:"category_id",defaultValue:(n==null?void 0:n.category_id)||"",children:[r.jsx(xn,{children:r.jsx(bn,{placeholder:"Select category"})}),r.jsx(vn,{children:c==null?void 0:c.map(C=>r.jsx(er,{value:C.id,children:C.name},C.id))})]})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"script_text",children:"Script Text"}),r.jsx(ps,{id:"script_text",name:"script_text",defaultValue:n==null?void 0:n.script_text,rows:6,required:!0,placeholder:"Enter the teleprompter script..."})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"tags",children:"Tags (comma-separated)"}),r.jsx(yt,{id:"tags",name:"tags",defaultValue:((k=n==null?void 0:n.tags)==null?void 0:k.join(", "))||"",placeholder:"birthday, follow-up, thank-you"})]})]}),r.jsxs(ni,{className:"mt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>o(!1),children:"Cancel"}),r.jsxs(te,{type:"submit",disabled:y.isPending,children:[y.isPending&&r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function Fbt(){const{toast:t}=la(),[e,n]=P.useState(""),[s,i]=P.useState(!0),[o,c]=P.useState(!1);P.useEffect(()=>{(async()=>{i(!0);try{const{data:m}=await ee.from("settings").select("value").eq("key","mapbox_public_token").maybeSingle();m!=null&&m.value&&n(m.value)}catch(m){console.error("Error fetching settings:",m)}i(!1)})()},[]);const a=async()=>{c(!0);try{await ee.from("settings").upsert({key:"mapbox_public_token",value:e.trim()}),t({title:"Mapbox token saved!"})}catch{t({title:"Error saving token",variant:"destructive"})}c(!1)};return s?r.jsx(Ye,{children:r.jsx(Je,{className:"flex justify-center py-8",children:r.jsx(sn,{className:"h-8 w-8 animate-spin text-muted-foreground"})})}):r.jsx("div",{className:"space-y-6",children:r.jsxs(Ye,{children:[r.jsxs(Ht,{children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(yl,{className:"h-5 w-5"}),"Popby Map Settings"]}),r.jsx(An,{children:"Configure the map feature for popbys"})]}),r.jsxs(Je,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"mapbox-token",children:"Mapbox Public Token"}),r.jsx(yt,{id:"mapbox-token",placeholder:"pk.eyJ1I...",value:e,onChange:f=>n(f.target.value)}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your token at"," ",r.jsx("a",{href:"https://mapbox.com/",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"mapbox.com"}),". This token will be used by all agents for the popby map feature."]})]}),r.jsxs(te,{onClick:a,disabled:o,children:[o&&r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),"Save Token"]}),e&&r.jsx(Rt,{variant:"secondary",className:"ml-2",children:"Token configured"})]})]})})}const zbt=()=>{const[t,e]=P.useState(""),[n,s]=P.useState("grid"),i=es(),{data:o=[],isLoading:c}=rr({queryKey:["additional-services"],queryFn:async()=>{const{data:f,error:m}=await ee.from("additional_services").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(m)throw m;return f}}),a=o.filter(f=>{var y;return f.name.toLowerCase().includes(t.toLowerCase())||((y=f.description)==null?void 0:y.toLowerCase().includes(t.toLowerCase()))});return r.jsx(Or,{title:"Additional Services",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Additional Services"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Explore our additional services and offerings"})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(Ti,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(yt,{placeholder:"Search services...",value:t,onChange:f=>e(f.target.value),className:"pl-9"})]}),r.jsxs("div",{className:"flex gap-2",children:[t&&r.jsx(te,{variant:"outline",size:"sm",onClick:()=>e(""),children:"Clear"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(te,{variant:n==="grid"?"secondary":"outline",size:"icon",onClick:()=>s("grid"),className:"rounded-full",children:r.jsx(lg,{className:"h-4 w-4"})}),r.jsx(te,{variant:n==="list"?"secondary":"outline",size:"icon",onClick:()=>s("list"),className:"rounded-full",children:r.jsx(rm,{className:"h-4 w-4"})})]})]})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[a.length," service",a.length!==1?"s":""," found"]}),c&&r.jsx("div",{className:n==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:[...Array(4)].map((f,m)=>r.jsx(Ye,{children:r.jsxs(Je,{className:"p-4",children:[r.jsx(Gr,{className:"aspect-[3/2] w-full rounded-lg mb-4"}),r.jsx(Gr,{className:"h-5 w-3/4 mb-2"}),r.jsx(Gr,{className:"h-4 w-full mb-4"})]})},m))}),!c&&a.length===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx("div",{className:"text-muted-foreground mb-4",children:t?"No services match your search":"No additional services available yet"}),t&&r.jsx(te,{variant:"outline",onClick:()=>e(""),children:"Clear Search"})]}),!c&&a.length>0&&r.jsx("div",{className:n==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:a.map(f=>r.jsxs(Ye,{className:`group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer ${n==="list"?"flex flex-row":""}`,onClick:()=>i(`/additional-services/${f.id}`),children:[r.jsx("div",{className:`relative overflow-hidden bg-muted ${n==="list"?"w-48 shrink-0":"aspect-[3/2]"}`,children:f.preview_image_url?r.jsx("img",{src:f.preview_image_url,alt:f.name,className:"w-full h-full object-contain group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:r.jsx(Mi,{className:"h-8 w-8"})})}),r.jsxs(Je,{className:`p-4 flex flex-col ${n==="list"?"flex-1":""}`,children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:f.name}),f.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 flex-1",children:jne(f.description)})]})]},f.id))})]})})},Bbt=()=>{const{serviceId:t}=dd(),e=es(),{data:n,isLoading:s}=rr({queryKey:["additional-service",t],queryFn:async()=>{const{data:i,error:o}=await ee.from("additional_services").select("*").eq("id",t).eq("is_published",!0).single();if(o)throw o;return i},enabled:!!t});return s?r.jsx(Or,{title:"Loading...",children:r.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[r.jsx(Gr,{className:"h-8 w-48"}),r.jsx(Gr,{className:"h-64 w-full rounded-lg"}),r.jsx(Gr,{className:"h-24 w-full"})]})}):n?r.jsx(Or,{title:n.name,children:r.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[r.jsxs(te,{variant:"ghost",onClick:()=>e("/additional-services"),className:"gap-2",children:[r.jsx(Va,{className:"h-4 w-4"}),"Back to Services"]}),r.jsx(Ye,{className:"overflow-hidden",children:r.jsx("div",{className:"relative bg-muted",children:n.preview_image_url?r.jsx("img",{src:n.preview_image_url,alt:n.name,className:"w-full h-auto max-h-[500px] object-contain mx-auto"}):r.jsx("div",{className:"w-full h-64 flex items-center justify-center text-muted-foreground",children:r.jsx(Mi,{className:"h-16 w-16"})})})}),r.jsx(Ye,{children:r.jsxs(Je,{className:"p-6 space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground mb-2",children:n.name}),r.jsxs("div",{className:"flex items-center text-sm text-muted-foreground",children:[r.jsx(li,{className:"h-4 w-4 mr-1"}),"Published ",un(new Date(n.publish_date),"MMMM d, yyyy")]})]}),n.description&&r.jsx("div",{className:"prose prose-sm max-w-none text-muted-foreground [&_a]:text-primary [&_a]:underline",dangerouslySetInnerHTML:{__html:n.description}}),r.jsx("div",{className:"pt-4 border-t",children:r.jsxs(te,{size:"lg",className:"gap-2",onClick:()=>window.open(n.signup_link_url,"_blank"),children:[r.jsx(Fs,{className:"h-5 w-5"}),"Sign Up Now"]})})]})})]})}):r.jsx(Or,{title:"Not Found",children:r.jsxs("div",{className:"max-w-4xl mx-auto text-center py-12",children:[r.jsx("h2",{className:"text-2xl font-bold text-foreground mb-4",children:"Service Not Found"}),r.jsx("p",{className:"text-muted-foreground mb-6",children:"The service you're looking for doesn't exist or has been removed."}),r.jsxs(te,{onClick:()=>e("/additional-services"),children:[r.jsx(Va,{className:"h-4 w-4 mr-2"}),"Back to Services"]})]})})},_5=[{id:"content-calendar",name:"Social Media Content Calendar Generator",iframe:``},{id:"property-promotion",name:"Property Promotion AI Tool",iframe:''},{id:"bio-boost",name:"Realtor Bio-Boost",iframe:''},{id:"market-report",name:"Market Report & Video Script Generator",iframe:''},{id:"property-description",name:"Property Description Writer",iframe:''},{id:"newsletter-generator",name:"Local Real Estate Newsletter Generator",iframe:''}];function $bt(){const[t,e]=P.useState(_5[0].id),n=_5.find(s=>s.id===t)||_5[0];return r.jsx(Or,{title:"AI Toolkit",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(PS,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"AI Toolkit"}),r.jsx("p",{className:"text-muted-foreground",children:"Powerful AI tools to boost your real estate business"})]})]}),r.jsx("div",{className:"md:hidden",children:r.jsxs(_n,{value:t,onValueChange:e,children:[r.jsx(xn,{className:"w-full",children:r.jsx(bn,{placeholder:"Select a tool"})}),r.jsx(vn,{children:_5.map(s=>r.jsx(er,{value:s.id,children:s.name},s.id))})]})}),r.jsx("div",{className:"hidden md:block",children:r.jsx(La,{value:t,onValueChange:e,className:"w-full",children:r.jsx(Ma,{className:"w-full flex-wrap h-auto gap-1 bg-muted p-1",children:_5.map(s=>r.jsx(yn,{value:s.id,className:"flex-1 min-w-[150px] text-xs lg:text-sm whitespace-normal h-auto py-2",children:s.name},s.id))})})}),r.jsx("div",{className:"flex justify-center",children:r.jsx("div",{className:"w-full max-w-[700px]",dangerouslySetInnerHTML:{__html:n.iframe}})})]})})}const GNe="agent-os-onboarding-completed",vL=[{icon:cg,iconColor:"text-white",bgGradient:"from-primary via-primary/80 to-purple-600",title:"Welcome to Agent OS",description:"You've unlocked a powerful new tool designed to help you build stronger relationships and close more deals. Agent OS is currently in beta, and we're excited for you to try it!",highlights:["Manage your most important relationships","Stay in touch with automated reminders","Track your transactions and goals","Maximize referrals from your sphere"]},{icon:e1,iconColor:"text-white",bgGradient:"from-pink-500 via-rose-500 to-red-500",title:"InnerCircle Home",description:"Your daily command center. See today's action items, track your momentum streak, and get a snapshot of your relationship health—all at a glance.",highlights:["Today's touchpoints and special dates","Momentum stats and streak tracking","Relationship health overview","Quick access to all features"]},{icon:hs,iconColor:"text-white",bgGradient:"from-blue-500 via-indigo-500 to-purple-500",title:"Contacts",description:"Import and organize your sphere of influence. Tag contacts by relationship type (Top 25, Past Clients, Referral Partners, etc.) to prioritize your outreach.",highlights:["Import contacts via CSV","Tag by relationship type","Track birthdays and home anniversaries","See relationship health scores"]},{icon:em,iconColor:"text-white",bgGradient:"from-emerald-500 via-teal-500 to-cyan-500",title:"Touchpoint Plans",description:"Assign automated touchpoint schedules to your contact groups. Each plan tells you exactly who to reach out to and when—with pre-written scripts to make it easy.",highlights:["Pre-built 12-month plans","Create your own custom plans","Scripts for calls, texts, and emails","Automatic daily action items"]},{icon:Qa,iconColor:"text-white",bgGradient:"from-orange-500 via-amber-500 to-yellow-500",title:"Popbys",description:"Pop-by visits are one of the most powerful ways to stay top-of-mind. Track your gift drop-offs and see who's due for a visit on the map.",highlights:["Track pop-by gift ideas","Set visit frequency by contact type","Log completed pop-bys","Map view for route planning"]},{icon:xc,iconColor:"text-white",bgGradient:"from-purple-500 via-violet-500 to-indigo-500",title:"Scorecard",description:"Track your transactions, set goals, and see your progress over time. Know exactly where your business stands and where your deals are coming from.",highlights:["Log buyer and seller transactions","Set and track annual goals","See your top lead sources","Export data for your records"]}],Ubt=()=>{const[t,e]=P.useState(!1),[n,s]=P.useState(0),[i,o]=P.useState(!1);P.useEffect(()=>{if(!localStorage.getItem(GNe)){const C=setTimeout(()=>e(!0),500);return()=>clearTimeout(C)}},[]);const c=()=>{n{s(n+1),o(!1)},150)):f()},a=()=>{f()},f=()=>{localStorage.setItem(GNe,"true"),e(!1)},m=vL[n],y=m.icon,v=n===vL.length-1,w=k=>{k||f(),e(k)};return r.jsx($r,{open:t,onOpenChange:w,children:r.jsxs(zr,{className:"sm:max-w-lg overflow-hidden p-0 gap-0",children:[r.jsxs("div",{className:`relative bg-gradient-to-br ${m.bgGradient} p-8 pb-12 transition-all duration-500`,children:[r.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[r.jsx("div",{className:"absolute -top-4 -right-4 w-32 h-32 bg-white/10 rounded-full blur-2xl animate-pulse"}),r.jsx("div",{className:"absolute -bottom-8 -left-8 w-40 h-40 bg-white/10 rounded-full blur-3xl animate-pulse",style:{animationDelay:"1s"}}),r.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-64 h-64 bg-white/5 rounded-full blur-3xl"})]}),r.jsxs("div",{className:`relative mx-auto flex h-20 w-20 items-center justify-center transition-all duration-300 ${i?"scale-75 opacity-0":"scale-100 opacity-100"}`,children:[r.jsx("div",{className:"absolute inset-0 bg-white/20 rounded-2xl blur-xl"}),r.jsx("div",{className:"relative flex h-20 w-20 items-center justify-center rounded-2xl bg-white/20 backdrop-blur-sm border border-white/30 shadow-2xl",children:r.jsx(y,{className:`h-10 w-10 ${m.iconColor} drop-shadow-lg`})})]}),n===0&&r.jsxs("div",{className:"absolute top-4 right-4 px-3 py-1 rounded-full bg-white/20 backdrop-blur-sm border border-white/30 text-white text-xs font-medium flex items-center gap-1.5",children:[r.jsx(Mi,{className:"h-3 w-3"}),"Beta"]})]}),r.jsxs("div",{className:"p-6 pt-4",children:[r.jsxs(Zr,{className:"text-center sm:text-center pb-2",children:[r.jsx(Kr,{className:`text-2xl font-bold transition-all duration-300 ${i?"translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,children:m.title}),r.jsx(ls,{className:`text-base pt-2 transition-all duration-300 delay-75 ${i?"translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,children:m.description})]}),m.highlights&&r.jsx("div",{className:`space-y-2.5 py-4 transition-all duration-300 delay-100 ${i?"translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,children:m.highlights.map((k,C)=>r.jsxs("div",{className:"flex items-center gap-3 group",style:{transitionDelay:`${150+C*50}ms`},children:[r.jsx("div",{className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-gradient-to-br ${m.bgGradient} shadow-sm`,children:r.jsx(Ba,{className:"h-3.5 w-3.5 text-white"})}),r.jsx("span",{className:"text-sm text-muted-foreground group-hover:text-foreground transition-colors",children:k})]},C))}),r.jsx("div",{className:"flex justify-center gap-2 py-4",children:vL.map((k,C)=>r.jsx("button",{onClick:()=>{C!==n&&(o(!0),setTimeout(()=>{s(C),o(!1)},150))},className:`h-2 rounded-full transition-all duration-300 ${C===n?"w-8 bg-gradient-to-r "+m.bgGradient:C{const $e=parseInt(F,10);if(isNaN($e)||$e<1){Wi({title:"Invalid goal",description:"Please enter a number greater than 0",variant:"destructive"});return}K($e),GOe($e),$(!1),Wi({title:"Goal updated",description:`Weekly touch goal set to ${$e}`})},re=()=>{q(W.toString()),$(!0)};P.useEffect(()=>{(async()=>{if(!(e!=null&&e.id))return;const{data:Pe}=await ee.from("profiles").select("name").eq("id",e.id).single();Pe!=null&&Pe.name&&A(Pe.name.split(" ")[0])})()},[e==null?void 0:e.id]),P.useEffect(()=>{a.mutate()},[]);const he=Kh(new Date),ue=Rl(he,7),Ne=$e=>{if(!$e)return null;const Pe=new Date($e);return new Date(he.getFullYear(),Pe.getMonth(),Pe.getDate())},se=(i==null?void 0:i.filter($e=>{const Pe=Ne($e.birthday),Ae=Ne($e.home_anniversary);return Pe&&Vl(Pe,he)||Ae&&Vl(Ae,he)}))||[],xe=(i==null?void 0:i.filter($e=>{if(!$e.birthday&&!$e.home_anniversary)return!1;const Pe=Ae=>{if(!Ae)return!1;const nt=Ne(Ae);return nt?cte(nt,he)&&ase(nt,ue):!1};return Pe($e.birthday)||Pe($e.home_anniversary)}).slice(0,5))||[],ie=se.map($e=>{var Te,Xe,ge;const Pe=Ne($e.birthday),Ae=Pe&&Vl(Pe,he),nt=(o==null?void 0:o.find(mt=>mt.name==="Call"))||(o==null?void 0:o[0]);return{contact:$e,actionType:nt||{id:"special-date",name:Ae?"Birthday Call":"Anniversary Call",icon:Ae?"Cake":"Home",color:Ae?"#EC4899":"#8B5CF6",description:Ae?"Wish them happy birthday!":"Celebrate their home anniversary!",active:!0,sort_order:0,created_at:"",updated_at:""},planName:Ae?"🎂 Birthday Today!":"🏠 Home Anniversary!",relationshipTypeName:((ge=(Xe=(Te=$e.tags)==null?void 0:Te[0])==null?void 0:Xe.relationship_type)==null?void 0:ge.name)||"",monthNumber:0,isSpecialDate:!0,specialDateType:Ae?"birthday":"anniversary"}}),fe=c!==void 0?c||[]:(i==null?void 0:i.slice(0,5).map(($e,Pe)=>{var nt,Te,Xe;const Ae=o==null?void 0:o[Pe%((o==null?void 0:o.length)||1)];return Ae?{contact:$e,actionType:Ae,planName:"Quick Touch",relationshipTypeName:((Xe=(Te=(nt=$e.tags)==null?void 0:nt[0])==null?void 0:Te.relationship_type)==null?void 0:Xe.name)||"",monthNumber:0}:null}).filter(Boolean))||[],ve=[...ie,...fe],Ie=async($e,Pe,Ae)=>{await y.mutateAsync({contactId:$e,actionTypeId:Pe,scriptUsedId:Ae}),T(!1),C(null)},Se=$e=>{$e.script?(C($e),T(!0)):Ie($e.contact.id,$e.actionType.id)},oe=$e=>KNe[$e||"Phone"]||Wa,ae=$e=>KNe[$e||"Users"]||hs,je=($e,Pe)=>$e.replace(/\{\{FirstName\}\}/g,Pe.first_name).replace(/\{\{LastName\}\}/g,Pe.last_name||"").replace(/\{\{AgentName\}\}/g,I||"there"),Me=($e,Pe)=>({Call:`Thinking of you, ${Pe}!`,Text:`Quick hello, ${Pe}`,Email:`Checking in, ${Pe}`,"Handwritten Note":`A note for ${Pe}`,Video:`Video message for ${Pe}`,Gift:`Something special for you, ${Pe}`})[$e]||`Hello ${Pe}!`,Ue=($e,Pe,Ae)=>{const nt=`sms:${$e}`;if(Pe&&Ae){const Te=je(Pe,Ae);return`${nt}?body=${encodeURIComponent(Te)}`}return nt},Re=($e,Pe,Ae,nt,Te)=>{const Xe=`mailto:${$e}`,ge=[];if(Te){const mt=Ae||Me(nt||"Email",Te.first_name);if(ge.push(`subject=${encodeURIComponent(mt)}`),Pe){const rt=je(Pe,Te);ge.push(`body=${encodeURIComponent(rt)}`)}}return ge.length>0?`${Xe}?${ge.join("&")}`:Xe};return r.jsxs(Or,{title:"InnerCircle",description:"Your relationship-first contact system",children:[r.jsxs("div",{className:"space-y-6 overflow-x-hidden",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h1",{className:"text-2xl font-bold",children:"InnerCircle"}),r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0.5 rounded border border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10",children:"Beta"})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Your InnerCircle"}),r.jsx("div",{className:"flex flex-wrap gap-3",children:n==null?void 0:n.filter($e=>$e.active).map($e=>{const Pe=ae($e.icon),Ae=(s==null?void 0:s[$e.id])||0,nt=v===$e.id,Te=qbt[$e.name]||"bg-secondary text-secondary-foreground";return r.jsxs("button",{onClick:()=>{nt?(w(null),t("/innercircle/contacts")):(w($e.id),t(`/innercircle/contacts?type=${$e.id}`))},className:` flex items-center gap-2 px-4 py-3 rounded-lg border transition-all ${nt?Te:"bg-card hover:bg-accent"} `,children:[r.jsx(Pe,{className:"h-5 w-5"}),r.jsxs("div",{className:"text-left",children:[r.jsx("div",{className:"font-medium",children:$e.name}),r.jsxs("div",{className:`text-sm ${nt?"opacity-90":"text-muted-foreground"}`,children:[Ae," Contacts"]})]})]},$e.id)})})]}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[r.jsxs(te,{onClick:()=>t("/innercircle/video/record"),className:"w-full bg-gradient-to-r from-primary to-primary/80",children:[r.jsx(wd,{className:"h-4 w-4 mr-1"}),"Quick Video"]}),r.jsxs(te,{onClick:()=>t("/innercircle/contacts"),className:"w-full",variant:"outline",children:["View Contacts",r.jsx(Ha,{className:"h-4 w-4 ml-1"})]}),r.jsx(te,{variant:"outline",onClick:()=>t("/innercircle/video-library"),className:"w-full",children:"Video Library"}),r.jsx(te,{variant:"outline",onClick:()=>t("/innercircle/plans"),className:"w-full",children:"Manage Plans"})]}),r.jsxs("section",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx("h2",{className:"text-xl font-semibold",children:"Today in Your InnerCircle"}),c!==void 0&&r.jsxs(Rt,{variant:"outline",className:"gap-1",children:[r.jsx(Mi,{className:"h-3 w-3"}),"Plan-based"]})]}),r.jsx(Ye,{children:r.jsx(Je,{className:"p-4",children:ve.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx("p",{children:"No actions scheduled for today."}),r.jsx("p",{className:"text-sm mt-1",children:"Add contacts and enable touchpoint plans to get started."}),r.jsx(te,{variant:"outline",className:"mt-4",onClick:()=>t("/innercircle/plans"),children:"Manage Plans"})]}):r.jsxs("div",{className:"flex gap-3 overflow-x-auto pb-2",children:[ve.map(($e,Pe)=>{var We,Ce,et,Fe,Ke,Le,ft;const Ae=$e.isSpecialDate,nt=$e.specialDateType,Te=Ae?nt==="birthday"?og:Hi:oe(((We=$e.actionType)==null?void 0:We.icon)||null),Xe=$e.contact.phone,ge=$e.contact.email,mt=Ae?nt==="birthday"?"#EC4899":"#8B5CF6":((Ce=$e.actionType)==null?void 0:Ce.color)||"#3B82F6",rt=Ae?nt==="birthday"?"🎂 Birthday Today!":"🏠 Home Anniversary!":(et=$e.actionType)==null?void 0:et.name;return r.jsxs("div",{className:`flex-shrink-0 w-[260px] border rounded-lg overflow-hidden ${Ae?"ring-2 ring-offset-2":""}`,style:Ae?{"--tw-ring-color":mt}:void 0,children:[r.jsxs("div",{className:"p-3 text-white flex items-center gap-2",style:{backgroundColor:mt},children:[r.jsx(Te,{className:"h-4 w-4"}),r.jsx("span",{className:"font-medium text-sm",children:rt})]}),r.jsxs("div",{className:"p-3 space-y-2",children:[r.jsxs("p",{className:"font-medium text-sm",children:[$e.contact.first_name," ",$e.contact.last_name]}),r.jsxs("div",{className:"flex gap-1.5",children:[Xe&&r.jsxs(r.Fragment,{children:[r.jsxs("a",{href:`tel:${$e.contact.phone}`,className:"flex-1 flex items-center justify-center gap-1 px-2 py-1.5 bg-primary/10 hover:bg-primary/20 text-primary rounded text-xs font-medium transition-colors",title:"Call",children:[r.jsx(Wa,{className:"h-3 w-3"}),"Call"]}),r.jsxs("a",{href:Ue($e.contact.phone,(Fe=$e.script)==null?void 0:Fe.script_body,$e.contact),className:"flex-1 flex items-center justify-center gap-1 px-2 py-1.5 bg-emerald-500/10 hover:bg-emerald-500/20 text-emerald-600 dark:text-emerald-400 rounded text-xs font-medium transition-colors",title:"Text",children:[r.jsx(Wl,{className:"h-3 w-3"}),"Text"]})]}),ge&&r.jsxs("a",{href:Re($e.contact.email,(Ke=$e.script)==null?void 0:Ke.script_body,(Le=$e.script)==null?void 0:Le.email_subject,(ft=$e.actionType)==null?void 0:ft.name,$e.contact),className:"flex-1 flex items-center justify-center gap-1 px-2 py-1.5 bg-sky-500/10 hover:bg-sky-500/20 text-sky-600 dark:text-sky-400 rounded text-xs font-medium transition-colors",title:"Email",children:[r.jsx(di,{className:"h-3 w-3"}),"Email"]})]}),!Xe&&!ge&&r.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No contact info"}),r.jsxs("div",{className:"flex gap-1 flex-wrap",children:[$e.relationshipTypeName&&r.jsx(Rt,{variant:"secondary",className:"text-xs",children:$e.relationshipTypeName}),$e.monthNumber>0&&r.jsxs(Rt,{variant:"outline",className:"text-xs",children:["Month ",$e.monthNumber]})]}),$e.script&&r.jsx(te,{size:"sm",variant:"outline",className:"w-full",onClick:()=>Se($e),children:"View Script"}),r.jsx(te,{size:"sm",className:"w-full",onClick:()=>{var Nt;return Ie($e.contact.id,$e.actionType.id,(Nt=$e.script)==null?void 0:Nt.id)},disabled:y.isPending,children:"Mark Complete"})]})]},$e.contact.id+Pe)}),r.jsx("div",{className:"flex-shrink-0 w-[100px] border rounded-lg flex items-center justify-center",children:r.jsxs(fm,{children:[r.jsx(pm,{asChild:!0,children:r.jsxs(te,{variant:"ghost",className:"h-full w-full",children:[r.jsx(Zm,{className:"h-5 w-5 mr-2"}),"More"]})}),r.jsx(Xf,{children:r.jsx(uo,{onClick:()=>t("/innercircle/contacts"),children:"View all contacts"})})]})})]})})})]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsxs(Ye,{className:"md:col-span-2",children:[r.jsx(Ht,{className:"pb-2",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Yt,{className:"text-lg",children:"Momentum"}),r.jsxs($r,{open:D,onOpenChange:$,children:[r.jsx(Lo,{asChild:!0,children:r.jsx("button",{onClick:re,className:"p-0.5 rounded hover:bg-muted transition-colors","aria-label":"Edit weekly goal",children:r.jsx(id,{className:"h-4 w-4 text-muted-foreground hover:text-primary"})})}),r.jsxs(zr,{className:"sm:max-w-[360px]",children:[r.jsxs(Zr,{children:[r.jsx(Kr,{children:"Set Weekly Goal"}),r.jsx(ls,{children:"How many touches do you want to complete each week?"})]}),r.jsxs("div",{className:"space-y-4 pt-2",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"weekly-goal-ic",children:"Weekly touch goal"}),r.jsx(yt,{id:"weekly-goal-ic",type:"number",min:"1",value:F,onChange:$e=>q($e.target.value),placeholder:"20",onKeyDown:$e=>{$e.key==="Enter"&&Z()}})]}),r.jsx(te,{onClick:Z,className:"w-full",children:"Save Goal"})]})]})]})]})}),r.jsxs(Je,{className:"space-y-4",children:[r.jsx(zc,{value:Math.min(f.actionsThisWeek/W*100,100),className:"h-3 w-full max-w-full"}),r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Df,{className:"h-5 w-5 text-orange-500"}),r.jsxs("span",{className:"font-medium",children:[f.actionsThisWeek," / ",W]}),r.jsx("span",{className:"text-muted-foreground",children:"Actions Completed This Week"})]}),f.streak>0&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"text-lg",children:"🔥"}),r.jsx("span",{className:"font-medium",children:"Great Job!"}),r.jsxs("span",{className:"text-muted-foreground",children:["Keep Your Streak Going! (",f.streak," days)"]})]})]})]}),r.jsxs(Ye,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Yt,{className:"text-lg",children:"Upcoming Reminders"})}),r.jsxs(Je,{className:"space-y-3",children:[xe.length>0?xe.map($e=>{const Pe=$e.birthday,Ae=$e.home_anniversary;return r.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[Pe?r.jsx("span",{className:"text-lg",children:"🎂"}):r.jsx("span",{className:"text-lg",children:"🏠"}),r.jsxs("div",{children:[r.jsxs("span",{className:"font-medium",children:[$e.first_name,"'s"]}),r.jsxs("span",{className:"text-muted-foreground",children:[" ",Pe?"Birthday":"Home Anniversary"]}),r.jsxs("div",{className:"text-xs text-muted-foreground",children:[Pe&&$e.birthday&&un(new Date($e.birthday),"MMM d"),Ae&&$e.home_anniversary&&un(new Date($e.home_anniversary),"MMM d")]})]})]},$e.id)}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No upcoming reminders"}),m.count>0&&r.jsxs("button",{onClick:()=>t("/innercircle/contacts?filter=not-touched-90"),className:"flex items-start gap-2 text-sm pt-2 border-t w-full text-left hover:bg-accent/50 -mx-4 px-4 py-2 rounded-md transition-colors",children:[r.jsx(Xi,{className:"h-4 w-4 text-orange-500 mt-0.5"}),r.jsxs("div",{children:[r.jsxs("span",{className:"font-medium text-orange-600 dark:text-orange-400",children:[m.count," Contact",m.count!==1?"s":""]}),r.jsx("span",{className:"text-muted-foreground",children:" Not Reached in 90+ Days"})]}),r.jsx(Ha,{className:"h-4 w-4 text-muted-foreground ml-auto mt-0.5"})]})]})]}),r.jsx(cDe,{})]})]}),r.jsx($r,{open:S,onOpenChange:T,children:r.jsxs(zr,{className:"max-w-md",children:[r.jsx(Zr,{children:r.jsx(Kr,{className:"flex items-center gap-2",children:k&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:k.actionType.color||"#3B82F6"}}),k.actionType.name," Script"]})})}),k&&k.script&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["For: ",r.jsxs("span",{className:"font-medium text-foreground",children:[k.contact.first_name," ",k.contact.last_name]})]}),r.jsx("div",{className:"bg-muted p-4 rounded-lg",children:r.jsx("p",{className:"whitespace-pre-wrap",children:je(k.script.script_body,k.contact)})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(te,{variant:"outline",className:"flex-1",onClick:()=>T(!1),children:"Close"}),r.jsx(te,{className:"flex-1",onClick:()=>{var $e;return Ie(k.contact.id,k.actionType.id,($e=k.script)==null?void 0:$e.id)},disabled:y.isPending,children:"Mark Complete"})]})]})]})}),r.jsx(Ubt,{})]})}const Hbt=()=>{const{user:t}=Fr();return rr({queryKey:["contact-snoozes",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await ee.from("contact_snoozes").select("*").gte("snoozed_until",new Date().toISOString());if(n)throw n;return e},enabled:!!t})},Wbt=()=>{const t=Xr(),{user:e}=Fr();return cr({mutationFn:async({contactId:n,days:s})=>{if(!(e!=null&&e.id))throw new Error("Not authenticated");const i=Rl(new Date,s);await ee.from("contact_snoozes").delete().eq("contact_id",n);const{error:o}=await ee.from("contact_snoozes").insert({contact_id:n,owner_user_id:e.id,snoozed_until:i.toISOString()});if(o)throw o},onSuccess:()=>{t.invalidateQueries({queryKey:["contact-snoozes"]}),t.invalidateQueries({queryKey:["popby-logs"]}),Wi({title:"Touch snoozed!",description:"Contact has been snoozed."})},onError:n=>{Wi({title:"Error snoozing contact",description:n.message,variant:"destructive"})}})},Gbt=()=>{const t=Xr();return cr({mutationFn:async e=>{const{error:n}=await ee.from("contact_snoozes").delete().eq("contact_id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["contact-snoozes"]}),Wi({title:"Snooze cancelled"})},onError:e=>{Wi({title:"Error cancelling snooze",description:e.message,variant:"destructive"})}})},Kbt=[{label:"1 week",days:7},{label:"2 weeks",days:14},{label:"1 month",days:30}];function rze({open:t,onOpenChange:e,contactId:n,contactName:s}){const[i,o]=P.useState(null),c=Wbt(),a=async()=>{i&&(await c.mutateAsync({contactId:n,days:i}),o(null),e(!1))},f=m=>un(Rl(new Date,m),"MMM d, yyyy");return r.jsx($r,{open:t,onOpenChange:e,children:r.jsxs(zr,{className:"sm:max-w-md",children:[r.jsxs(Zr,{children:[r.jsxs(Kr,{className:"flex items-center gap-2",children:[r.jsx(Xi,{className:"h-5 w-5"}),"Snooze Touch"]}),r.jsxs(ls,{children:["Postpone the next scheduled touch for ",s,". Select how long to snooze."]})]}),r.jsx("div",{className:"space-y-3 py-4",children:Kbt.map(m=>r.jsxs("button",{type:"button",onClick:()=>o(m.days),className:zt("w-full flex items-center justify-between p-3 rounded-lg border transition-colors",i===m.days?"border-primary bg-primary/5":"border-border hover:border-primary/50 hover:bg-accent/50"),children:[r.jsx("span",{className:"font-medium",children:m.label}),r.jsxs("span",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[r.jsx(li,{className:"h-3.5 w-3.5"}),"Until ",f(m.days)]})]},m.days))}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsx(te,{onClick:a,disabled:!i||c.isPending,children:c.isPending?"Snoozing...":"Snooze Touch"})]})]})})}const nze=()=>{const{user:t}=Fr();return rr({queryKey:["popby-items",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await ee.from("popby_items").select("*").or(`owner_user_id.is.null,owner_user_id.eq.${t==null?void 0:t.id}`).eq("is_active",!0).order("name");if(n)throw n;return e},enabled:!!t})},gI=t=>{const{user:e}=Fr();return rr({queryKey:["popby-logs",e==null?void 0:e.id,t],queryFn:async()=>{let n=ee.from("popby_logs").select("*").order("completed_at",{ascending:!1});if(t){const o=new Date;o.setDate(o.getDate()-t),n=n.gte("completed_at",o.toISOString())}const{data:s,error:i}=await n;if(i)throw i;return s},enabled:!!e})},axe=()=>{const{user:t}=Fr();return rr({queryKey:["relationship-type-popby-defaults",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await ee.from("relationship_type_popby_defaults").select("*");if(n)throw n;return e},enabled:!!t})},sze=()=>{const{user:t}=Fr();return rr({queryKey:["contact-popby-settings",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await ee.from("contact_popby_settings").select("*");if(n)throw n;return e},enabled:!!t})},ize=()=>{const{data:t}=mm(),{data:e}=Ag(),{data:n}=gI(),{data:s}=sze(),{data:i}=axe(),o=new Map;n==null||n.forEach(y=>{const v=o.get(y.contact_id);(!v||new Date(y.completed_at)>new Date(v))&&o.set(y.contact_id,y.completed_at)});const c=new Map;i==null||i.forEach(y=>c.set(y.relationship_type_id,y.frequency_days));const a=new Map;s==null||s.filter(y=>y.is_active).forEach(y=>{a.set(y.contact_id,y.frequency_days)});const f=Kh(new Date);return(t||[]).map(y=>{let v=90;if(a.has(y.id))v=a.get(y.id);else if(y.tags&&y.tags.length>0){const T=y.tags.map(I=>c.get(I.relationship_type_id)).filter(I=>I!==void 0);T.length>0&&(v=Math.min(...T))}const w=o.get(y.id)||null,k=w?G4(f,Kh(new Date(w))):null,C=k===null||k>=v,S=C&&k!==null?k-v:0;return{...y,lastPopby:w,daysSinceLastPopby:k,frequencyDays:v,isDue:C,daysOverdue:S}}).sort((y,v)=>v.daysOverdue-y.daysOverdue)},aze=()=>ize().filter(e=>e.isDue),Zbt=()=>{const t=Xr(),{user:e}=Fr();return cr({mutationFn:async n=>{const{error:s}=await ee.from("popby_items").insert({...n,owner_user_id:e==null?void 0:e.id});if(s)throw s},onSuccess:()=>{t.invalidateQueries({queryKey:["popby-items"]}),Wi({title:"Popby item created!"})},onError:n=>{Wi({title:"Error creating popby item",description:n.message,variant:"destructive"})}})},oze=()=>{const t=Xr(),{user:e}=Fr();return cr({mutationFn:async n=>{const{error:s}=await ee.from("popby_logs").insert({...n,owner_user_id:e==null?void 0:e.id});if(s)throw s},onSuccess:()=>{t.invalidateQueries({queryKey:["popby-logs"]}),Wi({title:"Popby logged!"})},onError:n=>{Wi({title:"Error logging popby",description:n.message,variant:"destructive"})}})},Ybt=()=>{const t=Xr(),{user:e}=Fr();return cr({mutationFn:async n=>{const{error:s}=await ee.from("relationship_type_popby_defaults").upsert({...n,owner_user_id:e==null?void 0:e.id},{onConflict:"relationship_type_id,owner_user_id"});if(s)throw s},onSuccess:()=>{t.invalidateQueries({queryKey:["relationship-type-popby-defaults"]}),Wi({title:"Frequency updated!"})},onError:n=>{Wi({title:"Error updating frequency",description:n.message,variant:"destructive"})}})},Xbt=()=>{const{data:t}=gI(30),e=aze(),n=new Date;n.setDate(n.getDate()-7);const s=(t==null?void 0:t.filter(o=>new Date(o.completed_at)>=n).length)||0,i=(t==null?void 0:t.length)||0;return{thisWeekCount:s,thisMonthCount:i,dueCount:e.length}};function lze(t){const{data:e}=gI(),{data:n}=sze(),{data:s}=axe(),{data:i}=Hbt();return P.useMemo(()=>{const o=i==null?void 0:i.find(T=>T.contact_id===t.id),c=o?new Date(o.snoozed_until):null,a=Kh(new Date);if(c&&!ase(c,a))return{nextTouchDate:c,daysUntil:G4(c,a),status:"snoozed",frequencyDays:90,lastTouchDate:null,snoozedUntil:c};const m=((e==null?void 0:e.filter(T=>T.contact_id===t.id))||[]).sort((T,I)=>new Date(I.completed_at).getTime()-new Date(T.completed_at).getTime())[0],y=m?new Date(m.completed_at):null;let v=90;const w=n==null?void 0:n.find(T=>T.contact_id===t.id&&T.is_active);if(w)v=w.frequency_days;else if(t.tags&&t.tags.length>0){const T=t.tags.map(I=>{const A=s==null?void 0:s.find(D=>D.relationship_type_id===I.relationship_type_id);return A==null?void 0:A.frequency_days}).filter(I=>I!==void 0);T.length>0&&(v=Math.min(...T))}if(!y)return{nextTouchDate:null,daysUntil:null,status:"never-touched",frequencyDays:v,lastTouchDate:null,snoozedUntil:null};const k=Rl(Kh(y),v),C=G4(k,a);let S;return C<0?S="overdue":C<=7?S="due-soon":S="on-track",{nextTouchDate:k,daysUntil:C,status:S,frequencyDays:v,lastTouchDate:y,snoozedUntil:null}},[t,e,n,s,i])}function Xhe({contact:t}){const e=lze(t),s=(()=>{switch(e.status){case"overdue":return{variant:"destructive",icon:Bl,text:`${Math.abs(e.daysUntil)} days overdue`,className:""};case"due-soon":return{variant:"secondary",icon:Xi,text:e.daysUntil===0?"Due today":`Due in ${e.daysUntil} days`,className:"bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-400"};case"on-track":return{variant:"secondary",icon:io,text:`Next touch in ${e.daysUntil} days`,className:"bg-emerald-100 text-emerald-800 dark:bg-emerald-900/30 dark:text-emerald-400"};case"snoozed":return{variant:"secondary",icon:zf,text:`Snoozed until ${un(e.snoozedUntil,"MMM d")}`,className:"bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-300"};case"never-touched":return{variant:"outline",icon:li,text:"Never touched",className:"border-dashed"}}})(),i=s.icon;return r.jsxs(Rt,{variant:s.variant,className:zt("gap-1",s.className),children:[r.jsx(i,{className:"h-3 w-3"}),s.text]})}function Qbt({contact:t,onLogTouch:e,onSnooze:n}){const s=lze(t),i=Gbt(),[o,c]=P.useState(!1),a=()=>{switch(s.status){case"overdue":return"text-destructive";case"due-soon":return"text-amber-600 dark:text-amber-400";case"on-track":return"text-emerald-600 dark:text-emerald-400";case"snoozed":return"text-slate-600 dark:text-slate-400";case"never-touched":return"text-muted-foreground"}},f=()=>{switch(s.status){case"overdue":return r.jsx(Bl,{className:"h-5 w-5 text-destructive"});case"due-soon":return r.jsx(Xi,{className:"h-5 w-5 text-amber-600 dark:text-amber-400"});case"on-track":return r.jsx(io,{className:"h-5 w-5 text-emerald-600 dark:text-emerald-400"});case"snoozed":return r.jsx(zf,{className:"h-5 w-5 text-slate-600 dark:text-slate-400"});case"never-touched":return r.jsx(li,{className:"h-5 w-5 text-muted-foreground"})}},m=()=>{switch(s.status){case"overdue":return`${Math.abs(s.daysUntil)} days overdue`;case"due-soon":return s.daysUntil===0?"Due today!":`Due in ${s.daysUntil} days`;case"on-track":return`On track - ${s.daysUntil} days remaining`;case"snoozed":return`Snoozed for ${s.daysUntil} more days`;case"never-touched":return"No touches logged yet"}},y=async()=>{await i.mutateAsync(t.id)};return r.jsxs(r.Fragment,{children:[r.jsxs(Ye,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsxs(Yt,{className:"text-sm font-medium flex items-center gap-2",children:[r.jsx(li,{className:"h-4 w-4"}),"Next Touch"]})}),r.jsxs(Je,{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[f(),r.jsx("span",{className:zt("font-medium",a()),children:m()})]}),s.status==="snoozed"&&s.snoozedUntil&&r.jsxs("div",{className:"text-sm text-muted-foreground",children:[r.jsx("span",{className:"font-medium",children:"Snoozed until:"})," ",un(s.snoozedUntil,"MMMM d, yyyy")]}),s.status!=="snoozed"&&s.nextTouchDate&&r.jsxs("div",{className:"text-sm text-muted-foreground",children:[r.jsx("span",{className:"font-medium",children:"Scheduled:"})," ",un(s.nextTouchDate,"MMMM d, yyyy")]}),s.lastTouchDate&&r.jsxs("div",{className:"text-sm text-muted-foreground",children:[r.jsx("span",{className:"font-medium",children:"Last touch:"})," ",un(s.lastTouchDate,"MMM d, yyyy")]}),s.status!=="snoozed"&&r.jsxs("div",{className:"text-xs text-muted-foreground border-t pt-2",children:["Touch frequency: Every ",s.frequencyDays," days"]}),s.status==="snoozed"&&r.jsxs("div",{className:"flex gap-2 pt-1",children:[r.jsxs(te,{size:"sm",variant:"outline",className:"flex-1",onClick:y,disabled:i.isPending,children:[r.jsx(Ms,{className:"h-4 w-4 mr-1"}),"Cancel Snooze"]}),e&&r.jsx(te,{size:"sm",className:"flex-1",onClick:e,children:"Log Touch"})]}),s.status!=="snoozed"&&r.jsxs("div",{className:"flex gap-2 pt-1",children:[r.jsxs(te,{size:"sm",variant:"outline",className:"flex-1",onClick:()=>c(!0),children:[r.jsx(zf,{className:"h-4 w-4 mr-1"}),"Snooze"]}),(s.status==="overdue"||s.status==="due-soon"||s.status==="never-touched")&&e&&r.jsx(te,{size:"sm",className:"flex-1",variant:s.status==="overdue"?"default":"outline",onClick:e,children:"Log Touch"})]})]})]}),r.jsx(rze,{open:o,onOpenChange:c,contactId:t.id,contactName:`${t.first_name} ${t.last_name||""}`.trim()})]})}const Nce=768;function yI(){const[t,e]=P.useState(void 0);return P.useEffect(()=>{const n=window.matchMedia(`(max-width: ${Nce-1}px)`),s=()=>{e(window.innerWidthn.removeEventListener("change",s)},[]),!!t}const Jbt={warm:{label:"Warm",emoji:"🟢",bgClass:"bg-emerald-500",textClass:"text-emerald-600 dark:text-emerald-400",borderClass:"border-emerald-500",bgLightClass:"bg-emerald-500/10"},cooling:{label:"Cooling Off",emoji:"🟡",bgClass:"bg-amber-500",textClass:"text-amber-600 dark:text-amber-400",borderClass:"border-amber-500",bgLightClass:"bg-amber-500/10"},"at-risk":{label:"At Risk",emoji:"🔴",bgClass:"bg-red-500",textClass:"text-red-600 dark:text-red-400",borderClass:"border-red-500",bgLightClass:"bg-red-500/10"}},ewt={sm:{dot:"h-2 w-2",text:"text-xs",badge:"px-1.5 py-0.5 gap-1"},md:{dot:"h-2.5 w-2.5",text:"text-sm",badge:"px-2 py-1 gap-1.5"},lg:{dot:"h-3 w-3",text:"text-base",badge:"px-3 py-1.5 gap-2"}};function ZNe({score:t,showScore:e=!1,showTooltip:n=!0,size:s="sm",className:i}){const o=Jbt[t.status],c=ewt[s],a=r.jsxs("div",{className:zt("inline-flex items-center rounded-full font-medium",o.bgLightClass,o.textClass,c.badge,c.text,i),children:[r.jsx("span",{className:zt("rounded-full",o.bgClass,c.dot)}),e?r.jsx("span",{children:t.score}):r.jsx("span",{children:o.label})]});return n?r.jsx(KE,{children:r.jsxs(fg,{children:[r.jsx(pg,{asChild:!0,children:a}),r.jsx(am,{side:"top",className:"w-64 p-3",children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"font-semibold",children:"Relationship Score"}),r.jsxs("span",{className:zt("font-bold",o.textClass),children:[t.score,"/100"]})]}),r.jsx(zc,{value:t.score,className:"h-2"}),r.jsxs("div",{className:"space-y-1.5 text-xs",children:[r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-muted-foreground",children:"Recency"}),r.jsxs("span",{children:[t.breakdown.recency,"/40"]})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-muted-foreground",children:"Touchpoints (12mo)"}),r.jsxs("span",{children:[t.breakdown.touchpoints,"/30"]})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-muted-foreground",children:"Transactions"}),r.jsxs("span",{children:[t.breakdown.transactions,"/20"]})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-muted-foreground",children:"Referrals"}),r.jsxs("span",{children:[t.breakdown.referrals,"/10"]})]})]}),t.daysSinceTouch!==null&&r.jsxs("p",{className:"text-xs text-muted-foreground pt-1 border-t",children:["Last contact: ",t.daysSinceTouch===0?"Today":`${t.daysSinceTouch} days ago`]}),t.daysSinceTouch===null&&r.jsx("p",{className:"text-xs text-muted-foreground pt-1 border-t italic",children:"Never contacted"})]})})]})}):a}const twt=[{key:"first_name",label:"First Name",required:!0},{key:"last_name",label:"Last Name",required:!1},{key:"email",label:"Email",required:!1},{key:"phone",label:"Phone",required:!1},{key:"address",label:"Street Address",required:!1},{key:"city",label:"City",required:!1},{key:"state",label:"State",required:!1},{key:"zip",label:"Zip Code",required:!1},{key:"spouse_name",label:"Spouse Name",required:!1},{key:"company_name",label:"Company",required:!1},{key:"job_title",label:"Job Title",required:!1},{key:"birthday",label:"Birthday",required:!1},{key:"home_anniversary",label:"Home Anniversary",required:!1},{key:"notes",label:"Notes",required:!1}],rwt=({open:t,onOpenChange:e,relationshipTypes:n,onSuccess:s})=>{const{user:i}=Fr(),{toast:o}=la(),c=P.useRef(null),[a,f]=P.useState("upload"),[m,y]=P.useState([]),[v,w]=P.useState([]),[k,C]=P.useState({}),[S,T]=P.useState([]),[I,A]=P.useState([]),[D,$]=P.useState(!1),[F,q]=P.useState(null),W=()=>{f("upload"),y([]),w([]),C({}),T([]),A([]),q(null),c.current&&(c.current.value="")},K=()=>{W(),e(!1)},Z=me=>{const fe=me.split(` `).map(oe=>oe.trim()).filter(oe=>oe);if(fe.length===0)return{headers:[],data:[]};const ve=oe=>{const ae=[];let je="",Me=!1;for(let Ue=0;Ue{var Ie;const fe=(Ie=me.target.files)==null?void 0:Ie[0];if(!fe)return;const ve=new FileReader;ve.onload=Se=>{var Ue;const oe=(Ue=Se.target)==null?void 0:Ue.result,{headers:ae,data:je}=Z(oe);if(ae.length===0){o({title:"No data found",description:"The CSV file appears to be empty.",variant:"destructive"});return}y(ae),w(je);const Me={};ae.forEach(Re=>{const $e=Re.toLowerCase().replace(/[_\s-]/g,"");$e.includes("firstname")||$e==="first"?Me.first_name=Re:$e.includes("lastname")||$e==="last"?Me.last_name=Re:$e.includes("email")?Me.email=Re:$e.includes("phone")||$e.includes("mobile")||$e.includes("cell")?Me.phone=Re:$e.includes("address")||$e.includes("street")?Me.address=Re:$e==="city"?Me.city=Re:$e==="state"||$e==="province"?Me.state=Re:$e==="zip"||$e==="zipcode"||$e==="postalcode"?Me.zip=Re:$e.includes("spouse")||$e.includes("partner")?Me.spouse_name=Re:$e.includes("company")||$e.includes("organization")||$e.includes("business")?Me.company_name=Re:$e.includes("jobtitle")||$e.includes("title")||$e.includes("position")?Me.job_title=Re:$e.includes("birthday")||$e.includes("dob")||$e.includes("birthdate")?Me.birthday=Re:$e.includes("anniversary")||$e.includes("homeanniversary")?Me.home_anniversary=Re:($e.includes("notes")||$e.includes("comment"))&&(Me.notes=Re)}),C(Me),f("mapping")},ve.readAsText(fe)},he=(me,fe)=>{C(ve=>{if(fe==="none"){const{[me]:Ie,...Se}=ve;return Se}return{...ve,[me]:fe}})},ue=me=>{T(fe=>fe.includes(me)?fe.filter(ve=>ve!==me):[...fe,me])},Ne=()=>{const me=v.map(fe=>{const ve=oe=>{const ae=k[oe];if(!ae)return"";const je=m.indexOf(ae);return je>=0?(fe[je]||"").trim():""},Ie=ve("first_name"),Se=Ie.length>0;return{first_name:Ie,last_name:ve("last_name"),email:ve("email"),phone:ve("phone"),address:ve("address"),city:ve("city"),state:ve("state"),zip:ve("zip"),spouse_name:ve("spouse_name"),company_name:ve("company_name"),job_title:ve("job_title"),birthday:ve("birthday"),home_anniversary:ve("home_anniversary"),notes:ve("notes"),isValid:Se,error:Se?void 0:"First name is required"}});A(me),f("preview")},se=async()=>{if(!(i!=null&&i.id))return;const me=I.filter(Se=>Se.isValid);if(me.length===0){o({title:"No valid contacts",description:"There are no valid contacts to import.",variant:"destructive"});return}$(!0);let fe=0,ve=0,Ie=0;try{for(const Se of me)try{let oe=null;if(Se.email){const{data:je}=await ee.from("innercircle_contacts").select("id").eq("owner_user_id",i.id).eq("email",Se.email).maybeSingle();oe=je}if(!oe&&Se.phone){const{data:je}=await ee.from("innercircle_contacts").select("id").eq("owner_user_id",i.id).eq("phone",Se.phone).maybeSingle();oe=je}const ae={owner_user_id:i.id,first_name:Se.first_name,last_name:Se.last_name||null,email:Se.email||null,phone:Se.phone||null,address:Se.address||null,city:Se.city||null,state:Se.state||null,zip:Se.zip||null,spouse_name:Se.spouse_name||null,company_name:Se.company_name||null,job_title:Se.job_title||null,birthday:Se.birthday||null,home_anniversary:Se.home_anniversary||null,notes:Se.notes||null};if(oe)await ee.from("innercircle_contacts").update(ae).eq("id",oe.id),ve++;else{const{data:je}=await ee.from("innercircle_contacts").insert(ae).select("id").single();je&&S.length>0&&await ee.from("innercircle_contact_tags").insert(S.map(Me=>({contact_id:je.id,relationship_type_id:Me}))),fe++}}catch(oe){console.error("Error importing contact:",oe),Ie++}q({created:fe,updated:ve,failed:Ie}),f("result"),(fe>0||ve>0)&&s(),o({title:"Import Complete",description:`${fe} created, ${ve} updated${Ie>0?`, ${Ie} failed`:""}.`})}catch(Se){console.error("Import error:",Se),o({title:"Import Failed",description:Se.message||"Failed to import contacts",variant:"destructive"})}finally{$(!1)}},xe=I.filter(me=>me.isValid).length,ie=I.filter(me=>!me.isValid).length;return r.jsx($r,{open:t,onOpenChange:K,children:r.jsxs(zr,{className:"max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",children:[r.jsxs(Zr,{children:[r.jsxs(Kr,{className:"flex items-center gap-2",children:[r.jsx(H0,{className:"h-5 w-5"}),"Import Contacts from CSV"]}),r.jsx(ls,{children:"Upload a CSV file with your contacts. You can map columns and select relationship types."})]}),a==="upload"&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-8 text-center",children:[r.jsx("input",{type:"file",accept:".csv,.txt",ref:c,onChange:re,className:"hidden"}),r.jsx(Ao,{className:"h-10 w-10 mx-auto text-muted-foreground mb-4"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Click to upload or drag and drop a CSV file"}),r.jsx(te,{onClick:()=>{var me;return(me=c.current)==null?void 0:me.click()},children:"Select CSV File"})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 text-sm",children:[r.jsx("p",{className:"font-medium mb-2",children:"Supported Fields:"}),r.jsx("p",{className:"text-muted-foreground text-xs mb-3",children:"First Name, Last Name, Email, Phone, Street Address, City, State, Zip, Spouse Name, Company, Job Title, Birthday, Home Anniversary, Notes"}),r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>{const me=`First Name,Last Name,Email,Phone,Street Address,City,State,Zip,Spouse Name,Company,Job Title,Birthday,Home Anniversary,Notes John,Doe,john@example.com,555-123-4567,123 Main St,Austin,TX,78701,Jane Doe,ABC Realty,Real Estate Agent,1985-06-15,2020-03-22,Met at open house`,fe=new Blob([me],{type:"text/csv"}),ve=URL.createObjectURL(fe),Ie=document.createElement("a");Ie.href=ve,Ie.download="contact_import_template.csv",Ie.click(),URL.revokeObjectURL(ve)},children:[r.jsx(Mo,{className:"h-4 w-4 mr-2"}),"Download Template"]})]})]}),a==="mapping"&&r.jsxs("div",{className:"flex-1 overflow-auto space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx(Qe,{className:"text-base font-medium",children:"Map CSV Columns to Contact Fields"}),r.jsx("div",{className:"grid gap-3",children:twt.map(me=>r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs(Qe,{className:"w-40 text-sm",children:[me.label,me.required&&r.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),r.jsxs(_n,{value:k[me.key]||"none",onValueChange:fe=>he(me.key,fe),children:[r.jsx(xn,{className:"w-48",children:r.jsx(bn,{placeholder:"Select column..."})}),r.jsxs(vn,{children:[r.jsx(er,{value:"none",children:"-- Not mapped --"}),m.map(fe=>r.jsx(er,{value:fe,children:fe},fe))]})]})]},me.key))})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Qe,{className:"text-base font-medium",children:"Apply Relationship Types (optional)"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:n.map(me=>r.jsx(Rt,{variant:S.includes(me.id)?"default":"outline",className:"cursor-pointer",onClick:()=>ue(me.id),children:me.name},me.id))})]}),r.jsx("div",{className:"bg-muted/50 rounded-lg p-3 text-sm",children:r.jsxs("p",{className:"text-muted-foreground",children:["Preview: ",v.length," row(s) found in CSV"]})})]}),a==="preview"&&r.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(io,{className:"h-4 w-4 text-green-500"}),r.jsxs("span",{children:[xe," valid"]})]}),ie>0&&r.jsxs("div",{className:"flex items-center gap-2 text-destructive",children:[r.jsx(Bl,{className:"h-4 w-4"}),r.jsxs("span",{children:[ie," invalid"]})]})]}),r.jsxs("div",{className:"flex-1 overflow-auto border rounded-lg",children:[r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{className:"bg-muted/30",children:[r.jsx(At,{children:"First Name"}),r.jsx(At,{children:"Last Name"}),r.jsx(At,{children:"Email"}),r.jsx(At,{children:"Phone"}),r.jsx(At,{children:"Status"})]})}),r.jsx(qs,{children:I.slice(0,100).map((me,fe)=>r.jsxs(Er,{children:[r.jsx(_t,{children:me.first_name}),r.jsx(_t,{children:me.last_name}),r.jsx(_t,{children:me.email}),r.jsx(_t,{children:me.phone}),r.jsx(_t,{children:me.isValid?r.jsx(Rt,{variant:"default",className:"bg-green-500/10 text-green-600",children:"Valid"}):r.jsx(Rt,{variant:"destructive",children:me.error||"Invalid"})})]},fe))})]}),I.length>100&&r.jsxs("p",{className:"text-sm text-muted-foreground text-center py-2",children:["Showing first 100 of ",I.length," contacts"]})]})]}),a==="result"&&F&&r.jsxs("div",{className:"space-y-4 py-4 text-center",children:[r.jsx(io,{className:"h-12 w-12 mx-auto text-green-500"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Import Complete"}),r.jsxs("p",{className:"text-muted-foreground",children:[F.created," contact(s) created, ",F.updated," updated"]}),F.failed>0&&r.jsxs("p",{className:"text-destructive",children:[F.failed," failed to import"]})]}),r.jsxs(ni,{children:[a==="upload"&&r.jsx(te,{variant:"outline",onClick:K,children:"Cancel"}),a==="mapping"&&r.jsxs(r.Fragment,{children:[r.jsx(te,{variant:"outline",onClick:W,children:"Back"}),r.jsx(te,{onClick:Ne,disabled:!k.first_name,children:"Continue"})]}),a==="preview"&&r.jsxs(r.Fragment,{children:[r.jsx(te,{variant:"outline",onClick:()=>f("mapping"),children:"Back"}),r.jsx(te,{onClick:se,disabled:D||xe===0,children:D?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"mr-2 h-4 w-4 animate-spin"}),"Importing..."]}):`Import ${xe} Contact${xe!==1?"s":""}`})]}),a==="result"&&r.jsx(te,{onClick:K,children:"Done"})]})]})})};function nwt(){const t=es(),[e]=Ed(),{user:n}=Fr(),s=yI(),i=Xr(),o=e.get("type"),c=e.get("filter")??e.get("status"),a=e.get("new")==="true",{contactsWithScores:f,isLoading:m}=lye(),{data:y}=Ag(),v=$Oe(),w=UOe(),k=qOe(),[C,S]=P.useState(""),[T,I]=P.useState(o||"all"),[A,D]=P.useState(c||"all"),[$,F]=P.useState("name"),[q,W]=P.useState(a),[K,Z]=P.useState(null),[re,he]=P.useState(!1),[ue,Ne]=P.useState(null),[se,xe]=P.useState("");P.useEffect(()=>{if(!(n!=null&&n.id))return;const oe=ee.channel(`innercircle_contacts_inserts_${n.id}`).on("postgres_changes",{event:"INSERT",schema:"public",table:"innercircle_contacts",filter:`owner_user_id=eq.${n.id}`},()=>{i.invalidateQueries({queryKey:["innercircle-contacts"]}),i.invalidateQueries({queryKey:["innercircle-contact-counts"]})}).subscribe();return()=>{ee.removeChannel(oe)}},[i,n==null?void 0:n.id]),P.useEffect(()=>{c&&D(c)},[c]);const[ie,me]=P.useState({first_name:"",last_name:"",email:"",phone:"",address:"",city:"",state:"",zip_code:"",birthday:"",home_anniversary:"",notes:"",tagIds:[]});P.useEffect(()=>{a&&W(!0)},[a]),P.useEffect(()=>{var oe;K&&me({first_name:K.first_name||"",last_name:K.last_name||"",email:K.email||"",phone:K.phone||"",address:K.address||"",city:K.city||"",state:K.state||"",zip_code:K.zip_code||"",birthday:K.birthday||"",home_anniversary:K.home_anniversary||"",notes:K.notes||"",tagIds:((oe=K.tags)==null?void 0:oe.map(ae=>ae.relationship_type_id))||[]})},[K]);const fe=P.useMemo(()=>{if(!f)return[];let oe=f.filter(ae=>{var Ue,Re,$e;const je=C===""||`${ae.first_name} ${ae.last_name}`.toLowerCase().includes(C.toLowerCase())||((Ue=ae.email)==null?void 0:Ue.toLowerCase().includes(C.toLowerCase()))||((Re=ae.phone)==null?void 0:Re.includes(C)),Me=T==="all"||(($e=ae.tags)==null?void 0:$e.some(Pe=>Pe.relationship_type_id===T));return je&&Me});return A==="not-touched-90"?oe=oe.filter(ae=>{const je=ae.relationshipScore.daysSinceTouch;return je===null||je>90}):A==="at-risk"?oe=oe.filter(ae=>ae.relationshipScore.status==="at-risk"):A==="cooling"?oe=oe.filter(ae=>ae.relationshipScore.status==="cooling"):A==="warm"&&(oe=oe.filter(ae=>ae.relationshipScore.status==="warm")),oe=[...oe].sort((ae,je)=>{switch($){case"last-touched":{const Me=ae.relationshipScore.lastTouchDate,Ue=je.relationshipScore.lastTouchDate;return!Me&&!Ue?0:Me?Ue?new Date(Me).getTime()-new Date(Ue).getTime():1:-1}case"next-touch":{const Me=ae.relationshipScore.daysSinceTouch,Ue=je.relationshipScore.daysSinceTouch;return Me===null&&Ue===null?0:Me===null?-1:Ue===null?1:Ue-Me}case"score":return ae.relationshipScore.score-je.relationshipScore.score;case"date-added":{const Me=ae.created_at,Ue=je.created_at;return!Me&&!Ue?0:Me?Ue?new Date(Ue).getTime()-new Date(Me).getTime():-1:1}case"name":default:{const Me=`${ae.first_name||""} ${ae.last_name||""}`.toLowerCase(),Ue=`${je.first_name||""} ${je.last_name||""}`.toLowerCase();return Me.localeCompare(Ue)}}}),oe},[f,C,T,A,$]),ve=()=>{me({first_name:"",last_name:"",email:"",phone:"",address:"",city:"",state:"",zip_code:"",birthday:"",home_anniversary:"",notes:"",tagIds:[]})},Ie=async oe=>{oe.preventDefault(),K?(await w.mutateAsync({id:K.id,...ie}),Z(null)):(await v.mutateAsync(ie),W(!1)),ve()},Se=async oe=>{confirm("Are you sure you want to delete this contact?")&&await k.mutateAsync(oe)};return r.jsx(Or,{title:"Contacts",description:"Manage your InnerCircle contacts",children:r.jsxs("div",{className:"space-y-6 overflow-x-hidden",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Contacts"}),r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0.5 rounded border border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10",children:"Beta"})]}),r.jsx("div",{className:"flex items-center gap-4",children:r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>t("/innercircle"),children:[r.jsx(sd,{className:"h-4 w-4 mr-1"}),"Back"]})}),r.jsx(Ye,{children:r.jsx(Je,{className:"p-4",children:r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Ti,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(yt,{placeholder:"Search by name, email, or phone...",value:C,onChange:oe=>S(oe.target.value),className:"pl-9"})]}),r.jsxs(_n,{value:T,onValueChange:I,children:[r.jsx(xn,{className:"w-[160px]",children:r.jsx(bn,{placeholder:"Filter by type"})}),r.jsxs(vn,{children:[r.jsx(er,{value:"all",children:"All Types"}),y==null?void 0:y.filter(oe=>oe.active).map(oe=>r.jsx(er,{value:oe.id,children:oe.name},oe.id))]})]}),r.jsxs(_n,{value:A,onValueChange:D,children:[r.jsx(xn,{className:"w-[160px]",children:r.jsx(bn,{placeholder:"Filter by status"})}),r.jsxs(vn,{children:[r.jsx(er,{value:"all",children:"All Status"}),r.jsx(er,{value:"warm",children:"🟢 Warm"}),r.jsx(er,{value:"cooling",children:"🟡 Cooling Off"}),r.jsx(er,{value:"at-risk",children:"🔴 At Risk"})]})]}),r.jsxs(_n,{value:$,onValueChange:F,children:[r.jsx(xn,{className:"w-[180px]",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(B0,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(bn,{placeholder:"Sort by"})]})}),r.jsxs(vn,{children:[r.jsx(er,{value:"name",children:"Name (A-Z)"}),r.jsx(er,{value:"last-touched",children:"Last Touched"}),r.jsx(er,{value:"next-touch",children:"Next Touch Due"}),r.jsx(er,{value:"score",children:"Relationship Score"}),r.jsx(er,{value:"date-added",children:"Date Added"})]})]}),r.jsxs(te,{onClick:()=>W(!0),children:[r.jsx(Sn,{className:"h-4 w-4 mr-1"}),"Add Contact"]}),r.jsxs(te,{variant:"outline",onClick:()=>he(!0),children:[r.jsx(Ao,{className:"h-4 w-4 mr-1"}),"Import CSV"]})]})})}),s?r.jsx("div",{className:"space-y-3",children:m?r.jsx(Ye,{className:"p-6 text-center text-muted-foreground",children:"Loading contacts..."}):fe.length===0?r.jsx(Ye,{className:"p-6 text-center text-muted-foreground",children:C||T!=="all"||A!=="all"?"No contacts match your search":"No contacts yet. Add your first contact!"}):fe.map(oe=>{var je;const{relationshipScore:ae}=oe;return r.jsx(Ye,{className:"cursor-pointer hover:bg-accent/50 transition-colors",onClick:()=>{const Me=new URLSearchParams;C&&Me.set("search",C),T!=="all"&&Me.set("type",T),A!=="all"&&Me.set("filter",A);const Ue=Me.toString();t(`/innercircle/contacts/${oe.id}${Ue?`?${Ue}`:""}`)},children:r.jsx(Je,{className:"p-4",children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsxs("h3",{className:"font-semibold text-base truncate",children:[oe.first_name," ",oe.last_name]}),r.jsx(Ha,{className:"h-4 w-4 text-muted-foreground shrink-0"})]}),r.jsxs("div",{className:"space-y-1 text-sm mb-3",children:[oe.email&&r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[r.jsx(di,{className:"h-3.5 w-3.5 shrink-0"}),r.jsx("span",{className:"truncate",children:oe.email})]}),oe.phone&&r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[r.jsx(Wa,{className:"h-3.5 w-3.5 shrink-0"}),r.jsx("span",{children:oe.phone})]})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-1 mb-2",children:[r.jsx(ZNe,{score:ae,size:"sm"}),r.jsx(Xhe,{contact:oe}),(je=oe.tags)==null?void 0:je.map(Me=>{var Ue;return r.jsx(Rt,{variant:"secondary",className:"text-xs",children:(Ue=Me.relationship_type)==null?void 0:Ue.name},Me.id)})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[ae.lastTouchDate?r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Xi,{className:"h-3 w-3"}),un(new Date(ae.lastTouchDate),"MMM d")]}):r.jsx("span",{className:"italic",children:"Never contacted"}),oe.birthday&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(li,{className:"h-3 w-3"}),un(new Date(oe.birthday),"MMM d")]}),oe.home_anniversary&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Hi,{className:"h-3 w-3"}),un(new Date(oe.home_anniversary),"MMM d")]})]})]}),r.jsxs("div",{className:"flex flex-col gap-1 ml-2",children:[r.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8",title:"Snooze Touch",onClick:Me=>{Me.stopPropagation(),Ne(oe.id),xe(`${oe.first_name} ${oe.last_name||""}`.trim())},children:r.jsx(zf,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:Me=>{Me.stopPropagation(),Z(oe)},children:r.jsx(ma,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:Me=>{Me.stopPropagation(),Se(oe.id)},children:r.jsx(Xn,{className:"h-4 w-4 text-destructive"})})]})]})})},oe.id)})}):r.jsx(Ye,{children:r.jsx(Je,{className:"p-0 overflow-x-auto",children:r.jsxs($s,{className:"min-w-[600px]",children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"Name"}),r.jsx(At,{children:"Status"}),r.jsx(At,{children:"Contact Info"}),r.jsx(At,{children:"Relationship Types"}),r.jsx(At,{children:"Last Contact"}),r.jsx(At,{children:"Important Dates"}),r.jsx(At,{className:"w-[100px]",children:"Actions"})]})}),r.jsx(qs,{children:m?r.jsx(Er,{children:r.jsx(_t,{colSpan:7,className:"text-center py-8",children:"Loading contacts..."})}):fe.length===0?r.jsx(Er,{children:r.jsx(_t,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:C||T!=="all"||A!=="all"?"No contacts match your search":"No contacts yet. Add your first contact!"})}):fe.map(oe=>{var je;const{relationshipScore:ae}=oe;return r.jsxs(Er,{className:"cursor-pointer hover:bg-accent/50",onClick:()=>{const Me=new URLSearchParams;C&&Me.set("search",C),T!=="all"&&Me.set("type",T),A!=="all"&&Me.set("status",A);const Ue=Me.toString();t(`/innercircle/contacts/${oe.id}${Ue?`?${Ue}`:""}`)},children:[r.jsx(_t,{className:"font-medium",children:r.jsxs("div",{className:"flex items-center gap-2",children:[oe.first_name," ",oe.last_name]})}),r.jsx(_t,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ZNe,{score:ae,size:"sm"}),r.jsx(Xhe,{contact:oe})]})}),r.jsx(_t,{children:r.jsxs("div",{className:"space-y-1 text-sm",children:[oe.email&&r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(di,{className:"h-3 w-3"}),oe.email]}),oe.phone&&r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(Wa,{className:"h-3 w-3"}),oe.phone]})]})}),r.jsx(_t,{children:r.jsx("div",{className:"flex flex-wrap gap-1",children:(je=oe.tags)==null?void 0:je.map(Me=>{var Ue;return r.jsx(Rt,{variant:"secondary",className:"text-xs",children:(Ue=Me.relationship_type)==null?void 0:Ue.name},Me.id)})})}),r.jsx(_t,{children:r.jsx("div",{className:"text-sm",children:ae.lastTouchDate?r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(Xi,{className:"h-3 w-3"}),un(new Date(ae.lastTouchDate),"MMM d, yyyy")]}):r.jsx("span",{className:"text-muted-foreground text-xs italic",children:"Never contacted"})})}),r.jsx(_t,{children:r.jsxs("div",{className:"space-y-1 text-sm text-muted-foreground",children:[oe.birthday&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(li,{className:"h-3 w-3"}),un(new Date(oe.birthday),"MMM d")]}),oe.home_anniversary&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Hi,{className:"h-3 w-3"}),un(new Date(oe.home_anniversary),"MMM d")]})]})}),r.jsx(_t,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(te,{variant:"ghost",size:"sm",title:"Snooze Touch",onClick:Me=>{Me.stopPropagation(),Ne(oe.id),xe(`${oe.first_name} ${oe.last_name||""}`.trim())},children:r.jsx(zf,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"sm",onClick:Me=>{Me.stopPropagation(),Z(oe)},children:r.jsx(ma,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"sm",onClick:Me=>{Me.stopPropagation(),Se(oe.id)},children:r.jsx(Xn,{className:"h-4 w-4 text-destructive"})})]})})]},oe.id)})})]})})}),r.jsx($r,{open:q||!!K,onOpenChange:oe=>{oe||(W(!1),Z(null),ve())},children:r.jsxs(zr,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsx(Zr,{children:r.jsx(Kr,{children:K?"Edit Contact":"Add Contact"})}),r.jsxs("form",{onSubmit:Ie,className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"first_name",children:"First Name *"}),r.jsx(yt,{id:"first_name",value:ie.first_name,onChange:oe=>me({...ie,first_name:oe.target.value}),required:!0})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"last_name",children:"Last Name"}),r.jsx(yt,{id:"last_name",value:ie.last_name,onChange:oe=>me({...ie,last_name:oe.target.value})})]})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"email",children:"Email"}),r.jsx(yt,{id:"email",type:"email",value:ie.email,onChange:oe=>me({...ie,email:oe.target.value})})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"phone",children:"Phone"}),r.jsx(yt,{id:"phone",value:ie.phone,onChange:oe=>me({...ie,phone:oe.target.value})})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"address",children:"Address"}),r.jsx(yt,{id:"address",value:ie.address,onChange:oe=>me({...ie,address:oe.target.value}),placeholder:"Street address"})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"city",children:"City"}),r.jsx(yt,{id:"city",value:ie.city,onChange:oe=>me({...ie,city:oe.target.value})})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"state",children:"State"}),r.jsx(yt,{id:"state",value:ie.state,onChange:oe=>me({...ie,state:oe.target.value})})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"zip_code",children:"Zip"}),r.jsx(yt,{id:"zip_code",value:ie.zip_code,onChange:oe=>me({...ie,zip_code:oe.target.value})})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"birthday",children:"Birthday"}),r.jsx(yt,{id:"birthday",type:"date",value:ie.birthday,onChange:oe=>me({...ie,birthday:oe.target.value})})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"home_anniversary",children:"Home Anniversary"}),r.jsx(yt,{id:"home_anniversary",type:"date",value:ie.home_anniversary,onChange:oe=>me({...ie,home_anniversary:oe.target.value})})]})]}),r.jsxs("div",{children:[r.jsx(Qe,{children:"Relationship Types"}),r.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:y==null?void 0:y.filter(oe=>oe.active).map(oe=>r.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[r.jsx(_c,{checked:ie.tagIds.includes(oe.id),onCheckedChange:ae=>{me(ae?{...ie,tagIds:[...ie.tagIds,oe.id]}:{...ie,tagIds:ie.tagIds.filter(je=>je!==oe.id)})}}),r.jsx("span",{className:"text-sm",children:oe.name})]},oe.id))})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"notes",children:"Notes"}),r.jsx(ps,{id:"notes",value:ie.notes,onChange:oe=>me({...ie,notes:oe.target.value}),rows:3})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>{W(!1),Z(null),ve()},children:"Cancel"}),r.jsxs(te,{type:"submit",disabled:v.isPending||w.isPending,children:[K?"Update":"Create"," Contact"]})]})]})]})}),r.jsx(rwt,{open:re,onOpenChange:he,relationshipTypes:(y==null?void 0:y.filter(oe=>oe.active))||[],onSuccess:()=>{he(!1)}}),r.jsx(rze,{open:!!ue,onOpenChange:oe=>{oe||Ne(null)},contactId:ue||"",contactName:se})]})})}function swt(){return rr({queryKey:["video-script-categories"],queryFn:async()=>{const{data:t,error:e}=await ee.from("video_script_categories").select("*").order("sort_order");if(e)throw e;return t}})}function iwt(t){return rr({queryKey:["video-scripts",t],queryFn:async()=>{let e=ee.from("video_scripts").select("*, category:video_script_categories(*)").eq("is_active",!0).order("title");const{data:n,error:s}=await e;if(s)throw s;return n}})}function awt(){const{user:t}=Fr();return rr({queryKey:["user-video-scripts",t==null?void 0:t.id],queryFn:async()=>{if(!(t!=null&&t.id))return[];const{data:e,error:n}=await ee.from("user_video_scripts").select("*, category:video_script_categories(*)").eq("owner_user_id",t.id).order("title");if(n)throw n;return e},enabled:!!(t!=null&&t.id)})}function owt(){const{user:t}=Fr(),e=Xr();return cr({mutationFn:async n=>{if(!(t!=null&&t.id))throw new Error("Not authenticated");const{data:s,error:i}=await ee.from("user_video_scripts").insert([{owner_user_id:t.id,source_script_id:n.id,category_id:n.category_id,title:n.title,script_text:n.script_text,tags:n.tags,is_custom:!1}]).select().single();if(i)throw i;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["user-video-scripts"]})}})}function lwt(t){const{user:e}=Fr();return rr({queryKey:["agent-videos",e==null?void 0:e.id,t],queryFn:async()=>{if(!(e!=null&&e.id))return[];let n=ee.from("agent_videos").select("*, contact:innercircle_contacts(id, first_name, last_name)").eq("owner_user_id",e.id).order("created_at",{ascending:!1});n=n.eq("is_deleted",!1);const{data:s,error:i}=await n;if(i)throw i;return s},enabled:!!(e!=null&&e.id)})}function cwt(t){return rr({queryKey:["agent-video",t],queryFn:async()=>{const{data:e,error:n}=await ee.from("agent_videos").select("*, contact:innercircle_contacts(id, first_name, last_name)").eq("id",t).single();if(n)throw n;return e},enabled:!!t})}function cze(){const{user:t}=Fr(),e=Xr();return cr({mutationFn:async n=>{if(!(t!=null&&t.id))throw new Error("Not authenticated");const{data:s,error:i}=await ee.from("agent_videos").insert([{owner_user_id:t.id,contact_id:n.contact_id,bunny_video_id:n.bunny_video_id,playback_url:n.playback_url,thumbnail_url:n.thumbnail_url,preview_url:n.preview_url,duration_seconds:n.duration_seconds,file_size_mb:n.file_size_mb||0,title:n.title,notes:n.notes,task_id:n.task_id,status:n.status||"processing",touch_type:n.touch_type||"video",page_template:"default"}]).select("*, share_token").single();if(i)throw i;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["agent-videos"]}),e.invalidateQueries({queryKey:["storage-usage"]})}})}function dwt(){const t=Xr();return cr({mutationFn:async({id:e,bunnyVideoId:n,hardDelete:s=!1})=>{if(console.log("Deleting video:",{id:e,bunnyVideoId:n,hardDelete:s}),n){console.log("Calling bunny-upload delete for videoId:",n);const{data:i,error:o}=await ee.functions.invoke("bunny-upload",{body:{action:"delete",videoId:n,isAgentVideo:!0}});o?console.error("Failed to delete from Bunny:",o):console.log("Bunny delete response:",i)}else console.warn("No bunnyVideoId provided, skipping Bunny.net deletion");if(s){console.log("Hard deleting from database:",e);const{error:i}=await ee.from("agent_videos").delete().eq("id",e);if(i)throw i}else{console.log("Soft deleting from database:",e);const{error:i}=await ee.from("agent_videos").update({is_deleted:!0}).eq("id",e);if(i)throw i}console.log("Video deletion complete")},onSuccess:()=>{t.invalidateQueries({queryKey:["agent-videos"]}),t.invalidateQueries({queryKey:["storage-usage"]})}})}function oxe(){const{user:t}=Fr();return rr({queryKey:["storage-usage",t==null?void 0:t.id],queryFn:async()=>{if(!(t!=null&&t.id))return null;const{data:e,error:n}=await ee.from("agent_storage_usage").select("*").eq("user_id",t.id).maybeSingle();if(n)throw n;return e||{user_id:t.id,total_storage_mb:0,storage_tier:"basic",max_storage_mb:1024}},enabled:!!(t!=null&&t.id)})}function uwt(){const{data:t,isLoading:e}=oxe(),n=t?t.total_storage_mb0?t.total_storage_mb/t.max_storage_mb*100:0,o=i>=80;return{canRecord:n,remainingMb:s,usagePercent:i,isNearLimit:o,storage:t,isLoading:e}}async function hwt(t){const{data:e,error:n}=await ee.functions.invoke("bunny-upload",{body:{action:"create",title:t,isAgentVideo:!0}});if(n)throw n;return e}async function fwt(t){const{data:e,error:n}=await ee.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:t,isAgentVideo:!0}});if(n)throw n;return e}async function pwt(t){const{data:e,error:n}=await ee.functions.invoke("bunny-upload",{body:{action:"status",videoId:t,isAgentVideo:!0}});if(n)throw n;return e}function mwt(){const{user:t}=Fr(),e=Xr();return cr({mutationFn:async({contactId:n,videoId:s,notes:i})=>{if(!(t!=null&&t.id))throw new Error("Not authenticated");const{data:o}=await ee.from("action_types").select("id").eq("name","Video").single();if(!o)throw new Error("Video action type not found");const{data:c,error:a}=await ee.from("contact_touch_logs").insert([{owner_user_id:t.id,contact_id:n,action_type_id:o.id,notes:i||`Quick Video Touch - Video ID: ${s}`}]).select().single();if(a)throw a;return c},onSuccess:()=>{e.invalidateQueries({queryKey:["contact-touch-logs"]}),e.invalidateQueries({queryKey:["contacts"]})}})}function gwt(t){return rr({queryKey:["contact-video-replies",t],queryFn:async()=>{if(!t)return[];const{data:e,error:n}=await ee.from("video_replies").select(` *, video:agent_videos(id, title, thumbnail_url, playback_url) `).eq("contact_id",t).order("created_at",{ascending:!1});if(n)throw n;return e},enabled:!!t})}function ywt({videoId:t}){var c;const{data:e,isLoading:n,error:s}=cwt(t);if(n)return r.jsxs("div",{className:"space-y-4",children:[r.jsx(Gr,{className:"w-full aspect-video rounded-lg"}),r.jsx(Gr,{className:"h-4 w-1/3"})]});if(s||!e||e.is_deleted)return r.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[r.jsx(Ph,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"font-medium",children:"Video Unavailable"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"This video has been deleted or is no longer available."})]});const i=a=>{let f=a;return f.includes("iframe.mediadelivery.net/play/")&&(f=f.replace("/play/","/embed/"),f+=(f.includes("?")?"&":"?")+"autoplay=true&responsive=true"),f},o=(c=e.playback_url)==null?void 0:c.includes("iframe.mediadelivery.net");return r.jsxs("div",{className:"space-y-4",children:[e.playback_url?r.jsx("div",{className:"relative w-full aspect-video bg-black rounded-lg overflow-hidden",children:o?r.jsx("iframe",{src:i(e.playback_url),title:e.title||"Video preview",className:"absolute top-0 left-0 w-full h-full",style:{border:0},allow:"accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0}):r.jsx("video",{src:e.playback_url,controls:!0,autoPlay:!0,className:"absolute top-0 left-0 w-full h-full object-contain"})}):r.jsx("div",{className:"w-full aspect-video bg-muted rounded-lg flex items-center justify-center",children:r.jsx("p",{className:"text-muted-foreground",children:"Video is still processing..."})}),e.title&&r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium",children:e.title}),e.notes&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:e.notes})]})]})}function xwt(){var Me,Ue;const{contactId:t}=dd(),e=es(),[n]=Ed(),s=n.get("search")||"",i=n.get("type")||"all",o=n.get("status")||"all",{data:c,isLoading:a}=Xut(t||""),{data:f}=Ag(),{data:m}=iye(),{data:y}=use(365),{data:v}=gI(365),{data:w}=gwt(t),{contactsWithScores:k}=lye(),C=UOe(),S=qOe(),T=HOe(),[I,A]=P.useState(!1),[D,$]=P.useState({}),[F,q]=P.useState(!1),[W,K]=P.useState(null),[Z,re]=P.useState(""),[he,ue]=P.useState(null),Ne=Re=>{if(!Re)return null;const $e=Re.match(/Video ID:\s*([a-f0-9-]+)/i);return $e?$e[1]:null},se=P.useMemo(()=>{if(!k)return[];let Re=k.filter($e=>{var nt,Te,Xe;const Pe=s===""||`${$e.first_name} ${$e.last_name}`.toLowerCase().includes(s.toLowerCase())||((nt=$e.email)==null?void 0:nt.toLowerCase().includes(s.toLowerCase()))||((Te=$e.phone)==null?void 0:Te.includes(s)),Ae=i==="all"||((Xe=$e.tags)==null?void 0:Xe.some(ge=>ge.relationship_type_id===i));return Pe&&Ae});return o==="not-touched-90"?Re=Re.filter($e=>{const Pe=$e.relationshipScore.daysSinceTouch;return Pe===null||Pe>90}):o==="at-risk"?Re=Re.filter($e=>$e.relationshipScore.status==="at-risk"):o==="cooling"?Re=Re.filter($e=>$e.relationshipScore.status==="cooling"):o==="warm"&&(Re=Re.filter($e=>$e.relationshipScore.status==="warm")),Re.map($e=>$e.id)},[k,s,i,o]),xe=se.indexOf(t||""),ie=xe>0?se[xe-1]:null,me=xe1&&xe!==-1,ve=Re=>{const $e=new URLSearchParams;s&&$e.set("search",s),i!=="all"&&$e.set("type",i),o!=="all"&&$e.set("status",o);const Pe=$e.toString();return`/innercircle/contacts/${Re}${Pe?`?${Pe}`:""}`},Ie=P.useMemo(()=>{const Re=((y==null?void 0:y.filter(Pe=>Pe.contact_id===t))||[]).map(Pe=>{var nt,Te;const Ae=Ne(Pe.notes);return{id:Pe.id,type:"touch",completed_at:Pe.completed_at,name:((nt=Pe.action_type)==null?void 0:nt.name)||"Touch",color:((Te=Pe.action_type)==null?void 0:Te.color)||"#3B82F6",notes:Pe.notes,videoId:Ae}}),$e=((v==null?void 0:v.filter(Pe=>Pe.contact_id===t))||[]).map(Pe=>({id:Pe.id,type:"popby",completed_at:Pe.completed_at,name:"Pop-by",color:"#F97316",notes:Pe.notes,videoId:null}));return[...Re,...$e].sort((Pe,Ae)=>new Date(Ae.completed_at).getTime()-new Date(Pe.completed_at).getTime())},[y,v,t]),Se=()=>{var Re;c&&($({first_name:c.first_name||"",last_name:c.last_name||"",email:c.email||"",phone:c.phone||"",address:c.address||"",city:c.city||"",state:c.state||"",zip_code:c.zip_code||"",birthday:c.birthday||"",home_anniversary:c.home_anniversary||"",spouse_name:c.spouse_name||"",company_name:c.company_name||"",job_title:c.job_title||"",notes:c.notes||"",tagIds:((Re=c.tags)==null?void 0:Re.map($e=>$e.relationship_type_id))||[]}),A(!0))},oe=async()=>{await C.mutateAsync({id:t,...D}),A(!1)},ae=async()=>{confirm("Are you sure you want to delete this contact?")&&(await S.mutateAsync(t),e("/innercircle/contacts"))},je=async()=>{W&&(await T.mutateAsync({contactId:t,actionTypeId:W,notes:Z}),q(!1),K(null),re(""))};return a?r.jsx(Or,{title:"Contact Details",children:r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent rounded-full"})})}):c?r.jsx(Or,{title:`${c.first_name} ${c.last_name||""}`,description:"Contact details and activity",children:r.jsxs("div",{className:"space-y-6 overflow-x-hidden",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>e("/innercircle/contacts"),children:[r.jsx(sd,{className:"h-4 w-4 mr-1"}),"Back to Contacts"]}),fe&&r.jsxs("div",{className:"flex items-center gap-1 ml-2 border-l pl-2",children:[r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>ie&&e(ve(ie)),disabled:!ie,className:"px-2",children:[r.jsx(sd,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only sm:not-sr-only sm:ml-1",children:"Prev"})]}),r.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[xe+1," of ",se.length]}),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>me&&e(ve(me)),disabled:!me,className:"px-2",children:[r.jsx("span",{className:"sr-only sm:not-sr-only sm:mr-1",children:"Next"}),r.jsx(Ha,{className:"h-4 w-4"})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2 w-full sm:w-auto justify-end flex-wrap",children:[r.jsxs(te,{variant:"default",onClick:()=>e(`/innercircle/video/record?contact_id=${t}`),className:"bg-gradient-to-r from-primary to-primary/80",children:[r.jsx(Gi,{className:"h-4 w-4 mr-1"}),"Quick Video Touch"]}),r.jsxs($r,{open:F,onOpenChange:q,children:[r.jsx(Lo,{asChild:!0,children:r.jsxs(te,{variant:"outline",children:[r.jsx(Sn,{className:"h-4 w-4 mr-1"}),"Log Action"]})}),r.jsxs(zr,{children:[r.jsx(Zr,{children:r.jsx(Kr,{children:"Log an Action"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Qe,{children:"Action Type"}),r.jsx("div",{className:"grid grid-cols-2 gap-2 mt-2",children:m==null?void 0:m.filter(Re=>Re.active).map(Re=>r.jsxs("button",{onClick:()=>K(Re.id),className:` p-3 rounded-lg border text-left transition-all ${W===Re.id?"border-primary bg-primary/10":"hover:bg-accent"} `,children:[r.jsx("div",{className:"font-medium",children:Re.name}),r.jsx("div",{className:"text-xs text-muted-foreground",children:Re.description})]},Re.id))})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"action-notes",children:"Notes (optional)"}),r.jsx(ps,{id:"action-notes",value:Z,onChange:Re=>re(Re.target.value),placeholder:"Add any notes about this interaction...",rows:3})]}),r.jsxs(te,{onClick:je,disabled:!W||T.isPending,className:"w-full",children:[r.jsx(Ba,{className:"h-4 w-4 mr-1"}),"Complete Action"]})]})]})]}),r.jsxs(te,{variant:"outline",onClick:Se,children:[r.jsx(Jl,{className:"h-4 w-4 mr-1"}),"Edit"]}),r.jsx(te,{variant:"destructive",size:"icon",onClick:ae,children:r.jsx(Xn,{className:"h-4 w-4"})})]})]}),r.jsx("div",{className:"bg-card border rounded-lg p-4 sm:p-6",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-4",children:[r.jsxs("div",{className:"flex-1",children:[r.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold",children:[c.first_name," ",c.last_name||""]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 mt-2 text-muted-foreground",children:[c.email&&r.jsxs("a",{href:`mailto:${c.email}`,className:"flex items-center gap-1 hover:text-primary transition-colors",children:[r.jsx(di,{className:"h-4 w-4"}),r.jsx("span",{className:"text-sm",children:c.email})]}),c.phone&&r.jsxs("a",{href:`tel:${c.phone}`,className:"flex items-center gap-1 hover:text-primary transition-colors",children:[r.jsx(Wa,{className:"h-4 w-4"}),r.jsx("span",{className:"text-sm",children:c.phone})]})]})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx(Xhe,{contact:c}),(Me=c.tags)==null?void 0:Me.map(Re=>{const $e=f==null?void 0:f.find(Pe=>Pe.id===Re.relationship_type_id);return $e?r.jsx(Rt,{variant:"secondary",className:"text-xs",children:$e.name},Re.id):null})]})]})}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsxs(Ye,{className:"md:col-span-2",children:[r.jsx(Ht,{children:r.jsx(Yt,{children:"Contact Information"})}),r.jsx(Je,{children:I?r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"first_name",children:"First Name"}),r.jsx(yt,{id:"first_name",value:D.first_name,onChange:Re=>$({...D,first_name:Re.target.value})})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"last_name",children:"Last Name"}),r.jsx(yt,{id:"last_name",value:D.last_name,onChange:Re=>$({...D,last_name:Re.target.value})})]})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"email",children:"Email"}),r.jsx(yt,{id:"email",type:"email",value:D.email,onChange:Re=>$({...D,email:Re.target.value})})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"phone",children:"Phone"}),r.jsx(yt,{id:"phone",value:D.phone,onChange:Re=>$({...D,phone:Re.target.value})})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"address",children:"Street Address"}),r.jsx(yt,{id:"address",value:D.address,onChange:Re=>$({...D,address:Re.target.value}),placeholder:"123 Main St"})]}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"col-span-2",children:[r.jsx(Qe,{htmlFor:"city",children:"City"}),r.jsx(yt,{id:"city",value:D.city,onChange:Re=>$({...D,city:Re.target.value}),placeholder:"City"})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"state",children:"State"}),r.jsx(yt,{id:"state",value:D.state,onChange:Re=>$({...D,state:Re.target.value}),placeholder:"TX",maxLength:2})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"zip_code",children:"Zip Code"}),r.jsx(yt,{id:"zip_code",value:D.zip_code,onChange:Re=>$({...D,zip_code:Re.target.value}),placeholder:"12345"})]})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"birthday",children:"Birthday"}),r.jsx(yt,{id:"birthday",type:"date",value:D.birthday,onChange:Re=>$({...D,birthday:Re.target.value})})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"home_anniversary",children:"Home Anniversary"}),r.jsx(yt,{id:"home_anniversary",type:"date",value:D.home_anniversary,onChange:Re=>$({...D,home_anniversary:Re.target.value})})]})]}),r.jsx(Vd,{}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"spouse_name",children:"Spouse/Partner Name"}),r.jsx(yt,{id:"spouse_name",value:D.spouse_name,onChange:Re=>$({...D,spouse_name:Re.target.value}),placeholder:"Enter spouse name"})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"company_name",children:"Company"}),r.jsx(yt,{id:"company_name",value:D.company_name,onChange:Re=>$({...D,company_name:Re.target.value}),placeholder:"Enter company name"})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"job_title",children:"Job Title"}),r.jsx(yt,{id:"job_title",value:D.job_title,onChange:Re=>$({...D,job_title:Re.target.value}),placeholder:"Enter job title"})]})]}),r.jsxs("div",{children:[r.jsx(Qe,{children:"Relationship Types"}),r.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:f==null?void 0:f.filter(Re=>Re.active).map(Re=>{var $e;return r.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[r.jsx(_c,{checked:($e=D.tagIds)==null?void 0:$e.includes(Re.id),onCheckedChange:Pe=>{var Ae;$(Pe?{...D,tagIds:[...D.tagIds||[],Re.id]}:{...D,tagIds:(Ae=D.tagIds)==null?void 0:Ae.filter(nt=>nt!==Re.id)})}}),r.jsx("span",{className:"text-sm",children:Re.name})]},Re.id)})})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"notes",children:"Notes"}),r.jsx(ps,{id:"notes",value:D.notes,onChange:Re=>$({...D,notes:Re.target.value}),rows:4})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(te,{onClick:oe,disabled:C.isPending,children:"Save Changes"}),r.jsx(te,{variant:"outline",onClick:()=>A(!1),children:"Cancel"})]})]}):r.jsxs("div",{className:"space-y-4",children:[Ie.length>0&&r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 flex items-center gap-2",children:[r.jsx(li,{className:"h-4 w-4 text-primary"}),r.jsxs("span",{className:"text-sm",children:[r.jsx("span",{className:"font-medium",children:"Last Contacted:"})," ",un(new Date(Ie[0].completed_at),"MMM d, yyyy")," ","(",Ie[0].name,")"]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row sm:gap-6 gap-2",children:[c.email&&r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r.jsx(di,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),r.jsx("a",{href:`mailto:${c.email}`,className:"text-primary hover:underline truncate",children:c.email})]}),c.phone&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Wa,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),r.jsx("a",{href:`tel:${c.phone}`,className:"text-primary hover:underline",children:c.phone})]})]}),(c.address||c.city||c.state||c.zip_code)&&r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(yl,{className:"h-4 w-4 text-muted-foreground mt-0.5"}),r.jsxs("div",{className:"flex flex-col",children:[c.address&&r.jsx("span",{children:c.address}),(c.city||c.state||c.zip_code)&&r.jsxs("span",{className:"text-muted-foreground",children:[[c.city,c.state].filter(Boolean).join(", "),c.zip_code&&` ${c.zip_code}`]})]})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[c.birthday&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(li,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Birthday: ",un(new Date(c.birthday),"MMMM d")]})]}),c.home_anniversary&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Hi,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Home Anniversary: ",un(new Date(c.home_anniversary),"MMMM d")]})]})]}),(c.spouse_name||c.company_name||c.job_title)&&r.jsxs(r.Fragment,{children:[r.jsx(Vd,{}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[c.spouse_name&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(jc,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Spouse: ",c.spouse_name]})]}),(c.company_name||c.job_title)&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ra,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{children:c.job_title&&c.company_name?`${c.job_title} at ${c.company_name}`:c.job_title||c.company_name})]})]})]}),r.jsx(Vd,{}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-2",children:"Relationship Types"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:(Ue=c.tags)!=null&&Ue.length?c.tags.map(Re=>{var $e;return r.jsx(Rt,{variant:"secondary",children:($e=Re.relationship_type)==null?void 0:$e.name},Re.id)}):r.jsx("span",{className:"text-sm text-muted-foreground",children:"No relationship types assigned"})})]}),c.notes&&r.jsxs(r.Fragment,{children:[r.jsx(Vd,{}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-2",children:"Notes"}),r.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:c.notes})]})]})]})})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsx(Qbt,{contact:c,onLogTouch:()=>q(!0)}),r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsx(Yt,{children:"Activity Log"})}),r.jsx(Je,{children:Ie.length>0?r.jsx("div",{className:"space-y-4",children:Ie.map(Re=>{var $e;return r.jsxs("div",{className:"flex items-start gap-3 pb-3 border-b last:border-0",children:[r.jsx("div",{className:"h-8 w-8 rounded-full flex items-center justify-center text-white text-xs",style:{backgroundColor:Re.color},children:Re.type==="popby"?r.jsx(Qa,{className:"h-4 w-4"}):($e=Re.name)==null?void 0:$e.charAt(0)}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"font-medium text-sm",children:Re.name}),Re.videoId&&r.jsxs(te,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:()=>ue(Re.videoId),children:[r.jsx(wc,{className:"h-3 w-3 mr-1"}),"Preview"]})]}),r.jsx("div",{className:"text-xs text-muted-foreground",children:un(new Date(Re.completed_at),"MMM d, yyyy h:mm a")}),Re.notes&&!Re.videoId&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:Re.notes})]})]},Re.id)})}):r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No activity logged yet"})})]}),w&&w.length>0&&r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(Wl,{className:"h-5 w-5 text-primary"}),"Video Replies"]})}),r.jsx(Je,{children:r.jsx("div",{className:"space-y-4",children:w.map(Re=>{var $e,Pe;return r.jsxs("div",{className:"flex items-start gap-3 pb-3 border-b last:border-0",children:[($e=Re.video)!=null&&$e.thumbnail_url?r.jsx("img",{src:Re.video.thumbnail_url,alt:Re.video.title||"Video",className:"h-12 w-16 object-cover rounded cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>ue(Re.video_id)}):r.jsx("div",{className:"h-12 w-16 bg-muted rounded flex items-center justify-center cursor-pointer hover:bg-muted/80 transition-colors",onClick:()=>ue(Re.video_id),children:r.jsx(Gi,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"font-medium text-sm truncate",children:["Replied to: ",((Pe=Re.video)==null?void 0:Pe.title)||"Untitled Video"]}),r.jsxs(te,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs flex-shrink-0",onClick:()=>ue(Re.video_id),children:[r.jsx(wc,{className:"h-3 w-3 mr-1"}),"Watch"]})]}),r.jsx("div",{className:"text-xs text-muted-foreground",children:un(new Date(Re.created_at),"MMM d, yyyy h:mm a")}),Re.message&&r.jsxs("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:['"',Re.message,'"']})]})]},Re.id)})})})]})]}),r.jsx($r,{open:!!he,onOpenChange:Re=>!Re&&ue(null),children:r.jsxs(zr,{className:"max-w-2xl",children:[r.jsx(Zr,{children:r.jsx(Kr,{children:"Video Preview"})}),he&&r.jsx(ywt,{videoId:he})]})})]})]})}):r.jsx(Or,{title:"Contact Not Found",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"This contact was not found."}),r.jsx(te,{onClick:()=>e("/innercircle/contacts"),children:"Back to Contacts"})]})})}const YNe={Crown:Bw,FileText:Ai,Users:hs,Globe:OS,Star:Ca,Phone:Wa,MessageSquare:Wl,PenTool:KS,Video:Gi,Gift:Qa},Sce=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function vwt(){var Nt,Mt;const t=es(),{user:e}=Fr(),{data:n}=Ag(),{data:s}=Jut(),{data:i}=aht(),{data:o}=BOe(),{data:c}=iye(),{data:a}=Qut(),f=oht(),m=eht(),y=rht(),v=nht(),w=sht(),k=iht(),C=tht(),[S,T]=P.useState(null),[I,A]=P.useState(!1),[D,$]=P.useState(null),[F,q]=P.useState(""),[W,K]=P.useState(""),[Z,re]=P.useState([]),[he,ue]=P.useState(null),[Ne,se]=P.useState(null),[xe,ie]=P.useState(!1),[me,fe]=P.useState(""),[ve,Ie]=P.useState(""),[Se,oe]=P.useState(""),[ae,je]=P.useState(""),Me=(It,tr)=>i==null?void 0:i.some(Mr=>Mr.plan_id===It&&Mr.relationship_type_id===tr&&Mr.active),Ue=It=>i==null?void 0:i.find(tr=>tr.relationship_type_id===It&&tr.active),Re=async(It,tr)=>{const Mr=Me(It,tr);await f.mutateAsync({planId:It,relationshipTypeId:tr,active:!Mr})},$e=(s==null?void 0:s.filter(It=>It.active&&!It.owner_user_id))||[],Pe=(s==null?void 0:s.filter(It=>It.owner_user_id===(e==null?void 0:e.id)))||[],Ae=n==null?void 0:n.find(It=>It.id===S),nt=S?Ue(S):null,Te=s==null?void 0:s.find(It=>It.id===(nt==null?void 0:nt.plan_id)),Xe=async()=>{if(!F.trim())return;const It=await m.mutateAsync({name:F,description:W});It&&Z.length>0&&await w.mutateAsync({planId:It.id,items:Z}),rt()},ge=async()=>{!F.trim()||!D||(await y.mutateAsync({id:D,name:F,description:W}),await w.mutateAsync({planId:D,items:Z}),rt())},mt=It=>{var tr;$(It.id),q(It.name),K(It.description||""),re(((tr=It.items)==null?void 0:tr.map(Mr=>({month_number:Mr.month_number,action_type_id:Mr.action_type_id,default_script_id:Mr.default_script_id||void 0,notes:Mr.notes||void 0})))||[]),A(!0)},rt=()=>{A(!1),$(null),q(""),K(""),re([])},We=(It,tr)=>{se(tr)},Ce=(It,tr,Mr)=>{re(pn=>[...pn.filter(Qn=>Qn.month_number!==It),{month_number:It,action_type_id:tr,default_script_id:Mr}]),ue(null),se(null)},et=It=>{re(tr=>tr.filter(Mr=>Mr.month_number!==It))},Fe=async()=>{if(!me.trim()||!ve.trim()||!Ne)return;const It=await k.mutateAsync({actionTypeId:Ne,title:me,scriptBody:ve,emailSubject:Se||void 0,tone:ae||void 0});It&&he!==null&&Ce(he,Ne,It.id),ie(!1),fe(""),Ie(""),oe(""),je("")},Ke=Ne?a==null?void 0:a.filter(It=>It.action_type_id===Ne&&It.active):[],Le=It=>YNe[It||"Phone"]||Wa,ft=It=>YNe[It||"Users"]||hs;return r.jsxs(Or,{title:"Touchpoint Plans",description:"Assign plans to your contact groups",children:[r.jsxs("div",{className:"space-y-6 overflow-x-hidden",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Touchpoint Plans"}),r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0.5 rounded border border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10",children:"Beta"})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3",children:[r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>t("/innercircle"),children:[r.jsx(sd,{className:"h-4 w-4 mr-1"}),"Back"]}),r.jsxs(te,{onClick:()=>A(!0),className:"w-full sm:w-auto",children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Create Custom Plan"]})]}),r.jsxs("div",{className:"grid lg:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx("h3",{className:"font-semibold text-lg",children:"Your Contact Groups"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Select a group to assign a touchpoint plan"}),n==null?void 0:n.filter(It=>It.active).map(It=>{const tr=ft(It.icon),Mr=(o==null?void 0:o[It.id])||0,pn=Ue(It.id),fs=s==null?void 0:s.find(js=>js.id===(pn==null?void 0:pn.plan_id)),Qn=S===It.id;return r.jsxs("button",{onClick:()=>T(It.id),className:` w-full flex items-center gap-3 p-4 rounded-lg border text-left transition-all ${Qn?"border-primary bg-primary/5 ring-2 ring-primary":"hover:bg-accent"} `,children:[r.jsx(tr,{className:"h-5 w-5 text-muted-foreground"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"font-medium",children:It.name}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[Mr," contacts"]})]}),fs?r.jsxs(Rt,{variant:"secondary",className:"text-xs",children:[r.jsx(za,{className:"h-3 w-3 mr-1"}),fs.name.split(" ")[0]]}):r.jsx(Rt,{variant:"outline",className:"text-xs text-muted-foreground",children:"No plan"})]},It.id)})]}),r.jsx("div",{className:"lg:col-span-2",children:S&&Ae?r.jsxs(Ye,{children:[r.jsxs(Ht,{children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[(()=>{const It=ft(Ae.icon);return r.jsx(It,{className:"h-5 w-5"})})(),Ae.name," Touchpoint Plan"]}),r.jsxs(An,{children:["Choose a plan for your ",Ae.name," contacts"]})]}),r.jsxs(Je,{className:"space-y-6",children:[Te&&r.jsxs("div",{className:"p-4 bg-primary/5 rounded-lg border border-primary/20",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"font-medium flex items-center gap-2",children:[r.jsx(za,{className:"h-4 w-4 text-green-500"}),"Currently using: ",Te.name]}),Te.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:Te.description})]}),r.jsx(te,{variant:"outline",size:"sm",onClick:()=>Re(Te.id,S),children:"Disable"})]}),Te.items&&Te.items.length>0&&r.jsxs("div",{className:"mt-4",children:[r.jsxs("div",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[r.jsx(li,{className:"h-4 w-4"}),"12-Month Schedule"]}),r.jsx("div",{className:"grid grid-cols-4 sm:grid-cols-6 gap-2",children:Sce.map((It,tr)=>{var Qn,js;const Mr=((Qn=Te.items)==null?void 0:Qn.filter(Qs=>Qs.month_number===tr+1))||[],pn=(js=Mr[0])==null?void 0:js.action_type,fs=pn?Le(pn.icon):null;return r.jsxs("div",{className:` p-2 rounded border text-center ${Mr.length>0?"bg-primary/10 border-primary":"bg-muted"} `,children:[r.jsx("div",{className:"text-xs text-muted-foreground",children:It}),fs&&r.jsx(fs,{className:"h-4 w-4 mx-auto mt-1",style:{color:(pn==null?void 0:pn.color)||"#3B82F6"}})]},tr)})})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-3",children:Te?"Switch to a Different Plan":"Choose a Plan"}),$e.length>0&&r.jsxs("div",{className:"space-y-2 mb-4",children:[r.jsx("div",{className:"text-sm text-muted-foreground",children:"Pre-built Templates"}),$e.map(It=>{var Mr;const tr=(Te==null?void 0:Te.id)===It.id;return r.jsxs("div",{className:` flex items-center justify-between p-3 rounded-lg border ${tr?"opacity-50":"hover:bg-accent"} `,children:[r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:It.name}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[((Mr=It.items)==null?void 0:Mr.length)||0," touchpoints/year"]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(te,{size:"sm",variant:"ghost",title:"Duplicate as my own plan",disabled:C.isPending,onClick:()=>{const pn=`${It.name} (Copy)`;C.mutate({sourcePlanId:It.id,newName:pn})},children:r.jsx(Ul,{className:"h-4 w-4"})}),r.jsx(te,{size:"sm",variant:tr?"outline":"default",disabled:tr||f.isPending,onClick:()=>Re(It.id,S),children:tr?"Active":"Use This"})]})]},It.id)})]}),Pe.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"text-sm text-muted-foreground",children:"My Custom Plans"}),Pe.map(It=>{var Mr;const tr=(Te==null?void 0:Te.id)===It.id;return r.jsxs("div",{className:` flex items-center justify-between p-3 rounded-lg border ${tr?"opacity-50":"hover:bg-accent"} `,children:[r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:It.name}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[((Mr=It.items)==null?void 0:Mr.length)||0," touchpoints/year"]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(te,{size:"sm",variant:"ghost",title:"Edit plan",onClick:()=>mt(It),children:r.jsx(Xx,{className:"h-4 w-4"})}),r.jsx(te,{size:"sm",variant:"ghost",title:"Delete plan",onClick:()=>v.mutate(It.id),children:r.jsx(Xn,{className:"h-4 w-4 text-destructive"})}),r.jsx(te,{size:"sm",variant:tr?"outline":"default",disabled:tr||f.isPending,onClick:()=>Re(It.id,S),children:tr?"Active":"Use This"})]})]},It.id)})]}),$e.length===0&&Pe.length===0&&r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No plans available. Create a custom plan to get started."})]})]})]}):r.jsx(Ye,{children:r.jsxs(Je,{className:"py-12 text-center text-muted-foreground",children:[r.jsx(li,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"Select a contact group to view and assign plans"})]})})})]}),r.jsx(Ye,{className:"bg-muted/50",children:r.jsx(Je,{className:"py-4",children:r.jsxs("p",{className:"text-sm text-muted-foreground",children:[r.jsx("strong",{children:"How it works:"})," When you assign a plan to a contact group, those contacts will appear in your daily suggested actions based on the plan's schedule."]})})})]}),r.jsx($r,{open:I,onOpenChange:It=>{It?A(!0):rt()},children:r.jsxs(zr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Zr,{children:r.jsx(Kr,{children:D?"Edit Touchpoint Plan":"Create Custom Touchpoint Plan"})}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid gap-4",children:[r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"plan-name",children:"Plan Name"}),r.jsx(yt,{id:"plan-name",value:F,onChange:It=>q(It.target.value),placeholder:"e.g., My VIP Plan"})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"plan-description",children:"Description (optional)"}),r.jsx(ps,{id:"plan-description",value:W,onChange:It=>K(It.target.value),placeholder:"Describe your plan...",rows:2})]})]}),r.jsxs("div",{children:[r.jsx(Qe,{children:"12-Month Schedule"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"Click on a month to add a touchpoint"}),r.jsx("div",{className:"grid grid-cols-6 gap-2",children:Sce.map((It,tr)=>{const Mr=tr+1,pn=Z.find(js=>js.month_number===Mr),fs=pn?c==null?void 0:c.find(js=>js.id===pn.action_type_id):null,Qn=fs?Le(fs.icon):null;return r.jsxs("div",{className:"relative",children:[r.jsxs("button",{type:"button",onClick:()=>ue(he===Mr?null:Mr),className:` w-full p-3 rounded-lg border text-center transition-all ${pn?"bg-primary/10 border-primary":"bg-muted hover:bg-accent"} ${he===Mr?"ring-2 ring-primary":""} `,children:[r.jsx("div",{className:"text-xs text-muted-foreground font-medium",children:It}),Qn?r.jsx(Qn,{className:"h-5 w-5 mx-auto mt-1",style:{color:(fs==null?void 0:fs.color)||"#3B82F6"}}):r.jsx(Sn,{className:"h-5 w-5 mx-auto mt-1 text-muted-foreground/50"})]}),pn&&r.jsx("button",{type:"button",onClick:js=>{js.stopPropagation(),et(Mr)},className:"absolute -top-1 -right-1 p-1 bg-destructive text-destructive-foreground rounded-full",children:r.jsx(Ms,{className:"h-3 w-3"})})]},tr)})}),he!==null&&!Ne&&r.jsxs("div",{className:"mt-4 p-3 bg-muted rounded-lg",children:[r.jsxs("div",{className:"text-sm font-medium mb-2",children:["Step 1: Select action for ",Sce[he-1],":"]}),r.jsx("div",{className:"flex flex-wrap gap-2",children:c==null?void 0:c.filter(It=>It.active).map(It=>{const tr=Le(It.icon);return r.jsxs("button",{type:"button",onClick:()=>We(he,It.id),className:"flex items-center gap-2 px-3 py-2 rounded-lg border bg-background hover:bg-accent transition-colors",children:[r.jsx(tr,{className:"h-4 w-4",style:{color:It.color||"#3B82F6"}}),r.jsx("span",{className:"text-sm",children:It.name})]},It.id)})})]}),he!==null&&Ne&&r.jsxs("div",{className:"mt-4 p-3 bg-muted rounded-lg space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("div",{className:"text-sm font-medium",children:"Step 2: Select a script (optional)"}),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>se(null),children:[r.jsx(sd,{className:"h-4 w-4 mr-1"})," Back"]})]}),r.jsxs("div",{className:"space-y-2 max-h-[300px] overflow-y-auto pr-1",children:[r.jsx("button",{type:"button",onClick:()=>Ce(he,Ne),className:"w-full flex items-center gap-3 p-3 rounded-lg border bg-background hover:bg-accent transition-colors text-left",children:r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium text-sm",children:"No Script"}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Use without a predefined script"})]})}),Ke==null?void 0:Ke.map(It=>r.jsx("button",{type:"button",onClick:()=>Ce(he,Ne,It.id),className:"w-full flex items-center gap-3 p-3 rounded-lg border bg-background hover:bg-accent transition-colors text-left",children:r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"font-medium text-sm",children:It.title}),It.tone&&r.jsx(Rt,{variant:"secondary",className:"text-xs mt-1",children:It.tone}),r.jsxs("div",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:[It.script_body.substring(0,100),"..."]})]})},It.id)),r.jsxs("button",{type:"button",onClick:()=>ie(!0),className:"w-full flex items-center gap-3 p-3 rounded-lg border border-dashed bg-background hover:bg-accent transition-colors text-left",children:[r.jsx(Sn,{className:"h-5 w-5 text-muted-foreground"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium text-sm",children:"Create Custom Script"}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Write your own script for this action"})]})]})]})]})]}),Z.length>0&&r.jsxs("div",{className:"text-sm text-muted-foreground",children:[Z.length," touchpoint",Z.length!==1?"s":""," per year"]})]}),r.jsxs(ni,{children:[r.jsx(te,{variant:"outline",onClick:rt,children:"Cancel"}),r.jsxs(te,{onClick:D?ge:Xe,disabled:!F.trim()||m.isPending||y.isPending,children:[r.jsx(dg,{className:"h-4 w-4 mr-2"}),D?"Save Changes":"Create Plan"]})]})]})}),r.jsx($r,{open:xe,onOpenChange:ie,children:r.jsxs(zr,{className:"max-w-lg",children:[r.jsx(Zr,{children:r.jsx(Kr,{children:"Create Custom Script"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"script-title",children:"Script Title"}),r.jsx(yt,{id:"script-title",value:me,onChange:It=>fe(It.target.value),placeholder:"e.g., Friendly Check-in Call"})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"script-tone",children:"Tone (optional)"}),r.jsxs(_n,{value:ae,onValueChange:je,children:[r.jsx(xn,{children:r.jsx(bn,{placeholder:"Select tone..."})}),r.jsxs(vn,{children:[r.jsx(er,{value:"friendly",children:"Friendly"}),r.jsx(er,{value:"professional",children:"Professional"}),r.jsx(er,{value:"casual",children:"Casual"}),r.jsx(er,{value:"formal",children:"Formal"})]})]})]}),((Mt=(Nt=c==null?void 0:c.find(It=>It.id===Ne))==null?void 0:Nt.name)==null?void 0:Mt.toLowerCase().includes("email"))&&r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"script-email-subject",children:"Email Subject"}),r.jsx(yt,{id:"script-email-subject",value:Se,onChange:It=>oe(It.target.value),placeholder:"e.g., Quick Hello!"})]}),r.jsxs("div",{children:[r.jsx(Qe,{htmlFor:"script-body",children:"Script Content"}),r.jsx(ps,{id:"script-body",value:ve,onChange:It=>Ie(It.target.value),placeholder:"Write your script here... You can use {{FirstName}} and {{LastName}} as placeholders.",rows:6}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Tip: Use ","{{FirstName}}"," and ","{{LastName}}"," as placeholders"]})]})]}),r.jsxs(ni,{children:[r.jsx(te,{variant:"outline",onClick:()=>ie(!1),children:"Cancel"}),r.jsxs(te,{onClick:Fe,disabled:!me.trim()||!ve.trim()||k.isPending,children:[r.jsx(dg,{className:"h-4 w-4 mr-2"}),"Create & Use Script"]})]})]})})]})}const _wt="0dde5abb-0005-4c8c-a471-30d0cbc9e280",bwt=[{value:"30",label:"Monthly (30 days)"},{value:"60",label:"Bi-Monthly (60 days)"},{value:"90",label:"Quarterly (90 days)"},{value:"180",label:"Twice a Year (180 days)"},{value:"365",label:"Yearly (365 days)"}];function wwt(){const t=es(),e=aze(),{data:n}=nze(),{data:s}=Ag(),{data:i}=axe(),{data:o}=gI(90),{data:c}=mm(),a=Xbt(),f=oze(),m=Zbt(),y=Ybt(),{data:v=[],isLoading:w}=rr({queryKey:["popby-templates"],queryFn:async()=>{const{data:xe,error:ie}=await ee.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).eq("category_id",_wt).order("publish_date",{ascending:!1});if(ie)throw ie;const{data:me}=await ee.from("template_likes").select("template_id"),{data:fe}=await ee.from("template_comments").select("template_id"),ve=new Map;me==null||me.forEach(Se=>{ve.set(Se.template_id,(ve.get(Se.template_id)||0)+1)});const Ie=new Map;return fe==null||fe.forEach(Se=>{Ie.set(Se.template_id,(Ie.get(Se.template_id)||0)+1)}),(xe||[]).map(Se=>({...Se,likesCount:ve.get(Se.id)||0,commentsCount:Ie.get(Se.id)||0}))}}),k=xe=>{const ie=c==null?void 0:c.find(me=>me.id===xe);return ie?`${ie.first_name} ${ie.last_name||""}`.trim():"Unknown"},C=xe=>{if(!xe)return null;const ie=n==null?void 0:n.find(me=>me.id===xe);return(ie==null?void 0:ie.name)||null},[S,T]=P.useState(null),[I,A]=P.useState(!1),[D,$]=P.useState(!1),[F,q]=P.useState(!1),[W,K]=P.useState({popby_item_id:"",notes:""}),[Z,re]=P.useState({name:"",description:""}),he=async()=>{S&&(await f.mutateAsync({contact_id:S.id,popby_item_id:W.popby_item_id||void 0,notes:W.notes||void 0}),A(!1),T(null),K({popby_item_id:"",notes:""}))},ue=async()=>{Z.name.trim()&&(await m.mutateAsync({name:Z.name.trim(),description:Z.description.trim()||void 0}),q(!1),re({name:"",description:""}))},Ne=async(xe,ie)=>{await y.mutateAsync({relationship_type_id:xe,frequency_days:parseInt(ie)})},se=xe=>{var me;const ie=i==null?void 0:i.find(fe=>fe.relationship_type_id===xe);return((me=ie==null?void 0:ie.frequency_days)==null?void 0:me.toString())||"90"};return r.jsx(Or,{title:"Popbys",description:"Drop off gifts to stay top of mind",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Popbys"}),r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0.5 rounded border border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10",children:"Beta"})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsx(Ye,{children:r.jsxs(Je,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-3xl font-bold text-primary",children:a.thisWeekCount}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"This Week"})]})}),r.jsx(Ye,{children:r.jsxs(Je,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-3xl font-bold text-emerald-500",children:a.thisMonthCount}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"This Month"})]})}),r.jsx(Ye,{children:r.jsxs(Je,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-3xl font-bold text-amber-500",children:a.dueCount}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Due Now"})]})})]}),r.jsxs("div",{className:"flex gap-2 flex-wrap",children:[r.jsxs(te,{onClick:()=>t("/innercircle/popbys/map"),children:[r.jsx(yl,{className:"h-4 w-4 mr-2"}),"View Map"]}),r.jsxs(te,{variant:"outline",onClick:()=>$(!0),children:[r.jsx(id,{className:"h-4 w-4 mr-2"}),"Frequency Settings"]}),r.jsxs(te,{variant:"outline",onClick:()=>q(!0),children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Add Popby Idea"]})]}),r.jsxs(La,{defaultValue:"due",children:[r.jsxs(Ma,{children:[r.jsx(yn,{value:"due",children:"Due for Popby"}),r.jsx(yn,{value:"activity",children:"Recent Activity"}),r.jsx(yn,{value:"library",children:"Popby Library"}),r.jsx(yn,{value:"templates",children:"Popby Templates"})]}),r.jsx($n,{value:"due",className:"space-y-4 mt-4",children:!e||e.length===0?r.jsx(Ye,{children:r.jsxs(Je,{className:"p-8 text-center text-muted-foreground",children:[r.jsx(Qa,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No contacts due for a popby right now!"}),r.jsx("p",{className:"text-sm mt-1",children:"Great job staying connected."})]})}):r.jsx("div",{className:"space-y-3",children:e.map(xe=>r.jsx(Ye,{className:"hover:shadow-md transition-shadow",children:r.jsx(Je,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"font-medium",children:[xe.first_name," ",xe.last_name]}),xe.daysOverdue>0&&r.jsxs(Rt,{variant:"destructive",className:"text-xs",children:[xe.daysOverdue,"+ days overdue"]}),xe.daysSinceLastPopby===null&&r.jsx(Rt,{variant:"outline",className:"text-xs",children:"Never visited"})]}),r.jsxs("div",{className:"flex items-center gap-4 mt-1 text-sm text-muted-foreground",children:[xe.address&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(yl,{className:"h-3 w-3"}),xe.city||xe.address]}),xe.tags&&xe.tags.length>0&&r.jsx("span",{children:xe.tags.map(ie=>{var me;return(me=ie.relationship_type)==null?void 0:me.name}).join(", ")})]}),xe.lastPopby&&r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Last popby: ",un(new Date(xe.lastPopby),"MMM d, yyyy")]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[xe.phone&&r.jsx(te,{size:"sm",variant:"ghost",asChild:!0,children:r.jsx("a",{href:`tel:${xe.phone}`,children:r.jsx(Wa,{className:"h-4 w-4"})})}),r.jsxs(te,{size:"sm",onClick:()=>{T(xe),A(!0)},children:[r.jsx(za,{className:"h-4 w-4 mr-1"}),"Log Popby"]})]})]})})},xe.id))})}),r.jsx($n,{value:"activity",className:"space-y-4 mt-4",children:!o||o.length===0?r.jsx(Ye,{children:r.jsxs(Je,{className:"p-8 text-center text-muted-foreground",children:[r.jsx(Xi,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No popby activity yet!"}),r.jsx("p",{className:"text-sm mt-1",children:"Start logging popbys to see your history here."})]})}):r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsx(Yt,{className:"text-lg",children:"Recent Popby Log"})}),r.jsx(Je,{className:"space-y-3",children:o.map(xe=>r.jsxs("div",{className:"flex items-start gap-3 pb-3 border-b last:border-0 last:pb-0",children:[r.jsx("div",{className:"h-10 w-10 rounded-full bg-orange-500/10 flex items-center justify-center",children:r.jsx(Qa,{className:"h-5 w-5 text-orange-500"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx("span",{className:"font-medium",children:k(xe.contact_id)}),C(xe.popby_item_id)&&r.jsx(Rt,{variant:"secondary",className:"text-xs",children:C(xe.popby_item_id)})]}),r.jsx("div",{className:"text-sm text-muted-foreground",children:un(new Date(xe.completed_at),"MMM d, yyyy h:mm a")}),xe.notes&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:xe.notes})]})]},xe.id))})]})}),r.jsx($n,{value:"library",className:"space-y-4 mt-4",children:r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[n==null?void 0:n.map(xe=>r.jsx(Ye,{children:r.jsx(Je,{className:"p-4",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(Qa,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"font-medium",children:xe.name}),xe.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:xe.description}),!xe.owner_user_id&&r.jsx(Rt,{variant:"secondary",className:"mt-2 text-xs",children:"Shared"})]})]})})},xe.id)),r.jsx(Ye,{className:"border-dashed cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>q(!0),children:r.jsx(Je,{className:"p-4 flex items-center justify-center h-full min-h-[100px]",children:r.jsxs("div",{className:"text-center text-muted-foreground",children:[r.jsx(Sn,{className:"h-8 w-8 mx-auto mb-2"}),r.jsx("p",{children:"Add New Popby Idea"})]})})})]})}),r.jsxs($n,{value:"templates",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:[v.length," template",v.length!==1?"s":""," found"]}),w&&r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:[...Array(4)].map((xe,ie)=>r.jsx(Ye,{children:r.jsxs(Je,{className:"p-4",children:[r.jsx(Gr,{className:"aspect-[3/2] w-full rounded-lg mb-4"}),r.jsx(Gr,{className:"h-5 w-3/4 mb-2"}),r.jsx(Gr,{className:"h-4 w-full mb-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Gr,{className:"h-5 w-16"}),r.jsx(Gr,{className:"h-5 w-20"})]})]})},ie))}),!w&&v.length===0&&r.jsx(Ye,{children:r.jsxs(Je,{className:"p-8 text-center text-muted-foreground",children:[r.jsx(Tl,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No popby templates available yet!"}),r.jsx("p",{className:"text-sm mt-1",children:"Check back soon for new templates."})]})}),!w&&v.length>0&&r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:v.map(xe=>r.jsxs(Ye,{className:"group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer",onClick:()=>t(`/templates/${xe.id}`),children:[r.jsx("div",{className:"relative overflow-hidden bg-muted aspect-[3/2]",children:xe.preview_image_url?r.jsx("img",{src:xe.preview_image_url,alt:xe.name,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:"No Preview"})}),r.jsxs(Je,{className:"p-4 flex flex-col",children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:xe.name}),xe.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3 flex-1",children:jne(xe.description)}),r.jsx("div",{className:"flex flex-wrap gap-2 mb-3",children:r.jsx(Rt,{variant:"secondary",className:"text-xs",children:"PopBys"})}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground mb-3",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Zd,{className:"h-3.5 w-3.5"}),xe.likesCount]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Hl,{className:"h-3.5 w-3.5"}),xe.commentsCount]})]}),r.jsxs(te,{size:"sm",className:"w-full gap-2",onClick:ie=>{ie.stopPropagation(),t(`/templates/${xe.id}`)},children:[r.jsx(Fs,{className:"h-4 w-4"}),"View Template"]})]})]},xe.id))})]})]}),r.jsx($r,{open:I,onOpenChange:A,children:r.jsxs(zr,{children:[r.jsx(Zr,{children:r.jsxs(Kr,{children:["Log Popby for ",S==null?void 0:S.first_name," ",S==null?void 0:S.last_name]})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Popby Item (optional)"}),r.jsxs(_n,{value:W.popby_item_id,onValueChange:xe=>K(ie=>({...ie,popby_item_id:xe})),children:[r.jsx(xn,{children:r.jsx(bn,{placeholder:"Select a popby item..."})}),r.jsx(vn,{children:n==null?void 0:n.map(xe=>r.jsx(er,{value:xe.id,children:xe.name},xe.id))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Notes (optional)"}),r.jsx(ps,{placeholder:"Any notes about this popby...",value:W.notes,onChange:xe=>K(ie=>({...ie,notes:xe.target.value}))})]})]}),r.jsxs(ni,{children:[r.jsx(te,{variant:"outline",onClick:()=>A(!1),children:"Cancel"}),r.jsx(te,{onClick:he,disabled:f.isPending,children:"Log Popby"})]})]})}),r.jsx($r,{open:D,onOpenChange:$,children:r.jsxs(zr,{className:"max-w-md",children:[r.jsx(Zr,{children:r.jsx(Kr,{children:"Popby Frequency Settings"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Set default popby frequency for each relationship type. You can override these per-contact."}),s==null?void 0:s.map(xe=>r.jsxs("div",{className:"flex items-center justify-between gap-4",children:[r.jsx(Qe,{className:"font-medium",children:xe.name}),r.jsxs(_n,{value:se(xe.id),onValueChange:ie=>Ne(xe.id,ie),children:[r.jsx(xn,{className:"w-[180px]",children:r.jsx(bn,{})}),r.jsx(vn,{children:bwt.map(ie=>r.jsx(er,{value:ie.value,children:ie.label},ie.value))})]})]},xe.id))]}),r.jsx(ni,{children:r.jsx(te,{onClick:()=>$(!1),children:"Done"})})]})}),r.jsx($r,{open:F,onOpenChange:q,children:r.jsxs(zr,{children:[r.jsx(Zr,{children:r.jsx(Kr,{children:"Add Popby Idea"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Name *"}),r.jsx(yt,{placeholder:"e.g., Homemade cookies",value:Z.name,onChange:xe=>re(ie=>({...ie,name:xe.target.value}))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Description"}),r.jsx(ps,{placeholder:"Optional description...",value:Z.description,onChange:xe=>re(ie=>({...ie,description:xe.target.value}))})]})]}),r.jsxs(ni,{children:[r.jsx(te,{variant:"outline",onClick:()=>q(!1),children:"Cancel"}),r.jsx(te,{onClick:ue,disabled:!Z.name.trim()||m.isPending,children:"Add Item"})]})]})})]})})}var dze={exports:{}};(function(t,e){(function(n,s){t.exports=s()})(_y,function(){var n,s,i;function o(a,f){if(!n)n=f;else if(!s)s=f;else{var m="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+n+")(sharedChunk); ("+s+")(sharedChunk); self.onerror = null;",y={};n(y),i=f(y),typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(i.workerUrl=window.URL.createObjectURL(new Blob([m],{type:"text/javascript"})))}}o(["exports"],function(a){var f=1e-6,m=typeof Float32Array<"u"?Float32Array:Array;function y(h,l){var u=l[0],g=l[1],x=l[2],j=l[3],N=u*j-x*g;return N?(h[0]=j*(N=1/N),h[1]=-g*N,h[2]=-x*N,h[3]=u*N,h):null}function v(){var h=new m(9);return m!=Float32Array&&(h[1]=0,h[2]=0,h[3]=0,h[5]=0,h[6]=0,h[7]=0),h[0]=1,h[4]=1,h[8]=1,h}function w(h,l){var u=l[0],g=l[1],x=l[2],j=l[3],N=l[4],E=l[5],R=l[6],B=l[7],H=l[8];return h[0]=N*H-E*B,h[1]=x*B-g*H,h[2]=g*E-x*N,h[3]=E*R-j*H,h[4]=u*H-x*R,h[5]=x*j-u*E,h[6]=j*B-N*R,h[7]=g*R-u*B,h[8]=u*N-g*j,h}function k(h,l,u){var g=l[0],x=l[1],j=l[2],N=l[3],E=l[4],R=l[5],B=l[6],H=l[7],G=l[8],X=u[0],J=u[1],ne=u[2],pe=u[3],ke=u[4],we=u[5],De=u[6],Be=u[7],He=u[8];return h[0]=X*g+J*N+ne*B,h[1]=X*x+J*E+ne*H,h[2]=X*j+J*R+ne*G,h[3]=pe*g+ke*N+we*B,h[4]=pe*x+ke*E+we*H,h[5]=pe*j+ke*R+we*G,h[6]=De*g+Be*N+He*B,h[7]=De*x+Be*E+He*H,h[8]=De*j+Be*R+He*G,h}function C(){var h=new m(16);return m!=Float32Array&&(h[1]=0,h[2]=0,h[3]=0,h[4]=0,h[6]=0,h[7]=0,h[8]=0,h[9]=0,h[11]=0,h[12]=0,h[13]=0,h[14]=0),h[0]=1,h[5]=1,h[10]=1,h[15]=1,h}function S(h){var l=new m(16);return l[0]=h[0],l[1]=h[1],l[2]=h[2],l[3]=h[3],l[4]=h[4],l[5]=h[5],l[6]=h[6],l[7]=h[7],l[8]=h[8],l[9]=h[9],l[10]=h[10],l[11]=h[11],l[12]=h[12],l[13]=h[13],l[14]=h[14],l[15]=h[15],l}function T(h){return h[0]=1,h[1]=0,h[2]=0,h[3]=0,h[4]=0,h[5]=1,h[6]=0,h[7]=0,h[8]=0,h[9]=0,h[10]=1,h[11]=0,h[12]=0,h[13]=0,h[14]=0,h[15]=1,h}function I(h,l){var u=l[0],g=l[1],x=l[2],j=l[3],N=l[4],E=l[5],R=l[6],B=l[7],H=l[8],G=l[9],X=l[10],J=l[11],ne=l[12],pe=l[13],ke=l[14],we=l[15],De=u*E-g*N,Be=u*R-x*N,He=u*B-j*N,dt=g*R-x*E,it=g*B-j*E,pt=x*B-j*R,wt=H*pe-G*ne,Ct=H*ke-X*ne,Wt=H*we-J*ne,Lt=G*ke-X*pe,Qt=G*we-J*pe,ar=X*we-J*ke,or=De*ar-Be*Qt+He*Lt+dt*Wt-it*Ct+pt*wt;return or?(h[0]=(E*ar-R*Qt+B*Lt)*(or=1/or),h[1]=(x*Qt-g*ar-j*Lt)*or,h[2]=(pe*pt-ke*it+we*dt)*or,h[3]=(X*it-G*pt-J*dt)*or,h[4]=(R*Wt-N*ar-B*Ct)*or,h[5]=(u*ar-x*Wt+j*Ct)*or,h[6]=(ke*He-ne*pt-we*Be)*or,h[7]=(H*pt-X*He+J*Be)*or,h[8]=(N*Qt-E*Wt+B*wt)*or,h[9]=(g*Wt-u*Qt-j*wt)*or,h[10]=(ne*it-pe*He+we*De)*or,h[11]=(G*He-H*it-J*De)*or,h[12]=(E*Ct-N*Lt-R*wt)*or,h[13]=(u*Lt-g*Ct+x*wt)*or,h[14]=(pe*Be-ne*dt-ke*De)*or,h[15]=(H*dt-G*Be+X*De)*or,h):null}function A(h,l,u){var g=l[0],x=l[1],j=l[2],N=l[3],E=l[4],R=l[5],B=l[6],H=l[7],G=l[8],X=l[9],J=l[10],ne=l[11],pe=l[12],ke=l[13],we=l[14],De=l[15],Be=u[0],He=u[1],dt=u[2],it=u[3];return h[0]=Be*g+He*E+dt*G+it*pe,h[1]=Be*x+He*R+dt*X+it*ke,h[2]=Be*j+He*B+dt*J+it*we,h[3]=Be*N+He*H+dt*ne+it*De,h[4]=(Be=u[4])*g+(He=u[5])*E+(dt=u[6])*G+(it=u[7])*pe,h[5]=Be*x+He*R+dt*X+it*ke,h[6]=Be*j+He*B+dt*J+it*we,h[7]=Be*N+He*H+dt*ne+it*De,h[8]=(Be=u[8])*g+(He=u[9])*E+(dt=u[10])*G+(it=u[11])*pe,h[9]=Be*x+He*R+dt*X+it*ke,h[10]=Be*j+He*B+dt*J+it*we,h[11]=Be*N+He*H+dt*ne+it*De,h[12]=(Be=u[12])*g+(He=u[13])*E+(dt=u[14])*G+(it=u[15])*pe,h[13]=Be*x+He*R+dt*X+it*ke,h[14]=Be*j+He*B+dt*J+it*we,h[15]=Be*N+He*H+dt*ne+it*De,h}function D(h,l,u){var g,x,j,N,E,R,B,H,G,X,J,ne,pe=u[0],ke=u[1],we=u[2];return l===h?(h[12]=l[0]*pe+l[4]*ke+l[8]*we+l[12],h[13]=l[1]*pe+l[5]*ke+l[9]*we+l[13],h[14]=l[2]*pe+l[6]*ke+l[10]*we+l[14],h[15]=l[3]*pe+l[7]*ke+l[11]*we+l[15]):(x=l[1],j=l[2],N=l[3],E=l[4],R=l[5],B=l[6],H=l[7],G=l[8],X=l[9],J=l[10],ne=l[11],h[0]=g=l[0],h[1]=x,h[2]=j,h[3]=N,h[4]=E,h[5]=R,h[6]=B,h[7]=H,h[8]=G,h[9]=X,h[10]=J,h[11]=ne,h[12]=g*pe+E*ke+G*we+l[12],h[13]=x*pe+R*ke+X*we+l[13],h[14]=j*pe+B*ke+J*we+l[14],h[15]=N*pe+H*ke+ne*we+l[15]),h}function $(h,l,u){var g=u[0],x=u[1],j=u[2];return h[0]=l[0]*g,h[1]=l[1]*g,h[2]=l[2]*g,h[3]=l[3]*g,h[4]=l[4]*x,h[5]=l[5]*x,h[6]=l[6]*x,h[7]=l[7]*x,h[8]=l[8]*j,h[9]=l[9]*j,h[10]=l[10]*j,h[11]=l[11]*j,h[12]=l[12],h[13]=l[13],h[14]=l[14],h[15]=l[15],h}function F(h,l,u){var g=Math.sin(u),x=Math.cos(u),j=l[4],N=l[5],E=l[6],R=l[7],B=l[8],H=l[9],G=l[10],X=l[11];return l!==h&&(h[0]=l[0],h[1]=l[1],h[2]=l[2],h[3]=l[3],h[12]=l[12],h[13]=l[13],h[14]=l[14],h[15]=l[15]),h[4]=j*x+B*g,h[5]=N*x+H*g,h[6]=E*x+G*g,h[7]=R*x+X*g,h[8]=B*x-j*g,h[9]=H*x-N*g,h[10]=G*x-E*g,h[11]=X*x-R*g,h}function q(h,l,u){var g=Math.sin(u),x=Math.cos(u),j=l[0],N=l[1],E=l[2],R=l[3],B=l[8],H=l[9],G=l[10],X=l[11];return l!==h&&(h[4]=l[4],h[5]=l[5],h[6]=l[6],h[7]=l[7],h[12]=l[12],h[13]=l[13],h[14]=l[14],h[15]=l[15]),h[0]=j*x-B*g,h[1]=N*x-H*g,h[2]=E*x-G*g,h[3]=R*x-X*g,h[8]=j*g+B*x,h[9]=N*g+H*x,h[10]=E*g+G*x,h[11]=R*g+X*x,h}function W(h,l,u){var g=Math.sin(u),x=Math.cos(u),j=l[0],N=l[1],E=l[2],R=l[3],B=l[4],H=l[5],G=l[6],X=l[7];return l!==h&&(h[8]=l[8],h[9]=l[9],h[10]=l[10],h[11]=l[11],h[12]=l[12],h[13]=l[13],h[14]=l[14],h[15]=l[15]),h[0]=j*x+B*g,h[1]=N*x+H*g,h[2]=E*x+G*g,h[3]=R*x+X*g,h[4]=B*x-j*g,h[5]=H*x-N*g,h[6]=G*x-E*g,h[7]=X*x-R*g,h}function K(h,l){return h[0]=l[0],h[1]=0,h[2]=0,h[3]=0,h[4]=0,h[5]=l[1],h[6]=0,h[7]=0,h[8]=0,h[9]=0,h[10]=l[2],h[11]=0,h[12]=0,h[13]=0,h[14]=0,h[15]=1,h}function Z(h,l,u){var g,x,j,N=u[0],E=u[1],R=u[2],B=Math.sqrt(N*N+E*E+R*R);return B0&&(j=1/Math.sqrt(j)),h[0]=l[0]*j,h[1]=l[1]*j,h[2]=l[2]*j,h}function Ae(h,l){return h[0]*l[0]+h[1]*l[1]+h[2]*l[2]}function nt(h,l,u){var g=l[0],x=l[1],j=l[2],N=u[0],E=u[1],R=u[2];return h[0]=x*R-j*E,h[1]=j*N-g*R,h[2]=g*E-x*N,h}function Te(h,l,u,g){var x=l[0],j=l[1],N=l[2];return h[0]=x+g*(u[0]-x),h[1]=j+g*(u[1]-j),h[2]=N+g*(u[2]-N),h}function Xe(h,l,u){var g=l[0],x=l[1],j=l[2],N=u[3]*g+u[7]*x+u[11]*j+u[15];return h[0]=(u[0]*g+u[4]*x+u[8]*j+u[12])/(N=N||1),h[1]=(u[1]*g+u[5]*x+u[9]*j+u[13])/N,h[2]=(u[2]*g+u[6]*x+u[10]*j+u[14])/N,h}function ge(h,l,u){var g=l[0],x=l[1],j=l[2];return h[0]=g*u[0]+x*u[3]+j*u[6],h[1]=g*u[1]+x*u[4]+j*u[7],h[2]=g*u[2]+x*u[5]+j*u[8],h}function mt(h,l,u){var g=u[0],x=u[1],j=u[2],N=u[3],E=l[0],R=l[1],B=l[2],H=x*B-j*R,G=j*E-g*B,X=g*R-x*E;return h[0]=E+N*(H+=H)+x*(X+=X)-j*(G+=G),h[1]=R+N*G+j*H-g*X,h[2]=B+N*X+g*G-x*H,h}function rt(h){return h[0]=0,h[1]=0,h[2]=0,h}function We(h,l){return h[0]===l[0]&&h[1]===l[1]&&h[2]===l[2]}var Ce=ve,et=Ie,Fe=xe;function Ke(){var h=new m(4);return m!=Float32Array&&(h[0]=0,h[1]=0,h[2]=0,h[3]=0),h}function Le(h,l,u){return h[0]=l[0]*u,h[1]=l[1]*u,h[2]=l[2]*u,h[3]=l[3]*u,h}function ft(h,l){var u=l[0],g=l[1],x=l[2],j=l[3],N=u*u+g*g+x*x+j*j;return N>0&&(N=1/Math.sqrt(N)),h[0]=u*N,h[1]=g*N,h[2]=x*N,h[3]=j*N,h}function Nt(h,l,u){var g=l[0],x=l[1],j=l[2],N=l[3];return h[0]=u[0]*g+u[4]*x+u[8]*j+u[12]*N,h[1]=u[1]*g+u[5]*x+u[9]*j+u[13]*N,h[2]=u[2]*g+u[6]*x+u[10]*j+u[14]*N,h[3]=u[3]*g+u[7]*x+u[11]*j+u[15]*N,h}function Mt(){var h=new m(4);return m!=Float32Array&&(h[0]=0,h[1]=0,h[2]=0),h[3]=1,h}function It(h){return h[0]=0,h[1]=0,h[2]=0,h[3]=1,h}function tr(h,l,u){u*=.5;var g=l[0],x=l[1],j=l[2],N=l[3],E=Math.sin(u),R=Math.cos(u);return h[0]=g*R+N*E,h[1]=x*R+j*E,h[2]=j*R-x*E,h[3]=N*R-g*E,h}function Mr(h,l,u){u*=.5;var g=l[0],x=l[1],j=l[2],N=l[3],E=Math.sin(u),R=Math.cos(u);return h[0]=g*R-j*E,h[1]=x*R+N*E,h[2]=j*R+g*E,h[3]=N*R-x*E,h}Ne(),Ke();var pn,fs,Qn,js=ft,Qs=(pn=Ne(),fs=ie(1,0,0),Qn=ie(0,1,0),function(h,l,u){var g=Ae(l,u);return g<-.999999?(nt(pn,fs,l),Fe(pn)<1e-6&&nt(pn,Qn,l),Pe(pn,pn),function(x,j,N){N*=.5;var E=Math.sin(N);x[0]=E*j[0],x[1]=E*j[1],x[2]=E*j[2],x[3]=Math.cos(N)}(h,pn,Math.PI),h):g>.999999?(h[0]=0,h[1]=0,h[2]=0,h[3]=1,h):(nt(pn,l,u),h[0]=pn[0],h[1]=pn[1],h[2]=pn[2],h[3]=1+g,js(h,h))});function si(){var h=new m(2);return m!=Float32Array&&(h[0]=0,h[1]=0),h}function wr(h,l){var u=new m(2);return u[0]=h,u[1]=l,u}function Ts(h,l,u){return h[0]=l,h[1]=u,h}function ii(h,l,u){return h[0]=l[0]+u[0],h[1]=l[1]+u[1],h}function mi(h,l,u){return h[0]=l[0]-u[0],h[1]=l[1]-u[1],h}function Ta(h,l,u){return h[0]=l[0]*u,h[1]=l[1]*u,h}function ga(h){var l=h[0],u=h[1];return Math.sqrt(l*l+u*u)}function vl(h,l){var u=l[0],g=l[1],x=u*u+g*g;return x>0&&(x=1/Math.sqrt(x)),h[0]=l[0]*x,h[1]=l[1]*x,h}function Yo(h,l){return h[0]*l[0]+h[1]*l[1]}Mt(),Mt(),v();var Ds,Ki,_s=mi;function yi(h){return h&&h.__esModule&&Object.prototype.hasOwnProperty.call(h,"default")?h.default:h}si();var Ni=function(){if(Ki)return Ds;function h(l,u,g,x){this.cx=3*l,this.bx=3*(g-l)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*u,this.by=3*(x-u)-this.cy,this.ay=1-this.cy-this.by,this.p1x=l,this.p1y=u,this.p2x=g,this.p2y=x}return Ki=1,Ds=h,h.prototype={sampleCurveX:function(l){return((this.ax*l+this.bx)*l+this.cx)*l},sampleCurveY:function(l){return((this.ay*l+this.by)*l+this.cy)*l},sampleCurveDerivativeX:function(l){return(3*this.ax*l+2*this.bx)*l+this.cx},solveCurveX:function(l,u){if(u===void 0&&(u=1e-6),l<0)return 0;if(l>1)return 1;for(var g=l,x=0;x<8;x++){var j=this.sampleCurveX(g)-l;if(Math.abs(j)j?E=g:R=g,g=.5*(R-E)+E;return g},solve:function(l,u){return this.sampleCurveY(this.solveCurveX(l,u))}},Ds}(),Oo=yi(Ni);function sr(h,l){this.x=h,this.y=l}function fo(h,l){if(Array.isArray(h)){if(!Array.isArray(l)||h.length!==l.length)return!1;for(let u=0;u=1)return 1;const l=h*h,u=l*h;return 4*(h<.5?u:3*(h-l)+u-.75)}function Ln(h,l,u,g){const x=new Oo(h,l,u,g);return function(j){return x.solve(j)}}const xt=Ln(.25,.1,.25,1);function _e(h,l,u){return Math.min(u,Math.max(l,h))}function ze(h,l,u){return(u=_e((u-h)/(l-h),0,1))*u*(3-2*u)}function tt(h,l,u){const g=u-l,x=((h-l)%g+g)%g+l;return x===l?u:x}function kt(h,l,u){if(!h.length)return u(null,[]);let g=h.length;const x=new Array(h.length);let j=null;h.forEach((N,E)=>{l(N,(R,B)=>{R&&(j=R),x[E]=B,--g==0&&u(j,x)})})}let bt=1;function Et(){return bt++}function $t(h){return h<=1?1:Math.pow(2,Math.ceil(Math.log2(h)))}function Ot(h,l){h.forEach(u=>{l[u]&&(l[u]=l[u].bind(l))})}function Bt(h,l,u){const g={};for(const x in h)g[x]=l.call(this,h[x],x,h);return g}function mr(h,l,u){const g={};for(const x in h)l.call(this,h[x],x,h)&&(g[x]=h[x]);return g}function ir(h){return Array.isArray(h)?h.map(ir):typeof h=="object"&&h?Bt(h,ir):h}function Wr(h,l){for(let u=0;u=0)return!0;return!1}const en={};function Br(h){en[h]||(typeof console<"u"&&console.warn(h),en[h]=!0)}function Zn(h,l,u){return(u.y-h.y)*(l.x-h.x)>(l.y-h.y)*(u.x-h.x)}function Wn(h){let l=0;for(let u,g,x=0,j=h.length,N=j-1;x@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(u,g,x,j)=>{const N=x||j;return l[g]=!N||N.toLowerCase(),""}),l["max-age"]){const u=parseInt(l["max-age"],10);isNaN(u)?delete l["max-age"]:l["max-age"]=u}return l}let $a=null;function Aa(h,l){return[h[4*l],h[4*l+1],h[4*l+2],h[4*l+3]]}function lo(h,l,u,g){for(;l>1;h[x]>1;h[x]<=g?l=x+1:u=x}return l}function zs(h){return h>0?1/(1.001-h):1+h}function ca(h){return h>0?1-1/(1.001-h):-h}function Di(h,l,u){return(h-l.min)*(u.max-u.min)/(l.max-l.min)+u.min}const bs={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i},get API_TILEJSON_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},get API_CDN_URL_REGEX(){return/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i},get EVENTS_URL(){if(!bs.API_URL)return null;try{const h=new URL(bs.API_URL);return h.hostname==="api.mapbox.cn"?"https://events.mapbox.cn/events/v2":h.hostname==="api.mapbox.com"?"https://events.mapbox.com/events/v2":null}catch{return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",RASTERARRAYS_URL_PREFIX:"rasterarrays/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,DEFAULT_STYLE:"mapbox://styles/mapbox/standard",MAX_PARALLEL_IMAGE_REQUESTS:16,DRACO_URL:"https://api.mapbox.com/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",MESHOPT_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_base_v0.20.wasm",MESHOPT_SIMD_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_simd_v0.20.wasm",BUILDING_GEN_URL:"https://api.mapbox.com/mapbox-gl-js/building-gen/building_gen_v1.2.4.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1"};function Da(h){return bs.API_URL_REGEX.test(h)}function _l(h){return bs.API_SPRITE_REGEX.test(h)}let El,Nc,ep,Xo,hd,Qo;function eu(){return El==null&&(El=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&typeof self.createImageBitmap=="function"),El}const Do={now:()=>Xo!==void 0?Xo:performance.now(),setNow(h){Xo=h},restoreNow(){Xo=void 0},frame(h){const l=requestAnimationFrame(h);return{cancel:()=>cancelAnimationFrame(l)}},getImageData(h,l=0){const{width:u,height:g}=h;hd||(hd=document.createElement("canvas"));const x=hd.getContext("2d",{willReadFrequently:!0});if(!x)throw new Error("failed to create canvas 2d context");return(u>hd.width||g>hd.height)&&(hd.width=u,hd.height=g),x.clearRect(-l,-l,u+2*l,g+2*l),x.drawImage(h,0,0,u,g),x.getImageData(-l,-l,u+2*l,g+2*l)},resolveURL:h=>(Nc||(Nc=document.createElement("a")),Nc.href=h,Nc.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(ep==null&&(ep=window.matchMedia("(prefers-reduced-motion: reduce)")),ep.matches)},hasCanvasFingerprintNoise(){if(Qo!==void 0)return Qo;if(!eu())return Qo=!1,!1;const h=new OffscreenCanvas(85,1),l=h.getContext("2d",{willReadFrequently:!0});let u=0;for(let x=0;x0?`?${j}`:""}`}const Yl="mapbox-tiles";let tp=500,xm=50;const $c=["language","worldview","jobid"];let Ru,Sc;function Uc(){try{return caches}catch{}}function fd(){const h=Uc();h&&Ru==null&&(Ru=h.open(Yl))}let Pd=1/0;const tu={supported:!1,testSupport:function(h){!nx&&rp&&(np?Wj(h):Fu=h)}};let Fu,rp,nx=!1,np=!1;const sp=typeof self<"u"?self:{};function Wj(h){const l=h.createTexture();h.bindTexture(h.TEXTURE_2D,l);try{if(h.texImage2D(h.TEXTURE_2D,0,h.RGBA,h.RGBA,h.UNSIGNED_BYTE,rp),h.isContextLost())return;tu.supported=!0}catch{}h.deleteTexture(l),nx=!0}sp.document&&(rp=sp.document.createElement("img"),rp.onload=function(){Fu&&Wj(Fu),Fu=null,np=!0},rp.onerror=function(){nx=!0,Fu=null},rp.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const Pg={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Iconset:"Iconset",Image:"Image",Model:"Model"};typeof Object.freeze=="function"&&Object.freeze(Pg);class qc extends Error{constructor(l,u,g){u===401&&Da(g)&&(l+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(l),this.status=u,this.url=g}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const sx=Ps()?()=>self.worker.referrer:()=>(location.protocol==="blob:"?parent:self).location.href,ip=function(h,l){if(!(/^file:/.test(u=h.url)||/^file:/.test(sx())&&!/^\w+:/.test(u))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return function(g,x){const j=new AbortController,N=new Request(g.url,{method:g.method||"GET",body:g.body,credentials:g.credentials,headers:g.headers,referrer:sx(),referrerPolicy:g.referrerPolicy,signal:j.signal});let E=!1,R=!1;const B=(H=N.url).indexOf("sku=")>0&&Da(H);var H;g.type==="json"&&N.headers.set("Accept","application/json");const G=(J,ne,pe)=>{if(R)return;if(J&&J.message!=="SecurityError"&&Br(J.toString()),ne&&pe)return X(ne);const ke=Date.now();fetch(N).then(we=>{if(we.ok){const De=B?we.clone():null;return X(we,De,ke)}return x(new qc(we.statusText,we.status,g.url))}).catch(we=>{we.name!=="AbortError"&&x(new Error(`${we.message} ${g.url}`))})},X=(J,ne,pe)=>{(g.type==="arrayBuffer"?J.arrayBuffer():g.type==="json"?J.json():J.text()).then(ke=>{R||(ne&&pe&&function(we,De,Be){if(fd(),Ru==null)return;const He=wa(De.headers.get("Cache-Control")||"");if(He["no-store"])return;const dt={status:De.status,statusText:De.statusText,headers:new Headers};De.headers.forEach((wt,Ct)=>dt.headers.set(Ct,wt)),He["max-age"]&&dt.headers.set("Expires",new Date(Be+1e3*He["max-age"]).toUTCString());const it=dt.headers.get("Expires");if(!it||new Date(it).getTime()-Be<42e4)return;let pt=Du(we.url,{persistentParams:$c});if(De.status===206){const wt=we.headers.get("Range");if(!wt)return;dt.status=200,pt=ef(pt,{range:wt})}(function(wt,Ct){if(Sc===void 0)try{new Response(new ReadableStream),Sc=!0}catch{Sc=!1}Sc?Ct(wt.body):wt.blob().then(Ct).catch(Wt=>Br(Wt.message))})(De,wt=>{const Ct=new Response((Wt=De.status)!==200&&Wt!==404&&[101,103,204,205,304].includes(Wt)?null:wt,dt);var Wt;fd(),Ru!=null&&Ru.then(Lt=>Lt.put(pt,Ct)).catch(Lt=>Br(Lt.message))})}(N,ne,pe),E=!0,x(null,ke,J.headers))}).catch(ke=>{R||x(new Error(ke.message))})};return B?function(J,ne){if(fd(),Ru==null)return ne(null);Ru.then(pe=>{let ke=Du(J.url,{persistentParams:$c});const we=J.headers.get("Range");we&&(ke=ef(ke,{range:we})),pe.match(ke).then(De=>{const Be=function(He){if(!He)return!1;const dt=new Date(He.headers.get("Expires")||0),it=wa(He.headers.get("Cache-Control")||"");return Number(dt)>Date.now()&&!it["no-cache"]}(De);pe.delete(ke).catch(ne),Be&&pe.put(ke,De.clone()).catch(ne),ne(null,De,Be)}).catch(ne)}).catch(ne)}(N,G):G(null,null),{cancel:()=>{R=!0,E||j.abort()}}}(h,l);if(Ps(self)&&self.worker.actor)return self.worker.actor.send("getResource",h,l,void 0,!0)}var u;return function(g,x){const j=new XMLHttpRequest;j.open(g.method||"GET",g.url,!0),g.type==="arrayBuffer"&&(j.responseType="arraybuffer");for(const N in g.headers)j.setRequestHeader(N,g.headers[N]);return g.type==="json"&&(j.responseType="text",j.setRequestHeader("Accept","application/json")),j.withCredentials=g.credentials==="include",j.onerror=()=>{x(new Error(j.statusText))},j.onload=()=>{if((j.status>=200&&j.status<300||j.status===0)&&j.response!==null){let N=j.response;if(g.type==="json")try{N=JSON.parse(j.response)}catch(R){return x(R)}const E=new Headers;j.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(R=>{const B=R.split(": "),H=B.shift(),G=B.join(": ");E.append(H,G)}),x(null,N,E)}else x(new qc(j.statusText,j.status,g.url))},j.send(g.body),{cancel:()=>j.abort()}}(h,l)},zu=function(h,l){return ip(Object.assign(h,{type:"arrayBuffer"}),l)};function a3(h){const l=document.createElement("a");return l.href=h,l.protocol===location.protocol&&l.host===location.host}const jt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let Sr,lr;Sr=[],lr=0;const ys=function(h,l){if(tu.supported&&(h.headers||(h.headers={}),h.headers.accept="image/webp,*/*"),lr>=bs.MAX_PARALLEL_IMAGE_REQUESTS){const j={requestParameters:h,callback:l,cancelled:!1,cancel(){this.cancelled=!0}};return Sr.push(j),j}lr++;let u=!1;const g=()=>{if(!u)for(u=!0,lr--;Sr.length&&lr{g(),j?l(j):N&&(self.createImageBitmap?function(R,B){const H=new Blob([new Uint8Array(R)],{type:"image/png"});createImageBitmap(H).then(G=>{B(null,G)}).catch(G=>{B(new Error(`Could not load image because of ${G.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(N,(R,B)=>l(R,B,E)):function(R,B){const H=new Image;H.onload=()=>{B(null,H),URL.revokeObjectURL(H.src),H.onload=null,requestAnimationFrame(()=>{H.src=jt})},H.onerror=()=>B(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const G=new Blob([new Uint8Array(R)],{type:"image/png"});H.src=R.byteLength?URL.createObjectURL(G):jt}(N,(R,B)=>l(R,B,E)))});return{cancel:()=>{x.cancel(),g()}}};var Ls,jo,eo,to={exports:{}},Lg={exports:{}},$1={exports:{}},o3=function(){if(eo)return to.exports;eo=1;var h=(Ls||(Ls=1,Lg.exports=function(u,g){var x,j,N,E,R,B,H,G;for(j=u.length-(x=3&u.length),N=g,R=3432918353,B=461845907,G=0;G>>16)*R&65535)<<16)&4294967295)<<15|H>>>17))*B+(((H>>>16)*B&65535)<<16)&4294967295)<<13|N>>>19))+((5*(N>>>16)&65535)<<16)&4294967295))+((58964+(E>>>16)&65535)<<16);switch(H=0,x){case 3:H^=(255&u.charCodeAt(G+2))<<16;case 2:H^=(255&u.charCodeAt(G+1))<<8;case 1:N^=H=(65535&(H=(H=(65535&(H^=255&u.charCodeAt(G)))*R+(((H>>>16)*R&65535)<<16)&4294967295)<<15|H>>>17))*B+(((H>>>16)*B&65535)<<16)&4294967295}return N^=u.length,N=2246822507*(65535&(N^=N>>>16))+((2246822507*(N>>>16)&65535)<<16)&4294967295,N=3266489909*(65535&(N^=N>>>13))+((3266489909*(N>>>16)&65535)<<16)&4294967295,(N^=N>>>16)>>>0}),Lg.exports),l=(jo||(jo=1,$1.exports=function(u,g){for(var x,j=u.length,N=g^j,E=0;j>=4;)x=1540483477*(65535&(x=255&u.charCodeAt(E)|(255&u.charCodeAt(++E))<<8|(255&u.charCodeAt(++E))<<16|(255&u.charCodeAt(++E))<<24))+((1540483477*(x>>>16)&65535)<<16),N=1540483477*(65535&N)+((1540483477*(N>>>16)&65535)<<16)^(x=1540483477*(65535&(x^=x>>>24))+((1540483477*(x>>>16)&65535)<<16)),j-=4,++E;switch(j){case 3:N^=(255&u.charCodeAt(E+2))<<16;case 2:N^=(255&u.charCodeAt(E+1))<<8;case 1:N=1540483477*(65535&(N^=255&u.charCodeAt(E)))+((1540483477*(N>>>16)&65535)<<16)}return N=1540483477*(65535&(N^=N>>>13))+((1540483477*(N>>>16)&65535)<<16),(N^=N>>>15)>>>0}),$1.exports);return to.exports=h,to.exports.murmur3=h,to.exports.murmur2=l,to.exports}(),Gj=yi(o3);class tf{constructor(l,...u){Object.assign(this,u[0]||{}),this.type=l}}class U1 extends tf{constructor(l,u={}){super("error",Object.assign({error:l},u))}}function l3(h,l,u){u[h]&&u[h].indexOf(l)!==-1||(u[h]=u[h]||[],u[h].push(l))}function vm(h,l,u){if(u&&u[h]){const g=u[h].indexOf(l);g!==-1&&u[h].splice(g,1)}}class Og{on(l,u){return this._listeners=this._listeners||{},l3(l,u,this._listeners),this}off(l,u){return vm(l,u,this._listeners),vm(l,u,this._oneTimeListeners),this}once(l,u){return u?(this._oneTimeListeners=this._oneTimeListeners||{},l3(l,u,this._oneTimeListeners),this):new Promise(g=>{this.once(l,g)})}fire(l,u){const g=typeof l=="string"?new tf(l,u):l,x=g.type;if(this.listens(x)){g.target=this;const j=this._listeners&&this._listeners[x]?this._listeners[x].slice():[];for(const R of j)R.call(this,g);const N=this._oneTimeListeners&&this._oneTimeListeners[x]?this._oneTimeListeners[x].slice():[];for(const R of N)vm(x,R,this._oneTimeListeners),R.call(this,g);const E=this._eventedParent;if(E){const R=typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData;Object.assign(g,R),E.fire(g)}}else g instanceof U1&&console.error(g.error);return this}listens(l){return!!(this._listeners&&this._listeners[l]&&this._listeners[l].length>0||this._oneTimeListeners&&this._oneTimeListeners[l]&&this._oneTimeListeners[l].length>0||this._eventedParent&&this._eventedParent.listens(l))}setEventedParent(l,u){return this._eventedParent=l,this._eventedParentData=u,this}}class Cc{constructor(l){typeof l=="string"?this.name=l:(this.name=l.name,this.iconsetId=l.iconsetId)}static from(l){return new Cc(l)}static toString(l){return l.iconsetId?`${l.name}${l.iconsetId}`:l.name}static parse(l){const[u,g]=l.split("");return new Cc({name:u,iconsetId:g})}static isEqual(l,u){return l.name===u.name&&l.iconsetId===u.iconsetId}toString(){return Cc.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var Kj,q1={},Bu=function(){if(Kj)return q1;Kj=1;var h={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function l(j){return(j=Math.round(j))<0?0:j>255?255:j}function u(j){return l(j[j.length-1]==="%"?parseFloat(j)/100*255:parseInt(j))}function g(j){return(N=j[j.length-1]==="%"?parseFloat(j)/100:parseFloat(j))<0?0:N>1?1:N;var N}function x(j,N,E){return E<0?E+=1:E>1&&(E-=1),6*E<1?j+(N-j)*E*6:2*E<1?N:3*E<2?j+(N-j)*(2/3-E)*6:j}try{q1.parseCSSColor=function(j){var N,E=j.replace(/ /g,"").toLowerCase();if(E in h)return h[E].slice();if(E[0]==="#")return E.length===4?(N=parseInt(E.substr(1),16))>=0&&N<=4095?[(3840&N)>>4|(3840&N)>>8,240&N|(240&N)>>4,15&N|(15&N)<<4,1]:null:E.length===7&&(N=parseInt(E.substr(1),16))>=0&&N<=16777215?[(16711680&N)>>16,(65280&N)>>8,255&N,1]:null;var R=E.indexOf("("),B=E.indexOf(")");if(R!==-1&&B+1===E.length){var H=E.substr(0,R),G=E.substr(R+1,B-(R+1)).split(","),X=1;switch(H){case"rgba":if(G.length!==4)return null;X=g(G.pop());case"rgb":return G.length!==3?null:[u(G[0]),u(G[1]),u(G[2]),X];case"hsla":if(G.length!==4)return null;X=g(G.pop());case"hsl":if(G.length!==3)return null;var J=(parseFloat(G[0])%360+360)%360/360,ne=g(G[1]),pe=g(G[2]),ke=pe<=.5?pe*(ne+1):pe+ne-pe*ne,we=2*pe-ke;return[l(255*x(we,ke,J+1/3)),l(255*x(we,ke,J)),l(255*x(we,ke,J-1/3)),X];default:return null}}return null}}catch{}return q1}();class xi{constructor(l,u,g,x=1){this.r=l,this.g=u,this.b=g,this.a=x}static parse(l){if(!l)return;if(l instanceof xi)return l;if(typeof l!="string")return;const u=Bu.parseCSSColor(l);return u?new xi(u[0]/255,u[1]/255,u[2]/255,u[3]):void 0}toString(){const[l,u,g,x]=[this.r,this.g,this.b,this.a];return`rgba(${Math.round(255*l)},${Math.round(255*u)},${Math.round(255*g)},${x})`}toNonPremultipliedRenderColor(l){const{r:u,g,b:x,a:j}=this;return new CI(l,u,g,x,j)}toPremultipliedRenderColor(l){const{r:u,g,b:x,a:j}=this;return new MI(l,u*j,g*j,x*j,j)}clone(){return new xi(this.r,this.g,this.b,this.a)}}class SI{constructor(l,u,g,x,j,N=!1){if(this.premultiplied=!1,this.premultiplied=N,l){const E=l.image.height,R=E*E;this.premultiplied?(u=j===0?0:u/j*(E-1),g=j===0?0:g/j*(E-1),x=j===0?0:x/j*(E-1)):(u*=E-1,g*=E-1,x*=E-1);const B=Math.floor(u),H=Math.floor(g),G=Math.floor(x),X=Math.ceil(u),J=Math.ceil(g),ne=Math.ceil(x),pe=u-B,ke=g-H,we=x-G,De=l.image.data,Be=4*(B+H*R+G*E),He=4*(B+H*R+ne*E),dt=4*(B+J*R+G*E),it=4*(B+J*R+ne*E),pt=4*(X+H*R+G*E),wt=4*(X+H*R+ne*E),Ct=4*(X+J*R+G*E),Wt=4*(X+J*R+ne*E);if(Be<0||Wt>=De.length)throw new Error("out of range");this.r=Dn(Dn(Dn(De[Be],De[He],we),Dn(De[dt],De[it],we),ke),Dn(Dn(De[pt],De[wt],we),Dn(De[Ct],De[Wt],we),ke),pe)/255*(this.premultiplied?j:1),this.g=Dn(Dn(Dn(De[Be+1],De[He+1],we),Dn(De[dt+1],De[it+1],we),ke),Dn(Dn(De[pt+1],De[wt+1],we),Dn(De[Ct+1],De[Wt+1],we),ke),pe)/255*(this.premultiplied?j:1),this.b=Dn(Dn(Dn(De[Be+2],De[He+2],we),Dn(De[dt+2],De[it+2],we),ke),Dn(Dn(De[pt+2],De[wt+2],we),Dn(De[Ct+2],De[Wt+2],we),ke),pe)/255*(this.premultiplied?j:1),this.a=j}else this.r=u,this.g=g,this.b=x,this.a=j}toArray(){const{r:l,g:u,b:g,a:x}=this;return[255*l,255*u,255*g,x]}toHslaArray(){let{r:l,g:u,b:g,a:x}=this;if(this.premultiplied){if(x===0)return[0,0,0,0];const ne=1/x;l*=ne,u*=ne,g*=ne}const j=Math.min(Math.max(l,0),1),N=Math.min(Math.max(u,0),1),E=Math.min(Math.max(g,0),1),R=Math.min(j,N,E),B=Math.max(j,N,E),H=B-R,G=.5*(R+B);if(H===0)return[0,0,100*G,x];const X=G>.5?H/(2-B-R):H/(B+R);let J;switch(B){case j:J=60*((N-E)/H+(NDn(g,l[x],u))}xi.black=new xi(0,0,0,1),xi.white=new xi(1,1,1,1),xi.transparent=new xi(0,0,0,0),xi.red=new xi(1,0,0,1),xi.blue=new xi(0,0,1,1);var V1=Object.freeze({__proto__:null,array:c3,color:function(h,l,u){return new xi(Dn(h.r,l.r,u),Dn(h.g,l.g,u),Dn(h.b,l.b,u),Dn(h.a,l.a,u))},number:Dn});class $u extends Error{constructor(l,u){super(u),this.message=u,this.key=l}}class ix{constructor(l,u=[]){this.parent=l,this.bindings={};for(const[g,x]of u)this.bindings[g]=x}concat(l){return new ix(this,l)}get(l){if(this.bindings[l])return this.bindings[l];if(this.parent)return this.parent.get(l);throw new Error(`${l} not found in scope.`)}has(l){return!!this.bindings[l]||!!this.parent&&this.parent.has(l)}}const xh={kind:"null"},fn={kind:"number"},Bs={kind:"string"},Si={kind:"boolean"},pd={kind:"color"},rf={kind:"object"},gi={kind:"value"},Zj={kind:"collator"},H1={kind:"formatted"},W1={kind:"resolvedImage"};function cc(h,l){return{kind:"array",itemType:h,N:l}}function ko(h){if(h.kind==="array"){const l=ko(h.itemType);return typeof h.N=="number"?`array<${l}, ${h.N}>`:h.itemType.kind==="value"?"array":`array<${l}>`}return h.kind}const Lie=[xh,fn,Bs,Si,pd,H1,rf,cc(gi),W1];function _m(h,l){if(l.kind==="error")return null;if(h.kind==="array"){if(l.kind==="array"&&(l.N===0&&l.itemType.kind==="value"||!_m(h.itemType,l.itemType))&&(typeof h.N!="number"||h.N===l.N))return null}else{if(h.kind===l.kind)return null;if(h.kind==="value"){for(const u of Lie)if(!_m(u,l))return null}}return`Expected ${ko(h)} but found ${ko(l)} instead.`}function d3(h,l){return l.some(u=>u.kind===h.kind)}function G1(h,l){return l.some(u=>u==="null"?h===null:u==="array"?Array.isArray(h):u==="object"?h&&!Array.isArray(h)&&typeof h=="object":u===typeof h)}function Yj(h,l){return h.kind==="array"&&l.kind==="array"?h.N===l.N&&Yj(h.itemType,l.itemType):h.kind===l.kind}class u3{constructor(l,u,g){this.sensitivity=l?u?"variant":"case":u?"accent":"base",this.locale=g,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(l,u){return this.collator.compare(l,u)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Xj{constructor(l,u,g,x,j){this.text=l.normalize?l.normalize():l,this.image=u,this.scale=g,this.fontStack=x,this.textColor=j}}class Vc{constructor(l){this.sections=l}static fromString(l){return new Vc([new Xj(l,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(l=>l.text.length!==0||!!l.image&&l.image.hasPrimary())}static factory(l){return l instanceof Vc?l:Vc.fromString(l)}toString(){return this.sections.length===0?"":this.sections.map(l=>l.text).join("")}serialize(){const l=["format"];for(const u of this.sections){if(u.image){const x=u.image.getPrimary().id.toString();l.push(["image",x]);continue}l.push(u.text);const g={};u.fontStack&&(g["text-font"]=["literal",u.fontStack.split(",")]),u.scale&&(g["font-scale"]=u.scale),u.textColor&&(g["text-color"]=["rgba"].concat(u.textColor.toNonPremultipliedRenderColor(null).toArray())),l.push(g)}return l}}class ap{constructor(l,u={}){this.id=Cc.from(l),this.params=u.params,this.sx=u.sx||1,this.sy=u.sy||1}toString(){return JSON.stringify(this)}static parse(l){let u,g,x,j;try{({id:u,params:g,sx:x,sy:j}=JSON.parse(l)||{})}catch{return null}return u?new ap(u,{params:g,sx:x,sy:j}):null}scaleSelf(l,u=l){return this.sx*=l,this.sy*=u,this}}class Hc{constructor(l,u,g,x,j=!1){this.primaryId=Cc.from(l),this.primaryOptions=u,g&&(this.secondaryId=Cc.from(g)),this.secondaryOptions=x,this.available=j}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new ap(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new ap(this.secondaryId,this.secondaryOptions):null}static from(l){return typeof l=="string"?Hc.build({name:l}):l}static build(l,u,g,x){return!l||typeof l=="object"&&!("name"in l)?null:new Hc(l,g,u,x)}}function Dg(h,l,u,g){return typeof h=="number"&&h>=0&&h<=255&&typeof l=="number"&&l>=0&&l<=255&&typeof u=="number"&&u>=0&&u<=255?g===void 0||typeof g=="number"&&g>=0&&g<=1?null:`Invalid rgba value [${[h,l,u,g].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof g=="number"?[h,l,u,g]:[h,l,u]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function ax(h){if(h===null||typeof h=="string"||typeof h=="boolean"||typeof h=="number"||h instanceof xi||h instanceof u3||h instanceof Vc||h instanceof Hc)return!0;if(Array.isArray(h)){for(const l of h)if(!ax(l))return!1;return!0}if(typeof h=="object"){for(const l in h)if(!ax(h[l]))return!1;return!0}return!1}function ll(h){if(h===null)return xh;if(typeof h=="string")return Bs;if(typeof h=="boolean")return Si;if(typeof h=="number")return fn;if(h instanceof xi)return pd;if(h instanceof u3)return Zj;if(h instanceof Vc)return H1;if(h instanceof Hc)return W1;if(Array.isArray(h)){const l=h.length;let u;for(const g of h){const x=ll(g);if(u){if(u===x)continue;u=gi;break}u=x}return cc(u||gi,l)}return rf}function Uu(h){const l=typeof h;return h===null?"":l==="string"||l==="number"||l==="boolean"?String(h):h instanceof Vc||h instanceof Hc||h instanceof xi?h.toString():JSON.stringify(h)}class op{constructor(l,u){this.type=l,this.value=u}static parse(l,u){if(l.length!==2)return u.error(`'literal' expression requires exactly one argument, but found ${l.length-1} instead.`);if(!ax(l[1]))return u.error("invalid value");const g=l[1];let x=ll(g);const j=u.expectedType;return x.kind!=="array"||x.N!==0||!j||j.kind!=="array"||typeof j.N=="number"&&j.N!==0||(x=j),new op(x,g)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof xi?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof Vc?this.value.serialize():this.value}}class Jo{constructor(l){this.name="ExpressionEvaluationError",this.message=l}toJSON(){return this.message}}const h3={string:Bs,number:fn,boolean:Si,object:rf};class vh{constructor(l,u){this.type=l,this.args=u}static parse(l,u){if(l.length<2)return u.error("Expected at least one argument.");let g,x=1;const j=l[0];if(j==="array"){let E,R;if(l.length>2){const B=l[1];if(typeof B!="string"||!(B in h3)||B==="object")return u.error('The item type argument of "array" must be one of string, number, boolean',1);E=h3[B],x++}else E=gi;if(l.length>3){if(l[2]!==null&&(typeof l[2]!="number"||l[2]<0||l[2]!==Math.floor(l[2])))return u.error('The length argument to "array" must be a positive integer literal',2);R=l[2],x++}g=cc(E,R)}else g=h3[j];const N=[];for(;xl.outputDefined())}serialize(){const l=this.type,u=[l.kind];if(l.kind==="array"){const g=l.itemType;if(g.kind==="string"||g.kind==="number"||g.kind==="boolean"){u.push(g.kind);const x=l.N;(typeof x=="number"||this.args.length>1)&&u.push(x)}}return u.concat(this.args.map(g=>g.serialize()))}}class nf{constructor(l){this.type=H1,this.sections=l}static parse(l,u){if(l.length<2)return u.error("Expected at least one argument.");const g=l[1];if(!Array.isArray(g)&&typeof g=="object")return u.error("First argument must be an image or text section.");const x=[];let j=!1;for(let N=1;N<=l.length-1;++N){const E=l[N];if(j&&typeof E=="object"&&!Array.isArray(E)){j=!1;let R=null;if(E["font-scale"]&&(R=u.parseObjectValue(E["font-scale"],N,"font-scale",fn),!R))return null;let B=null;if(E["text-font"]&&(B=u.parseObjectValue(E["text-font"],N,"text-font",cc(Bs)),!B))return null;let H=null;if(E["text-color"]&&(H=u.parseObjectValue(E["text-color"],N,"text-color",pd),!H))return null;const G=x[x.length-1];G.scale=R,G.font=B,G.textColor=H}else{const R=u.parse(l[N],N,gi);if(!R)return null;const B=R.type.kind;if(B!=="string"&&B!=="value"&&B!=="null"&&B!=="resolvedImage")return u.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");j=!0,x.push({content:R,scale:null,font:null,textColor:null})}}return new nf(x)}evaluate(l){return new Vc(this.sections.map(u=>{const g=u.content.evaluate(l);return Yj(ll(g),W1)?new Xj("",g,null,null,null):new Xj(Uu(g),null,u.scale?u.scale.evaluate(l):null,u.font?u.font.evaluate(l).join(","):null,u.textColor?u.textColor.evaluate(l):null)}))}eachChild(l){for(const u of this.sections)l(u.content),u.scale&&l(u.scale),u.font&&l(u.font),u.textColor&&l(u.textColor)}outputDefined(){return!1}serialize(){const l=["format"];for(const u of this.sections){l.push(u.content.serialize());const g={};u.scale&&(g["font-scale"]=u.scale.serialize()),u.font&&(g["text-font"]=u.font.serialize()),u.textColor&&(g["text-color"]=u.textColor.serialize()),l.push(g)}return l}}class Jn{constructor(l,u,g,x){this._imageWarnHistory={},this.type=W1,this.namePrimary=l,this.nameSecondary=u,g&&(this.paramsPrimary=g.params,this.iconsetIdPrimary=g.iconset?g.iconset.id:void 0),x&&(this.paramsSecondary=x.params,this.iconsetIdSecondary=x.iconset?x.iconset.id:void 0)}static parse(l,u){if(l.length<2)return u.error("Expected two or more arguments.");let g=1;const x=[];function j(){if(gCc.isEqual(N,j)),x.available){const N=x.getSecondary()?x.getSecondary().id:null;N&&(x.available=l.availableImages.some(E=>Cc.isEqual(E,N)))}}return x}eachChild(l){if(l(this.namePrimary),this.paramsPrimary)for(const u in this.paramsPrimary)this.paramsPrimary[u]&&l(this.paramsPrimary[u]);if(this.nameSecondary&&(l(this.nameSecondary),this.paramsSecondary))for(const u in this.paramsSecondary)this.paramsSecondary[u]&&l(this.paramsSecondary[u])}outputDefined(){return!1}serializeOptions(l,u){const g={};if(u&&(g.iconset={id:u}),l){g.params={};for(const x in l)l[x]&&(g.params[x]=l[x].serialize())}return Object.keys(g).length>0?g:void 0}serialize(){const l=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){const u=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);u&&l.push(u)}if(this.nameSecondary&&(l.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){const u=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);u&&l.push(u)}return l}}function cn(h){return Fn(h)?"string":ox(h)?"number":Jj(h)?"boolean":Array.isArray(h)?"array":h===null?"null":Qj(h)?"object":typeof h}function Qj(h){return h!=null&&!Array.isArray(h)&&typeof h!="function"&&!(h instanceof String||h instanceof Number||h instanceof Boolean)&&typeof h=="object"}function Fn(h){return typeof h=="string"||h instanceof String}function ox(h){return typeof h=="number"||h instanceof Number}function Jj(h){return typeof h=="boolean"||h instanceof Boolean}const Rn={"to-boolean":Si,"to-color":pd,"to-number":fn,"to-string":Bs};class sf{constructor(l,u){this.type=l,this.args=u}static parse(l,u){if(l.length<2)return u.error("Expected at least one argument.");const g=l[0],x=[];let j=xh;if(g==="to-array"){if(!Array.isArray(l[1]))return null;const N=l[1].length;if(u.expectedType){if(u.expectedType.kind!=="array")return u.error(`Expected ${u.expectedType.kind} but found array.`);j=cc(u.expectedType.itemType,N)}else{if(!(N>0&&ax(l[1][0])))return null;j=cc(ll(l[1][0]),N)}for(let E=0;E4?`Invalid rbga value ${JSON.stringify(u)}: expected an array containing either three or four numeric values.`:Dg(u[0],u[1],u[2],u[3]),!g))return new xi(u[0]/255,u[1]/255,u[2]/255,u[3])}throw new Jo(g||`Could not parse color from value '${typeof u=="string"?u:String(JSON.stringify(u))}'`)}if(this.type.kind==="number"){let u=null;for(const g of this.args){if(u=g.evaluate(l),u===null)return 0;const x=Number(u);if(!isNaN(x))return x}throw new Jo(`Could not convert ${JSON.stringify(u)} to number.`)}return this.type.kind==="formatted"?Vc.fromString(Uu(this.args[0].evaluate(l))):this.type.kind==="resolvedImage"?Hc.build(Uu(this.args[0].evaluate(l))):this.type.kind==="array"?this.args.map(u=>u.evaluate(l)):Uu(this.args[0].evaluate(l))}eachChild(l){this.args.forEach(l)}outputDefined(){return this.args.every(l=>l.outputDefined())}serialize(){if(this.type.kind==="formatted")return new nf([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new Jn(this.args[0]).serialize();const l=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild(u=>{l.push(u.serialize())}),l}}const f3=["Unknown","Point","LineString","Polygon"];class ek{constructor(l,u,g){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=l,this.options=u,this.iconImageUseTheme=g}id(){return this.feature&&this.feature.id!==void 0?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?f3[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}measureLight(l){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const l=this.featureDistanceData.center,u=this.featureDistanceData.scale,{x:g,y:x}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(g*u-l[0])+this.featureDistanceData.bearing[1]*(x*u-l[1])}return 0}parseColor(l){let u=this._parseColorCache[l];return u||(u=this._parseColorCache[l]=xi.parse(l)),u}getConfig(l){return this.options?this.options.get(l):null}}class Wc{constructor(l,u,g,x,j){this.name=l,this.type=u,this._evaluate=g,this.args=x,this._overloadIndex=j}evaluate(l){if(!this._evaluate){const u=Wc.definitions[this.name];this._evaluate=Array.isArray(u)?u[2]:u.overloads[this._overloadIndex][1]}return this._evaluate(l,this.args)}eachChild(l){this.args.forEach(l)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(l=>l.serialize()))}static parse(l,u){const g=l[0],x=Wc.definitions[g];if(!x)return u.error(`Unknown expression "${g}". If you wanted a literal array, use ["literal", [...]].`,0);const j=Array.isArray(x)?x[0]:x.type,N=Array.isArray(x)?[[x[1],x[2]]]:x.overloads,E=[];let R=null,B=-1;for(const[H,G]of N){if(Array.isArray(H)&&H.length!==l.length-1)continue;E.push(H),B++,R=new hk(u.registry,u.path,null,u.scope,void 0,u._scope,u.options,u.iconImageUseTheme);const X=[];let J=!1;for(let ne=1;neX)).map(tk).join(" | "),G=[];for(let X=1;Xu;){if(g-u>600){const R=g-u+1,B=l-u+1,H=Math.log(R),G=.5*Math.exp(2*H/3),X=.5*Math.sqrt(H*G*(R-G)/R)*(B-R/2<0?-1:1);rk(h,l,Math.max(u,Math.floor(l-B*G/R+X)),Math.min(g,Math.floor(l+(R-B)*G/R+X)),x)}const j=h[l];let N=u,E=g;for(_h(h,u,l),x(h[g],j)>0&&_h(h,u,g);N0;)E--}x(h[u],j)===0?_h(h,u,E):(E++,_h(h,E,g)),E<=l&&(u=E+1),l<=E&&(g=E-1)}}function _h(h,l,u){const g=h[l];h[l]=h[u],h[u]=g}function p3(h,l){return hl?1:0}function bm(h){let l=0;for(let u,g,x=0,j=h.length,N=j-1;x=l[2]||h[1]<=l[1]||h[3]>=l[3])}function Oie(h,l,u){const g=h[0]-l[0],x=h[1]-l[1],j=h[0]-u[0],N=h[1]-u[1];return g*N-j*x==0&&g*j<=0&&x*N<=0}function lx(h,l,u=!1){let g=!1;for(let E=0,R=l.length;E(x=h)[1]!=(N=ne)[1]>x[1]&&x[0]<(N[0]-j[0])*(x[1]-j[1])/(N[1]-j[1])+j[0]&&(g=!g)}}var x,j,N;return g}function Z1(h,l,u,g){const x=g[0]-u[0],j=g[1]-u[1],N=(h[0]-u[0])*j-x*(h[1]-u[1]),E=(l[0]-u[0])*j-x*(l[1]-u[1]);return N>0&&E<0||N<0&&E>0}function Y1(h,l,u,g){return(x=[g[0]-u[0],g[1]-u[1]])[0]*(j=[l[0]-h[0],l[1]-h[1]])[1]-x[1]*j[0]!=0&&!(!Z1(h,l,u,g)||!Z1(u,g,h,l));var x,j}function lp(h){const l=new sr(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),u=new sr(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const g of h[0])l.x>g.x&&(l.x=g.x),l.y>g.y&&(l.y=g.y),u.xu[2]){const x=.5*g;let j=h[0]-u[0]>x?-g:u[0]-h[0]>x?g:0;j===0&&(j=h[0]-u[2]>x?-g:u[2]-h[0]>x?g:0),h[0]+=j}qu(l,h)}function II(h,l,u,g){const x=Math.pow(2,g.z)*wm,j=[g.x*wm,g.y*wm],N=[];if(!h)return N;for(const E of h)for(const R of E){const B=[R.x+j[0],R.y+j[1]];EI(B,l,u,x),N.push(B)}return N}function nk(h,l,u,g){const x=Math.pow(2,g.z)*wm,j=[g.x*wm,g.y*wm],N=[];if(!h)return N;for(const R of h){const B=[];for(const H of R){const G=[H.x+j[0],H.y+j[1]];qu(l,G),B.push(G)}N.push(B)}if(l[2]-l[0]<=x/2){(E=l)[0]=E[1]=1/0,E[2]=E[3]=-1/0;for(const R of N)for(const B of R)EI(B,l,u,x)}var E;return N}class km{constructor(l,u){this.type=Si,this.geojson=l,this.geometries=u}static parse(l,u){if(l.length!==2)return u.error(`'within' expression requires exactly one argument, but found ${l.length-1} instead.`);if(ax(l[1])){const g=l[1];if(g.type==="FeatureCollection")for(let x=0;xu)return sk(j,N,(u-(g-E))/E)}return l[l.length-1]}pointToSegmentDistance(l,u,g){let[x,j]=u,N=ru(g[0]-x)*this.kx,E=(g[1]-j)*this.ky;if(N!==0||E!==0){const R=(ru(l[0]-x)*this.kx*N+(l[1]-j)*this.ky*E)/(N*N+E*E);R>1?(x=g[0],j=g[1]):R>0&&(x+=N/this.kx*R,j+=E/this.ky*R)}return N=ru(l[0]-x)*this.kx,E=(l[1]-j)*this.ky,Math.sqrt(N*N+E*E)}pointOnLine(l,u){let g=1/0,x=l[0][0],j=l[0][1],N=0,E=0;for(let R=0;R1?(B=l[R+1][0],H=l[R+1][1]):J>0&&(B+=G/this.kx*J,H+=X/this.ky*J)),G=ru(u[0]-B)*this.kx,X=(u[1]-H)*this.ky;const ne=G*G+X*X;nej.index||x.index===j.index&&x.t>j.t){const B=x;x=j,j=B}const N=[x.point],E=x.index+1,R=j.index;!y3(g[E],N[0])&&E<=R&&N.push(g[E]);for(let B=E+1;B<=R;B++)N.push(g[B]);return y3(g[R],j.point)||N.push(j.point),N}lineSliceAlong(l,u,g){let x=0;const j=[];for(let N=0;Nl&&j.length===0&&j.push(sk(E,R,(l-(x-B))/B)),x>=u)return j.push(sk(E,R,(u-(x-B))/B)),j;x>l&&j.push(R)}return j}bufferPoint(l,u){const g=u/this.ky,x=u/this.kx;return[l[0]-x,l[1]-g,l[0]+x,l[1]+g]}bufferBBox(l,u){const g=u/this.ky,x=u/this.kx;return[l[0]-x,l[1]-g,l[2]+x,l[3]+g]}insideBBox(l,u){return ru(l[0]-u[0])>=0&&ru(l[0]-u[2])<=0&&l[1]>=u[1]&&l[1]<=u[3]}}function y3(h,l){return h[0]===l[0]&&h[1]===l[1]}function sk(h,l,u){const g=ru(l[0]-h[0]);return[h[0]+g*u,h[1]+(l[1]-h[1])*u]}function ru(h){for(;h<-180;)h+=360;for(;h>180;)h-=360;return h}class ik{constructor(l=[],u=(g,x)=>gx?1:0){if(this.data=l,this.length=this.data.length,this.compare=u,this.length>0)for(let g=(this.length>>1)-1;g>=0;g--)this._down(g)}push(l){this.data.push(l),this._up(this.length++)}pop(){if(this.length===0)return;const l=this.data[0],u=this.data.pop();return--this.length>0&&(this.data[0]=u,this._down(0)),l}peek(){return this.data[0]}_up(l){const{data:u,compare:g}=this,x=u[l];for(;l>0;){const j=l-1>>1,N=u[j];if(g(x,N)>=0)break;u[l]=N,l=j}u[l]=x}_down(l){const{data:u,compare:g}=this,x=this.length>>1,j=u[l];for(;l=0)break;u[l]=u[N],l=N}u[l]=j}}var Cr=8192;function x3(h,l){return l.dist-h.dist}const ak=100,ok=50;function v3(h){const l=[1/0,1/0,-1/0,-1/0];if(l.length!==h.length)return!1;for(let u=0;u=h[0]&&h[1]h[1])return[null,null];const u=Q1(h);if(l){if(u===2)return[h,null];const g=Math.floor(u/2);return[[h[0],h[0]+g],[h[0]+g,h[1]]]}{if(u===1)return[h,null];const g=Math.floor(u/2)-1;return[[h[0],h[0]+g],[h[0]+g+1,h[1]]]}}function Rg(h,l){const u=[1/0,1/0,-1/0,-1/0];if(!af(l,h.length))return u;for(let g=l[0];g<=l[1];++g)qu(u,h[g]);return u}function Fg(h){const l=[1/0,1/0,-1/0,-1/0];for(let u=0;ul[2]&&(g=h[0]-l[2]),h[1]>l[3]&&(x=h[1]-l[3]),h[3]=g)return g;if(K1(x,j)){if(w3(h,l))return 0}else if(w3(l,h))return 0;let N=g;for(const E of h)for(let R=0,B=E.length,H=B-1;R=j)continue;const H=B.range1;if(Q1(H)<=E){if(!af(H,h.length))return NaN;if(l){const G=$ie(h,H,u,g);if((j=Math.min(j,G))===0)return j}else for(let G=H[0];G<=H[1];++G){const X=Bie(h[G],u,g);if((j=Math.min(j,X))===0)return j}}else{const G=_3(H,l);if(G[0]!==null){const X=Nm(Rg(h,G[0]),R,g);X=N)continue;const G=H.range1,X=H.range2;if(Q1(G)<=R&&Q1(X)<=B){if(!af(G,h.length)||!af(X,u.length))return NaN;if(l&&g?N=Math.min(N,Vs(h,G,u,X,x)):l||g?l&&!g?N=Math.min(N,b3(u,X,h,G,x)):!l&&g&&(N=Math.min(N,b3(h,G,u,X,x))):N=Math.min(N,zie(h,G,u,X,x)),N===0)return N}else{const J=_3(G,l),ne=_3(X,g);xa(E,N,x,h,u,J[0],ne[0]),xa(E,N,x,h,u,J[0],ne[1]),xa(E,N,x,h,u,J[1],ne[0]),xa(E,N,x,h,u,J[1],ne[1])}}return N}function j3(h,l,u,g,x=1/0){let j=x;const N=Rg(h,[0,h.length-1]);for(const E of u)if(!(j!==1/0&&Nm(N,Rg(E,[0,E.length-1]),g)>=j)&&(j=Math.min(j,DI(h,l,E,!0,g,j)),j===0))return j;return j}function dk(h,l,u,g,x=1/0){let j=x;const N=Rg(h,[0,h.length-1]);for(const E of u){if(j!==1/0&&Nm(N,Fg(E),g)>=j)continue;const R=qie(h,l,E,g,j);if(isNaN(R))return R;if((j=Math.min(j,R))===0)return j}return j}function k3(h){return h==="Point"||h==="MultiPoint"||h==="LineString"||h==="MultiLineString"||h==="Polygon"||h==="MultiPolygon"}class zg{constructor(l,u){this.type=fn,this.geojson=l,this.geometries=u}static parse(l,u){if(l.length!==2)return u.error(`'distance' expression requires either one argument, but found ' ${l.length-1} instead.`);if(ax(l[1])){const g=l[1];if(g.type==="FeatureCollection"){for(let x=0;x{l&&!ux(u)&&(l=!1)}),l}function J1(h){if(h instanceof Wc&&h.name==="feature-state")return!1;let l=!0;return h.eachChild(u=>{l&&!J1(u)&&(l=!1)}),l}function hx(h,l){if(h instanceof Wc&&l.indexOf(h.name)>=0)return!1;let u=!0;return h.eachChild(g=>{u&&!hx(g,l)&&(u=!1)}),u}function RI(h,l,u){return[h,l,u].filter(Boolean).join("")}function N3(h,l){switch(h){case"string":return Uu(l);case"number":return+l;case"boolean":return!!l;case"color":return xi.parse(l);case"formatted":return Vc.fromString(Uu(l));case"resolvedImage":return Hc.build(Uu(l))}return l}function FI(h,l,u,g){return g!==void 0&&(h=g*Math.round(h/g)),l!==void 0&&hu&&(h=u),h}class fx{constructor(l,u,g,x=!1){this.type=l,this.key=u,this.scope=g,this.featureConstant=x}static parse(l,u){let g=u.expectedType;if(g==null&&(g=gi),l.length<2||l.length>3)return u.error("Invalid number of arguments for 'config' expression.");const x=u.parse(l[1],1);if(!(x instanceof op))return u.error("Key name of 'config' expression must be a string literal.");let j,N=!0;const E=Uu(x.value);if(l.length>=3){const R=u.parse(l[2],2);if(!(R instanceof op))return u.error("Scope of 'config' expression must be a string literal.");j=Uu(R.value)}if(u.options){const R=RI(E,j,u._scope),B=u.options.get(R);B&&(N=ux(B.value||B.default))}return new fx(g,E,j,N)}evaluate(l){const u=RI(this.key,this.scope,l.scope),g=l.getConfig(u);if(!g)return null;const{type:x,value:j,values:N,minValue:E,maxValue:R,stepValue:B}=g,H=g.default.evaluate(l);let G=H;if(j){const X=l.scope;l.scope=(X||"").split("").slice(1).join(""),G=j.evaluate(l),l.scope=X}return x&&(G=N3(x,G)),G===void 0||E===void 0&&R===void 0&&B===void 0||(typeof G=="number"?G=FI(G,E,R,B):Array.isArray(G)&&(G=G.map(X=>typeof X=="number"?FI(X,E,R,B):X))),j!==void 0&&G!==void 0&&N&&!N.includes(G)&&(G=H,x&&(G=N3(x,G))),(x&&x!==this.type||G!==void 0&&!Yj(ll(G),this.type))&&(G=N3(this.type.kind,G)),G}eachChild(){}outputDefined(){return!1}serialize(){const l=["config",this.key];return this.scope&&l.concat(this.scope),l}}class uk{constructor(l,u){this.type=u.type,this.name=l,this.boundExpression=u}static parse(l,u){if(l.length!==2||typeof l[1]!="string")return u.error("'var' expression requires exactly one string literal argument.");const g=l[1];return u.scope.has(g)?new uk(g,u.scope.get(g)):u.error(`Unknown variable "${g}". Make sure "${g}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(l){return this.boundExpression.evaluate(l)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class hk{constructor(l,u=[],g,x=new ix,j=[],N,E,R){this.registry=l,this.path=u,this.key=u.map(B=>typeof B=="string"?`['${B}']`:`[${B}]`).join(""),this.scope=x,this.errors=j,this.expectedType=g,this._scope=N,this.options=E,this.iconImageUseTheme=R}parse(l,u,g,x,j={}){return u||g?this.concat(u,null,g,x)._parse(l,j):this._parse(l,j)}parseObjectValue(l,u,g,x,j,N={}){return this.concat(u,g,x,j)._parse(l,N)}_parse(l,u){function g(x,j,N){return N==="assert"?new vh(j,[x]):N==="coerce"?new sf(j,[x]):x}if(l!==null&&typeof l!="string"&&typeof l!="boolean"&&typeof l!="number"||(l=["literal",l]),Array.isArray(l)){if(l.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const x=typeof l[0]=="string"?this.registry[l[0]]:void 0;if(x){let j=x.parse(l,this);if(!j)return null;if(this.expectedType){const N=this.expectedType,E=j.type;if(N.kind!=="string"&&N.kind!=="number"&&N.kind!=="boolean"&&N.kind!=="object"&&N.kind!=="array"||E.kind!=="value")if(N.kind!=="color"&&N.kind!=="formatted"&&N.kind!=="resolvedImage"||E.kind!=="value"&&E.kind!=="string"){if(this.checkSubtype(N,E))return null}else j=g(j,N,u.typeAnnotation||"coerce");else j=g(j,N,u.typeAnnotation||"assert")}if(!(j instanceof op)&&j.type.kind!=="resolvedImage"&&S3(j)){const N=new ek(this._scope,this.options,this.iconImageUseTheme);try{j=new op(j.type,j.evaluate(N))}catch(E){return this.error(E.message),null}}return j}return sf.parse(["to-array",l],this)}return this.error(l===void 0?"'undefined' value invalid. Use null instead.":typeof l=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof l} instead.`)}concat(l,u,g,x){let j=typeof l=="number"?this.path.concat(l):this.path;j=typeof u=="string"?j.concat(u):j;const N=x?this.scope.concat(x):this.scope;return new hk(this.registry,j,g||null,N,this.errors,this._scope,this.options,this.iconImageUseTheme)}error(l,...u){const g=`${this.key}${u.map(x=>`[${x}]`).join("")}`;this.errors.push(new $u(g,l))}checkSubtype(l,u){const g=_m(l,u);return g&&this.error(g),g}}function S3(h){if(h instanceof uk)return S3(h.boundExpression);if(h instanceof Wc&&h.name==="error"||h instanceof bl||h instanceof km||h instanceof zg||h instanceof fx)return!1;const l=h instanceof sf||h instanceof vh;let u=!0;return h.eachChild(g=>{u=l?u&&S3(g):u&&g instanceof op}),!!u&&ux(h)&&hx(h,["zoom","heatmap-density","worldview","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])}function fk(h,l){const u=h.length-1;let g,x,j=0,N=u,E=0;for(;j<=N;)if(E=Math.floor((j+N)/2),g=h[E],x=h[E+1],g<=l){if(E===u||ll))throw new Jo("Input is not a number.");N=E-1}return 0}class ev{constructor(l,u,g){this.type=l,this.input=u,this.labels=[],this.outputs=[];for(const[x,j]of g)this.labels.push(x),this.outputs.push(j)}static parse(l,u){if(l.length-1<4)return u.error(`Expected at least 4 arguments, but found only ${l.length-1}.`);if((l.length-1)%2!=0)return u.error("Expected an even number of arguments.");const g=u.parse(l[1],1,fn);if(!g)return null;const x=[];let j=null;u.expectedType&&u.expectedType.kind!=="value"&&(j=u.expectedType);for(let N=1;N=E)return u.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',B);const G=u.parse(R,H,j);if(!G)return null;j=j||G.type,x.push([E,G])}return new ev(j,g,x)}evaluate(l){const u=this.labels,g=this.outputs;if(u.length===1)return g[0].evaluate(l);const x=this.input.evaluate(l);if(x<=u[0])return g[0].evaluate(l);const j=u.length;return x>=u[j-1]?g[j-1].evaluate(l):g[fk(u,x)].evaluate(l)}eachChild(l){l(this.input);for(const u of this.outputs)l(u)}outputDefined(){return this.outputs.every(l=>l.outputDefined())}serialize(){const l=["step",this.input.serialize()];for(let u=0;u0&&l.push(this.labels[u]),l.push(this.outputs[u].serialize());return l}}const zI=.95047,BI=1.08883,$I=4/29,px=6/29,UI=3*px*px,Vie=px*px*px,Hie=Math.PI/180,Wie=180/Math.PI;function C3(h){return h>Vie?Math.pow(h,1/3):h/UI+$I}function M3(h){return h>px?h*h*h:UI*(h-$I)}function T3(h){return 255*(h<=.0031308?12.92*h:1.055*Math.pow(h,1/2.4)-.055)}function A3(h){return(h/=255)<=.04045?h/12.92:Math.pow((h+.055)/1.055,2.4)}function qI(h){const l=A3(h.r),u=A3(h.g),g=A3(h.b),x=C3((.4124564*l+.3575761*u+.1804375*g)/zI),j=C3((.2126729*l+.7151522*u+.072175*g)/1);return{l:116*j-16,a:500*(x-j),b:200*(j-C3((.0193339*l+.119192*u+.9503041*g)/BI)),alpha:h.a}}function pk(h){let l=(h.l+16)/116,u=isNaN(h.a)?l:l+h.a/500,g=isNaN(h.b)?l:l-h.b/200;return l=1*M3(l),u=zI*M3(u),g=BI*M3(g),new xi(T3(3.2404542*u-1.5371385*l-.4985314*g),T3(-.969266*u+1.8760108*l+.041556*g),T3(.0556434*u-.2040259*l+1.0572252*g),h.alpha)}function mk(h,l,u){const g=l-h;return h+u*(g>180||g<-180?g-360*Math.round(g/360):g)}const mx={forward:qI,reverse:pk,interpolate:function(h,l,u){return{l:Dn(h.l,l.l,u),a:Dn(h.a,l.a,u),b:Dn(h.b,l.b,u),alpha:Dn(h.alpha,l.alpha,u)}}},tv={forward:function(h){const{l,a:u,b:g}=qI(h),x=Math.atan2(g,u)*Wie;return{h:x<0?x+360:x,c:Math.sqrt(u*u+g*g),l,alpha:h.a}},reverse:function(h){const l=h.h*Hie,u=h.c;return pk({l:h.l,a:Math.cos(l)*u,b:Math.sin(l)*u,alpha:h.alpha})},interpolate:function(h,l,u){return{h:mk(h.h,l.h,u),c:Dn(h.c,l.c,u),l:Dn(h.l,l.l,u),alpha:Dn(h.alpha,l.alpha,u)}}};var VI=Object.freeze({__proto__:null,hcl:tv,lab:mx});class nu{constructor(l,u,g,x,j){this.type=l,this.operator=u,this.interpolation=g,this.input=x,this.labels=[],this.outputs=[];for(const[N,E]of j)this.labels.push(N),this.outputs.push(E)}static interpolationFactor(l,u,g,x){let j=0;if(l.name==="exponential")j=gk(u,l.base,g,x);else if(l.name==="linear")j=gk(u,1,g,x);else if(l.name==="cubic-bezier"){const N=l.controlPoints;j=new Oo(N[0],N[1],N[2],N[3]).solve(gk(u,1,g,x))}return j}static parse(l,u){let[g,x,j,...N]=l;if(!Array.isArray(x)||x.length===0)return u.error("Expected an interpolation type expression.",1);if(x[0]==="linear")x={name:"linear"};else if(x[0]==="exponential"){const B=x[1];if(typeof B!="number")return u.error("Exponential interpolation requires a numeric base.",1,1);x={name:"exponential",base:B}}else{if(x[0]!=="cubic-bezier")return u.error(`Unknown interpolation type ${String(x[0])}`,1,0);{const B=x.slice(1);if(B.length!==4||B.some(H=>typeof H!="number"||H<0||H>1))return u.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);x={name:"cubic-bezier",controlPoints:B}}}if(l.length-1<4)return u.error(`Expected at least 4 arguments, but found only ${l.length-1}.`);if(l.length-1>3&&(l.length-1)%2!=0)return u.error("Expected an even number of arguments.");if(j=u.parse(j,2,fn),!j)return null;const E=[];let R=null;g==="interpolate-hcl"||g==="interpolate-lab"?R=pd:u.expectedType&&u.expectedType.kind!=="value"&&(R=u.expectedType);for(let B=0;B=H)return u.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',X);const ne=u.parse(G,J,R);if(!ne)return null;R=R||ne.type,E.push([H,ne])}return R.kind==="number"||R.kind==="color"||R.kind==="array"&&R.itemType.kind==="number"&&typeof R.N=="number"?new nu(R,g,x,j,E):u.error(`Type ${ko(R)} is not interpolatable.`)}evaluate(l){const u=this.labels,g=this.outputs;if(u.length===1)return g[0].evaluate(l);const x=this.input.evaluate(l);if(x<=u[0])return g[0].evaluate(l);const j=u.length;if(x>=u[j-1])return g[j-1].evaluate(l);const N=fk(u,x),E=nu.interpolationFactor(this.interpolation,x,u[N],u[N+1]),R=g[N].evaluate(l),B=g[N+1].evaluate(l);return this.operator==="interpolate"?V1[this.type.kind.toLowerCase()](R,B,E):this.operator==="interpolate-hcl"?tv.reverse(tv.interpolate(tv.forward(R),tv.forward(B),E)):mx.reverse(mx.interpolate(mx.forward(R),mx.forward(B),E))}eachChild(l){l(this.input);for(const u of this.outputs)l(u)}outputDefined(){return this.outputs.every(l=>l.outputDefined())}serialize(){let l;l=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier",...this.interpolation.controlPoints];const u=[this.operator,l,this.input.serialize()];for(let g=0;g_m(x,E.type));return new rv(N?gi:g,j)}evaluate(l){let u,g=null,x=0;for(const j of this.args){if(x++,g=j.evaluate(l),g&&g instanceof Hc&&!g.available&&(u||(u=g),g=null,x===this.args.length))return u;if(g!==null)break}return g}eachChild(l){this.args.forEach(l)}outputDefined(){return this.args.every(l=>l.outputDefined())}serialize(){const l=["coalesce"];return this.eachChild(u=>{l.push(u.serialize())}),l}}class cp{constructor(l,u){this.type=u.type,this.bindings=[].concat(l),this.result=u}evaluate(l){return this.result.evaluate(l)}eachChild(l){for(const u of this.bindings)l(u[1]);l(this.result)}static parse(l,u){if(l.length<4)return u.error(`Expected at least 3 arguments, but found ${l.length-1} instead.`);const g=[];for(let j=1;j=g.length)throw new Jo("Array index out of bounds: index exceeds array size");if(u!==Math.floor(u))throw new Jo("Array index must be an integer. Use at-interpolated for fractional indices");return g[u]}eachChild(l){l(this.index),l(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class xk{constructor(l,u,g){this.type=l,this.index=u,this.input=g}static parse(l,u){if(l.length!==3)return u.error(`Expected 2 arguments, but found ${l.length-1} instead.`);const g=u.parse(l[1],1,fn),x=u.parse(l[2],2,cc(u.expectedType||gi));return g&&x?new xk(x.type.itemType,g,x):null}evaluate(l){const u=this.index.evaluate(l),g=this.input.evaluate(l);if(u<0)throw new Jo(`Array index out of bounds: ${u} < 0.`);if(u>g.length-1)throw new Jo(`Array index out of bounds: ${u} > ${g.length-1}.`);if(u===Math.floor(u))return g[u];const x=Math.floor(u),j=Math.ceil(u),N=g[x],E=g[j];if(typeof N!="number"||typeof E!="number")throw new Jo(`Cannot interpolate between non-number values at index ${u}.`);const R=u-x;return N*(1-R)+E*R}eachChild(l){l(this.index),l(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class E3{constructor(l,u){this.type=Si,this.needle=l,this.haystack=u}static parse(l,u){if(l.length!==3)return u.error(`Expected 2 arguments, but found ${l.length-1} instead.`);const g=u.parse(l[1],1,gi),x=u.parse(l[2],2,gi);return g&&x?d3(g.type,[Si,Bs,fn,xh,gi])?new E3(g,x):u.error(`Expected first argument to be of type boolean, string, number or null, but found ${ko(g.type)} instead`):null}evaluate(l){const u=this.needle.evaluate(l),g=this.haystack.evaluate(l);if(g==null)return!1;if(!G1(u,["boolean","string","number","null"]))throw new Jo(`Expected first argument to be of type boolean, string, number or null, but found ${ko(ll(u))} instead.`);if(!G1(g,["string","array"]))throw new Jo(`Expected second argument to be of type array or string, but found ${ko(ll(g))} instead.`);return g.indexOf(u)>=0}eachChild(l){l(this.needle),l(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class gx{constructor(l,u,g){this.type=fn,this.needle=l,this.haystack=u,this.fromIndex=g}static parse(l,u){if(l.length<=2||l.length>=5)return u.error(`Expected 3 or 4 arguments, but found ${l.length-1} instead.`);const g=u.parse(l[1],1,gi),x=u.parse(l[2],2,gi);if(!g||!x)return null;if(!d3(g.type,[Si,Bs,fn,xh,gi]))return u.error(`Expected first argument to be of type boolean, string, number or null, but found ${ko(g.type)} instead`);if(l.length===4){const j=u.parse(l[3],3,fn);return j?new gx(g,x,j):null}return new gx(g,x)}evaluate(l){const u=this.needle.evaluate(l),g=this.haystack.evaluate(l);if(!G1(u,["boolean","string","number","null"]))throw new Jo(`Expected first argument to be of type boolean, string, number or null, but found ${ko(ll(u))} instead.`);if(!G1(g,["string","array"]))throw new Jo(`Expected second argument to be of type array or string, but found ${ko(ll(g))} instead.`);if(this.fromIndex){const x=this.fromIndex.evaluate(l);return g.indexOf(u,x)}return g.indexOf(u)}eachChild(l){l(this.needle),l(this.haystack),this.fromIndex&&l(this.fromIndex)}outputDefined(){return!1}serialize(){if(this.fromIndex!=null&&this.fromIndex!==void 0){const l=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),l]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class nv{constructor(l,u,g,x,j,N){this.inputType=l,this.type=u,this.input=g,this.cases=x,this.outputs=j,this.otherwise=N}static parse(l,u){if(l.length<5)return u.error(`Expected at least 4 arguments, but found only ${l.length-1}.`);if(l.length%2!=1)return u.error("Expected an even number of arguments.");let g,x;u.expectedType&&u.expectedType.kind!=="value"&&(x=u.expectedType);const j={},N=[];for(let B=2;BNumber.MAX_SAFE_INTEGER)return X.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof ne=="number"&&Math.floor(ne)!==ne)return X.error("Numeric branch labels must be integer values.");if(g){if(X.checkSubtype(g,ll(ne)))return null}else g=ll(ne);if(j[String(ne)]!==void 0)return X.error("Branch labels must be unique.");j[String(ne)]=N.length}const J=u.parse(G,B,x);if(!J)return null;x=x||J.type,N.push(J)}const E=u.parse(l[1],1,gi);if(!E)return null;const R=u.parse(l[l.length-1],l.length-1,x);return R?E.type.kind!=="value"&&u.concat(1).checkSubtype(g,E.type)?null:new nv(g,x,E,j,N,R):null}evaluate(l){const u=this.input.evaluate(l);return(Yj(ll(u),this.inputType)&&this.outputs[this.cases[u]]||this.otherwise).evaluate(l)}eachChild(l){l(this.input),this.outputs.forEach(l),l(this.otherwise)}outputDefined(){return this.outputs.every(l=>l.outputDefined())&&this.otherwise.outputDefined()}serialize(){const l=["match",this.input.serialize()],u=Object.keys(this.cases).sort(),g=[],x={};for(const N of u){const E=x[this.cases[N]];E===void 0?(x[this.cases[N]]=g.length,g.push([this.cases[N],[N]])):g[E][1].push(N)}const j=N=>this.inputType.kind==="number"?Number(N):N;for(const[N,E]of g)l.push(E.length===1?j(E[0]):E.map(j)),l.push(this.outputs[N].serialize());return l.push(this.otherwise.serialize()),l}}class sv{constructor(l,u,g){this.type=l,this.branches=u,this.otherwise=g}static parse(l,u){if(l.length<4)return u.error(`Expected at least 3 arguments, but found only ${l.length-1}.`);if(l.length%2!=0)return u.error("Expected an odd number of arguments.");let g;u.expectedType&&u.expectedType.kind!=="value"&&(g=u.expectedType);const x=[];for(let N=1;Nu.outputDefined())&&this.otherwise.outputDefined()}serialize(){const l=["case"];return this.eachChild(u=>{l.push(u.serialize())}),l}}class vk{constructor(l,u,g,x){this.type=l,this.input=u,this.beginIndex=g,this.endIndex=x}static parse(l,u){if(l.length<=2||l.length>=5)return u.error(`Expected 3 or 4 arguments, but found ${l.length-1} instead.`);const g=u.parse(l[1],1,gi),x=u.parse(l[2],2,fn);if(!g||!x)return null;if(!d3(g.type,[cc(gi),Bs,gi]))return u.error(`Expected first argument to be of type array or string, but found ${ko(g.type)} instead`);if(l.length===4){const j=u.parse(l[3],3,fn);return j?new vk(g.type,g,x,j):null}return new vk(g.type,g,x)}evaluate(l){const u=this.input.evaluate(l),g=this.beginIndex.evaluate(l);if(!G1(u,["string","array"]))throw new Jo(`Expected first argument to be of type array or string, but found ${ko(ll(u))} instead.`);if(this.endIndex){const x=this.endIndex.evaluate(l);return u.slice(g,x)}return u.slice(g)}eachChild(l){l(this.input),l(this.beginIndex),this.endIndex&&l(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&&this.endIndex!==void 0){const l=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),l]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}class I3{constructor(l,u){this.type=cc(Bs),this.str=l,this.delimiter=u}static parse(l,u){if(l.length!==3)return u.error(`Expected 2 arguments, but found ${l.length-1} instead.`);const g=u.parse(l[1],1,Bs),x=u.parse(l[2],2,Bs);return g&&x?new I3(g,x):void 0}evaluate(l){const u=this.str.evaluate(l),g=this.delimiter.evaluate(l);return u.split(g)}eachChild(l){l(this.str),l(this.delimiter)}outputDefined(){return!1}serialize(){return["split",this.str.serialize(),this.delimiter.serialize()]}}function P3(h,l){return h==="=="||h==="!="?l.kind==="boolean"||l.kind==="string"||l.kind==="number"||l.kind==="null"||l.kind==="value":l.kind==="string"||l.kind==="number"||l.kind==="value"}function L3(h,l,u,g){return g.compare(l,u)===0}function yx(h,l,u){const g=h!=="=="&&h!=="!=";return class uze{constructor(j,N,E){this.type=Si,this.lhs=j,this.rhs=N,this.collator=E,this.hasUntypedArgument=j.type.kind==="value"||N.type.kind==="value"}static parse(j,N){if(j.length!==3&&j.length!==4)return N.error("Expected two or three arguments.");const E=j[0];let R=N.parse(j[1],1,gi);if(!R)return null;if(!P3(E,R.type))return N.concat(1).error(`"${E}" comparisons are not supported for type '${ko(R.type)}'.`);let B=N.parse(j[2],2,gi);if(!B)return null;if(!P3(E,B.type))return N.concat(2).error(`"${E}" comparisons are not supported for type '${ko(B.type)}'.`);if(R.type.kind!==B.type.kind&&R.type.kind!=="value"&&B.type.kind!=="value")return N.error(`Cannot compare types '${ko(R.type)}' and '${ko(B.type)}'.`);g&&(R.type.kind==="value"&&B.type.kind!=="value"?R=new vh(B.type,[R]):R.type.kind!=="value"&&B.type.kind==="value"&&(B=new vh(R.type,[B])));let H=null;if(j.length===4){if(R.type.kind!=="string"&&B.type.kind!=="string"&&R.type.kind!=="value"&&B.type.kind!=="value")return N.error("Cannot use collator to compare non-string types.");if(H=N.parse(j[3],3,Zj),!H)return null}return new uze(R,B,H)}evaluate(j){const N=this.lhs.evaluate(j),E=this.rhs.evaluate(j);if(g&&this.hasUntypedArgument){const R=ll(N),B=ll(E);if(R.kind!==B.kind||R.kind!=="string"&&R.kind!=="number")throw new Jo(`Expected arguments for "${h}" to be (string, string) or (number, number), but found (${R.kind}, ${B.kind}) instead.`)}if(this.collator&&!g&&this.hasUntypedArgument){const R=ll(N),B=ll(E);if(R.kind!=="string"||B.kind!=="string")return l(j,N,E)}return this.collator?u(j,N,E,this.collator.evaluate(j)):l(j,N,E)}eachChild(j){j(this.lhs),j(this.rhs),this.collator&&j(this.collator)}outputDefined(){return!0}serialize(){const j=[h];return this.eachChild(N=>{j.push(N.serialize())}),j}}}const Gie=yx("==",function(h,l,u){return l===u},L3),Kie=yx("!=",function(h,l,u){return l!==u},function(h,l,u,g){return!L3(0,l,u,g)}),HI=yx("<",function(h,l,u){return l",function(h,l,u){return l>u},function(h,l,u,g){return g.compare(l,u)>0}),_k=yx("<=",function(h,l,u){return l<=u},function(h,l,u,g){return g.compare(l,u)<=0}),Zie=yx(">=",function(h,l,u){return l>=u},function(h,l,u,g){return g.compare(l,u)>=0});class bk{constructor(l,u,g,x,j,N){this.type=Bs,this.number=l,this.locale=u,this.currency=g,this.unit=x,this.minFractionDigits=j,this.maxFractionDigits=N}static parse(l,u){if(l.length!==3)return u.error("Expected two arguments.");const g=u.parse(l[1],1,fn);if(!g)return null;const x=l[2];if(typeof x!="object"||Array.isArray(x))return u.error("NumberFormat options argument must be an object.");let j=null;if(x.locale&&(j=u.parseObjectValue(x.locale,2,"locale",Bs),!j))return null;let N=null;if(x.currency&&(N=u.parseObjectValue(x.currency,2,"currency",Bs),!N))return null;let E=null;if(x.unit&&(E=u.parseObjectValue(x.unit,2,"unit",Bs),!E))return null;let R=null;if(x["min-fraction-digits"]&&(R=u.parseObjectValue(x["min-fraction-digits"],2,"min-fraction-digits",fn),!R))return null;let B=null;return x["max-fraction-digits"]&&(B=u.parseObjectValue(x["max-fraction-digits"],2,"max-fraction-digits",fn),!B)?null:new bk(g,j,N,E,R,B)}evaluate(l){return new Intl.NumberFormat(this.locale?this.locale.evaluate(l):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(l):void 0,unit:this.unit?this.unit.evaluate(l):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(l):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(l):void 0}).format(this.number.evaluate(l))}eachChild(l){l(this.number),this.locale&&l(this.locale),this.currency&&l(this.currency),this.unit&&l(this.unit),this.minFractionDigits&&l(this.minFractionDigits),this.maxFractionDigits&&l(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const l={};return this.locale&&(l.locale=this.locale.serialize()),this.currency&&(l.currency=this.currency.serialize()),this.unit&&(l.unit=this.unit.serialize()),this.minFractionDigits&&(l["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(l["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),l]}}class O3{constructor(l){this.type=fn,this.input=l}static parse(l,u){if(l.length!==2)return u.error(`Expected 1 argument, but found ${l.length-1} instead.`);const g=u.parse(l[1],1);return g?g.type.kind!=="array"&&g.type.kind!=="string"&&g.type.kind!=="value"?u.error(`Expected argument of type string or array, but found ${ko(g.type)} instead.`):new O3(g):null}evaluate(l){const u=this.input.evaluate(l);if(typeof u=="string"||Array.isArray(u))return u.length;throw new Jo(`Expected value to be of type string or array, but found ${ko(ll(u))} instead.`)}eachChild(l){l(this.input)}outputDefined(){return!1}serialize(){const l=["length"];return this.eachChild(u=>{l.push(u.serialize())}),l}}function GI(h){return function(){h=1831565813+(h|=0)|0;let l=Math.imul(h^h>>>15,1|h);return l=l+Math.imul(l^l>>>7,61|l)^l,((l^l>>>14)>>>0)/4294967296}}const xx={"==":Gie,"!=":Kie,">":WI,"<":HI,">=":Zie,"<=":_k,array:vh,at:yk,"at-interpolated":xk,boolean:vh,case:sv,coalesce:rv,collator:bl,format:nf,image:Jn,in:E3,"index-of":gx,interpolate:nu,"interpolate-hcl":nu,"interpolate-lab":nu,length:O3,let:cp,literal:op,match:nv,number:vh,"number-format":bk,object:vh,slice:vk,step:ev,string:vh,"to-boolean":sf,"to-color":sf,"to-number":sf,"to-string":sf,var:uk,within:km,distance:zg,config:fx,split:I3};function D3(h,[l,u,g,x]){l=l.evaluate(h),u=u.evaluate(h),g=g.evaluate(h);const j=x?x.evaluate(h):1,N=Dg(l,u,g,j);if(N)throw new Jo(N);return new xi(l/255,u/255,g/255,j)}function R3(h,[l,u,g,x]){l=l.evaluate(h),u=u.evaluate(h),g=g.evaluate(h);const j=x?x.evaluate(h):1,N=function(B,H,G,X){return typeof B=="number"&&B>=0&&B<=360?typeof H=="number"&&H>=0&&H<=100&&typeof G=="number"&&G>=0&&G<=100?X===void 0||typeof X=="number"&&X>=0&&X<=1?null:`Invalid hsla value [${[B,H,G,X].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(typeof X=="number"?[B,H,G,X]:[B,H,G]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(typeof X=="number"?[B,H,G,X]:[B,H,G]).join(", ")}]: 'h' must be between 0 and 360.`}(l,u,g,j);if(N)throw new Jo(N);const E=`hsla(${l}, ${u}%, ${g}%, ${j})`,R=xi.parse(E);if(!R)throw new Jo(`Failed to parse HSLA color: ${E}`);return R}function KI(h,l){return h in l}function F3(h,l){const u=l[h];return u===void 0?null:u}function Cm(h){return{type:h}}function Bg(h){if(h instanceof fx)return new Set([h.key]);let l=new Set;return h.eachChild(u=>{l=new Set([...l,...Bg(u)])}),l}function wk(h){if(h instanceof Wc&&h.name==="is-active-floor")return!0;let l=!1;return h.eachChild(u=>{!l&&wk(u)&&(l=!0)}),l}function ZI(h){return{result:"success",value:h}}function Mm(h){return{result:"error",value:h}}function z3(h,l){return!!h&&!!h.parameters&&h.parameters.indexOf(l)>-1}function iv(h){return h["property-type"]==="data-driven"}function YI(h){return z3(h.expression,"measure-light")}function XI(h){return z3(h.expression,"zoom")}function jk(h){return!!h.expression&&h.expression.interpolated}function kk(h){return typeof h=="object"&&h!==null&&!Array.isArray(h)}function QI(h){return h}function JI(h,l){const u=l.type==="color",g=h.stops&&typeof h.stops[0][0]=="object",x=g||!(g||h.property!==void 0),j=h.type||(jk(l)?"exponential":"interval");if(u&&((h=Object.assign({},h)).stops&&(h.stops=h.stops.map(B=>[B[0],xi.parse(B[1])])),h.default=xi.parse(h.default?h.default:l.default)),h.colorSpace&&h.colorSpace!=="rgb"&&!VI[h.colorSpace])throw new Error(`Unknown color space: ${h.colorSpace}`);let N,E,R;if(j==="exponential")N=eP;else if(j==="interval")N=Xie;else if(j==="categorical"){N=Yie,E=Object.create(null);for(const B of h.stops)E[B[0]]=B[1];R=typeof h.stops[0][0]}else{if(j!=="identity")throw new Error(`Unknown function type "${j}"`);N=tP}if(g){const B={},H=[];for(let J=0;JJ[0]),evaluate:({zoom:J},ne)=>eP({stops:G,base:h.base},l,J).evaluate(J,ne)}}if(x){const B=j==="exponential"?{name:"exponential",base:h.base!==void 0?h.base:1}:null;return{kind:"camera",interpolationType:B,interpolationFactor:nu.interpolationFactor.bind(void 0,B),zoomStops:h.stops.map(H=>H[0]),evaluate:({zoom:H})=>N(h,l,H,E,R)}}return{kind:"source",evaluate(B,H){const G=H&&H.properties?H.properties[h.property]:void 0;return G===void 0?of(h.default,l.default):N(h,l,G,E,R)}}}function of(h,l,u){return h!==void 0?h:l!==void 0?l:u!==void 0?u:void 0}function Yie(h,l,u,g,x){return of(typeof u===x?g[u]:void 0,h.default,l.default)}function Xie(h,l,u){if(!ox(u))return of(h.default,l.default);const g=h.stops.length;if(g===1||u<=h.stops[0][0])return h.stops[0][1];if(u>=h.stops[g-1][0])return h.stops[g-1][1];const x=fk(h.stops.map(j=>j[0]),u);return h.stops[x][1]}function eP(h,l,u){const g=h.base!==void 0?h.base:1;if(!ox(u))return of(h.default,l.default);const x=h.stops.length;if(x===1||u<=h.stops[0][0])return h.stops[0][1];if(u>=h.stops[x-1][0])return h.stops[x-1][1];const j=fk(h.stops.map(H=>H[0]),u),N=function(H,G,X,J){const ne=J-X,pe=H-X;return ne===0?0:G===1?pe/ne:(Math.pow(G,pe)-1)/(Math.pow(G,ne)-1)}(u,g,h.stops[j][0],h.stops[j+1][0]),E=h.stops[j][1],R=h.stops[j+1][1];let B=V1[l.type]||QI;if(h.colorSpace&&h.colorSpace!=="rgb"){const H=VI[h.colorSpace];B=(G,X)=>H.reverse(H.interpolate(H.forward(G),H.forward(X),N))}return typeof E.evaluate=="function"?{evaluate(...H){const G=E.evaluate.apply(void 0,H),X=R.evaluate.apply(void 0,H);if(G!==void 0&&X!==void 0)return B(G,X,N)}}:B(E,R,N)}function tP(h,l,u){return l.type==="color"?u=xi.parse(u):l.type==="formatted"?u=Vc.fromString(u.toString()):l.type==="resolvedImage"?u=Hc.build(u.toString()):cn(u)===l.type||l.type==="enum"&&l.values[u]||(u=void 0),of(u,h.default,l.default)}Wc.register(xx,{error:[{kind:"error"},[Bs],(h,[l])=>{throw new Jo(l.evaluate(h))}],typeof:[Bs,[gi],(h,[l])=>ko(ll(l.evaluate(h)))],"to-rgba":[cc(fn,4),[pd],(h,[l])=>l.evaluate(h).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[cc(fn,4),[pd],(h,[l])=>l.evaluate(h).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[pd,[fn,fn,fn],D3],rgba:[pd,[fn,fn,fn,fn],D3],hsl:[pd,[fn,fn,fn],R3],hsla:[pd,[fn,fn,fn,fn],R3],has:{type:Si,overloads:[[[Bs],(h,[l])=>KI(l.evaluate(h),h.properties())],[[Bs,rf],(h,[l,u])=>KI(l.evaluate(h),u.evaluate(h))]]},get:{type:gi,overloads:[[[Bs],(h,[l])=>F3(l.evaluate(h),h.properties())],[[Bs,rf],(h,[l,u])=>F3(l.evaluate(h),u.evaluate(h))]]},"feature-state":[gi,[Bs],(h,[l])=>F3(l.evaluate(h),h.featureState||{})],properties:[rf,[],h=>h.properties()],"geometry-type":[Bs,[],h=>h.geometryType()],worldview:[Bs,[],h=>h.globals.worldview||""],"is-active-floor":[Si,Cm(Bs),(h,l)=>{if(!(h.globals.activeFloors&&h.globals.activeFloors.size>0))return!1;const u=h.globals.activeFloors;return l.some(g=>{const x=g.evaluate(h);return u.has(x)})}],id:[gi,[],h=>h.id()],zoom:[fn,[],h=>h.globals.zoom],pitch:[fn,[],h=>h.globals.pitch||0],"distance-from-center":[fn,[],h=>h.distanceFromCenter()],"measure-light":[fn,[Bs],(h,[l])=>h.measureLight(l.evaluate(h))],"heatmap-density":[fn,[],h=>h.globals.heatmapDensity||0],"line-progress":[fn,[],h=>h.globals.lineProgress||0],"raster-value":[fn,[],h=>h.globals.rasterValue||0],"raster-particle-speed":[fn,[],h=>h.globals.rasterParticleSpeed||0],"sky-radial-progress":[fn,[],h=>h.globals.skyRadialProgress||0],accumulated:[gi,[],h=>h.globals.accumulated===void 0?null:h.globals.accumulated],"+":[fn,Cm(fn),(h,l)=>{let u=0;for(const g of l)u+=g.evaluate(h);return u}],"*":[fn,Cm(fn),(h,l)=>{let u=1;for(const g of l)u*=g.evaluate(h);return u}],"-":{type:fn,overloads:[[[fn,fn],(h,[l,u])=>l.evaluate(h)-u.evaluate(h)],[[fn],(h,[l])=>-l.evaluate(h)]]},"/":[fn,[fn,fn],(h,[l,u])=>l.evaluate(h)/u.evaluate(h)],"%":[fn,[fn,fn],(h,[l,u])=>l.evaluate(h)%u.evaluate(h)],ln2:[fn,[],()=>Math.LN2],pi:[fn,[],()=>Math.PI],e:[fn,[],()=>Math.E],"^":[fn,[fn,fn],(h,[l,u])=>Math.pow(l.evaluate(h),u.evaluate(h))],sqrt:[fn,[fn],(h,[l])=>Math.sqrt(l.evaluate(h))],log10:[fn,[fn],(h,[l])=>Math.log(l.evaluate(h))/Math.LN10],ln:[fn,[fn],(h,[l])=>Math.log(l.evaluate(h))],log2:[fn,[fn],(h,[l])=>Math.log2(l.evaluate(h))],sin:[fn,[fn],(h,[l])=>Math.sin(l.evaluate(h))],cos:[fn,[fn],(h,[l])=>Math.cos(l.evaluate(h))],tan:[fn,[fn],(h,[l])=>Math.tan(l.evaluate(h))],asin:[fn,[fn],(h,[l])=>Math.asin(l.evaluate(h))],acos:[fn,[fn],(h,[l])=>Math.acos(l.evaluate(h))],atan:[fn,[fn],(h,[l])=>Math.atan(l.evaluate(h))],min:[fn,Cm(fn),(h,l)=>Math.min(...l.map(u=>u.evaluate(h)))],max:[fn,Cm(fn),(h,l)=>Math.max(...l.map(u=>u.evaluate(h)))],abs:[fn,[fn],(h,[l])=>Math.abs(l.evaluate(h))],round:[fn,[fn],(h,[l])=>{const u=l.evaluate(h);return u<0?-Math.round(-u):Math.round(u)}],floor:[fn,[fn],(h,[l])=>Math.floor(l.evaluate(h))],ceil:[fn,[fn],(h,[l])=>Math.ceil(l.evaluate(h))],"filter-==":[Si,[Bs,gi],(h,[l,u])=>h.properties()[l.value]===u.value],"filter-id-==":[Si,[gi],(h,[l])=>h.id()===l.value],"filter-type-==":[Si,[Bs],(h,[l])=>h.geometryType()===l.value],"filter-<":[Si,[Bs,gi],(h,[l,u])=>{const g=h.properties()[l.value],x=u.value;return typeof g==typeof x&&g{const u=h.id(),g=l.value;return typeof u==typeof g&&u":[Si,[Bs,gi],(h,[l,u])=>{const g=h.properties()[l.value],x=u.value;return typeof g==typeof x&&g>x}],"filter-id->":[Si,[gi],(h,[l])=>{const u=h.id(),g=l.value;return typeof u==typeof g&&u>g}],"filter-<=":[Si,[Bs,gi],(h,[l,u])=>{const g=h.properties()[l.value],x=u.value;return typeof g==typeof x&&g<=x}],"filter-id-<=":[Si,[gi],(h,[l])=>{const u=h.id(),g=l.value;return typeof u==typeof g&&u<=g}],"filter->=":[Si,[Bs,gi],(h,[l,u])=>{const g=h.properties()[l.value],x=u.value;return typeof g==typeof x&&g>=x}],"filter-id->=":[Si,[gi],(h,[l])=>{const u=h.id(),g=l.value;return typeof u==typeof g&&u>=g}],"filter-has":[Si,[gi],(h,[l])=>l.value in h.properties()],"filter-has-id":[Si,[],h=>h.id()!==null&&h.id()!==void 0],"filter-type-in":[Si,[cc(Bs)],(h,[l])=>l.value.indexOf(h.geometryType())>=0],"filter-id-in":[Si,[cc(gi)],(h,[l])=>l.value.indexOf(h.id())>=0],"filter-in-small":[Si,[Bs,cc(gi)],(h,[l,u])=>u.value.indexOf(h.properties()[l.value])>=0],"filter-in-large":[Si,[Bs,cc(gi)],(h,[l,u])=>function(g,x,j,N){for(;j<=N;){const E=j+N>>1;if(x[E]===g)return!0;x[E]>g?N=E-1:j=E+1}return!1}(h.properties()[l.value],u.value,0,u.value.length-1)],all:{type:Si,overloads:[[[Si,Si],(h,[l,u])=>l.evaluate(h)&&u.evaluate(h)],[Cm(Si),(h,l)=>{for(const u of l)if(!u.evaluate(h))return!1;return!0}]]},any:{type:Si,overloads:[[[Si,Si],(h,[l,u])=>l.evaluate(h)||u.evaluate(h)],[Cm(Si),(h,l)=>{for(const u of l)if(u.evaluate(h))return!0;return!1}]]},"!":[Si,[Si],(h,[l])=>!l.evaluate(h)],"is-supported-script":[Si,[Bs],(h,[l])=>{const u=h.globals&&h.globals.isSupportedScript;return!u||u(l.evaluate(h))}],upcase:[Bs,[Bs],(h,[l])=>l.evaluate(h).toUpperCase()],downcase:[Bs,[Bs],(h,[l])=>l.evaluate(h).toLowerCase()],concat:[Bs,Cm(gi),(h,l)=>l.map(u=>Uu(u.evaluate(h))).join("")],"resolved-locale":[Bs,[Zj],(h,[l])=>l.evaluate(h).resolvedLocale()],random:[fn,[fn,fn,gi],(h,l)=>{const[u,g,x]=l.map(N=>N.evaluate(h));if(u>g||u===g)return u;let j;if(typeof x=="string")j=function(N){let E=0;if(N.length===0)return E;for(let R=0;RJSON.stringify(G)).join(", ")}, but found ${JSON.stringify(H)} instead.`);return H}catch(H){const G=H;return this._warningHistory[G.message]||(this._warningHistory[G.message]=!0,typeof console<"u"&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${G.message}`)),this._defaultValue}}}function av(h){return Array.isArray(h)&&h.length>0&&typeof h[0]=="string"&&h[0]in xx}function Tm(h,l,u,g,x){const j=new hk(xx,[],l?function(E){const R={color:pd,string:Bs,number:fn,enum:Bs,boolean:Si,formatted:H1,resolvedImage:W1};return E.type==="array"?cc(R[E.value]||gi,E.length):R[E.type]}(l):void 0,void 0,void 0,u,g,x),N=j.parse(h,void 0,void 0,void 0,l&&l.type==="string"?{typeAnnotation:"coerce"}:void 0);return N?ZI(new Nk(N,l,u,g,x)):Mm(j.errors)}class vx{constructor(l,u,g,x){this.kind=l,this._styleExpression=u,this.isLightConstant=g,this.isLineProgressConstant=x,this.isStateDependent=l!=="constant"&&!J1(u.expression),this.configDependencies=Bg(u.expression),this.isIndoorDependent=wk(u.expression)}evaluateWithoutErrorHandling(l,u,g,x,j,N){return this._styleExpression.evaluateWithoutErrorHandling(l,u,g,x,j,N)}evaluate(l,u,g,x,j,N,E){return this._styleExpression.evaluate(l,u,g,x,j,N,void 0,void 0,E)}}class $g{constructor(l,u,g,x,j,N){this.kind=l,this.zoomStops=g,this._styleExpression=u,this.isStateDependent=l!=="camera"&&!J1(u.expression),this.isIndoorDependent=wk(u.expression),this.isLightConstant=j,this.isLineProgressConstant=N,this.configDependencies=Bg(u.expression),this.interpolationType=x}evaluateWithoutErrorHandling(l,u,g,x,j,N){return this._styleExpression.evaluateWithoutErrorHandling(l,u,g,x,j,N)}evaluate(l,u,g,x,j,N){return this._styleExpression.evaluate(l,u,g,x,j,N)}interpolationFactor(l,u,g){return this.interpolationType?nu.interpolationFactor(this.interpolationType,l,u,g):0}}function B3(h,l,u,g,x){if((h=Tm(h,l,u,g,x)).result==="error")return h;const j=h.value.expression,N=ux(j);if(!N&&!iv(l))return Mm([new $u("","data expressions not supported")]);const E=hx(j,["zoom","pitch","distance-from-center"]);if(!E&&!XI(l))return Mm([new $u("","zoom expressions not supported")]);const R=hx(j,["measure-light"]);if(!R&&!YI(l))return Mm([new $u("","measure-light expression not supported")]);const B=hx(j,["line-progress"]);if(!B&&!function(X){return z3(X.expression,"line-progress")}(l))return Mm([new $u("","line-progress expression not supported")]);const H=l.expression&&l.expression.relaxZoomRestriction,G=bh(j);return G||E||H?G instanceof $u?Mm([G]):G instanceof nu&&!jk(l)?Mm([new $u("",'"interpolate" expressions cannot be used with this property')]):ZI(G?new $g(N&&B?"camera":"composite",h.value,G.labels,G instanceof nu?G.interpolation:void 0,R,B):new vx(N&&B?"constant":"source",h.value,R,B)):Mm([new $u("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class Sk{constructor(l,u){this._parameters=l,this._specification=u,Object.assign(this,JI(this._parameters,this._specification))}static deserialize(l){return new Sk(l._parameters,l._specification)}static serialize(l){return{_parameters:l._parameters,_specification:l._specification}}}function bh(h){let l=null;if(h instanceof cp)l=bh(h.result);else if(h instanceof rv){for(const u of h.args)if(l=bh(u),l)break}else(h instanceof ev||h instanceof nu)&&h.input instanceof Wc&&h.input.name==="zoom"&&(l=h);return l instanceof $u||h.eachChild(u=>{const g=bh(u);g instanceof $u?l=g:l&&g&&l!==g&&(l=new $u("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),l}var $3,rP,nP=function(){if(rP)return $3;rP=1,$3=l;var h=3;function l(u,g,x){var j=this.cells=[];if(u instanceof ArrayBuffer){this.arrayBuffer=u;var N=new Int32Array(this.arrayBuffer);u=N[0],this.d=(g=N[1])+2*(x=N[2]);for(var E=0;E=X[pe+0]&&j>=X[pe+1])?(R[ne]=!0,E.push(G[ne])):R[ne]=!1}}},l.prototype._forEachCell=function(u,g,x,j,N,E,R,B){for(var H=this._convertToCellCoord(u),G=this._convertToCellCoord(g),X=this._convertToCellCoord(x),J=this._convertToCellCoord(j),ne=H;ne<=X;ne++)for(var pe=G;pe<=J;pe++){var ke=this.d*pe+ne;if((!B||B(this._convertFromCellCoord(ne),this._convertFromCellCoord(pe),this._convertFromCellCoord(ne+1),this._convertFromCellCoord(pe+1)))&&N.call(this,u,g,x,j,ke,E,R,B))return}},l.prototype._convertFromCellCoord=function(u){return(u-this.padding)/this.scale},l.prototype._convertToCellCoord=function(u){return Math.max(0,Math.min(this.d-1,Math.floor(u*this.scale)+this.padding))},l.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var u=this.cells,g=h+this.cells.length+1+1,x=0,j=0;j=0||(x[j]=dp(h[j],l)));h instanceof Error&&(x.message=h.message)}if(x.$name)throw new Error("$name property is reserved for worker serialization logic.");return g!=="Object"&&(x.$name=g),x}throw new Error("can't serialize object of type "+typeof h)}function Am(h){if(h==null||typeof h=="boolean"||typeof h=="number"||typeof h=="string"||h instanceof Boolean||h instanceof Number||h instanceof String||h instanceof Date||h instanceof RegExp||ov(h)||h instanceof ImageBitmap||ArrayBuffer.isView(h)||h instanceof ImageData)return h;if(Array.isArray(h))return h.map(Am);if(typeof h=="object"){const l=h.$name||"Object";if(l==="Map"){const x=h.entries||[],j=new Map;for(let N=0;Nh>=128&&h<=255,Arabic:h=>h>=1536&&h<=1791,"Arabic Supplement":h=>h>=1872&&h<=1919,"Arabic Extended-A":h=>h>=2208&&h<=2303,"Hangul Jamo":h=>h>=4352&&h<=4607,"Unified Canadian Aboriginal Syllabics":h=>h>=5120&&h<=5759,Khmer:h=>h>=6016&&h<=6143,"Unified Canadian Aboriginal Syllabics Extended":h=>h>=6320&&h<=6399,"General Punctuation":h=>h>=8192&&h<=8303,"Letterlike Symbols":h=>h>=8448&&h<=8527,"Number Forms":h=>h>=8528&&h<=8591,"Miscellaneous Technical":h=>h>=8960&&h<=9215,"Control Pictures":h=>h>=9216&&h<=9279,"Optical Character Recognition":h=>h>=9280&&h<=9311,"Enclosed Alphanumerics":h=>h>=9312&&h<=9471,"Geometric Shapes":h=>h>=9632&&h<=9727,"Miscellaneous Symbols":h=>h>=9728&&h<=9983,"Miscellaneous Symbols and Arrows":h=>h>=11008&&h<=11263,"CJK Radicals Supplement":h=>h>=11904&&h<=12031,"Kangxi Radicals":h=>h>=12032&&h<=12255,"Ideographic Description Characters":h=>h>=12272&&h<=12287,"CJK Symbols and Punctuation":h=>h>=12288&&h<=12351,Hiragana:h=>h>=12352&&h<=12447,Katakana:h=>h>=12448&&h<=12543,Bopomofo:h=>h>=12544&&h<=12591,"Hangul Compatibility Jamo":h=>h>=12592&&h<=12687,Kanbun:h=>h>=12688&&h<=12703,"Bopomofo Extended":h=>h>=12704&&h<=12735,"CJK Strokes":h=>h>=12736&&h<=12783,"Katakana Phonetic Extensions":h=>h>=12784&&h<=12799,"Enclosed CJK Letters and Months":h=>h>=12800&&h<=13055,"CJK Compatibility":h=>h>=13056&&h<=13311,"CJK Unified Ideographs Extension A":h=>h>=13312&&h<=19903,"Yijing Hexagram Symbols":h=>h>=19904&&h<=19967,"CJK Unified Ideographs":h=>h>=19968&&h<=40959,"Yi Syllables":h=>h>=40960&&h<=42127,"Yi Radicals":h=>h>=42128&&h<=42191,"Hangul Jamo Extended-A":h=>h>=43360&&h<=43391,"Hangul Syllables":h=>h>=44032&&h<=55215,"Hangul Jamo Extended-B":h=>h>=55216&&h<=55295,"Private Use Area":h=>h>=57344&&h<=63743,"CJK Compatibility Ideographs":h=>h>=63744&&h<=64255,"Arabic Presentation Forms-A":h=>h>=64336&&h<=65023,"Vertical Forms":h=>h>=65040&&h<=65055,"CJK Compatibility Forms":h=>h>=65072&&h<=65103,"Small Form Variants":h=>h>=65104&&h<=65135,"Arabic Presentation Forms-B":h=>h>=65136&&h<=65279,"Halfwidth and Fullwidth Forms":h=>h>=65280&&h<=65519,Osage:h=>h>=66736&&h<=66815,"CJK Unified Ideographs Extension B":h=>h>=131072&&h<=173791};function lv(h){for(const l of h)if(Ck(l.charCodeAt(0)))return!0;return!1}function U3(h){for(const l of h)if(!sP(l.charCodeAt(0)))return!1;return!0}function sP(h){return!(Cn.Arabic(h)||Cn["Arabic Supplement"](h)||Cn["Arabic Extended-A"](h)||Cn["Arabic Presentation Forms-A"](h)||Cn["Arabic Presentation Forms-B"](h))}function Ck(h){return!(h!==746&&h!==747&&(h<4352||!(Cn["Bopomofo Extended"](h)||Cn.Bopomofo(h)||Cn["CJK Compatibility Forms"](h)&&!(h>=65097&&h<=65103)||Cn["CJK Compatibility Ideographs"](h)||Cn["CJK Compatibility"](h)||Cn["CJK Radicals Supplement"](h)||Cn["CJK Strokes"](h)||!(!Cn["CJK Symbols and Punctuation"](h)||h>=12296&&h<=12305||h>=12308&&h<=12319||h===12336)||Cn["CJK Unified Ideographs Extension A"](h)||Cn["CJK Unified Ideographs"](h)||Cn["Enclosed CJK Letters and Months"](h)||Cn["Hangul Compatibility Jamo"](h)||Cn["Hangul Jamo Extended-A"](h)||Cn["Hangul Jamo Extended-B"](h)||Cn["Hangul Jamo"](h)||Cn["Hangul Syllables"](h)||Cn.Hiragana(h)||Cn["Ideographic Description Characters"](h)||Cn.Kanbun(h)||Cn["Kangxi Radicals"](h)||Cn["Katakana Phonetic Extensions"](h)||Cn.Katakana(h)&&h!==12540||!(!Cn["Halfwidth and Fullwidth Forms"](h)||h===65288||h===65289||h===65293||h>=65306&&h<=65310||h===65339||h===65341||h===65343||h>=65371&&h<=65503||h===65507||h>=65512&&h<=65519)||!(!Cn["Small Form Variants"](h)||h>=65112&&h<=65118||h>=65123&&h<=65126)||Cn["Unified Canadian Aboriginal Syllabics"](h)||Cn["Unified Canadian Aboriginal Syllabics Extended"](h)||Cn["Vertical Forms"](h)||Cn["Yijing Hexagram Symbols"](h)||Cn["Yi Syllables"](h)||Cn["Yi Radicals"](h))))}function Mk(h){return!(Ck(h)||function(l){return!!(Cn["Latin-1 Supplement"](l)&&(l===167||l===169||l===174||l===177||l===188||l===189||l===190||l===215||l===247)||Cn["General Punctuation"](l)&&(l===8214||l===8224||l===8225||l===8240||l===8241||l===8251||l===8252||l===8258||l===8263||l===8264||l===8265||l===8273)||Cn["Letterlike Symbols"](l)||Cn["Number Forms"](l)||Cn["Miscellaneous Technical"](l)&&(l>=8960&&l<=8967||l>=8972&&l<=8991||l>=8996&&l<=9e3||l===9003||l>=9085&&l<=9114||l>=9150&&l<=9165||l===9167||l>=9169&&l<=9179||l>=9186&&l<=9215)||Cn["Control Pictures"](l)&&l!==9251||Cn["Optical Character Recognition"](l)||Cn["Enclosed Alphanumerics"](l)||Cn["Geometric Shapes"](l)||Cn["Miscellaneous Symbols"](l)&&!(l>=9754&&l<=9759)||Cn["Miscellaneous Symbols and Arrows"](l)&&(l>=11026&&l<=11055||l>=11088&&l<=11097||l>=11192&&l<=11243)||Cn["CJK Symbols and Punctuation"](l)||Cn.Katakana(l)||Cn["Private Use Area"](l)||Cn["CJK Compatibility Forms"](l)||Cn["Small Form Variants"](l)||Cn["Halfwidth and Fullwidth Forms"](l)||l===8734||l===8756||l===8757||l>=9984&&l<=10087||l>=10102&&l<=10131||l===65532||l===65533)}(h))}function Tk(h){return Cn.Arabic(h)||Cn["Arabic Supplement"](h)||Cn["Arabic Extended-A"](h)||Cn["Arabic Presentation Forms-A"](h)||Cn["Arabic Presentation Forms-B"](h)}function q3(h){return h>=1424&&h<=2303||Cn["Arabic Presentation Forms-A"](h)||Cn["Arabic Presentation Forms-B"](h)}function up(h,l){return!(!l&&q3(h)||h>=2304&&h<=3583||h>=3840&&h<=4255||Cn.Khmer(h))}function Qie(h){for(const l of h)if(q3(l.charCodeAt(0)))return!0;return!1}const Ld={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"};let V3=null,Gc=Ld.unavailable,hp=null;const cv=function(h){h&&typeof h=="string"&&h.indexOf("NetworkError")>-1&&(Gc=Ld.error),V3&&V3(h)};function Ak(){Ek.fire(new tf("pluginStateChange",{pluginStatus:Gc,pluginURL:hp}))}const Ek=new Og,dv=function(){return Gc},iP=function(){if(Gc!==Ld.deferred||!hp)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Gc=Ld.loading,Ak(),hp&&zu({url:hp},h=>{h?cv(h):(Gc=Ld.loaded,Ak())})},fp={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Gc===Ld.loaded||fp.applyArabicShaping!=null,isLoading:()=>Gc===Ld.loading,setState(h){Gc=h.pluginStatus,hp=h.pluginURL},isParsing:()=>Gc===Ld.parsing,isParsed:()=>Gc===Ld.parsed,getPluginURL:()=>hp};class Qi{constructor(l,u){this.zoom=l,u?(this.now=u.now,this.fadeDuration=u.fadeDuration,this.transition=u.transition,this.pitch=u.pitch,this.brightness=u.brightness,this.worldview=u.worldview,this.activeFloors=u.activeFloors):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(l){return function(u,g){for(const x of u)if(!up(x.charCodeAt(0),g))return!1;return!0}(l,fp.isLoaded())}}class Ik{constructor(l,u,g,x,j){this.property=l,this.value=u,this.expression=function(N,E,R,B,H){if(kk(N))return new Sk(N,E);if(av(N)||Array.isArray(N)&&N.length>0){const G=B3(N,E,R,B,H);if(G.result==="error")throw new Error(G.value.map(X=>`${X.key}: ${X.message}`).join(", "));return G.value}{let G=N;return typeof N=="string"&&E.type==="color"&&(G=xi.parse(N)),{kind:"constant",configDependencies:new Set,isIndoorDependent:!1,evaluate:()=>G}}}(u===void 0?l.specification.default:u,l.specification,g,x,j)}isIndoorDependent(){return this.expression.isIndoorDependent}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(l,u,g,x){return this.property.possiblyEvaluate(this,l,u,g,x)}}class H3{constructor(l,u,g,x){this.property=l,this.value=new Ik(l,void 0,u,g,x)}transitioned(l,u){return new oP(this.property,this.value,u,Object.assign({},l.transition,this.transition),l.now)}untransitioned(){return new oP(this.property,this.value,null,{},0)}}class aP{constructor(l,u,g,x){this._properties=l,this._values=Object.create(l.defaultTransitionablePropertyValues),this._scope=u,this._options=g,this._iconImageUseTheme=x,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(l){return ir(this._values[l].value.value)}setValue(l,u){this._values.hasOwnProperty(l)||(this._values[l]=new H3(this._values[l].property,this._scope,this._options,this._iconImageUseTheme)),this._values[l].value=new Ik(this._values[l].property,u===null?void 0:ir(u),this._scope,this._options,this._iconImageUseTheme),this._values[l].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[l].value.expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[l].value.isIndoorDependent())}setTransitionOrValue(l,u){u&&(this._options=u);const g=this._properties.properties;if(l)for(const x in l){const j=l[x];if(x.endsWith("-transition")){const N=x.slice(0,-11);g[N]&&this.setTransition(N,j)}else g.hasOwnProperty(x)&&this.setValue(x,j)}}getTransition(l){return ir(this._values[l].transition)}setTransition(l,u){this._values.hasOwnProperty(l)||(this._values[l]=new H3(this._values[l].property)),this._values[l].transition=ir(u)||void 0}serialize(){const l={};for(const u of Object.keys(this._values)){const g=this.getValue(u);g!==void 0&&(l[u]=g);const x=this.getTransition(u);x!==void 0&&(l[`${u}-transition`]=x)}return l}transitioned(l,u){const g=new lP(this._properties);for(const x of Object.keys(this._values))g._values[x]=this._values[x].transitioned(l,u._values[x]);return g}untransitioned(){const l=new lP(this._properties);for(const u of Object.keys(this._values))l._values[u]=this._values[u].untransitioned();return l}isIndoorDependent(){return this._isIndoorDependent}}class oP{constructor(l,u,g,x,j){const N=x.delay||0,E=x.duration||0;j=j||0,this.property=l,this.value=u,this.begin=j+N,this.end=this.begin+E,l.specification.transition&&(x.delay||x.duration)&&(this.prior=g)}possiblyEvaluate(l,u,g){const x=l.now||0,j=this.value.possiblyEvaluate(l,u,g),N=this.prior;if(N){if(x>this.end)return this.prior=null,j;if(this.value.isDataDriven())return this.prior=null,j;if(x":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*"}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"high-color":{"type":"color","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"space-color":{"type":"color","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"horizon-blend":{"type":"number","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"snow":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.85],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.3],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.4,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,50],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"flake-size":{"type":"number","default":0.71,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"rain":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.5],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#03113d",0.3,"#a8adbc"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":["interpolate",["linear"],["measure-light","brightness"],0,0.88,1,0.7],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#001736",0.3,"#464646"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.57,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"droplet-size":{"type":"array","default":[2.6,18.2],"minimum":0,"maximum":50,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"distortion-strength":{"type":"number","default":0.7,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective"}},"colorTheme":{"data":{"type":"string","expression":{}}},"indoor_source":{"sourceId":{"type":"string"},"sourceLayers":{"type":"array","value":"string"}},"indoor":{"*":{"type":"indoor_source"}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator"},"center":{"type":"array","length":2,"value":"number","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string"},"exaggeration":{"type":"number","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_building","paint_symbol","paint_raster","paint_raster-particle","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-bridge-guard-rail-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"},"fill-tunnel-structure-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"flat"},"fill-extrusion-base-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"terrain"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true}},"paint_building":{"building-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"parameters":[]},"transition":true},"building-ambient-occlusion-ground-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-cast-shadows":{"type":"boolean","default":true},"building-color":{"type":"color","default":"rgba(193, 154, 127, 1)","use-theme":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-facade-emissive-chance":{"type":"number","default":0.35,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["measure-light","zoom"]}},"building-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"building-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light","line-progress"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-gradient":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["line-progress"]}},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1]},"line-trim-fade-range":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-trim-color":{"type":"color","default":"transparent","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-driven"},"line-border-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"use-theme":true,"expression":{"interpolated":true,"parameters":["heatmap-density"]}},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-image-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{}},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-value"]}},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]}},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"raster-array-band":{"type":"string"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string"},"raster-particle-count":{"type":"number","default":512,"minimum":1},"raster-particle-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-particle-speed"]}},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-shadow-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-accent-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_background":{"background-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":[]}},"background-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]}},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]}},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]}},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"use-theme":true,"expression":{"interpolated":true,"parameters":["sky-radial-progress"]}},"sky-atmosphere-halo-color":{"type":"color","default":"white","use-theme":true},"sky-atmosphere-color":{"type":"color","default":"white","use-theme":true},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"property-type":"data-driven"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"use-theme":true,"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d"},"model-cast-shadows":{"type":"boolean","default":true},"model-receive-shadows":{"type":"boolean","default":true},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"model-front-cutoff":{"type":"array","value":"number","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]},"model-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{}}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"promoteId":{"*":{"type":"*"}}}');function dP(h){return h instanceof Number||h instanceof String||h instanceof Boolean?h.valueOf():h}function Pk(h){if(Array.isArray(h))return h.map(Pk);if(h instanceof Object&&!(h instanceof Number||h instanceof String||h instanceof Boolean)){const l={};for(const u in h)l[u]=Pk(h[u]);return l}return dP(h)}function lf(h){if(h===!0||h===!1)return!0;if(!Array.isArray(h)||h.length===0)return!1;switch(h[0]){case"has":return h.length>=2&&h[1]!=="$id"&&h[1]!=="$type";case"in":return h.length>=3&&(typeof h[1]!="string"||Array.isArray(h[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return h.length!==3||Array.isArray(h[1])||Array.isArray(h[2]);case"any":case"all":for(const l of h.slice(1))if(!lf(l)&&typeof l!="boolean")return!1;return!0;default:return!0}}function Lk(h,l="",u=null,g="fill"){if(h==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};lf(h)||(h=Ok(h));const x=h;let j=!0;try{j=function(H){if(!bx(H))return H;let G=Pk(H);return uP(G),G=Wg(G),G}(x)}catch{console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate. This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md and paste the contents of this message in the report. Thank you! Filter Expression: ${JSON.stringify(x,null,2)} `)}let N=null,E=null;if(g!=="background"&&g!=="sky"&&g!=="slot"){E=Dt[`filter_${g}`];const H=Tm(j,E,l,u);if(H.result==="error")throw new Error(H.value.map(G=>`${G.key}: ${G.message}`).join(", "));N=(G,X,J)=>H.value.evaluate(G,X,{},J)}let R=null,B=null;if(j!==x){const H=Tm(x,E,l,u);if(H.result==="error")throw new Error(H.value.map(G=>`${G.key}: ${G.message}`).join(", "));R=(G,X,J,ne,pe)=>H.value.evaluate(G,X,{},J,void 0,void 0,ne,pe),B=!ux(H.value.expression)}return{filter:N,dynamicFilter:R||void 0,needGeometry:hP(j),needFeature:!!B}}function Wg(h){if(!Array.isArray(h))return h;const l=function(u){if(Jie.has(u[0])){for(let g=1;gWg(u))}function uP(h){let l=!1;const u=[];if(h[0]==="case"){for(let g=1;g",">=","<","<=","to-boolean"]);function eae(h,l){return hl?1:0}function hP(h){if(!Array.isArray(h))return!1;if(h[0]==="within"||h[0]==="distance")return!0;for(let l=1;l"||l==="<="||l===">="?Dk(h[1],h[2],l):l==="any"?(u=h.slice(1),["any"].concat(u.map(Ok))):l==="all"?["all"].concat(h.slice(1).map(Ok)):l==="none"?["all"].concat(h.slice(1).map(Ok).map(uv)):l==="in"?Rk(h[1],h.slice(2)):l==="!in"?uv(Rk(h[1],h.slice(2))):l==="has"?Fk(h[1]):l!=="!has"||uv(Fk(h[1]));var u}function Dk(h,l,u){switch(h){case"$type":return[`filter-type-${u}`,l];case"$id":return[`filter-id-${u}`,l];default:return[`filter-${u}`,h,l]}}function Rk(h,l){if(l.length===0)return!1;switch(h){case"$type":return["filter-type-in",["literal",l]];case"$id":return["filter-id-in",["literal",l]];default:return l.length>200&&!l.some(u=>typeof u!=typeof l[0])?["filter-in-large",h,["literal",l.sort(eae)]]:["filter-in-small",h,["literal",l]]}}function Fk(h){switch(h){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",h]}}function uv(h){return["!",h]}const Gg="";function wh(h,l){return l?`${h}${Gg}${l}`:h}let fP;const pP=()=>fP||(fP=new Ra({"icon-size":new Ir(Dt.layout_symbol["icon-size"]),"icon-image":new Ir(Dt.layout_symbol["icon-image"]),"icon-rotate":new Ir(Dt.layout_symbol["icon-rotate"]),"icon-offset":new Ir(Dt.layout_symbol["icon-offset"]),"text-size":new Ir(Dt.layout_symbol["text-size"]),"text-rotate":new Ir(Dt.layout_symbol["text-rotate"]),"text-offset":new Ir(Dt.layout_symbol["text-offset"])}));class mP{constructor(l,u,g,x,j,N){const E=Tm(l,Dt.appearance.condition);if(E.result==="success"&&(this.condition=E.value),this.name=u,g){this.properties=new Vg(pP()),this.unevaluatedLayout=new cP(pP(),x,j,N);for(const R in g)this.unevaluatedLayout.setValue(R,g[R])}}isActive(l){return!(this.condition||!l.isHidden||this.name!=="hidden")||this.condition.evaluate(l.globals,l.feature,l.featureState,l.canonical)}getCondition(){return this.condition}getName(){return this.name}getProperty(l){return this.properties.get(l)}getUnevaluatedProperties(){return this.unevaluatedLayout}getUnevaluatedProperty(l){return this.unevaluatedLayout._values[l]}recalculate(l,u,g){this.unevaluatedLayout&&(this.properties=this.unevaluatedLayout.possiblyEvaluate(l,void 0,u,g))}serialize(){const l={};return l.condition=this.condition.expression.serialize(),this.name&&(l.name=this.name),this.unevaluatedLayout&&(l.properties=this.unevaluatedLayout.serialize()),l}hasIconProperties(){const l=this.hasProperty("icon-image"),u=this.hasProperty("icon-size"),g=this.hasProperty("icon-offset"),x=this.hasProperty("icon-rotate");return l||u||g||x}hasTextProperties(){const l=this.hasProperty("text-size"),u=this.hasProperty("text-offset"),g=this.hasProperty("text-rotate");return l||u||g}hasProperty(l){return this.getUnevaluatedProperty(l).value!==void 0}}const gP="-transition",cf=new Set(["fill","line","background","hillshade","raster"]);class Kc extends Og{constructor(l,u,g,x,j,N){if(super(),this.id=l.id,this.fqid=wh(this.id,g),this.type=l.type,this.scope=g,this.lut=x,this.options=j,this.iconImageUseTheme=N,this.appearances=new Array,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.expressionDependencies={isIndoorDependent:!1,configDependencies:new Set},l.type!=="custom"){if(this.metadata=l.metadata,this.minzoom=l.minzoom,this.maxzoom=l.maxzoom,l.type&&l.type!=="background"&&l.type!=="sky"&&l.type!=="slot"){this.source=l.source,this.sourceLayer=l["source-layer"],this.filter=l.filter;const E=Tm(this.filter,Dt[`filter_${l.type}`]);E.result!=="error"&&(this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...E.value.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||E.value.isIndoorDependent)}if(l.slot&&(this.slot=l.slot),l.appearances&&this.setAppearances(l.appearances),u.layout&&(this._unevaluatedLayout=new cP(u.layout,this.scope,j,this.iconImageUseTheme),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...this._unevaluatedLayout.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._unevaluatedLayout.isIndoorDependent()),u.paint){this._transitionablePaint=new aP(u.paint,this.scope,j);for(const E in l.paint)this.setPaintProperty(E,l.paint[E]);for(const E in l.layout)this.setLayoutProperty(E,l.layout[E]);this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...this._transitionablePaint.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._transitionablePaint.isIndoorDependent(),this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Vg(u.paint)}}}onAdd(l){}onRemove(l){}isDraped(l){return!this.is3D(!0)&&cf.has(this.type)}getLayoutProperty(l){return l==="visibility"?this.visibility:this._unevaluatedLayout.getValue(l)}setLayoutProperty(l,u){if(this.type==="custom"&&l==="visibility")return void(this.visibility=u);const g=this._unevaluatedLayout;g._properties.properties[l]&&(g.setValue(l,u),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...g.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||g.isIndoorDependent(),l==="visibility"&&this.possiblyEvaluateVisibility())}setAppearances(l){this.appearances=[],l.forEach(u=>{this.appearances.push(new mP(u.condition,u.name,u.properties,this.scope,this.options,this.iconImageUseTheme))})}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(l){return l.endsWith(gP)?this._transitionablePaint.getTransition(l.slice(0,-11)):this._transitionablePaint.getValue(l)}isPaintProperty(l){return!!this._transitionablePaint._properties.properties[l]}setPaintProperty(l,u){const g=this._transitionablePaint,x=g._properties.properties;if(l.endsWith(gP)){const G=l.slice(0,-11);return x[G]&&g.setTransition(G,u||void 0),!1}if(!x[l])return!1;const j=g._values[l],N=j.value.isDataDriven(),E=j.value;g.setValue(l,u),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...g.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||g.isIndoorDependent(),this._handleSpecialPaintPropertyUpdate(l);const R=g._values[l].value,B=R.isDataDriven(),H=l.endsWith("pattern")||l==="line-dasharray";return B||N||H||this._handleOverridablePaintPropertyUpdate(l,E,R)}_handleSpecialPaintPropertyUpdate(l){}getProgramIds(){return null}getDefaultProgramParams(l,u,g){return null}_handleOverridablePaintPropertyUpdate(l,u,g){return!1}isHidden(l){return!!(this.minzoom&&l=this.maxzoom)||this.visibility==="none"}updateTransitions(l){this._transitioningPaint=this._transitionablePaint.transitioned(l,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(l,u){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(l,void 0,u,this.iconImageUseTheme)),this.paint=this._transitioningPaint.possiblyEvaluate(l,void 0,u)}serialize(){const l={id:this.id,type:this.type,slot:this.slot,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.appearances.length!==0&&(l.appearances=this.appearances.map(u=>u.serialize())),mr(l,(u,g)=>!(u===void 0||g==="layout"&&!Object.keys(u).length||g==="paint"&&!Object.keys(u).length))}is3D(l){return!1}hasElevation(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}_clear(){}isStateDependent(){for(const l in this.paint._values){const u=this.paint.get(l);if(u instanceof qg&&iv(u.property.specification)&&(u.value.kind==="source"||u.value.kind==="composite")&&u.value.isStateDependent)return!0}for(const l of this.appearances)if(!J1(l.condition.expression))return!0;return!1}compileFilter(l){this._filterCompiled||(this._featureFilter=Lk(this.filter,this.scope,l),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(l){this._stats&&(l.renderPass==="shadow"?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}getAppearances(){return this.appearances}queryRenderedFeatures(l,u,g){return{}}queryRadius(l){}queryIntersectsFeature(l,u,g,x,j,N,E,R,B){}}const yP={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class hv{constructor(l,u){this._structArray=l,this._pos1=u*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}const tae=new ArrayBuffer(0);class da{constructor(){this._reallocCount=0,this.capacity=0,this.length=0}static serialize(l,u){return l._trim(),u&&l.arrayBuffer&&u.add(l.arrayBuffer),{length:l.length,arrayBuffer:l.arrayBuffer}}static deserialize(l){const u=Object.create(this.prototype);return u.arrayBuffer=l.arrayBuffer,u.length=l.length,l.arrayBuffer?u.capacity=l.arrayBuffer.byteLength/u.bytesPerElement:(u.capacity=0,u.arrayBuffer=tae),u._refreshViews(),u}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(l){this.reserve(l),this.length=l}reserve(l){if(l>this.capacity){this._reallocCount++,this.capacity=Math.max(l,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const u=this.uint8;this._refreshViews(),u&&this.uint8.set(u)}}reserveForAdditional(l){this.reserve(this.length+l)}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...l){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...l){throw new Error("StructArray#emplaceBack() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function ks(h,l=1){let u=0,g=0;return{members:h.map(x=>{const j=yP[x.type].BYTES_PER_ELEMENT,N=u=xP(u,Math.max(l,j)),E=x.components||1;return g=Math.max(g,j),u+=j*E,{name:x.name,type:x.type,components:E,offset:N}}),size:xP(u,Math.max(g,l)),alignment:l}}function xP(h,l){return Math.ceil(h/l)*l}class Em extends da{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,u){const g=this.length;return this.resize(g+1),this.emplace(g,l,u)}emplace(l,u,g){const x=2*l;return this.int16[x+0]=u,this.int16[x+1]=g,l}}Em.prototype.bytesPerElement=4,Yr(Em,"StructArrayLayout2i4");class wx extends da{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,u,g){const x=this.length;return this.resize(x+1),this.emplace(x,l,u,g)}emplace(l,u,g,x){const j=3*l;return this.int16[j+0]=u,this.int16[j+1]=g,this.int16[j+2]=x,l}}wx.prototype.bytesPerElement=6,Yr(wx,"StructArrayLayout3i6");class jx extends da{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,u,g,x){const j=this.length;return this.resize(j+1),this.emplace(j,l,u,g,x)}emplace(l,u,g,x,j){const N=4*l;return this.int16[N+0]=u,this.int16[N+1]=g,this.int16[N+2]=x,this.int16[N+3]=j,l}}jx.prototype.bytesPerElement=8,Yr(jx,"StructArrayLayout4i8");class pp extends da{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l){const u=this.length;return this.resize(u+1),this.emplace(u,l)}emplace(l,u){return this.float32[1*l+0]=u,l}}pp.prototype.bytesPerElement=4,Yr(pp,"StructArrayLayout1f4");class W3 extends da{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,g){const x=this.length;return this.resize(x+1),this.emplace(x,l,u,g)}emplace(l,u,g,x){const j=4*l,N=2*l;return this.int16[j+0]=u,this.int16[j+1]=g,this.float32[N+1]=x,l}}W3.prototype.bytesPerElement=8,Yr(W3,"StructArrayLayout2i1f8");class G3 extends da{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,u,g){const x=this.length;return this.resize(x+1),this.emplace(x,l,u,g)}emplace(l,u,g,x){const j=4*l;return this.int16[j+0]=u,this.int16[j+1]=g,this.int16[j+2]=x,l}}G3.prototype.bytesPerElement=8,Yr(G3,"StructArrayLayout3i8");class K3 extends da{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,u,g,x,j){const N=this.length;return this.resize(N+1),this.emplace(N,l,u,g,x,j)}emplace(l,u,g,x,j,N){const E=5*l;return this.int16[E+0]=u,this.int16[E+1]=g,this.int16[E+2]=x,this.int16[E+3]=j,this.int16[E+4]=N,l}}K3.prototype.bytesPerElement=10,Yr(K3,"StructArrayLayout5i10");class zk extends da{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,g,x,j,N,E){const R=this.length;return this.resize(R+1),this.emplace(R,l,u,g,x,j,N,E)}emplace(l,u,g,x,j,N,E,R){const B=6*l,H=12*l,G=3*l;return this.int16[B+0]=u,this.int16[B+1]=g,this.uint8[H+4]=x,this.uint8[H+5]=j,this.uint8[H+6]=N,this.uint8[H+7]=E,this.float32[G+2]=R,l}}zk.prototype.bytesPerElement=12,Yr(zk,"StructArrayLayout2i4ub1f12");class su extends da{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,g){const x=this.length;return this.resize(x+1),this.emplace(x,l,u,g)}emplace(l,u,g,x){const j=3*l;return this.float32[j+0]=u,this.float32[j+1]=g,this.float32[j+2]=x,l}}su.prototype.bytesPerElement=12,Yr(su,"StructArrayLayout3f12");class md extends da{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,g,x,j){const N=this.length;return this.resize(N+1),this.emplace(N,l,u,g,x,j)}emplace(l,u,g,x,j,N){const E=6*l,R=3*l;return this.uint16[E+0]=u,this.uint16[E+1]=g,this.uint16[E+2]=x,this.uint16[E+3]=j,this.float32[R+2]=N,l}}md.prototype.bytesPerElement=12,Yr(md,"StructArrayLayout4ui1f12");class Kg extends da{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,u,g,x){const j=this.length;return this.resize(j+1),this.emplace(j,l,u,g,x)}emplace(l,u,g,x,j){const N=4*l;return this.uint16[N+0]=u,this.uint16[N+1]=g,this.uint16[N+2]=x,this.uint16[N+3]=j,l}}Kg.prototype.bytesPerElement=8,Yr(Kg,"StructArrayLayout4ui8");class Bk extends da{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,u,g,x,j,N){const E=this.length;return this.resize(E+1),this.emplace(E,l,u,g,x,j,N)}emplace(l,u,g,x,j,N,E){const R=6*l;return this.int16[R+0]=u,this.int16[R+1]=g,this.int16[R+2]=x,this.int16[R+3]=j,this.int16[R+4]=N,this.int16[R+5]=E,l}}Bk.prototype.bytesPerElement=12,Yr(Bk,"StructArrayLayout6i12");class Z3 extends da{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,u,g,x,j,N,E,R,B,H,G,X){const J=this.length;return this.resize(J+1),this.emplace(J,l,u,g,x,j,N,E,R,B,H,G,X)}emplace(l,u,g,x,j,N,E,R,B,H,G,X,J){const ne=12*l;return this.int16[ne+0]=u,this.int16[ne+1]=g,this.int16[ne+2]=x,this.int16[ne+3]=j,this.uint16[ne+4]=N,this.uint16[ne+5]=E,this.uint16[ne+6]=R,this.uint16[ne+7]=B,this.int16[ne+8]=H,this.int16[ne+9]=G,this.int16[ne+10]=X,this.int16[ne+11]=J,l}}Z3.prototype.bytesPerElement=24,Yr(Z3,"StructArrayLayout4i4ui4i24");class Y3 extends da{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,g,x,j,N){const E=this.length;return this.resize(E+1),this.emplace(E,l,u,g,x,j,N)}emplace(l,u,g,x,j,N,E){const R=10*l,B=5*l;return this.int16[R+0]=u,this.int16[R+1]=g,this.int16[R+2]=x,this.float32[B+2]=j,this.float32[B+3]=N,this.float32[B+4]=E,l}}Y3.prototype.bytesPerElement=20,Yr(Y3,"StructArrayLayout3i3f20");class Im extends da{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,g,x){const j=this.length;return this.resize(j+1),this.emplace(j,l,u,g,x)}emplace(l,u,g,x,j){const N=4*l;return this.float32[N+0]=u,this.float32[N+1]=g,this.float32[N+2]=x,this.float32[N+3]=j,l}}Im.prototype.bytesPerElement=16,Yr(Im,"StructArrayLayout4f16");class $k extends da{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(l){const u=this.length;return this.resize(u+1),this.emplace(u,l)}emplace(l,u){return this.uint32[1*l+0]=u,l}}$k.prototype.bytesPerElement=4,Yr($k,"StructArrayLayout1ul4");class iu extends da{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,u){const g=this.length;return this.resize(g+1),this.emplace(g,l,u)}emplace(l,u,g){const x=2*l;return this.uint16[x+0]=u,this.uint16[x+1]=g,l}}iu.prototype.bytesPerElement=4,Yr(iu,"StructArrayLayout2ui4");class Uk extends da{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,u,g,x,j,N,E,R,B,H,G,X,J){const ne=this.length;return this.resize(ne+1),this.emplace(ne,l,u,g,x,j,N,E,R,B,H,G,X,J)}emplace(l,u,g,x,j,N,E,R,B,H,G,X,J,ne){const pe=20*l,ke=10*l;return this.int16[pe+0]=u,this.int16[pe+1]=g,this.int16[pe+2]=x,this.int16[pe+3]=j,this.int16[pe+4]=N,this.float32[ke+3]=E,this.float32[ke+4]=R,this.float32[ke+5]=B,this.float32[ke+6]=H,this.int16[pe+14]=G,this.uint32[ke+8]=X,this.uint16[pe+18]=J,this.uint16[pe+19]=ne,l}}Uk.prototype.bytesPerElement=40,Yr(Uk,"StructArrayLayout5i4f1i1ul2ui40");class qk extends da{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,u,g,x,j,N,E){const R=this.length;return this.resize(R+1),this.emplace(R,l,u,g,x,j,N,E)}emplace(l,u,g,x,j,N,E,R){const B=8*l;return this.int16[B+0]=u,this.int16[B+1]=g,this.int16[B+2]=x,this.int16[B+4]=j,this.int16[B+5]=N,this.int16[B+6]=E,this.int16[B+7]=R,l}}qk.prototype.bytesPerElement=16,Yr(qk,"StructArrayLayout3i2i2i16");class Vk extends da{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,u,g,x,j){const N=this.length;return this.resize(N+1),this.emplace(N,l,u,g,x,j)}emplace(l,u,g,x,j,N){const E=4*l,R=8*l;return this.float32[E+0]=u,this.float32[E+1]=g,this.float32[E+2]=x,this.int16[R+6]=j,this.int16[R+7]=N,l}}Vk.prototype.bytesPerElement=16,Yr(Vk,"StructArrayLayout2f1f2i16");class X3 extends da{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,g,x,j,N){const E=this.length;return this.resize(E+1),this.emplace(E,l,u,g,x,j,N)}emplace(l,u,g,x,j,N,E){const R=20*l,B=5*l;return this.uint8[R+0]=u,this.uint8[R+1]=g,this.float32[B+1]=x,this.float32[B+2]=j,this.float32[B+3]=N,this.float32[B+4]=E,l}}X3.prototype.bytesPerElement=20,Yr(X3,"StructArrayLayout2ub4f20");class Ro extends da{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,u,g){const x=this.length;return this.resize(x+1),this.emplace(x,l,u,g)}emplace(l,u,g,x){const j=3*l;return this.uint16[j+0]=u,this.uint16[j+1]=g,this.uint16[j+2]=x,l}}Ro.prototype.bytesPerElement=6,Yr(Ro,"StructArrayLayout3ui6");class kx extends da{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(l,u,g,x,j,N,E,R,B,H,G,X,J,ne,pe,ke,we,De,Be,He,dt){const it=this.length;return this.resize(it+1),this.emplace(it,l,u,g,x,j,N,E,R,B,H,G,X,J,ne,pe,ke,we,De,Be,He,dt)}emplace(l,u,g,x,j,N,E,R,B,H,G,X,J,ne,pe,ke,we,De,Be,He,dt,it){const pt=30*l,wt=15*l,Ct=60*l;return this.int16[pt+0]=u,this.int16[pt+1]=g,this.int16[pt+2]=x,this.float32[wt+2]=j,this.float32[wt+3]=N,this.uint16[pt+8]=E,this.uint16[pt+9]=R,this.uint32[wt+5]=B,this.uint32[wt+6]=H,this.uint32[wt+7]=G,this.uint16[pt+16]=X,this.uint16[pt+17]=J,this.uint16[pt+18]=ne,this.float32[wt+10]=pe,this.float32[wt+11]=ke,this.uint8[Ct+48]=we,this.uint8[Ct+49]=De,this.uint8[Ct+50]=Be,this.uint32[wt+13]=He,this.int16[pt+28]=dt,this.uint8[Ct+58]=it,l}}kx.prototype.bytesPerElement=60,Yr(kx,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class Q3 extends da{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(l,u,g,x,j,N,E,R,B,H,G,X,J,ne,pe,ke,we,De,Be,He,dt,it,pt,wt,Ct,Wt,Lt,Qt,ar,or,gr,xr,hr){const fr=this.length;return this.resize(fr+1),this.emplace(fr,l,u,g,x,j,N,E,R,B,H,G,X,J,ne,pe,ke,we,De,Be,He,dt,it,pt,wt,Ct,Wt,Lt,Qt,ar,or,gr,xr,hr)}emplace(l,u,g,x,j,N,E,R,B,H,G,X,J,ne,pe,ke,we,De,Be,He,dt,it,pt,wt,Ct,Wt,Lt,Qt,ar,or,gr,xr,hr,fr){const Xt=20*l,Gt=40*l,pr=80*l;return this.float32[Xt+0]=u,this.float32[Xt+1]=g,this.int16[Gt+4]=x,this.int16[Gt+5]=j,this.int16[Gt+6]=N,this.int16[Gt+7]=E,this.int16[Gt+8]=R,this.int16[Gt+9]=B,this.int16[Gt+10]=H,this.int16[Gt+11]=G,this.int16[Gt+12]=X,this.uint16[Gt+13]=J,this.uint16[Gt+14]=ne,this.uint16[Gt+15]=pe,this.uint16[Gt+16]=ke,this.uint16[Gt+17]=we,this.uint16[Gt+18]=De,this.uint16[Gt+19]=Be,this.uint16[Gt+20]=He,this.uint16[Gt+21]=dt,this.uint16[Gt+22]=it,this.uint16[Gt+23]=pt,this.uint16[Gt+24]=wt,this.uint16[Gt+25]=Ct,this.uint16[Gt+26]=Wt,this.uint16[Gt+27]=Lt,this.uint32[Xt+14]=Qt,this.float32[Xt+15]=ar,this.float32[Xt+16]=or,this.float32[Xt+17]=gr,this.float32[Xt+18]=xr,this.uint8[pr+76]=hr,this.uint16[Gt+39]=fr,l}}Q3.prototype.bytesPerElement=80,Yr(Q3,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class J3 extends da{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,g,x,j,N){const E=this.length;return this.resize(E+1),this.emplace(E,l,u,g,x,j,N)}emplace(l,u,g,x,j,N,E){const R=6*l;return this.float32[R+0]=u,this.float32[R+1]=g,this.float32[R+2]=x,this.float32[R+3]=j,this.float32[R+4]=N,this.float32[R+5]=E,l}}J3.prototype.bytesPerElement=24,Yr(J3,"StructArrayLayout6f24");class Zg extends da{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,g,x,j){const N=this.length;return this.resize(N+1),this.emplace(N,l,u,g,x,j)}emplace(l,u,g,x,j,N){const E=5*l;return this.float32[E+0]=u,this.float32[E+1]=g,this.float32[E+2]=x,this.float32[E+3]=j,this.float32[E+4]=N,l}}Zg.prototype.bytesPerElement=20,Yr(Zg,"StructArrayLayout5f20");class eM extends da{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,g,x,j,N,E){const R=this.length;return this.resize(R+1),this.emplace(R,l,u,g,x,j,N,E)}emplace(l,u,g,x,j,N,E,R){const B=7*l;return this.float32[B+0]=u,this.float32[B+1]=g,this.float32[B+2]=x,this.float32[B+3]=j,this.float32[B+4]=N,this.float32[B+5]=E,this.float32[B+6]=R,l}}eM.prototype.bytesPerElement=28,Yr(eM,"StructArrayLayout7f28");class tM extends da{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,g,x,j,N,E,R,B,H,G){const X=this.length;return this.resize(X+1),this.emplace(X,l,u,g,x,j,N,E,R,B,H,G)}emplace(l,u,g,x,j,N,E,R,B,H,G,X){const J=11*l;return this.float32[J+0]=u,this.float32[J+1]=g,this.float32[J+2]=x,this.float32[J+3]=j,this.float32[J+4]=N,this.float32[J+5]=E,this.float32[J+6]=R,this.float32[J+7]=B,this.float32[J+8]=H,this.float32[J+9]=G,this.float32[J+10]=X,l}}tM.prototype.bytesPerElement=44,Yr(tM,"StructArrayLayout11f44");class Nx extends da{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,g,x,j,N,E,R,B){const H=this.length;return this.resize(H+1),this.emplace(H,l,u,g,x,j,N,E,R,B)}emplace(l,u,g,x,j,N,E,R,B,H){const G=9*l;return this.float32[G+0]=u,this.float32[G+1]=g,this.float32[G+2]=x,this.float32[G+3]=j,this.float32[G+4]=N,this.float32[G+5]=E,this.float32[G+6]=R,this.float32[G+7]=B,this.float32[G+8]=H,l}}Nx.prototype.bytesPerElement=36,Yr(Nx,"StructArrayLayout9f36");class df extends da{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u){const g=this.length;return this.resize(g+1),this.emplace(g,l,u)}emplace(l,u,g){const x=2*l;return this.float32[x+0]=u,this.float32[x+1]=g,l}}df.prototype.bytesPerElement=8,Yr(df,"StructArrayLayout2f8");class gd extends da{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,u,g,x){const j=this.length;return this.resize(j+1),this.emplace(j,l,u,g,x)}emplace(l,u,g,x,j){const N=6*l;return this.uint32[3*l+0]=u,this.uint16[N+2]=g,this.uint16[N+3]=x,this.uint16[N+4]=j,l}}gd.prototype.bytesPerElement=12,Yr(gd,"StructArrayLayout1ul3ui12");class Pm extends da{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l){const u=this.length;return this.resize(u+1),this.emplace(u,l)}emplace(l,u){return this.uint16[1*l+0]=u,l}}Pm.prototype.bytesPerElement=2,Yr(Pm,"StructArrayLayout1ui2");class rM extends da{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,g,x,j,N,E,R,B,H,G,X,J,ne,pe,ke){const we=this.length;return this.resize(we+1),this.emplace(we,l,u,g,x,j,N,E,R,B,H,G,X,J,ne,pe,ke)}emplace(l,u,g,x,j,N,E,R,B,H,G,X,J,ne,pe,ke,we){const De=16*l;return this.float32[De+0]=u,this.float32[De+1]=g,this.float32[De+2]=x,this.float32[De+3]=j,this.float32[De+4]=N,this.float32[De+5]=E,this.float32[De+6]=R,this.float32[De+7]=B,this.float32[De+8]=H,this.float32[De+9]=G,this.float32[De+10]=X,this.float32[De+11]=J,this.float32[De+12]=ne,this.float32[De+13]=pe,this.float32[De+14]=ke,this.float32[De+15]=we,l}}rM.prototype.bytesPerElement=64,Yr(rM,"StructArrayLayout16f64");class Hk extends da{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,g,x,j,N,E){const R=this.length;return this.resize(R+1),this.emplace(R,l,u,g,x,j,N,E)}emplace(l,u,g,x,j,N,E,R){const B=10*l,H=5*l;return this.uint16[B+0]=u,this.uint16[B+1]=g,this.uint16[B+2]=x,this.uint16[B+3]=j,this.float32[H+2]=N,this.float32[H+3]=E,this.float32[H+4]=R,l}}Hk.prototype.bytesPerElement=20,Yr(Hk,"StructArrayLayout4ui3f20");class nM extends da{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l){const u=this.length;return this.resize(u+1),this.emplace(u,l)}emplace(l,u){return this.int16[1*l+0]=u,l}}nM.prototype.bytesPerElement=2,Yr(nM,"StructArrayLayout1i2");class Wk extends da{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(l){const u=this.length;return this.resize(u+1),this.emplace(u,l)}emplace(l,u){return this.uint8[1*l+0]=u,l}}Wk.prototype.bytesPerElement=1,Yr(Wk,"StructArrayLayout1ub1");class Gk extends hv{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}Gk.prototype.size=40;class vP extends Uk{get(l){return new Gk(this,l)}}Yr(vP,"CollisionBoxArray");class Kk extends hv{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(l){this._structArray.uint8[this._pos1+49]=l}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(l){this._structArray.uint8[this._pos1+50]=l}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(l){this._structArray.uint32[this._pos4+13]=l}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(l){this._structArray.uint8[this._pos1+58]=l}}Kk.prototype.size=60;class _P extends kx{get(l){return new Kk(this,l)}}Yr(_P,"PlacedSymbolArray");class bP extends hv{get tileAnchorX(){return this._structArray.float32[this._pos4+0]}get tileAnchorY(){return this._structArray.float32[this._pos4+1]}get projectedAnchorX(){return this._structArray.int16[this._pos2+4]}get projectedAnchorY(){return this._structArray.int16[this._pos2+5]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+6]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+7]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+11]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get key(){return this._structArray.uint16[this._pos2+13]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+14]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+15]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+17]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+19]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+21]}get featureIndex(){return this._structArray.uint16[this._pos2+22]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+23]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numIconVertices(){return this._structArray.uint16[this._pos2+25]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+26]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+27]}get crossTileID(){return this._structArray.uint32[this._pos4+14]}set crossTileID(l){this._structArray.uint32[this._pos4+14]=l}get textOffset0(){return this._structArray.float32[this._pos4+15]}get textOffset1(){return this._structArray.float32[this._pos4+16]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+17]}get zOffset(){return this._structArray.float32[this._pos4+18]}set zOffset(l){this._structArray.float32[this._pos4+18]=l}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}get elevationFeatureIndex(){return this._structArray.uint16[this._pos2+39]}}bP.prototype.size=80;class sM extends Q3{get(l){return new bP(this,l)}}Yr(sM,"SymbolInstanceArray");class Zk extends pp{getoffsetX(l){return this.float32[1*l+0]}}Yr(Zk,"GlyphOffsetArray");class wP extends Em{getx(l){return this.int16[2*l+0]}gety(l){return this.int16[2*l+1]}}Yr(wP,"SymbolLineVertexArray");class iM extends hv{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}iM.prototype.size=12;class aM extends gd{get(l){return new iM(this,l)}}Yr(aM,"FeatureIndexArray");class jP extends iu{geta_centroid_pos0(l){return this.uint16[2*l+0]}geta_centroid_pos1(l){return this.uint16[2*l+1]}}Yr(jP,"FillExtrusionCentroidArray");class Yk extends hv{get a_join_normal_inside0(){return this._structArray.int16[this._pos2+0]}get a_join_normal_inside1(){return this._structArray.int16[this._pos2+1]}get a_join_normal_inside2(){return this._structArray.int16[this._pos2+2]}}Yk.prototype.size=6;class fv extends wx{get(l){return new Yk(this,l)}}Yr(fv,"FillExtrusionWallArray");const kP=ks([{name:"a_pos",components:2,type:"Int16"}],4),rae=ks([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),NP=ks([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class ja{constructor(l=[]){this.segments=l}_prepareSegment(l,u,g,x){let j=this.segments[this.segments.length-1];return l>ja.MAX_VERTEX_ARRAY_LENGTH&&Br(`Max vertices per segment is ${ja.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${l}`),(!j||j.vertexLength+l>ja.MAX_VERTEX_ARRAY_LENGTH||j.sortKey!==x)&&(j={vertexOffset:u,primitiveOffset:g,vertexLength:0,primitiveLength:0},x!==void 0&&(j.sortKey=x),this.segments.push(j)),j}prepareSegment(l,u,g,x){return this._prepareSegment(l,u.length,g.length,x)}get(){return this.segments}destroy(){for(const l of this.segments)for(const u in l.vaos)l.vaos[u].destroy()}static simpleSegment(l,u,g,x){return new ja([{vertexOffset:l,primitiveOffset:u,vertexLength:g,primitiveLength:x,vaos:{},sortKey:0}])}}function Xk(h,l){return 256*(h=_e(Math.floor(h),0,255))+_e(Math.floor(l),0,255)}ja.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Yr(ja,"SegmentVector");const nae=ks([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),sae=ks([{name:"a_pattern_b",components:4,type:"Uint16"}]),iae=ks([{name:"a_dash",components:4,type:"Uint16"}]);class pv{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(l,u,g,x){this.ids.push(oM(l)),this.positions.push(u,g,x)}eachPosition(l,u){const g=oM(l);let x=0,j=this.ids.length-1;for(;x>1;this.ids[N]>=g?j=N:x=N+1}for(;this.ids[x]===g;)u(this.positions[3*x],this.positions[3*x+1],this.positions[3*x+2]),x++}static serialize(l,u){const g=new Float64Array(l.ids),x=new Uint32Array(l.positions);return lM(g,x,0,g.length-1),u&&(u.add(g.buffer),u.add(x.buffer)),{ids:g,positions:x}}static deserialize(l){const u=new pv;let g;u.ids=l.ids,u.positions=l.positions;for(const x of u.ids)x!==g&&u.uniqueIds.push(x),g=x;return u.indexed=!0,u}}function oM(h){const l=+h;return Number.isSafeInteger(l)?l:Gj(String(h))}function lM(h,l,u,g){for(;u>1];let j=u-1,N=g+1;for(;;){do j++;while(h[j]x);if(j>=N)break;Qk(h,j,N),Qk(l,3*j,3*N),Qk(l,3*j+1,3*N+1),Qk(l,3*j+2,3*N+2)}N-u`u_${j}`),this.type=g,this.context=x}setUniform(l,u,g,x,j){const N=x.constantOr(this.value);u.set(l,j,N instanceof xi?N.toPremultipliedRenderColor(this.lutExpression&&this.lutExpression.kind==="constant"&&this.lutExpression.value==="none"?null:this.context.lut):N)}getBinding(l,u){return this.type==="color"?new gv(l):new Fo(l)}}class Sx{constructor(l,u){this.uniformNames=u.map(g=>`u_${g}`),this.pattern=null,this.patternTransition=null,this.pixelRatio=1}setConstantPatternPositions(l,u){this.pixelRatio=l.pixelRatio||1,this.pattern=l.tl.concat(l.br),this.patternTransition=u?u.tl.concat(u.br):this.pattern}setUniform(l,u,g,x,j){let N=null;j!=="u_pattern"&&j!=="u_dash"||(N=this.pattern),j==="u_pattern_b"&&(N=this.patternTransition),j==="u_pixel_ratio"&&(N=this.pixelRatio),N&&u.set(l,j,N)}getBinding(l,u){return u==="u_pattern"||u==="u_pattern_b"||u==="u_dash"?new eN(l):new Fo(l)}}class gp{constructor(l,u,g,x){this.expression=l,this.type=g,this.maxValue=0,this.paintVertexAttributes=u.map(j=>({name:`a_${j}`,type:"Float32",components:g==="color"?2:1,offset:0})),this.paintVertexArray=new x}populatePaintArray(l,u,g,x,j,N,E,R){const B=this.paintVertexArray.length,H=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate(new Qi(0,{brightness:N,worldview:R}),u,{},j,x,E):this.expression.kind==="constant"&&this.expression.value,G=xv(this.lutExpression,u,{},x,j,N,E,R);this.paintVertexArray.resize(l),this._setPaintValue(B,l,H,G?null:this.context.lut)}updatePaintArray(l,u,g,x,j,N,E,R){const B=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate({zoom:0,brightness:E,worldview:R},g,x,void 0,j):this.expression.kind==="constant"&&this.expression.value,H=xv(this.lutExpression,g,x,j,void 0,E,void 0,R);this._setPaintValue(l,u,B,H?null:this.context.lut)}_setPaintValue(l,u,g,x){if(this.type==="color"){const j=cM(g.toPremultipliedRenderColor(x));for(let N=l;N`u_${E}_t`),this.type=g,this.useIntegerZoom=x,this.context=j,this.maxValue=0,this.paintVertexAttributes=u.map(E=>({name:`a_${E}`,type:"Float32",components:g==="color"?4:2,offset:0})),this.paintVertexArray=new N}populatePaintArray(l,u,g,x,j,N,E,R){const B=this.expression.evaluate(new Qi(this.context.zoom,{brightness:N,worldview:R}),u,{},j,x,E),H=this.expression.evaluate(new Qi(this.context.zoom+1,{brightness:N,worldview:R}),u,{},j,x,E),G=xv(this.lutExpression,u,{},x,j,N,E,R),X=this.paintVertexArray.length;this.paintVertexArray.resize(l),this._setPaintValue(X,l,B,H,G?null:this.context.lut)}updatePaintArray(l,u,g,x,j,N,E,R){const B=this.expression.evaluate({zoom:this.context.zoom,brightness:E,worldview:R},g,x,void 0,j),H=this.expression.evaluate({zoom:this.context.zoom+1,brightness:E,worldview:R},g,x,void 0,j),G=xv(this.lutExpression,g,x,j,void 0,E,void 0,R);this._setPaintValue(l,u,B,H,G?null:this.context.lut)}_setPaintValue(l,u,g,x,j){if(this.type==="color"){const N=cM(g.toPremultipliedRenderColor(j)),E=cM(g.toPremultipliedRenderColor(j));for(let R=l;R!0){this.binders={},this._buffers=[],this.context=u;const x=[];for(const j in l.paint._values){const N=l.paint.get(j);if(j.endsWith("-use-theme")||!g(j)||!(N instanceof qg&&iv(N.property.specification)))continue;const E=cae(j,l.type),R=N.value,B=N.property.specification.type,H=!!N.property.useIntegerZoom,G=j==="line-dasharray"||j.endsWith("pattern"),X=l.paint.get(`${j}-use-theme`),J=j==="line-dasharray"&&l.layout.get("line-cap").value.kind!=="constant"||X&&X.value.kind!=="constant";if(R.kind!=="constant"||J)if(R.kind==="source"||J||G){const ne=dM(j,B,"source");this.binders[j]=G?new xp(R,E,B,ne,l.id):new gp(R,E,B,ne),x.push(`/a_${j}`)}else{const ne=dM(j,B,"composite");this.binders[j]=new yp(R,E,B,H,u,ne),x.push(`/z_${j}`)}else this.binders[j]=G?new Sx(R.value,E):new vv(R.value,E,B,u),x.push(`/u_${j}`);X&&(this.binders[j].lutExpression=X.value)}this.cacheKey=x.sort().join("")}getMaxValue(l){const u=this.binders[l];return u instanceof gp||u instanceof yp?u.maxValue:0}populatePaintArrays(l,u,g,x,j,N,E,R){for(const B in this.binders){const H=this.binders[B];H.context=this.context,(H instanceof gp||H instanceof yp||H instanceof xp)&&H.populatePaintArray(l,u,g,x,j,N,E,R)}}setConstantPatternPositions(l,u){for(const g in this.binders){const x=this.binders[g];x instanceof Sx&&x.setConstantPatternPositions(l,u)}}getPatternTransitionVertexBuffer(l){const u=this.binders[l];return u instanceof xp?u.paintTransitionVertexBuffer:null}updatePaintArrays(l,u,g,x,j,N,E,R,B,H){let G=!1;const X=Object.keys(l),J=X.length!==0&&!R,ne=J?X:u.uniqueIds;this.context.lut=j.lut;for(const pe in this.binders){const ke=this.binders[pe];if(ke.context=this.context,(ke instanceof gp||ke instanceof yp||ke instanceof xp)&&ke.expression&&ke.expression.kind&&ke.expression.kind!=="constant"&&(ke.expression.isStateDependent===!0||ke.expression.isLightConstant===!1)){const we=j.paint.get(pe);ke.expression=we.value;for(const De of ne){const Be=l[De.toString()];u.eachPosition(De,(He,dt,it)=>{const pt=x.feature(He);ke.updatePaintArray(dt,it,pt,Be,N,E,B,H)})}if(!J)for(const De of g.uniqueIds){const Be=l[De.toString()];g.eachPosition(De,(He,dt,it)=>{const pt=x.feature(He);ke.updatePaintArray(dt,it,pt,Be,N,E,B,H)})}G=!0}}return G}defines(){const l=[];for(const u in this.binders){const g=this.binders[u];(g instanceof vv||g instanceof Sx)&&l.push(...g.uniformNames.map(x=>`#define HAS_UNIFORM_${x}`))}return l}getPaintVertexBuffers(){return this._buffers}getUniforms(l){const u=[];for(const g in this.binders){const x=this.binders[g];if(x instanceof vv||x instanceof Sx||x instanceof yp)for(const j of x.uniformNames)u.push({name:j,property:g,binding:x.getBinding(l,j)})}return u}setUniforms(l,u,g,x,j){for(const{name:N,property:E,binding:R}of g)this.binders[E].setUniform(l,R,j,x.get(E),N)}updatePaintBuffers(){this._buffers=[];for(const l in this.binders){const u=this.binders[l];(u instanceof gp||u instanceof yp||u instanceof xp)&&u.paintVertexBuffer&&this._buffers.push(u.paintVertexBuffer),u instanceof xp&&u.paintTransitionVertexBuffer&&this._buffers.push(u.paintTransitionVertexBuffer)}}upload(l){for(const u in this.binders){const g=this.binders[u];(g instanceof gp||g instanceof yp||g instanceof xp)&&g.upload(l)}this.updatePaintBuffers()}destroy(){for(const l in this.binders){const u=this.binders[l];(u instanceof gp||u instanceof yp||u instanceof xp)&&u.destroy()}}}class jh{constructor(l,u,g=()=>!0){this.programConfigurations={};for(const x of l)this.programConfigurations[x.id]=new Lm(x,u,g);this.needsUpload=!1,this._featureMap=new pv,this._featureMapWithoutIds=new pv,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(l,u,g,x,j,N,E,R,B){for(const H in this.programConfigurations)this.programConfigurations[H].populatePaintArrays(l,u,x,j,N,E,R,B);u.id!==void 0?this._featureMap.add(u.id,g,this._bufferOffset,l):(this._featureMapWithoutIds.add(this._idlessCounter,g,this._bufferOffset,l),this._idlessCounter+=1),this._bufferOffset=l,this.needsUpload=!0}updatePaintArrays(l,u,g,x,j,N,E,R){for(const B of g)this.needsUpload=this.programConfigurations[B.id].updatePaintArrays(l,this._featureMap,this._featureMapWithoutIds,u,B,x,j,N,E||0,R)||this.needsUpload}get(l){return this.programConfigurations[l]}upload(l){if(this.needsUpload){for(const u in this.programConfigurations)this.programConfigurations[u].upload(l);this.needsUpload=!1}}destroy(){for(const l in this.programConfigurations)this.programConfigurations[l].destroy()}}const lae={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-occlusion-opacity":["occlusion_opacity"],"icon-occlusion-opacity":["occlusion_opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-emissive-strength":["emissive_strength"],"icon-emissive-strength":["emissive_strength"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"symbol-z-offset":["z_offset"],"line-gap-width":["gapwidth"],"line-pattern":["pattern","pixel_ratio","pattern_b"],"fill-pattern":["pattern","pixel_ratio","pattern_b"],"fill-extrusion-pattern":["pattern","pixel_ratio","pattern_b"],"line-dasharray":["dash"],"fill-bridge-guard-rail-color":["structure_color"],"fill-tunnel-structure-color":["structure_color"]};function cae(h,l){return lae[h]||[h.replace(`${l}-`,"").replace(/-/g,"_")]}const dae={"line-pattern":{source:md,composite:md},"fill-pattern":{source:md,composite:md},"fill-extrusion-pattern":{source:md,composite:md},"line-dasharray":{source:Kg,composite:Kg}},uae={color:{source:df,composite:Im},number:{source:pp,composite:df}};function dM(h,l,u){const g=dae[h];return g&&g[u]||uae[l][u]}Yr(vv,"ConstantBinder"),Yr(Sx,"PatternConstantBinder"),Yr(gp,"SourceExpressionBinder"),Yr(xp,"PatternCompositeBinder"),Yr(yp,"CompositeExpressionBinder"),Yr(Lm,"ProgramConfiguration",{omit:["_buffers"]}),Yr(jh,"ProgramConfigurationSet");const dc=Cr/Math.PI/2,Hu=5,nN=6,hae=16383,Cx=64,uM=[Cx,32,16],Wu=-dc,Gu=dc;function Yg(h,l,u,g=dc){return u=Qr(u),[h*Math.sin(u)*g,-l*g,h*Math.cos(u)*g]}function Mx(h,l,u){return Yg(Math.cos(Qr(h)),Math.sin(Qr(h)),l,u)}const _=63710088e-1,d=2*Math.PI*_;class p{constructor(l,u){if(isNaN(l)||isNaN(u))throw new Error(`Invalid LngLat object: (${l}, ${u})`);if(this.lng=+l,this.lat=+u,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new p(tt(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(l){const u=Math.PI/180,g=this.lat*u,x=l.lat*u,j=Math.sin(g)*Math.sin(x)+Math.cos(g)*Math.cos(x)*Math.cos((l.lng-this.lng)*u);return _*Math.acos(Math.min(j,1))}toBounds(l=0){const u=360*l/40075017,g=u/Math.cos(Math.PI/180*this.lat);return new b({lng:this.lng-g,lat:this.lat-u},{lng:this.lng+g,lat:this.lat+u})}toEcef(l){return Mx(this.lat,this.lng,dc+l*dc/_)}static convert(l){if(l instanceof p)return l;if(Array.isArray(l)&&(l.length===2||l.length===3))return new p(Number(l[0]),Number(l[1]));if(!Array.isArray(l)&&typeof l=="object"&&l!==null)return new p(Number("lng"in l?l.lng:l.lon),Number(l.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}class b{constructor(l,u){l&&(u?this.setSouthWest(l).setNorthEast(u):Array.isArray(l)&&l.length===4?this.setSouthWest([l[0],l[1]]).setNorthEast([l[2],l[3]]):this.setSouthWest(l[0]).setNorthEast(l[1]))}setNorthEast(l){return this._ne=l instanceof p?new p(l.lng,l.lat):p.convert(l),this}setSouthWest(l){return this._sw=l instanceof p?new p(l.lng,l.lat):p.convert(l),this}extend(l){const u=this._sw,g=this._ne;let x,j;if(l instanceof p)x=l,j=l;else{if(!(l instanceof b))return Array.isArray(l)?l.length===4||l.every(Array.isArray)?this.extend(b.convert(l)):this.extend(p.convert(l)):typeof l=="object"&&l!==null&&l.hasOwnProperty("lat")&&(l.hasOwnProperty("lon")||l.hasOwnProperty("lng"))?this.extend(p.convert(l)):this;if(x=l._sw,j=l._ne,!x||!j)return this}return u||g?(u.lng=Math.min(x.lng,u.lng),u.lat=Math.min(x.lat,u.lat),g.lng=Math.max(j.lng,g.lng),g.lat=Math.max(j.lat,g.lat)):(this._sw=new p(x.lng,x.lat),this._ne=new p(j.lng,j.lat)),this}getCenter(){return new p((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new p(this.getWest(),this.getNorth())}getSouthEast(){return new p(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(l){const{lng:u,lat:g}=p.convert(l);let x=this._sw.lng<=u&&u<=this._ne.lng;return this._sw.lng>this._ne.lng&&(x=this._sw.lng>=u&&u>=this._ne.lng),this._sw.lat<=g&&g<=this._ne.lat&&x}static convert(l){if(l)return l instanceof b?l:new b(l)}}const M=0,L=25.5;function O(h){return d*Math.cos(h*Math.PI/180)}function z(h){return(180+h)/360}function V(h){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+h*Math.PI/360)))/360}function Y(h,l){return h/O(l)}function Q(h){return 360*h-180}function ce(h){return 360/Math.PI*Math.atan(Math.exp((180-360*h)*Math.PI/180))-90}function le(h,l){return h*O(ce(l))}const de=85.051129;function be(h){return Math.cos(Qr(_e(h,-de,de)))}function ye(h,l){const u=_e(l,M,L),g=Math.pow(2,u);return be(h)*d/(512*g)}function Oe(h){return 1/Math.cos(h*Math.PI/180)}function Ee(h,l=0){const u=Math.exp(Math.PI*(1-(h.y+l/Cr)/(1<=R?(Ze(h,l,u,B,H,j,G,E,R),Ze(h,B,H,g,x,G,N,E,R)):h.push(N)}function Ve(h,l,u){let g=h[0],x=g.x,j=g.y;l(g);const N=[g];for(let E=1;Eh.x+1||gh.y+1)&&Br("Geometry exceeds allowed extent, reduce your vector tile buffer size"),h}function vt(h,l,u){const g=h.loadGeometry(),x=h.extent,j=Cr/x;if(l&&u&&u.projection.isReprojectedInTileSpace){const N=1<{const J=Q((l.x+X.x/x)/N),ne=ce((l.y+X.y/x)/N),pe=H.project(J,ne);X.x=(pe.x*E-R)*x,X.y=(pe.y*E-B)*x};for(let X=0;X=x||ne.y<0||ne.y>=x||(G(ne),J.push(ne));g[X]=J}}for(const N of g)for(const E of N)st(E,j);return g}function Pt(h,l){return{type:h.type,id:h.id,properties:h.properties,geometry:l?vt(h):[]}}class Tt{constructor(l,u,g,x,j){this.properties={},this.extent=g,this.type=0,this.id=void 0,this._pbf=l,this._geometry=-1,this._keys=x,this._values=j,l.readFields(qt,this,u)}loadGeometry(){const l=this._pbf;l.pos=this._geometry;const u=l.readVarint()+l.pos,g=[];let x,j=1,N=0,E=0,R=0;for(;l.pos>3}if(N--,j===1||j===2)E+=l.readSVarint(),R+=l.readSVarint(),j===1&&(x&&g.push(x),x=[]),x&&x.push(new sr(E,R));else{if(j!==7)throw new Error(`unknown command ${j}`);x&&x.push(x[0].clone())}}return x&&g.push(x),g}bbox(){const l=this._pbf;l.pos=this._geometry;const u=l.readVarint()+l.pos;let g=1,x=0,j=0,N=0,E=1/0,R=-1/0,B=1/0,H=-1/0;for(;l.pos>3}if(x--,g===1||g===2)j+=l.readSVarint(),N+=l.readSVarint(),jR&&(R=j),NH&&(H=N);else if(g!==7)throw new Error(`unknown command ${g}`)}return[E,B,R,H]}toGeoJSON(l,u,g){const x=this.extent*Math.pow(2,g),j=this.extent*l,N=this.extent*u,E=this.loadGeometry();function R(X){return[360*(X.x+j)/x-180,360/Math.PI*Math.atan(Math.exp((1-2*(X.y+N)/x)*Math.PI))-90]}function B(X){return X.map(R)}let H;if(this.type===1){const X=[];for(const ne of E)X.push(ne[0]);const J=B(X);H=X.length===1?{type:"Point",coordinates:J[0]}:{type:"MultiPoint",coordinates:J}}else if(this.type===2){const X=E.map(B);H=X.length===1?{type:"LineString",coordinates:X[0]}:{type:"MultiLineString",coordinates:X}}else{if(this.type!==3)throw new Error("unknown feature type");{const X=function(ne){const pe=ne.length;if(pe<=1)return[ne];const ke=[];let we,De;for(let Be=0;Be=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[l];const u=this._pbf.readVarint()+this._pbf.pos;return new Tt(this._pbf,u,this.extent,this._keys,this._values)}}function vr(h,l,u){h===15?l.version=u.readVarint():h===1?l.name=u.readString():h===5?l.extent=u.readVarint():h===2?l._features.push(u.pos):h===3?l._keys.push(u.readString()):h===4&&l._values.push(function(g){let x=null;const j=g.readVarint()+g.pos;for(;g.pos>3;x=N===1?g.readString():N===2?g.readFloat():N===3?g.readDouble():N===4?g.readVarint64():N===5?g.readVarint():N===6?g.readSVarint():N===7?g.readBoolean():null}if(x==null)throw new Error("unknown feature value");return x}(u))}class Ft{constructor(l,u){this.layers=l.readFields(St,{},u)}}function St(h,l,u){if(h===3){const g=new nr(u,u.readVarint()+u.pos);g.length&&(l[g.name]=g)}}const Kt="3d_elevation_id",Ut="level";class ur{constructor(){this._valid=!1}reset(l){return this.feature=l,this._valid=!0,this._geometry=l.loadGeometry(),this._geometry.length!==0&&this._geometry[0].length!==0||(this._valid=!1),this}geometry(l,u){return this._valid&&l(u(this._geometry)),this}require(l,u,g){return this.get(l,!0,u,g)}optional(l,u,g){return this.get(l,!1,u,g)}success(){return this._valid}get(l,u,g,x){const j=this.feature.properties.hasOwnProperty(l)?+this.feature.properties[l]:void 0;return this._valid&&j!==void 0&&!Number.isNaN(j)?g(x?x(j):j):u&&(this._valid=!1),this}}class Ar{constructor(l,u){this.featureFunc=l,this.vertexFunc=u}parseFeature(l,u,g){return this.featureFunc(l,u,g)}parseVertex(l,u,g){return this.vertexFunc(l,u,g)}}const Ur=new Ar((h,l,u)=>h.reset(l).require(Kt,g=>{u.id=g}).optional("fixed_height_relative",g=>{u.constantHeight=g},_r.decodeRelativeHeight).geometry(g=>{u.bounds=g},lp).success(),(h,l,u)=>h.reset(l).require(Kt,g=>{u.id=g}).require("elevation_idx",g=>{u.idx=g}).require("extent",g=>{u.extent=g}).require("height_relative",g=>{u.height=g},_r.decodeRelativeHeight).geometry(g=>{u.position=g},_r.getPoint).success()),Nr=new Ar((h,l,u)=>h.reset(l).require(Kt,g=>{u.id=g}).optional("fixed_height",g=>{u.constantHeight=g},_r.decodeMetricHeight).geometry(g=>{u.bounds=g},lp).success(),(h,l,u)=>h.reset(l).require(Kt,g=>{u.id=g}).require("elevation_idx",g=>{u.idx=g}).require("extent",g=>{u.extent=g}).require("height",g=>{u.height=g},_r.decodeMetricHeight).geometry(g=>{u.position=g},_r.getPoint).success());class _r{static getPoint(l){return wr(l[0][0].x,l[0][0].y)}static decodeRelativeHeight(l){return 1e-4*l*5}static decodeMetricHeight(l){return 1e-4*l}static getVersionSchema(l){return l?l==="1.0.1"?Nr:void 0:Ur}static parse(l){const u=[],g=[],x=l.length,j=new ur;for(let N=0;N=0);if(j===0)return 0;j!==l.length&&(u=!1)}return u?2:1}function Hn(h,l){for(const u of h.projections){const g=qr(l,h.points[0],u.axis);if(u.projection[1]g[1])return 0}return 1}function As(h,l){let u=0;const g=[0,0,0,0];for(let N=0;N=0&&u++;var x,j;return u}class ai{constructor(l,u){this.points=l||new Array(8).fill([0,0,0]),this.planes=u||new Array(6).fill([0,0,0,0]),this.bounds=on.fromPoints(this.points),this.projections=[],this.frustumEdges=[Ce([],this.points[2],this.points[3]),Ce([],this.points[0],this.points[3]),Ce([],this.points[4],this.points[0]),Ce([],this.points[5],this.points[1]),Ce([],this.points[6],this.points[2]),Ce([],this.points[7],this.points[3])];for(const g of this.frustumEdges){const x=[0,-g[2],g[1]],j=[g[2],0,-g[0]];this.projections.push({axis:x,projection:qr(this.points,this.points[0],x)}),this.projections.push({axis:j,projection:qr(this.points,this.points[0],j)})}}static fromInvProjectionMatrix(l,u,g,x){const j=Math.pow(2,g),N=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(B=>{const H=Nt([],B,l),G=1/H[3]/u*j;return(X=H)[0]=(J=H)[0]*(ne=[G,G,x?1/H[3]:G,G])[0],X[1]=J[1]*ne[1],X[2]=J[2]*ne[2],X[3]=J[3]*ne[3],X;var X,J,ne}),E=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(B=>{const H=Pe([],nt([],Ce([],N[B[0]],N[B[1]]),Ce([],N[B[2]],N[B[1]]))),G=-Ae(H,N[B[1]]);return H.concat(G)}),R=[];for(let B=0;BB[1]||B[0]>R[1])return 0}return 1}containsPoint(l){for(const u of this.planes){const g=u[3];if(Ae([u[0],u[1],u[2]],l)+g<0)return!1}return!0}}class on{static fromPoints(l){const u=[1/0,1/0,1/0],g=[-1/0,-1/0,-1/0];for(const x of l)Se(u,u,x),oe(g,g,x);return new on(u,g)}static fromTileIdAndHeight(l,u,g){const x=1<l.max[u]||l.min[u]>this.max[u])return!1;return!0}intersectsAabbXY(l){return!(this.min[0]>l.max[0]||l.min[0]>this.max[0]||this.min[1]>l.max[1]||l.min[1]>this.max[1])}encapsulate(l){for(let u=0;u<3;u++)this.min[u]=Math.min(this.min[u],l.min[u]),this.max[u]=Math.max(this.max[u],l.max[u])}encapsulatePoint(l){for(let u=0;u<3;u++)this.min[u]=Math.min(this.min[u],l[u]),this.max[u]=Math.max(this.max[u],l[u])}closestPoint(l){return[Math.max(Math.min(this.max[0],l[0]),this.min[0]),Math.max(Math.min(this.max[1],l[1]),this.min[1]),Math.max(Math.min(this.max[2],l[2]),this.min[2])]}}Yr(on,"Aabb");class Js{constructor(l,u){this.feature=l,this.metersToTile=u,this.index=0}get(){const l=this.feature.vertices[this.index],u=this.feature.vertexProps[this.index].dir,g=u[1],x=-u[0],j=(l.extent+1)*this.metersToTile;return[new sr(Math.trunc(l.position[0]+g*j),Math.trunc(l.position[1]+x*j)),new sr(Math.trunc(l.position[0]-g*j),Math.trunc(l.position[1]-x*j))]}next(){this.index++}valid(){return this.index{return E.a0?ae(R,R,1/B):me(R,0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(l){if(this.edges.length===0)return;let u=0,g=Number.POSITIVE_INFINITY,x=0;const[j,N,E,R,B,H,G]=this._tmpVec2;Ts(G,l.x,l.y);const X=new nn(G,null);for(let J=0;J0?Yo(R,E)/He:0,it=_e(dt,0,1),pt=Math.abs((dt-it)*this.edgeProps[J].len);mi(B,G,ke),Ts(H,pe[1],-pe[0]);const wt=pt+Math.abs(Yo(B,H));wt=0;--N){const E=this.edges[N].a,R=this.edges[N].b,{position:B,height:H,extent:G}=this.vertices[E],{position:X,height:J,extent:ne}=this.vertices[R],pe=this.vertexProps[E].dir,ke=this.vertexProps[R].dir;if(me(u,B[0]/l,B[1]/l,H),me(g,X[0]/l,X[1]/l,J),me(x,pe[1],-pe[0],0),ae(x,x,G),me(j,ke[1],-ke[0],0),ae(j,j,ne),this.distSqLines(ie(u[0]+.5*x[0],u[1]+.5*x[1],u[2]+.5*x[2]),ie(g[0]-.5*j[0],g[1]-.5*j[1],g[2]-.5*j[2]),ie(u[0]-.5*x[0],u[1]-.5*x[1],u[2]-.5*x[2]),ie(g[0]+.5*j[0],g[1]+.5*j[1],g[2]+.5*j[2]))<=.0025000000000000005)continue;const we=this.vertices.length,De=ii(si(),B,X);this.vertices.push({position:Ta(De,De,.5),height:.5*(H+J),extent:.5*(G+ne)});const Be=ii(si(),pe,ke);this.vertexProps.push({dir:vl(Be,Be)}),this.edges.splice(N,1),this.edgeProps.splice(N,1),this.edges.push({a:E,b:we}),this.edges.push({a:we,b:R});const He=mi(si(),this.vertices[we].position,B),dt=ga(He),it={vec:He,dir:Ta(si(),He,1/dt),len:dt};this.edgeProps.push(it),this.edgeProps.push(it)}}distSqLines(l,u,g,x){const j=ve(Ne(),u,l),N=ve(Ne(),x,g),E=ve(Ne(),l,g),R=Ae(j,j),B=Ae(j,N),H=Ae(j,E),G=Ae(N,N),X=Ae(N,E),J=R*G-B*B;if(J===0)return Ue(Te(j,g,x,Ae(E,N)/Ae(N,N)),l);const ne=(R*X-B*H)/J;return Ue(Te(j,l,u,(B*X-H*G)/J),Te(N,g,x,ne))}}class ui{static parseFrom(l,u){const g=_r.parse(l);if(!g)return[];let{vertices:x,features:j}=g;const N=1/Ee(u);j.sort((H,G)=>H.id-G.id),x.sort((H,G)=>H.id-G.id||H.idx-G.idx),x=x.filter((H,G,X)=>G===X.findIndex(J=>J.id===H.id&&J.idx===H.idx));const E=new Array;let R=0;const B=x.length;for(const H of j){if(H.constantHeight){E.push(new Un(H.id,H.bounds,H.constantHeight));continue}for(;R!==B&&x[R].idx.id===g)}}class Ci{constructor(l,u){this.zScale=1,this.xOffset=0,this.yOffset=0,l.equals(u)||(this.zScale=Math.pow(2,u.z-l.z),this.xOffset=(l.x*this.zScale-u.x)*Cr,this.yOffset=(l.y*this.zScale-u.y)*Cr)}constantElevation(l,u){if(l.constantHeight!=null)return this.computeBiasedHeight(l.constantHeight,u)}pointElevation(l,u,g){const x=this.constantElevation(u,g);return x??(l.x=l.x*this.zScale+this.xOffset,l.y=l.y*this.zScale+this.yOffset,this.computeBiasedHeight(u.pointElevation(l),g))}computeBiasedHeight(l,u){return u<=0?l:l+u*ze(0,u,l>=0?l:Math.abs(.5*l))}}Yr(Un,"ElevationFeature");class vi{constructor(l){this.zoom=l.zoom,this.overscaling=l.overscaling,this.layers=l.layers,this.layerIds=this.layers.map(u=>u.fqid),this.index=l.index,this.hasPattern=!1,this.projection=l.projection,this.layoutVertexArray=new Em,this.indexArray=new Ro,this.segments=new ja,this.programConfigurations=new jh(l.layers,{zoom:l.zoom,lut:l.lut}),this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.elevationMode=this.layers[0].layout.get("circle-elevation-reference"),this.hasElevation=!1,this.elevationMode!=="none"&&(this.elevatedLayoutVertexArray=new pp),this.worldview=l.worldview,this.hasAppearances=null}updateFootprints(l,u){}updateAppearances(l,u,g,x){}populate(l,u,g,x){const j=this.layers[0],N=[];let E=null;j.type==="circle"&&(E=j.layout.get("circle-sort-key"));for(const{feature:B,id:H,index:G,sourceLayerIndex:X}of l){const J=this.layers[0]._featureFilter.needGeometry,ne=Pt(B,J);if(!this.layers[0]._featureFilter.filter(new Qi(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),ne,g))continue;const pe=E?E.evaluate(ne,{},g):void 0,ke={id:H,properties:B.properties,type:B.type,sourceLayerIndex:X,index:G,geometry:J?ne.geometry:vt(B,g,x),patterns:{},sortKey:pe};N.push(ke)}E&&N.sort((B,H)=>B.sortKey-H.sortKey);let R=null;x.projection.name==="globe"&&(this.globeExtVertexArray=new Bk,R=x.projection);for(const B of N){const{geometry:H,index:G,sourceLayerIndex:X}=B,J=l[G].feature;this.addFeature(B,H,G,u.availableImages,g,R,u.brightness,u.elevationFeatures),u.featureIndex.insert(J,H,G,X,this.index)}this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}update(l,u,g,x,j,N,E){this.programConfigurations.updatePaintArrays(l,u,j,g,x,N,E,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(l){this.uploaded||(this.layoutVertexBuffer=l.createVertexBuffer(this.layoutVertexArray,kP.members),this.indexBuffer=l.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=l.createVertexBuffer(this.globeExtVertexArray,NP.members)),this.elevatedLayoutVertexArray&&(this.elevatedLayoutVertexBuffer=l.createVertexBuffer(this.elevatedLayoutVertexArray,rae.members))),this.programConfigurations.upload(l),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy())}addFeature(l,u,g,x,j,N,E,R){let B;this.elevationMode!=="none"&&(B=ui.getElevationFeature(l,R));for(const H of u)for(const G of H){const X=G.x,J=G.y;if(X<0||X>=Cr||J<0||J>=Cr)continue;if(N){const ke=N.projectTilePoint(X,J,j),we=N.upVector(j,X,J);this.addGlobeExtVertex(ke,we),this.addGlobeExtVertex(ke,we),this.addGlobeExtVertex(ke,we),this.addGlobeExtVertex(ke,we)}const ne=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,l.sortKey),pe=ne.vertexLength;if(this.addCircleVertex(X,J,-1,-1),this.addCircleVertex(X,J,1,-1),this.addCircleVertex(X,J,1,1),this.addCircleVertex(X,J,-1,1),this.elevationMode!=="none"){const ke=B?B.pointElevation(new sr(X,J)):0;this.hasElevation=this.hasElevation||ke!==0;for(let we=0;we<4;we++)this.elevatedLayoutVertexArray.emplaceBack(ke)}this.indexArray.emplaceBack(pe,pe+1,pe+2),this.indexArray.emplaceBack(pe,pe+2,pe+3),ne.vertexLength+=4,ne.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,l,g,{},x,j,E,void 0,this.worldview)}addCircleVertex(l,u,g,x){this.layoutVertexArray.emplaceBack(2*l+(g+1)/2,2*u+(x+1)/2)}addGlobeExtVertex(l,u){this.globeExtVertexArray.emplaceBack(l.x,l.y,l.z,u[0]*16384,u[1]*16384,u[2]*16384)}}function Ys(h,l){for(let u=0;u1){if(ua(h,l))return!0;for(let g=0;g1?u:u.sub(l)._mult(x)._add(l))}function ka(h,l){let u,g,x,j=!1;for(let N=0;Nl.y!=x.y>l.y&&l.x<(x.x-g.x)*(l.y-g.y)/(x.y-g.y)+g.x&&(j=!j)}return j}function zi(h,l){let u=!1;for(let g=0,x=h.length-1;gl.y!=N.y>l.y&&l.x<(N.x-j.x)*(l.y-j.y)/(N.y-j.y)+j.x&&(u=!u)}return u}function Zc(h,l,u,g,x){for(const N of h)if(l<=N.x&&u<=N.y&&g>=N.x&&x>=N.y)return!0;const j=[new sr(l,u),new sr(l,x),new sr(g,x),new sr(g,u)];if(h.length>2){for(const N of j)if(zi(h,N))return!0}for(let N=0;Nx.x&&l.x>x.x||h.yx.y&&l.y>x.y)return!1;const j=Zn(h,l,u[0]);return j!==Zn(h,l,u[1])||j!==Zn(h,l,u[2])||j!==Zn(h,l,u[3])}function zo(h,l,u,g,x,j){let N=l.y-h.y,E=h.x-l.x;if(j=j||0){const R=N*N+E*E;if(R===0)return!0;const B=Math.sqrt(R);N/=B,E/=B}return!((u.x-h.x)*N+(u.y-h.y)*E-j<0||(g.x-h.x)*N+(g.y-h.y)*E-j<0||(x.x-h.x)*N+(x.y-h.y)*E-j<0)}function uc(h,l,u,g,x,j,N){return!(zo(h,l,g,x,j,N)||zo(l,u,g,x,j,N)||zo(u,h,g,x,j,N)||zo(g,x,h,l,u,N)||zo(x,j,h,l,u,N)||zo(j,g,h,l,u,N))}function hc(h,l,u){const g=l.paint.get(h).value;return g.kind==="constant"?g.value:u.programConfigurations.get(l.id).getMaxValue(h)}function Il(h){return Math.sqrt(h[0]*h[0]+h[1]*h[1])}function au(h,l,u,g,x){if(!l[0]&&!l[1])return h;const j=sr.convert(l)._mult(x);u==="viewport"&&j._rotate(-g);const N=[];for(let E=0;E>u&&l.y===this.y>>u}url(l,u){const g=function(j,N,E){var R=ro(256*j,256*(N=Math.pow(2,E)-N-1),E),B=ro(256*(j+1),256*(N+1),E);return R[0]+","+R[1]+","+B[0]+","+B[1]}(this.x,this.y,this.z),x=function(j,N,E){let R,B="";for(let H=j;H>0;H--)R=1<this.canonical.z?new Ia(l,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Ia(l,this.wrap,l,this.canonical.x>>u,this.canonical.y>>u)}calculateScaledKey(l,u=!0){if(this.overscaledZ===l&&u)return this.key;if(l>this.canonical.z)return Na(this.wrap*+u,l,this.canonical.z,this.canonical.x,this.canonical.y);{const g=this.canonical.z-l;return Na(this.wrap*+u,l,l,this.canonical.x>>g,this.canonical.y>>g)}}isChildOf(l){if(l.wrap!==this.wrap)return!1;const u=this.canonical.z-l.canonical.z;return l.overscaledZ===0||l.overscaledZ>u&&l.canonical.y===this.canonical.y>>u}children(l){if(this.overscaledZ>=l)return[new Ia(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const u=this.canonical.z+1,g=2*this.canonical.x,x=2*this.canonical.y;return[new Ia(u,this.wrap,u,g,x),new Ia(u,this.wrap,u,g+1,x),new Ia(u,this.wrap,u,g,x+1),new Ia(u,this.wrap,u,g+1,x+1)]}isLessThan(l){return this.wrapl.wrap)&&(this.overscaledZl.overscaledZ)&&(this.canonical.xl.canonical.x)&&this.canonical.y{let l=h.canonical.x-1,u=h.wrap;return l<0&&(l=(1<{let l=h.canonical.x+1,u=h.wrap;return l===1<new Ia(h.overscaledZ,h.wrap,h.canonical.z,h.canonical.x,(h.canonical.y===0?1<new Ia(h.overscaledZ,h.wrap,h.canonical.z,h.canonical.x,h.canonical.y===(1<1?null:function(g,x,j,N){const E=Math.sin(j);return g*(Math.sin((1-N)*j)/E)+x*(Math.sin(N*j)/E)}(h.a[l],h.b[l],h.angle,_e(u,0,1))+h.center[l]}function Nh(h){if(h.z<=1)return vp[h.z+2*h.y+h.x];const l=fae(SP(h));return on.fromPoints(l)}function bp(h,l,u){return ae(h,h,1-u),je(h,h,l,u)}function _0e(h,l,u){for(const g of h)Xe(g,g,l),ae(g,g,u)}function b0e(h,l,u,g){const x=l/h.worldSize,j=h.globeMatrix;if(u.z<=1){const Ct=Nh(u).getCorners();return _0e(Ct,j,x),on.fromPoints(Ct)}const N=SP(u,g),E=fae(N,dc+hf(h._tileCoverLift));_0e(E,j,x);const R=Number.MAX_VALUE,B=[-R,-R,-R],H=[R,R,R];if(N.contains(h.center)){for(const Lt of E)Se(H,H,Lt),oe(B,B,Lt);B[2]=0;const Ct=h.point,Wt=[Ct.x*x,Ct.y*x,0];return Se(H,H,Wt),oe(B,B,Wt),new on(H,B)}if(h._tileCoverLift>0){for(const Ct of E)Se(H,H,Ct),oe(B,B,Ct);return new on(H,B)}const G=[j[12]*x,j[13]*x,j[14]*x],X=N.getCenter(),J=_e(h.center.lat,-de,de),ne=_e(X.lat,-de,de),pe=z(h.center.lng),ke=V(J);let we=pe-z(X.lng);const De=ke-V(ne);we>.5?we-=1:we<-.5&&(we+=1);let Be=0;Math.abs(we)>Math.abs(De)?Be=we>=0?1:3:(Be=De>=0?0:2,je(G,G,[j[4]*x,j[5]*x,j[6]*x],-Math.sin(Qr(De>=0?N.getSouth():N.getNorth()))*dc));const He=E[Be],dt=E[(Be+1)%4],it=new Om(He,dt,G),pt=[_p(it,0)||He[0],_p(it,1)||He[1],_p(it,2)||He[2]],wt=Ex(h.zoom);if(wt>0){const Ct=function({x:Lt,y:Qt,z:ar},or,gr,xr,hr){const fr=1/(1<.5?br=-1:dn<-.5&&(br=1),Xt=((Xt+br)*or-(xr*=or))*gr+xr,Gt=((Gt+br)*or-xr)*gr+xr,pr=(pr*or-(hr*=or))*gr+hr,Tr=(Tr*or-hr)*gr+hr,[[Xt,Tr,0],[Gt,Tr,0],[Gt,pr,0],[Xt,pr,0]]}(u,l,h._pixelsPerMercatorPixel,pe,ke);for(let Lt=0;LtMath.PI/2*1.01}const S0e=Qr(85),E$e=Math.cos(S0e),I$e=Math.sin(S0e),P$e=C(),C0e=h=>{const l=[];return h.paint.get("circle-pitch-alignment")==="map"&&l.push("PITCH_WITH_MAP"),h.paint.get("circle-pitch-scale")==="map"&&l.push("SCALE_WITH_MAP"),l};function M0e(h,l,u,g,x,j,N,E,R){if(j&&h.queryGeometry.isAboveHorizon)return!1;j&&(R*=h.pixelToTileUnitsFactor);const B=h.tileID.canonical,H=u.projection.upVectorScale(B,u.center.lat,u.worldSize).metersToTile;for(const G of l)for(const X of G){const J=X.add(E),ne=x&&u.elevation?u.elevation.exaggeration()*x.getElevationAt(J.x,J.y,!0):0,pe=u.projection.projectTilePoint(J.x,J.y,B);if(ne>0){const Be=u.projection.upVector(B,J.x,J.y);pe.x+=Be[0]*H*ne,pe.y+=Be[1]*H*ne,pe.z+=Be[2]*H*ne}const ke=j?J:L$e(pe.x,pe.y,pe.z,g),we=j?h.tilespaceRays.map(Be=>D$e(Be,ne)):h.queryGeometry.screenGeometry,De=Nt([],[pe.x,pe.y,pe.z,1],g);if(!N&&j?R*=De[3]/u.cameraToCenterDistance:N&&!j&&(R*=u.cameraToCenterDistance/De[3]),j){const Be=ce((X.y/Cr+B.y)/(1<h.width||x.height>h.height||u.x>h.width-x.width||u.y>h.height-x.height)throw new RangeError("out of range source coordinates for image copy");if(x.width>l.width||x.height>l.height||g.x>l.width-x.width||g.y>l.height-x.height)throw new RangeError("out of range destination coordinates for image copy");const R=h.data,B=l.data,H=j===4&&E;for(let G=0;G{l[h.evaluationKey]=R;const B=h.expression.evaluate(l),H=B?B.toNonPremultipliedRenderColor(null):null;H&&(x.data[N+E+0]=Math.floor(255*H.r),x.data[N+E+1]=Math.floor(255*H.g),x.data[N+E+2]=Math.floor(255*H.b),x.data[N+E+3]=Math.floor(255*H.a))};if(h.clips)for(let N=0,E=0;N80*u){E=h[0],R=h[1];let H=E,G=R;for(let X=u;XH&&(H=J),ne>G&&(G=ne)}B=Math.max(H-E,G-R),B=B!==0?32767/B:0}return pM(j,N,u,E,R,B,0),N}function F0e(h,l,u,g,x){let j;if(x===function(N,E,R,B){let H=0;for(let G=E,X=R-B;G0)for(let N=l;N=l;N-=g)j=U0e(N/g|0,h[N],h[N+1],j);return j&&iN(j,j.next)&&(yM(j),j=j.next),j}function wv(h,l){if(!h)return h;l||(l=h);let u,g=h;do if(u=!1,g.steiner||!iN(g,g.next)&&wl(g.prev,g,g.next)!==0)g=g.next;else{if(yM(g),g=l=g.prev,g===g.next)break;u=!0}while(u||g!==l);return l}function pM(h,l,u,g,x,j,N){if(!h)return;!N&&j&&function(R,B,H,G){let X=R;do X.z===0&&(X.z=xae(X.x,X.y,B,H,G)),X.prevZ=X.prev,X.nextZ=X.next,X=X.next;while(X!==R);X.prevZ.nextZ=null,X.prevZ=null,function(J){let ne,pe=1;do{let ke,we=J;J=null;let De=null;for(ne=0;we;){ne++;let Be=we,He=0;for(let it=0;it0||dt>0&&Be;)He!==0&&(dt===0||!Be||we.z<=Be.z)?(ke=we,we=we.nextZ,He--):(ke=Be,Be=Be.nextZ,dt--),De?De.nextZ=ke:J=ke,ke.prevZ=De,De=ke;we=Be}De.nextZ=null,pe*=2}while(ne>1)}(X)}(h,g,x,j);let E=h;for(;h.prev!==h.next;){const R=h.prev,B=h.next;if(j?U$e(h,g,x,j):$$e(h))l.push(R.i,h.i,B.i),yM(h),h=B.next,E=B.next;else if((h=B)===E){N?N===1?pM(h=q$e(wv(h),l),l,u,g,x,j,2):N===2&&V$e(h,l,u,g,x,j):pM(wv(h),l,u,g,x,j,1);break}}}function $$e(h){const l=h.prev,u=h,g=h.next;if(wl(l,u,g)>=0)return!1;const x=l.x,j=u.x,N=g.x,E=l.y,R=u.y,B=g.y,H=Math.min(x,j,N),G=Math.min(E,R,B),X=Math.max(x,j,N),J=Math.max(E,R,B);let ne=g.next;for(;ne!==l;){if(ne.x>=H&&ne.x<=X&&ne.y>=G&&ne.y<=J&&mM(x,E,j,R,N,B,ne.x,ne.y)&&wl(ne.prev,ne,ne.next)>=0)return!1;ne=ne.next}return!0}function U$e(h,l,u,g){const x=h.prev,j=h,N=h.next;if(wl(x,j,N)>=0)return!1;const E=x.x,R=j.x,B=N.x,H=x.y,G=j.y,X=N.y,J=Math.min(E,R,B),ne=Math.min(H,G,X),pe=Math.max(E,R,B),ke=Math.max(H,G,X),we=xae(J,ne,l,u,g),De=xae(pe,ke,l,u,g);let Be=h.prevZ,He=h.nextZ;for(;Be&&Be.z>=we&&He&&He.z<=De;){if(Be.x>=J&&Be.x<=pe&&Be.y>=ne&&Be.y<=ke&&Be!==x&&Be!==N&&mM(E,H,R,G,B,X,Be.x,Be.y)&&wl(Be.prev,Be,Be.next)>=0||(Be=Be.prevZ,He.x>=J&&He.x<=pe&&He.y>=ne&&He.y<=ke&&He!==x&&He!==N&&mM(E,H,R,G,B,X,He.x,He.y)&&wl(He.prev,He,He.next)>=0))return!1;He=He.nextZ}for(;Be&&Be.z>=we;){if(Be.x>=J&&Be.x<=pe&&Be.y>=ne&&Be.y<=ke&&Be!==x&&Be!==N&&mM(E,H,R,G,B,X,Be.x,Be.y)&&wl(Be.prev,Be,Be.next)>=0)return!1;Be=Be.prevZ}for(;He&&He.z<=De;){if(He.x>=J&&He.x<=pe&&He.y>=ne&&He.y<=ke&&He!==x&&He!==N&&mM(E,H,R,G,B,X,He.x,He.y)&&wl(He.prev,He,He.next)>=0)return!1;He=He.nextZ}return!0}function q$e(h,l){let u=h;do{const g=u.prev,x=u.next.next;!iN(g,x)&&B0e(g,u,u.next,x)&&gM(g,x)&&gM(x,g)&&(l.push(g.i,u.i,x.i),yM(u),yM(u.next),u=h=x),u=u.next}while(u!==h);return wv(u)}function V$e(h,l,u,g,x,j){let N=h;do{let E=N.next.next;for(;E!==N.prev;){if(N.i!==E.i&&Z$e(N,E)){let R=$0e(N,E);return N=wv(N,N.next),R=wv(R,R.next),pM(N,l,u,g,x,j,0),void pM(R,l,u,g,x,j,0)}E=E.next}N=N.next}while(N!==h)}function H$e(h,l){let u=h.x-l.x;return u===0&&(u=h.y-l.y,u===0)&&(u=(h.next.y-h.y)/(h.next.x-h.x)-(l.next.y-l.y)/(l.next.x-l.x)),u}function W$e(h,l){const u=function(x,j){let N=j;const E=x.x,R=x.y;let B,H=-1/0;if(iN(x,N))return N;do{if(iN(x,N.next))return N.next;if(R<=N.y&&R>=N.next.y&&N.next.y!==N.y){const pe=N.x+(R-N.y)*(N.next.x-N.x)/(N.next.y-N.y);if(pe<=E&&pe>H&&(H=pe,B=N.x=N.x&&N.x>=X&&E!==N.x&&z0e(RB.x||N.x===B.x&&G$e(B,N)))&&(B=N,ne=pe)}N=N.next}while(N!==G);return B}(h,l);if(!u)return l;const g=$0e(u,h);return wv(g,g.next),wv(u,u.next)}function G$e(h,l){return wl(h.prev,h,l.prev)<0&&wl(l.next,h,h.next)<0}function xae(h,l,u,g,x){return(h=1431655765&((h=858993459&((h=252645135&((h=16711935&((h=(h-u)*x|0)|h<<8))|h<<4))|h<<2))|h<<1))|(l=1431655765&((l=858993459&((l=252645135&((l=16711935&((l=(l-g)*x|0)|l<<8))|l<<4))|l<<2))|l<<1))<<1}function K$e(h){let l=h,u=h;do(l.x=(h-N)*(j-E)&&(h-N)*(g-E)>=(u-N)*(l-E)&&(u-N)*(j-E)>=(x-N)*(g-E)}function mM(h,l,u,g,x,j,N,E){return!(h===N&&l===E)&&z0e(h,l,u,g,x,j,N,E)}function Z$e(h,l){return h.next.i!==l.i&&h.prev.i!==l.i&&!function(u,g){let x=u;do{if(x.i!==u.i&&x.next.i!==u.i&&x.i!==g.i&&x.next.i!==g.i&&B0e(x,x.next,u,g))return!0;x=x.next}while(x!==u);return!1}(h,l)&&(gM(h,l)&&gM(l,h)&&function(u,g){let x=u,j=!1;const N=(u.x+g.x)/2,E=(u.y+g.y)/2;do x.y>E!=x.next.y>E&&x.next.y!==x.y&&N<(x.next.x-x.x)*(E-x.y)/(x.next.y-x.y)+x.x&&(j=!j),x=x.next;while(x!==u);return j}(h,l)&&(wl(h.prev,h,l.prev)||wl(h,l.prev,l))||iN(h,l)&&wl(h.prev,h,h.next)>0&&wl(l.prev,l,l.next)>0)}function wl(h,l,u){return(l.y-h.y)*(u.x-l.x)-(l.x-h.x)*(u.y-l.y)}function iN(h,l){return h.x===l.x&&h.y===l.y}function B0e(h,l,u,g){const x=AP(wl(h,l,u)),j=AP(wl(h,l,g)),N=AP(wl(u,g,h)),E=AP(wl(u,g,l));return x!==j&&N!==E||!(x!==0||!TP(h,u,l))||!(j!==0||!TP(h,g,l))||!(N!==0||!TP(u,h,g))||!(E!==0||!TP(u,l,g))}function TP(h,l,u){return l.x<=Math.max(h.x,u.x)&&l.x>=Math.min(h.x,u.x)&&l.y<=Math.max(h.y,u.y)&&l.y>=Math.min(h.y,u.y)}function AP(h){return h>0?1:h<0?-1:0}function gM(h,l){return wl(h.prev,h,h.next)<0?wl(h,l,h.next)>=0&&wl(h,h.prev,l)>=0:wl(h,l,h.prev)<0||wl(h,h.next,l)<0}function $0e(h,l){const u=vae(h.i,h.x,h.y),g=vae(l.i,l.x,l.y),x=h.next,j=l.prev;return h.next=l,l.prev=h,u.next=x,x.prev=u,g.next=u,u.prev=g,j.next=g,g.prev=j,g}function U0e(h,l,u,g){const x=vae(h,l,u);return g?(x.next=g.next,x.prev=g,g.next.prev=x,g.next=x):(x.prev=x,x.next=x),x}function yM(h){h.next.prev=h.prev,h.prev.next=h.next,h.prevZ&&(h.prevZ.nextZ=h.nextZ),h.nextZ&&(h.nextZ.prevZ=h.prevZ)}function vae(h,l,u){return{i:h,x:l,y:u,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function xM(h,l){const u=h.length;if(u<=1)return[h];const g=[];let x,j;for(let N=0;N1)for(let N=0;N=Cr&&u>=Cr}static evaluate(l){if(l.length===0)return new Xg;let u=[];for(const R of l)u.push(...R.portals);if(u.length===0)return new Xg;for(const R of u){const B=R.va,H=R.vb;(Xg.isOnBorder(B.x,H.x)||Xg.isOnBorder(B.y,H.y))&&(R.type="border")}const g=u.filter(R=>R.type!=="unevaluated"),x=u.filter(R=>R.type==="unevaluated");if(x.length===0)return new Xg;x.sort((R,B)=>R.hash===B.hash?R.isTunnel===B.isTunnel?0:R.isTunnel?-1:1:R.hashR.hashj!=="fill-tunnel-structure-color"),this.tunnelProgramConfigurations=new jh(u,{zoom:g,lut:x},j=>j!=="fill-bridge-guard-rail-color")}addVertices(l,u){const g=this.unevalVertices.length;for(let x=0;x=j.min.x&&G.x<=j.max.x&&G.y>=j.min.y&&G.y<=j.max.y||X.x>=j.min.x&&X.x<=j.max.x&&X.y>=j.min.y&&X.y<=j.max.y||Xl(G,X,E))||this.isOnBorder(G.x,X.x)||this.isOnBorder(G.y,X.y))continue;const J=ou.computeEdgeHash(this.unevalVertices[B],this.unevalVertices[H]);let ne,pe=this.vertexHashLookup.get(ou.computePosHash(G));pe!=null?ne=pe.next:(pe=this.vertexHashLookup.get(ou.computePosHash(X)),ne=pe!=null?pe.prev:J),this.unevalEdges.push({polygonIdx:l,a:B,b:H,hash:J,portalHash:ne,isTunnel:x,type:"unevaluated",featureInfo:N})}}addPortalCandidates(l,u,g,x,j){if(u.length===0)return;this.portalPolygons.add(l,{geometry:u,zLevel:j});const N=u[0];this.vertexHashLookup.clear();let E=ou.computeEdgeHash(N[N.length-2],N[N.length-1]);for(let R=0;R({vertexOffset:0,primitiveOffset:this.indexArray.length}),g=X=>{X.primitiveLength=this.indexArray.length-X.primitiveOffset},x=new X$e(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(l.portals,this.unevalEdges);const j=u(),N=u(),E=u(),R=(X,J)=>{X.sort((pe,ke)=>pe.type===J&&ke.type!==J?-1:pe.type!==J&&ke.type===J?1:0);const ne=X.findIndex(pe=>pe.type!==J);return ne>=0?ne:X.length};let B=0;this.unevalEdges.length>0&&(B=R(this.unevalEdges,"none"),this.constructBridgeStructures(x,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:B},this.tileToMeters)),g(E);const H=u(),G=u();if(this.unevalEdges.length>0){const X=this.unevalEdges.splice(B),J=R(X,"tunnel")+B;this.unevalEdges.push(...X),this.constructTunnelStructures(x,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:B},{min:B,max:J})}g(H),x.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),g(G),x.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),g(N),x.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),g(j),this.maskSegments=ja.simpleSegment(0,G.primitiveOffset,0,G.primitiveLength),this.depthSegments=ja.simpleSegment(0,N.primitiveOffset,0,N.primitiveLength),this.renderableBridgeSegments=ja.simpleSegment(0,E.primitiveOffset,0,E.primitiveLength),this.renderableTunnelSegments=ja.simpleSegment(0,H.primitiveOffset,0,H.primitiveLength),this.shadowCasterSegments=ja.simpleSegment(0,j.primitiveOffset,0,j.primitiveLength)}update(l,u,g,x,j,N,E,R){this.bridgeProgramConfigurations.updatePaintArrays(l,u,j,g,x,N,E,R),this.tunnelProgramConfigurations.updatePaintArrays(l,u,j,g,x,N,E,R)}upload(l){this.vertexBuffer||this.vertexPositions.length===0||this.vertexNormals.length===0||this.indexArray.length===0||(this.vertexBuffer=l.createVertexBuffer(this.vertexPositions,z$e.members),this.vertexBufferNormal=l.createVertexBuffer(this.vertexNormals,B$e.members),this.indexBuffer=l.createIndexBuffer(this.indexArray),this.bridgeProgramConfigurations.upload(l),this.tunnelProgramConfigurations.upload(l))}destroy(){this.vertexBuffer&&(this.vertexBuffer.destroy(),this.vertexBufferNormal.destroy(),this.indexBuffer.destroy()),this.maskSegments&&(this.maskSegments.destroy(),this.depthSegments.destroy(),this.renderableBridgeSegments.destroy(),this.renderableTunnelSegments.destroy(),this.shadowCasterSegments.destroy()),this.bridgeProgramConfigurations.destroy(),this.tunnelProgramConfigurations.destroy()}populatePaintArrays(l,u,g,x,j){const N=(E,R)=>{for(let B=0;Bme(gr,u[xr].x,u[xr].y,g[xr]*R),G=Ne(),X=Ne(),J=Ne(),ne=Ne(),pe=Ne(),ke=(gr,xr)=>{const hr=E.get(ou.computePosHash(u[xr])),fr=hr.from,Xt=hr.to;if(!fr||!Xt)return;H(G,fr),H(X,xr),H(J,Xt),rt(ne),We(G,X)||(Ce(pe,X,G),Pe(ne,pe)),We(J,X)||(Ce(pe,J,X),fe(ne,ne,Pe(pe,pe)));const Gt=Fe(ne);return Gt>0?ae(gr,ne,1/Gt):void 0};let we=Number.POSITIVE_INFINITY;this.sortSubarray(x,j.min,j.max,(gr,xr)=>gr.featureInfo.featureIndex-xr.featureInfo.featureIndex);const De=Ne(),Be=Ne(),He=Ne(),dt=Ne(),it=Ne(),pt=Ne(),wt=Ne(),Ct=Ne(),Wt=Ne(),Lt=[Ne(),Ne(),Ne(),Ne()],Qt=[Ne(),Ne(),Ne(),Ne()],ar=[{coord:new sr(0,0),height:0},{coord:new sr(0,0),height:0}],or=(gr,xr)=>gr>xr;for(let gr=j.min;grwe.featureInfo.featureIndex-De.featureInfo.featureIndex;this.sortSubarray(x,j.min,j.max,R),this.sortSubarray(x,N.min,N.max,R);const B=we=>Pe(we,we),H=[{coord:new sr(0,0),height:0},{coord:new sr(0,0),height:0}],G=(we,De)=>weE.hash===R.hash?R.polygonIdx-E.polygonIdx:R.hash>E.hash?1:-1);let g=0,x=0,j=0,N=u[g].polygonIdx;do x++,(x===u.length||u[g].hash!==u[x].hash)&&((x-g==1||u[x-1].polygonIdx!==N)&&(jB.portalHashH.hash?E++:H.hash>B.portalHash?R++:(B.type=H.type,E++)}}}isOnBorder(l,u){return l<=0&&u<=0||l>=Cr&&u>=Cr}addFeatureSection(l,u,g,x){return l!==u&&(u=l,g.push({featureIndex:l,vertexStart:x.getVertexCount()}),x.clearVertexLookup()),u}sortSubarray(l,u,g,x){const j=l.slice(u,g);j.sort(x),l.splice(u,j.length,...j)}static computeEdgeHash(l,u){return(l.y===u.y&&l.x>u.x||l.y>u.y)&&([l,u]=[u,l]),BigInt(ou.computePosHash(l))<<32n|BigInt(ou.computePosHash(u))}static computePosHash(l){return((65535&l.x)<<16|65535&l.y)>>>0}}var H0e,W0e={exports:{}},G0e=(H0e||(H0e=1,function(h){function l(at,ut){return at>ut?1:at0){var hn=yr+Math.floor(Lr/2),mn={key:ut[hn],data:Jt[hn],parent:at};return mn.left=x(mn,ut,Jt,yr,hn),mn.right=x(mn,ut,Jt,hn+1,Pr),mn}return null}function j(at,ut,Jt,yr,Pr){if(!(Jt>=yr)){for(var Lr=at[Jt+yr>>1],hn=Jt-1,mn=yr+1;;){do hn++;while(Pr(at[hn],Lr)<0);do mn--;while(Pr(at[mn],Lr)>0);if(hn>=mn)break;var Kn=at[hn];at[hn]=at[mn],at[mn]=Kn,Kn=ut[hn],ut[hn]=ut[mn],ut[mn]=Kn}j(at,ut,Jt,mn,Pr),j(at,ut,mn+1,yr,Pr)}}u.prototype.rotateLeft=function(at){var ut=at.right;ut&&(at.right=ut.left,ut.left&&(ut.left.parent=at),ut.parent=at.parent),at.parent?at===at.parent.left?at.parent.left=ut:at.parent.right=ut:this._root=ut,ut&&(ut.left=at),at.parent=ut},u.prototype.rotateRight=function(at){var ut=at.left;ut&&(at.left=ut.right,ut.right&&(ut.right.parent=at),ut.parent=at.parent),at.parent?at===at.parent.left?at.parent.left=ut:at.parent.right=ut:this._root=ut,ut&&(ut.right=at),at.parent=ut},u.prototype._splay=function(at){for(;at.parent;){var ut=at.parent;ut.parent?ut.left===at&&ut.parent.left===ut?(this.rotateRight(ut.parent),this.rotateRight(ut)):ut.right===at&&ut.parent.right===ut?(this.rotateLeft(ut.parent),this.rotateLeft(ut)):ut.left===at&&ut.parent.right===ut?(this.rotateRight(ut),this.rotateLeft(ut)):(this.rotateLeft(ut),this.rotateRight(ut)):ut.left===at?this.rotateRight(ut):this.rotateLeft(ut)}},u.prototype.splay=function(at){for(var ut,Jt,yr,Pr,Lr;at.parent;)(Jt=(ut=at.parent).parent)&&Jt.parent?((yr=Jt.parent).left===Jt?yr.left=at:yr.right=at,at.parent=yr):(at.parent=null,this._root=at),Pr=at.left,Lr=at.right,at===ut.left?(Jt&&(Jt.left===ut?(ut.right?(Jt.left=ut.right,Jt.left.parent=Jt):Jt.left=null,ut.right=Jt,Jt.parent=ut):(Pr?(Jt.right=Pr,Pr.parent=Jt):Jt.right=null,at.left=Jt,Jt.parent=at)),Lr?(ut.left=Lr,Lr.parent=ut):ut.left=null,at.right=ut,ut.parent=at):(Jt&&(Jt.right===ut?(ut.left?(Jt.right=ut.left,Jt.right.parent=Jt):Jt.right=null,ut.left=Jt,Jt.parent=ut):(Lr?(Jt.left=Lr,Lr.parent=Jt):Jt.left=null,at.right=Jt,Jt.parent=at)),Pr?(ut.right=Pr,Pr.parent=ut):ut.right=null,at.left=ut,ut.parent=at)},u.prototype.replace=function(at,ut){at.parent?at===at.parent.left?at.parent.left=ut:at.parent.right=ut:this._root=ut,ut&&(ut.parent=at.parent)},u.prototype.minNode=function(at){if(at===void 0&&(at=this._root),at)for(;at.left;)at=at.left;return at},u.prototype.maxNode=function(at){if(at===void 0&&(at=this._root),at)for(;at.right;)at=at.right;return at},u.prototype.insert=function(at,ut){var Jt=this._root,yr=null,Pr=this._compare;if(this._noDuplicates)for(;Jt;){if(yr=Jt,Pr(Jt.key,at)===0)return;Jt=Pr(Jt.key,at)<0?Jt.right:Jt.left}else for(;Jt;)yr=Jt,Jt=Pr(Jt.key,at)<0?Jt.right:Jt.left;return Jt={key:at,data:ut,left:null,right:null,parent:yr},yr?Pr(yr.key,Jt.key)<0?yr.right=Jt:yr.left=Jt:this._root=Jt,this.splay(Jt),this._size++,Jt},u.prototype.find=function(at){for(var ut=this._root,Jt=this._compare;ut;){var yr=Jt(ut.key,at);if(yr<0)ut=ut.right;else{if(!(yr>0))return ut;ut=ut.left}}return null},u.prototype.contains=function(at){for(var ut=this._root,Jt=this._compare;ut;){var yr=Jt(at,ut.key);if(yr===0)return!0;ut=yr<0?ut.left:ut.right}return!1},u.prototype.remove=function(at){var ut=this.find(at);if(!ut)return!1;if(this.splay(ut),ut.left)if(ut.right){var Jt=this.minNode(ut.right);Jt.parent!==ut&&(this.replace(Jt,Jt.right),Jt.right=ut.right,Jt.right.parent=Jt),this.replace(ut,Jt),Jt.left=ut.left,Jt.left.parent=Jt}else this.replace(ut,ut.left);else this.replace(ut,ut.right);return this._size--,!0},u.prototype.removeNode=function(at){if(!at)return!1;if(this.splay(at),at.left)if(at.right){var ut=this.minNode(at.right);ut.parent!==at&&(this.replace(ut,ut.right),ut.right=at.right,ut.right.parent=ut),this.replace(at,ut),ut.left=at.left,ut.left.parent=ut}else this.replace(at,at.left);else this.replace(at,at.right);return this._size--,!0},u.prototype.erase=function(at){var ut=this.find(at);if(ut){this.splay(ut);var Jt=ut.left,yr=ut.right,Pr=null;Jt&&(Jt.parent=null,Pr=this.maxNode(Jt),this.splay(Pr),this._root=Pr),yr&&(Jt?Pr.right=yr:this._root=yr,yr.parent=Pr),this._size--}},u.prototype.pop=function(){var at=this._root,ut=null;if(at){for(;at.left;)at=at.left;ut={key:at.key,data:at.data},this.remove(at.key)}return ut},u.prototype.next=function(at){var ut=at;if(ut)if(ut.right)for(ut=ut.right;ut&&ut.left;)ut=ut.left;else for(ut=at.parent;ut&&ut.right===at;)at=ut,ut=ut.parent;return ut},u.prototype.prev=function(at){var ut=at;if(ut)if(ut.left)for(ut=ut.left;ut&&ut.right;)ut=ut.right;else for(ut=at.parent;ut&&ut.left===at;)at=ut,ut=ut.parent;return ut},u.prototype.forEach=function(at){for(var ut=this._root,Jt=[],yr=!1,Pr=0;!yr;)ut?(Jt.push(ut),ut=ut.left):Jt.length>0?(at(ut=Jt.pop(),Pr++),ut=ut.right):yr=!0;return this},u.prototype.range=function(at,ut,Jt,yr){for(var Pr=[],Lr=this._compare,hn=this._root;Pr.length!==0||hn;)if(hn)Pr.push(hn),hn=hn.left;else{if(Lr((hn=Pr.pop()).key,ut)>0)break;if(Lr(hn.key,at)>=0&&Jt.call(yr,hn))return this;hn=hn.right}return this},u.prototype.keys=function(){for(var at=this._root,ut=[],Jt=[],yr=!1;!yr;)at?(ut.push(at),at=at.left):ut.length>0?(at=ut.pop(),Jt.push(at.key),at=at.right):yr=!0;return Jt},u.prototype.values=function(){for(var at=this._root,ut=[],Jt=[],yr=!1;!yr;)at?(ut.push(at),at=at.left):ut.length>0?(at=ut.pop(),Jt.push(at.data),at=at.right):yr=!0;return Jt},u.prototype.at=function(at){for(var ut=this._root,Jt=[],yr=!1,Pr=0;!yr;)if(ut)Jt.push(ut),ut=ut.left;else if(Jt.length>0){if(ut=Jt.pop(),Pr===at)return ut;Pr++,ut=ut.right}else yr=!0;return null},u.prototype.load=function(at,ut,Jt){if(at===void 0&&(at=[]),ut===void 0&&(ut=[]),Jt===void 0&&(Jt=!1),this._size!==0)throw new Error("bulk-load: tree is not empty");var yr=at.length;return Jt&&j(at,ut,0,yr-1,this._compare),this._root=x(null,at,ut,0,yr),this._size=yr,this},u.prototype.min=function(){var at=this.minNode(this._root);return at?at.key:null},u.prototype.max=function(){var at=this.maxNode(this._root);return at?at.key:null},u.prototype.isEmpty=function(){return this._root===null},g.size.get=function(){return this._size},u.createTree=function(at,ut,Jt,yr,Pr){return new u(Jt,Pr).load(at,ut,yr)},Object.defineProperties(u.prototype,g);var N=0,E=1,R=2,B=3,H=0,G=1,X=2,J=3;function ne(at,ut,Jt){ut===null?(at.inOut=!1,at.otherInOut=!0):(at.isSubject===ut.isSubject?(at.inOut=!ut.inOut,at.otherInOut=ut.otherInOut):(at.inOut=!ut.otherInOut,at.otherInOut=ut.isVertical()?!ut.inOut:ut.inOut),ut&&(at.prevInResult=!pe(ut,Jt)||ut.isVertical()?ut.prevInResult:ut));var yr=pe(at,Jt);at.resultTransition=yr?function(Pr,Lr){var hn,mn=!Pr.inOut,Kn=!Pr.otherInOut;switch(Lr){case H:hn=mn&&Kn;break;case G:hn=mn||Kn;break;case J:hn=mn^Kn;break;case X:hn=Pr.isSubject?mn&&!Kn:Kn&&!mn}return hn?1:-1}(at,Jt):0}function pe(at,ut){switch(at.type){case N:switch(ut){case H:return!at.otherInOut;case G:return at.otherInOut;case X:return at.isSubject&&at.otherInOut||!at.isSubject&&!at.otherInOut;case J:return!0}break;case R:return ut===H||ut===G;case B:return ut===X;case E:return!1}return!1}var ke=function(at,ut,Jt,yr,Pr){this.left=ut,this.point=at,this.otherEvent=Jt,this.isSubject=yr,this.type=Pr||N,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.resultTransition=0,this.otherPos=-1,this.outputContourId=-1,this.isExteriorRing=!0},we={inResult:{configurable:!0}};function De(at,ut){return at[0]===ut[0]&&at[1]===ut[1]}ke.prototype.isBelow=function(at){var ut=this.point,Jt=this.otherEvent.point;return this.left?(ut[0]-at[0])*(Jt[1]-at[1])-(Jt[0]-at[0])*(ut[1]-at[1])>0:(Jt[0]-at[0])*(ut[1]-at[1])-(ut[0]-at[0])*(Jt[1]-at[1])>0},ke.prototype.isAbove=function(at){return!this.isBelow(at)},ke.prototype.isVertical=function(){return this.point[0]===this.otherEvent.point[0]},we.inResult.get=function(){return this.resultTransition!==0},ke.prototype.clone=function(){var at=new ke(this.point,this.left,this.otherEvent,this.isSubject,this.type);return at.contourId=this.contourId,at.resultTransition=this.resultTransition,at.prevInResult=this.prevInResult,at.isExteriorRing=this.isExteriorRing,at.inOut=this.inOut,at.otherInOut=this.otherInOut,at},Object.defineProperties(ke.prototype,we);var Be=11102230246251565e-32,He=134217729,dt=(3+8*Be)*Be;function it(at,ut,Jt,yr,Pr){var Lr,hn,mn,Kn,ns=ut[0],ds=yr[0],Ns=0,En=0;ds>ns==ds>-ns?(Lr=ns,ns=ut[++Ns]):(Lr=ds,ds=yr[++En]);var zn=0;if(Nsns==ds>-ns?(mn=Lr-((hn=ns+Lr)-ns),ns=ut[++Ns]):(mn=Lr-((hn=ds+Lr)-ds),ds=yr[++En]),Lr=hn,mn!==0&&(Pr[zn++]=mn);Nsns==ds>-ns?(mn=Lr-((hn=Lr+ns)-(Kn=hn-Lr))+(ns-Kn),ns=ut[++Ns]):(mn=Lr-((hn=Lr+ds)-(Kn=hn-Lr))+(ds-Kn),ds=yr[++En]),Lr=hn,mn!==0&&(Pr[zn++]=mn);for(;Ns0!=Ns>0)return En;var zn=Math.abs(ds+Ns);return Math.abs(En)>=wt*zn?En:-function(Ks,ei,ti,_i,$i,Ii,oi){var fi,ss,Os,va,Mn,Ss,Ri,Vi,Ji,no,Zi,Tn,Sa,bi,ha,Bo,dl,No,So=Ks-$i,tl=ti-$i,xd=ei-Ii,Yi=_i-Ii;Lt[0]=(ha=(Vi=So-(Ri=(Ss=He*So)-(Ss-So)))*(no=Yi-(Ji=(Ss=He*Yi)-(Ss-Yi)))-((bi=So*Yi)-Ri*Ji-Vi*Ji-Ri*no))-((Zi=ha-(dl=(Vi=xd-(Ri=(Ss=He*xd)-(Ss-xd)))*(no=tl-(Ji=(Ss=He*tl)-(Ss-tl)))-((Bo=xd*tl)-Ri*Ji-Vi*Ji-Ri*no)))+(Mn=ha-Zi))+(Mn-dl),Lt[1]=(Sa=bi-((Tn=bi+Zi)-(Mn=Tn-bi))+(Zi-Mn))-((Zi=Sa-Bo)+(Mn=Sa-Zi))+(Mn-Bo),Lt[2]=Tn-((No=Tn+Zi)-(Mn=No-Tn))+(Zi-Mn),Lt[3]=No;var Ya=function(Fm,Ql){for(var Yc=Ql[0],cu=1;cu<4;cu++)Yc+=Ql[cu];return Yc}(0,Lt),so=Ct*oi;if(Ya>=so||-Ya>=so||(fi=Ks-(So+(Mn=Ks-So))+(Mn-$i),Os=ti-(tl+(Mn=ti-tl))+(Mn-$i),ss=ei-(xd+(Mn=ei-xd))+(Mn-Ii),va=_i-(Yi+(Mn=_i-Yi))+(Mn-Ii),fi===0&&ss===0&&Os===0&&va===0)||(so=Wt*oi+dt*Math.abs(Ya),(Ya+=So*va+Yi*fi-(xd*Os+tl*ss))>=so||-Ya>=so))return Ya;gr[0]=(ha=(Vi=fi-(Ri=(Ss=He*fi)-(Ss-fi)))*(no=Yi-(Ji=(Ss=He*Yi)-(Ss-Yi)))-((bi=fi*Yi)-Ri*Ji-Vi*Ji-Ri*no))-((Zi=ha-(dl=(Vi=ss-(Ri=(Ss=He*ss)-(Ss-ss)))*(no=tl-(Ji=(Ss=He*tl)-(Ss-tl)))-((Bo=ss*tl)-Ri*Ji-Vi*Ji-Ri*no)))+(Mn=ha-Zi))+(Mn-dl),gr[1]=(Sa=bi-((Tn=bi+Zi)-(Mn=Tn-bi))+(Zi-Mn))-((Zi=Sa-Bo)+(Mn=Sa-Zi))+(Mn-Bo),gr[2]=Tn-((No=Tn+Zi)-(Mn=No-Tn))+(Zi-Mn),gr[3]=No;var Od=it(4,Lt,4,gr,Qt);gr[0]=(ha=(Vi=So-(Ri=(Ss=He*So)-(Ss-So)))*(no=va-(Ji=(Ss=He*va)-(Ss-va)))-((bi=So*va)-Ri*Ji-Vi*Ji-Ri*no))-((Zi=ha-(dl=(Vi=xd-(Ri=(Ss=He*xd)-(Ss-xd)))*(no=Os-(Ji=(Ss=He*Os)-(Ss-Os)))-((Bo=xd*Os)-Ri*Ji-Vi*Ji-Ri*no)))+(Mn=ha-Zi))+(Mn-dl),gr[1]=(Sa=bi-((Tn=bi+Zi)-(Mn=Tn-bi))+(Zi-Mn))-((Zi=Sa-Bo)+(Mn=Sa-Zi))+(Mn-Bo),gr[2]=Tn-((No=Tn+Zi)-(Mn=No-Tn))+(Zi-Mn),gr[3]=No;var $o=it(Od,Qt,4,gr,ar);gr[0]=(ha=(Vi=fi-(Ri=(Ss=He*fi)-(Ss-fi)))*(no=va-(Ji=(Ss=He*va)-(Ss-va)))-((bi=fi*va)-Ri*Ji-Vi*Ji-Ri*no))-((Zi=ha-(dl=(Vi=ss-(Ri=(Ss=He*ss)-(Ss-ss)))*(no=Os-(Ji=(Ss=He*Os)-(Ss-Os)))-((Bo=ss*Os)-Ri*Ji-Vi*Ji-Ri*no)))+(Mn=ha-Zi))+(Mn-dl),gr[1]=(Sa=bi-((Tn=bi+Zi)-(Mn=Tn-bi))+(Zi-Mn))-((Zi=Sa-Bo)+(Mn=Sa-Zi))+(Mn-Bo),gr[2]=Tn-((No=Tn+Zi)-(Mn=No-Tn))+(Zi-Mn),gr[3]=No;var pf=it($o,ar,4,gr,or);return or[pf-1]}(Pr,Lr,hn,mn,Kn,ns,zn)}(at[0],at[1],ut[0],ut[1],Jt[0],Jt[1]);return yr>0?-1:yr<0?1:0}function hr(at,ut){var Jt=at.point,yr=ut.point;return Jt[0]>yr[0]?1:Jt[0]yr[1]?1:-1:function(Pr,Lr,hn,mn){return Pr.left!==Lr.left?Pr.left?1:-1:xr(hn,Pr.otherEvent.point,Lr.otherEvent.point)!==0?Pr.isBelow(Lr.otherEvent.point)?-1:1:!Pr.isSubject&&Lr.isSubject?1:-1}(at,ut,Jt)}function fr(at,ut,Jt){var yr=new ke(ut,!1,at,at.isSubject),Pr=new ke(ut,!0,at.otherEvent,at.isSubject);return De(at.point,at.otherEvent.point)&&console.warn("what is that, a collapsed segment?",at),yr.contourId=Pr.contourId=at.contourId,hr(Pr,at.otherEvent)>0&&(at.otherEvent.left=!0,Pr.left=!1),at.otherEvent.otherEvent=Pr,at.otherEvent=yr,Jt.push(Pr),Jt.push(yr),Jt}function Xt(at,ut){return at[0]*ut[1]-at[1]*ut[0]}function Gt(at,ut){return at[0]*ut[0]+at[1]*ut[1]}function pr(at,ut,Jt){var yr=function(Kn,ns,ds,Ns,En){var zn=[ns[0]-Kn[0],ns[1]-Kn[1]],Ks=[Ns[0]-ds[0],Ns[1]-ds[1]];function ei(Ss,Ri,Vi){return[Ss[0]+Ri*Vi[0],Ss[1]+Ri*Vi[1]]}var ti=[ds[0]-Kn[0],ds[1]-Kn[1]],_i=Xt(zn,Ks),$i=_i*_i,Ii=Gt(zn,zn);if($i>0){var oi=Xt(ti,Ks)/_i;if(oi<0||oi>1)return null;var fi=Xt(ti,zn)/_i;return fi<0||fi>1?null:oi===0||oi===1?[ei(Kn,oi,zn)]:fi===0||fi===1?[ei(ds,fi,Ks)]:[ei(Kn,oi,zn)]}if(($i=(_i=Xt(ti,zn))*_i)>0)return null;var ss=Gt(zn,ti)/Ii,Os=ss+Gt(zn,Ks)/Ii,va=Math.min(ss,Os),Mn=Math.max(ss,Os);return va<=1&&Mn>=0?va===1?[ei(Kn,va>0?va:0,zn)]:Mn===0?[ei(Kn,Mn<1?Mn:1,zn)]:[ei(Kn,va>0?va:0,zn),ei(Kn,Mn<1?Mn:1,zn)]:null}(at.point,at.otherEvent.point,ut.point,ut.otherEvent.point),Pr=yr?yr.length:0;if(Pr===0||Pr===1&&(De(at.point,ut.point)||De(at.otherEvent.point,ut.otherEvent.point))||Pr===2&&at.isSubject===ut.isSubject)return 0;if(Pr===1)return De(at.point,yr[0])||De(at.otherEvent.point,yr[0])||fr(at,yr[0],Jt),De(ut.point,yr[0])||De(ut.otherEvent.point,yr[0])||fr(ut,yr[0],Jt),1;var Lr=[],hn=!1,mn=!1;return De(at.point,ut.point)?hn=!0:hr(at,ut)===1?Lr.push(ut,at):Lr.push(at,ut),De(at.otherEvent.point,ut.otherEvent.point)?mn=!0:hr(at.otherEvent,ut.otherEvent)===1?Lr.push(ut.otherEvent,at.otherEvent):Lr.push(at.otherEvent,ut.otherEvent),hn&&mn||hn?(ut.type=E,at.type=ut.inOut===at.inOut?R:B,hn&&!mn&&fr(Lr[1].otherEvent,Lr[0].point,Jt),2):mn?(fr(Lr[0],Lr[1].point,Jt),3):Lr[0]!==Lr[3].otherEvent?(fr(Lr[0],Lr[1].point,Jt),fr(Lr[1],Lr[2].point,Jt),3):(fr(Lr[0],Lr[1].point,Jt),fr(Lr[3].otherEvent,Lr[2].point,Jt),3)}function Tr(at,ut){if(at===ut)return 0;if(xr(at.point,at.otherEvent.point,ut.point)!==0||xr(at.point,at.otherEvent.point,ut.otherEvent.point)!==0)return De(at.point,ut.point)?at.isBelow(ut.otherEvent.point)?-1:1:at.point[0]===ut.point[0]?at.point[1]ut.contourId?1:-1:hr(at,ut)===1?1:-1}var br=function(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null};function dn(at,ut,Jt,yr){var Pr,Lr=at+1,hn=ut[at].point,mn=ut.length;for(Lryr;)Lr--;return Lr}br.prototype.isExterior=function(){return this.holeOf==null};var Rr=tn,Vr=tn;function tn(at,ut){if(!(this instanceof tn))return new tn(at,ut);if(this.data=at||[],this.length=this.data.length,this.compare=ut||us,this.length>0)for(var Jt=(this.length>>1)-1;Jt>=0;Jt--)this._down(Jt)}function us(at,ut){return atut?1:0}tn.prototype={push:function(at){this.data.push(at),this.length++,this._up(this.length-1)},pop:function(){if(this.length!==0){var at=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),at}},peek:function(){return this.data[0]},_up:function(at){for(var ut=this.data,Jt=this.compare,yr=ut[at];at>0;){var Pr=at-1>>1,Lr=ut[Pr];if(Jt(yr,Lr)>=0)break;ut[at]=Lr,at=Pr}ut[at]=yr},_down:function(at){for(var ut=this.data,Jt=this.compare,yr=this.length>>1,Pr=ut[at];at=0)break;ut[at]=mn,at=Lr}ut[at]=Pr}},Rr.default=Vr;var jr=Math.max,rn=Math.min,Bn=0;function Es(at,ut,Jt,yr,Pr,Lr){var hn,mn,Kn,ns,ds,Ns;for(hn=0,mn=at.length-1;hn0?Ns.left=!0:ds.left=!0;var En=Kn[0],zn=Kn[1];Pr[0]=rn(Pr[0],En),Pr[1]=rn(Pr[1],zn),Pr[2]=jr(Pr[2],En),Pr[3]=jr(Pr[3],zn),yr.push(ds),yr.push(Ns)}}var Rs=[];function Yn(at,ut,Jt){typeof at[0][0][0]=="number"&&(at=[at]),typeof ut[0][0][0]=="number"&&(ut=[ut]);var yr=function(zn,Ks,ei){var ti=null;return zn.length*Ks.length==0&&(ei===H?ti=Rs:ei===X?ti=zn:ei!==G&&ei!==J||(ti=zn.length===0?Ks:zn)),ti}(at,ut,Jt);if(yr)return yr===Rs?null:yr;var Pr=[1/0,1/0,-1/0,-1/0],Lr=[1/0,1/0,-1/0,-1/0],hn=function(zn,Ks,ei,ti,_i){var $i,Ii,oi,fi,ss,Os,va=new Rr(null,hr);for(oi=0,fi=zn.length;oiti[2]||ti[0]>ei[2]||ei[1]>ti[3]||ti[1]>ei[3])&&(_i===H?$i=Rs:_i===X?$i=zn:_i!==G&&_i!==J||($i=zn.concat(Ks))),$i}(at,ut,Pr,Lr,Jt))return yr===Rs?null:yr;for(var mn=function(zn){var Ks,ei,ti=function(oi){var fi,ss,Os,va,Mn=[];for(ss=0,Os=oi.length;ss0){var Zi=Ss[no];if(Zi.holeOf!=null){var Tn=Zi.holeOf;Ss[Tn].holeIds.push(Ri),Vi.holeOf=Tn,Vi.depth=Ss[no].depth}else Ss[no].holeIds.push(Ri),Vi.holeOf=no,Vi.depth=Ss[no].depth+1}else Vi.holeOf=null,Vi.depth=Ss[no].depth}else Vi.holeOf=null,Vi.depth=0;return Vi}(ti[Ks],$i,oi),ss=function(Mn){_i[Mn]=!0,Mn=ti.length)&&ti[Os];);$i.push(fi)}};for(Ks=0,ei=ti.length;Ksva||$i===X&&Mn.point[0]>ti[2])break;if(Mn.left){oi=Ii=ss.insert(Mn),Ii=Ii!==(fi=ss.minNode())?ss.prev(Ii):null,oi=ss.next(oi);var Ss=Ii?Ii.key:null;if(ne(Mn,Ss,$i),oi&&pr(Mn,oi.key,zn)===2&&(ne(Mn,Ss,$i),ne(oi.key,Mn,$i)),Ii&&pr(Ii.key,Mn,zn)===2){var Ri=Ii;ne(Ss,(Ri=Ri!==fi?ss.prev(Ri):null)?Ri.key:null,$i),ne(Mn,Ss,$i)}}else oi=Ii=ss.find(Mn=Mn.otherEvent),Ii&&oi&&(Ii=Ii!==fi?ss.prev(Ii):null,oi=ss.next(oi),ss.remove(Mn),oi&&Ii&&pr(Ii.key,oi.key,zn))}return Os}(hn,0,0,Pr,Lr,Jt)),Kn=[],ns=0;ns * @license MIT * @preserve */function EP(h,l,u,g){const x=[],j=g===0?(N,E,R,B,H,G)=>{N.push(new sr(G,R+(G-E)/(B-E)*(H-R)))}:(N,E,R,B,H,G)=>{N.push(new sr(E+(G-R)/(H-R)*(B-E),G))};for(const N of h){const E=[];for(const R of N){if(R.length<=2)continue;const B=[];for(let X=0;Xl&&j(B,J,ne,pe,ke,l):we>u?De=l&&j(B,J,ne,pe,ke,l),De>u&&we<=u&&j(B,J,ne,pe,ke,u)}let H=R[R.length-1];const G=g===0?H.x:H.y;G>=l&&G<=u&&B.push(H),B.length&&(H=B[B.length-1],B[0].x===H.x&&B[0].y===H.y||B.push(B[0]),E.push(B))}E.length&&x.push(E)}return x}function Q$e(h,l){const u=wae(h),g=wae([l]),x=G0e.intersection(u,g);return x==null?[]:K0e(x)}function J$e(h,l){let g=wae(h,65536);const x=[];for(;l.valid();l.next()){const[j,N]=l.get(),E=j.x*65536,R=j.y*65536,B=N.x*65536,H=N.y*65536,G=B-E,X=H-R,J=Math.hypot(G,X);if(J===0)continue;const ne=Math.trunc(X/J*3),pe=-Math.trunc(G/J*3);x.push([[[E,R],[B,H],[B+ne,H+pe],[E+ne,R+pe],[E,R]]])}return x.length>0&&(g=G0e.diff(g,x)),K0e(g,1/65536)}function wae(h,l=1){return[h.map(u=>u.map(g=>[g.x*l,g.y*l]))]}function K0e(h,l=1){return h.map(u=>u.map((g,x)=>{const j=g.map(N=>new sr(N[0]*l,N[1]*l).round());return x>0&&j.reverse(),j}))}class jae{constructor(l,u){this.layoutVertexArray=new Em,this.indexArray=new Ro,this.lineIndexArray=new iu,this.triangleSegments=new ja,this.lineSegments=new ja,this.programConfigurations=new jh(l.layers,{zoom:l.zoom,lut:l.lut}),this.uploaded=!1,u&&(this.elevatedLayoutVertexArray=new pp)}update(l,u,g,x,j,N,E,R){this.programConfigurations.updatePaintArrays(l,u,j,g,x,N,E,R)}isEmpty(){return this.layoutVertexArray.length===0}needsUpload(){return this.programConfigurations.needsUpload}upload(l){this.uploaded||(this.layoutVertexBuffer=l.createVertexBuffer(this.layoutVertexArray,R$e.members),this.indexBuffer=l.createIndexBuffer(this.indexArray),this.lineIndexBuffer=l.createIndexBuffer(this.lineIndexArray),this.elevatedLayoutVertexArray&&this.elevatedLayoutVertexArray.length>0&&(this.elevatedLayoutVertexBuffer=l.createVertexBuffer(this.elevatedLayoutVertexArray,F$e.members))),this.programConfigurations.upload(l),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.lineIndexBuffer.destroy(),this.programConfigurations.destroy(),this.triangleSegments.destroy(),this.lineSegments.destroy())}populatePaintArrays(l,u,g,x,j,N,E){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,l,u,g,x,j,N,void 0,E)}}class kae{constructor(l){this.zoom=l.zoom,this.pixelRatio=l.pixelRatio,this.overscaling=l.overscaling,this.layers=l.layers,this.layerIds=this.layers.map(u=>u.fqid),this.index=l.index,this.hasPattern=!1,this.patternFeatures=[],this.lut=l.lut,this.bufferData=new jae(l,!1),this.elevationBufferData=new jae(l,!0),this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.projection=l.projection,this.elevationMode=this.layers[0].layout.get("fill-elevation-reference"),this.sourceLayerIndex=l.sourceLayerIndex,this.worldview=l.worldview,this.hasAppearances=null}updateFootprints(l,u){}updateAppearances(l,u,g,x){}populate(l,u,g,x){this.hasPattern=_ae("fill",this.layers,this.pixelRatio,u);const j=this.layers[0].layout.get("fill-sort-key"),N=[];for(const{feature:E,id:R,index:B,sourceLayerIndex:H}of l){const G=this.layers[0]._featureFilter.needGeometry,X=Pt(E,G);if(!this.layers[0]._featureFilter.filter(new Qi(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),X,g))continue;const J=j?j.evaluate(X,{},g,u.availableImages):void 0,ne={id:R,properties:E.properties,type:E.type,sourceLayerIndex:H,index:B,geometry:G?X.geometry:vt(E,g,x),patterns:{},sortKey:J};N.push(ne)}j&&N.sort((E,R)=>E.sortKey-R.sortKey);for(const E of N){const{geometry:R,index:B,sourceLayerIndex:H}=E;if(this.hasPattern){const G=bae("fill",this.layers,E,this.zoom,this.pixelRatio,u);this.patternFeatures.push(G)}else this.addFeature(E,R,B,g,{},u.availableImages,u.brightness,u.elevationFeatures);u.featureIndex.insert(l[B].feature,R,B,H,this.index)}}update(l,u,g,x,j,N,E){this.bufferData.update(l,u,g,x,j,N,E,this.worldview),this.elevationBufferData.update(l,u,g,x,j,N,E,this.worldview),this.elevatedStructures&&this.elevatedStructures.update(l,u,g,x,j,N,E,this.worldview)}addFeatures(l,u,g,x,j,N){for(const E of this.patternFeatures)this.addFeature(E,E.geometry,E.index,u,g,x,N,l.elevationFeatures)}isEmpty(){return this.bufferData.isEmpty()&&this.elevationBufferData.isEmpty()}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||this.elevationBufferData.needsUpload()}upload(l){this.bufferData.upload(l),this.elevationBufferData.upload(l),this.elevatedStructures&&this.elevatedStructures.upload(l)}destroy(){this.bufferData.destroy(),this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}addFeature(l,u,g,x,j,N=[],E,R){const B=xM(u,500);this.elevationMode!=="none"?this.addElevatedRoadFeature(l,B,x,g,R):this.addGeometry(B,this.bufferData),this.bufferData.populatePaintArrays(l,g,j,N,x,E,this.worldview),this.elevationBufferData.populatePaintArrays(l,g,j,N,x,E,this.worldview)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}getElevationPolygons(){return this.elevatedStructures?this.elevatedStructures.portalPolygons:void 0}setEvaluatedPortalGraph(l,u,g,x,j){this.elevatedStructures&&(this.elevatedStructures.construct(l),this.elevatedStructures.populatePaintArrays(u,g,x,j,this.worldview))}addElevatedRoadFeature(l,u,g,x,j){const N=new Array,E=ui.getElevationFeature(l,j);if(!E)return void this.addGeometry(u,this.bufferData);{const B=this.clipPolygonsToTile(u,1);B.length>0&&N.push({polygons:B,elevationFeature:E,elevationTileID:g})}const R={guardRailEnabled:this.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(l,{},g),featureIndex:x};for(const B of N)if(B.elevationFeature){if(this.elevationMode==="hd-road-base"){this.elevatedStructures||(this.elevatedStructures=new ou(B.elevationTileID,this.layers,this.zoom,this.lut));const G=B.elevationFeature.isTunnel();let X=0;l.properties.hasOwnProperty(Ut)&&(X=+l.properties[Ut]);for(const J of B.polygons)this.elevatedStructures.addPortalCandidates(B.elevationFeature.id,J,G,B.elevationFeature,X)}B.elevationFeature.constantHeight==null&&(B.polygons=this.prepareElevatedPolygons(B.polygons,B.elevationFeature,B.elevationTileID));const H=new Ci(g,B.elevationTileID);this.addElevatedGeometry(B.polygons,H,B.elevationFeature,this.elevationMode==="hd-road-base"?0:.05,x,R)}}addElevatedGeometry(l,u,g,x,j,N){const E={elevation:g,elevationSampler:u,bias:x,index:j,featureInfo:N},[R,B]=this.addGeometry(l,this.elevationBufferData,E);this.elevationBufferData.heightRange==null?this.elevationBufferData.heightRange={min:R,max:B}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,R),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,B))}addGeometry(l,u,g){let x=Number.POSITIVE_INFINITY,j=Number.NEGATIVE_INFINITY,N=null;g&&(N=g.elevationSampler.constantElevation(g.elevation,g.bias),N!=null&&(x=N,j=N));const E=(R,B,H)=>{if(g!=null)if(B.push(R),N!=null)u.elevatedLayoutVertexArray.emplaceBack(N),H.push(N);else{const G=g.elevationSampler.pointElevation(R,g.elevation,g.bias);u.elevatedLayoutVertexArray.emplaceBack(G),H.push(G),x=Math.min(x,G),j=Math.max(j,G)}};for(const R of l){let B=0;for(const Be of R)B+=Be.length;const H=u.triangleSegments.prepareSegment(B,u.layoutVertexArray,u.indexArray),G=H.vertexLength,X=[],J=[],ne=[],pe=[],ke=[],we=u.layoutVertexArray.length;for(const Be of R){if(Be.length===0)continue;Be!==R[0]&&J.push(X.length/2);const He=u.lineSegments.prepareSegment(Be.length,u.layoutVertexArray,u.lineIndexArray),dt=He.vertexLength;g&&ke.push(u.layoutVertexArray.length-we),E(Be[0],ne,pe),u.layoutVertexArray.emplaceBack(Be[0].x,Be[0].y),u.lineIndexArray.emplaceBack(dt+Be.length-1,dt),X.push(Be[0].x),X.push(Be[0].y);for(let it=1;it0&&g&&this.elevationMode==="hd-road-base"){const Be=g.elevation.isTunnel(),He=g.elevation.safeArea,dt=this.elevatedStructures.addVertices(ne,pe);this.elevatedStructures.addTriangles(De,dt,Be);const it=ke.length;if(it>0){for(let pt=0;pt=g&&J.max.x<=j&&J.min.y>=x&&J.max.y<=N?R:B).push(X)}if(R.length===l.length)return l;const H=[new sr(g,x),new sr(j,x),new sr(j,N),new sr(g,N),new sr(g,x)],G=R;for(const X of B)G.push(...Q$e(X,H));return G}}let Z0e,Y0e,X0e,Q0e;Yr(kae,"FillBucket",{omit:["layers","patternFeatures"]}),Yr(jae,"FillBufferData"),Yr(ou,"ElevatedStructures");class IP{constructor(l,u,g,x){if(this.triangleCount=u.length/3,this.min=new sr(0,0),this.max=new sr(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],this.triangleCount===0||l.length===0)return;const[j,N]=[l[0].clone(),l[0].clone()];for(let G=1;GG.cellIdx-X.cellIdx||G.triIdx-X.triIdx);let H=0;for(;Hthis.max.x||this.min.x>l.x||l.y>this.max.y||this.min.y>l.y)return;const g=Dm(l.x-this.min.x,this.xScale,this.cellsX),x=Dm(l.y-this.min.y,this.yScale,this.cellsY),j=this.cells[x*this.cellsX+g];if(j){this._lazyInitLookup();for(let N=0;Nthis.max.x||this.min.x>u.x||l.y>this.max.y||this.min.y>u.y)return;this._lazyInitLookup();const x=Dm(l.x-this.min.x,this.xScale,this.cellsX),j=Dm(u.x-this.min.x,this.xScale,this.cellsX),N=Dm(l.y-this.min.y,this.yScale,this.cellsY),E=Dm(u.y-this.min.y,this.yScale,this.cellsY);for(let R=N;R<=E;R++)for(let B=x;B<=j;B++){const H=this.cells[R*this.cellsX+B];if(H)for(let G=0;Gu.fqid),this.index=l.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.footprints=[],this.worldview=l.worldview,this.hasAppearances=null}updateFootprints(l,u){for(const g of this.footprints)u.push({footprint:g,id:l})}updateAppearances(l,u,g,x){}populate(l,u,g,x){const j=[];for(const{feature:N,id:E,index:R,sourceLayerIndex:B}of l){const H=this.layers[0]._featureFilter.needGeometry,G=Pt(N,H);if(!this.layers[0]._featureFilter.filter(new Qi(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),G,g))continue;const X={id:E,properties:N.properties,type:N.type,sourceLayerIndex:B,index:R,geometry:H?G.geometry:vt(N,g,x),patterns:{}};j.push(X)}for(const N of j){const{geometry:E,index:R,sourceLayerIndex:B}=N;this.addFeature(N,E,R,g,{},u.availableImages,u.brightness),u.featureIndex.insert(l[R].feature,E,R,B,this.index)}}isEmpty(){return this.footprints.length===0}uploadPending(){return!1}upload(l){}update(l,u,g,x,j,N,E){}destroy(){}addFeature(l,u,g,x,j,N=[],E){for(const R of xM(u,2)){const B=[],H=[],G=[],X=new sr(1/0,1/0),J=new sr(-1/0,-1/0);for(const ke of R)if(ke.length!==0){ke!==R[0]&&G.push(H.length/2);for(let we=0;weN===x)===void 0}(g,h.clipScope)}function PP(h,l){return h.x-l.x||h.y-l.y}function r1e(h,l){return PP(h.min,l.min)===0&&PP(h.max,l.max)===0}function Nae(h,l){return!(h.min.x>l.max.x||h.max.xl.max.y||h.max.ynew sr((R.x+j.x*Cr)*E-N.x*Cr,(R.y+j.y*Cr)*E-N.y*Cr))}return Sae(u,x,h.indices,0,h.indices.length,0,0)}function i1e(h,l,u,g){const x=Math.pow(2,g.z-u.z);return new sr((h+u.x*Cr)*x-g.x*Cr,(l+u.y*Cr)*x-g.y*Cr)}function a1e(h,l){const u=[];l.grid.queryPoint(h,u);const g=l.indices,x=l.vertices;for(let j=0;j0&&(g.length>1&&u.push(g),g=[])}return g.length>1&&u.push(g),u}const Mae=Tt.types,cUe=["fill-extrusion-base","fill-extrusion-height","fill-extrusion-color","fill-extrusion-pattern","fill-extrusion-flood-light-wall-radius","fill-extrusion-line-width","fill-extrusion-emissive-strength"],dUe=["fill-extrusion-flood-light-ground-radius"],uUe=Math.pow(2,13),hUe=Math.pow(2,15)-1,l1e=new sr(0,1),Qg=2147483648,c1e=7,d1e=450;function _M(h,l,u,g,x,j,N,E){h.emplaceBack((l<<1)+N,(u<<1)+j,(Math.floor(g*uUe)<<1)+x,Math.round(E))}function bM(h,l,u){h.emplaceBack(l.x*Cr,l.y*Cr,u?1:0)}function OP(h,l,u,g,x,j){h.emplaceBack(l.x,l.y,(u.x<<1)+g,(u.y<<1)+x,j)}function wM(h,l,u){h.emplaceBack(l.x,l.y,l.z,u[0]*16384,u[1]*16384,u[2]*16384)}class u1e{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class h1e{constructor(){this.centroidXY=new sr(0,0),this.vertexArrayOffset=0,this.vertexCount=0,this.groundVertexArrayOffset=0,this.groundVertexCount=0,this.flags=0,this.footprintSegIdx=-1,this.footprintSegLen=0,this.polygonSegIdx=-1,this.polygonSegLen=0,this.min=new sr(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new sr(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0,this.buildingId=0}span(){return new sr(this.max.x-this.min.x,this.max.y-this.min.y)}}class f1e{constructor(){this.acc=new sr(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(l,u){l.min.x===Number.MAX_VALUE&&(l.min.x=l.max.x=u.x,l.min.y=l.max.y=u.y)}appendEdge(l,u,g){this.accCount++,this.acc._add(u);let x=!!this.borders;u.xl.max.x&&(l.max.x=u.x,x=!0),u.yl.max.y&&(l.max.y=u.y,x=!0),((u.x===0||u.x===Cr)&&u.x===g.x)!=((u.y===0||u.y===Cr)&&u.y===g.y)&&this.processBorderOverlap(u,g),x&&this.checkBorderIntersection(u,g)}checkBorderIntersection(l,u){u.x<0!=l.x<0&&this.addBorderIntersection(0,Dn(u.y,l.y,(0-u.x)/(l.x-u.x))),u.x>Cr!=l.x>Cr&&this.addBorderIntersection(1,Dn(u.y,l.y,(Cr-u.x)/(l.x-u.x))),u.y<0!=l.y<0&&this.addBorderIntersection(2,Dn(u.x,l.x,(0-u.y)/(l.y-u.y))),u.y>Cr!=l.y>Cr&&this.addBorderIntersection(3,Dn(u.x,l.x,(Cr-u.y)/(l.y-u.y)))}addBorderIntersection(l,u){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const g=this.borders[l];ug[1]&&(g[1]=u)}processBorderOverlap(l,u){if(l.x===u.x){if(l.y===u.y)return;const g=l.x===0?0:1;this.addBorderIntersection(g,u.y),this.addBorderIntersection(g,l.y)}else{const g=l.y===0?2:3;this.addBorderIntersection(g,u.x),this.addBorderIntersection(g,l.x)}}centroid(){return this.accCount===0?new sr(0,0):new sr(Math.floor(Math.max(0,this.acc.x)/this.accCount),Math.floor(Math.max(0,this.acc.y)/this.accCount))}intersectsCount(){return this.borders?this.borders.reduce((l,u)=>l+ +(u[0]!==Number.MAX_VALUE),0):0}}function p1e(h,l){const u=h.add(l)._unit(),g=_e(h.x*u.x+h.y*u.y,-1,1);var x,j,N;return x=Math.acos(g),Math.min(4,Math.max(-4,Math.tan(x)))/4*hUe*((j=h).x*(N=l).y-j.y*N.x<0?-1:1)}const fUe=[h=>h.x<0,h=>h.x>Cr,h=>h.y<0,h=>h.y>Cr];function pUe(h,l,u,g){const x=[4];if(g===0)return x;u._mult(g);const j=h.sub(u),N=l.sub(u),E=[h,l,j,N];for(let R=0;R<4;R++)for(const B of E)if(fUe[R](B)){x.push(R);break}return x}class Tae{constructor(l){this.groundRadiusArray=null,this.groundRadiusBuffer=null,this.vertexArray=new K3,this.indexArray=new Ro,this.programConfigurations=new jh(l.layers,{zoom:l.zoom,lut:l.lut},u=>dUe.includes(u)),this._segments=new ja,this.hiddenByLandmarkVertexArray=new Wk,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new ja}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}addData(l,u,g,x=!1){const j=l.length;if(j>2){let N=Math.max(0,this._segments.get().length-1);const E=this._segments._prepareSegment(4*j,this.vertexArray.length,2*this._segmentToGroundQuads[N].length);let R;N!==this._segments.get().length-1&&(N++,this._segmentToGroundQuads[N]=[],this._segmentToRegionTriCounts[N]=[0,0,0,0,0]);{const B=l[0],H=l[1];R=p1e(B.sub(l[j-1])._perp()._unit(),H.sub(B)._perp()._unit())}for(let B=0;Bx.region-j.region);for(let g=0;gR+B,0);let E=0;for(let R=0;R<=4;R++){const B=N[R];if(B!==0){let H=this.regionSegments[R];H||(H=this.regionSegments[R]=new ja);const G={vertexOffset:j.vertexOffset,primitiveOffset:j.primitiveOffset+E,vertexLength:j.vertexLength,primitiveLength:B};H.get().push(G)}E+=B}for(let R=0;R0?this.hiddenByLandmarkVertexBuffer=l.createVertexBuffer(this.hiddenByLandmarkVertexArray,iUe.members,!0):this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray),this._needsHiddenByLandmarkUpdate=!1)}destroy(){if(this.vertexBuffer){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.destroy(),this.groundRadiusBuffer&&this.groundRadiusBuffer.destroy(),this._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let l=0;l<=4;l++){const u=this.regionSegments[l];u&&u.destroy()}}}}class DP{constructor(l){this.zoom=l.zoom,this.canonical=l.canonical,this.overscaling=l.overscaling,this.layers=l.layers,this.pixelRatio=l.pixelRatio,this.layerIds=this.layers.map(u=>u.fqid),this.index=l.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=l.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new Ro,this.footprintVertices=new Em,this.footprintSegments=[],this.layoutVertexArray=new jx,this.centroidVertexArray=new jP,this.wallVertexArray=new fv,this.indexArray=new Ro,this.programConfigurations=new jh(l.layers,{zoom:l.zoom,lut:l.lut},u=>cUe.includes(u)),this.segments=new ja,this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.groundEffect=new Tae(l),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.worldview=l.worldview,this.hasAppearances=null}updateFootprints(l,u){}updateAppearances(l,u,g,x){}populate(l,u,g,x){this.features=[],this.hasPattern=_ae("fill-extrusion",this.layers,this.pixelRatio,u),this.featuresOnBorder=[],this.borderFeatureIndices=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.selfDEMTileTimestamp=Number.MAX_VALUE,this.borderDEMTileTimestamp=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE],this.tileToMeter=Ee(g),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,this.wallMode=this.layers[0].paint.get("fill-extrusion-line-width").constantOr(1)!==0;for(const{feature:j,id:N,index:E,sourceLayerIndex:R}of l){const B=this.layers[0]._featureFilter.needGeometry,H=Pt(j,B);if(!this.layers[0]._featureFilter.filter(new Qi(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),H,g))continue;const G={id:N,sourceLayerIndex:R,index:E,geometry:B?H.geometry:vt(j,g,x),properties:j.properties,type:j.type,patterns:{}},X=this.layoutVertexArray.length,J=Mae[G.type]==="Polygon";if(this.hasPattern)this.features.push({featureId:j.id,feature:bae("fill-extrusion",this.layers,G,this.zoom,this.pixelRatio,u)});else if(this.wallMode)for(const ne of G.geometry)for(const pe of o1e(ne,J))this.addFeature(j.id,G,[pe],E,g,{},u.availableImages,x,u.brightness);else this.addFeature(j.id,G,G.geometry,E,g,{},u.availableImages,x,u.brightness);u.featureIndex.insert(j,G.geometry,E,R,this.index,X)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(l,u,g,x,j,N){for(const{featureId:E,feature:R}of this.features){const B=Mae[R.type]==="Polygon",{geometry:H}=R;if(this.wallMode)for(const G of H)for(const X of o1e(G,B))this.addFeature(E,R,[X],R.index,u,g,x,j,N);else this.addFeature(E,R,H,R.index,u,g,x,j,N)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles()}update(l,u,g,x,j,N,E){this.programConfigurations.updatePaintArrays(l,u,j,g,x,N,E,this.worldview),this.groundEffect.update(l,u,j,g,x,N,E,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(l){this.uploaded||(this.layoutVertexBuffer=l.createVertexBuffer(this.layoutVertexArray,oUe),this.indexBuffer=l.createIndexBuffer(this.indexArray),this.wallVertexBuffer=l.createVertexBuffer(this.wallVertexArray,sUe.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=l.createVertexBuffer(this.layoutVertexExtArray,aUe.members,!0)),this.groundEffect.upload(l)),this.groundEffect.uploadPaintProperties(l),this.programConfigurations.upload(l),this.uploaded=!0}uploadCentroid(l){this.groundEffect.uploadHiddenByLandmark(l),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=l.createVertexBuffer(this.centroidVertexArray,nUe.members,!0):this.centroidVertexBuffer&&this.centroidVertexBuffer.updateData(this.centroidVertexArray),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(l,u,g,x,j,N,E,R,B){const H=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(u,{})/this.tileToMeter,G=[new sr(0,0),new sr(Cr,Cr)],X=R.projection,J=X.name==="globe",ne=this.wallMode||Mae[u.type]==="Polygon",pe=new f1e;pe.centroidDataIndex=this.centroidData.length;const ke=new h1e;ke.buildingId=l,u.properties&&u.properties.hasOwnProperty("building_id")&&(ke.buildingId=u.properties.building_id);const we=this.layers[0].paint.get("fill-extrusion-base").evaluate(u,{},j)<=0,De=this.layers[0].paint.get("fill-extrusion-height").evaluate(u,{},j);let Be;if(ke.height=De,ke.vertexArrayOffset=this.layoutVertexArray.length,ke.groundVertexArrayOffset=this.groundEffect.vertexArray.length,J&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new Bk),this.wallMode){if(J)return void Br("Non zero fill-extrusion-line-width is not yet supported on globe.");if(g.length!==1)return;Be=function(Lt){const Qt=Lt[0].x===Lt[Lt.length-1].x&&Lt[0].y===Lt[Lt.length-1].y;(function(Vr){let tn=0;const us=Vr.length;for(let jr=0;jr=0})(Lt)||(Lt=Lt.reverse());const or={geometry:[],joinNormals:[],indices:[]},gr=[],xr=[],hr=[];let fr=Lt.length;for(;fr>=2&&Lt[fr-1].equals(Lt[fr-2]);)fr--;if(fr<(Qt?3:2))return or;let Xt,Gt,pr,Tr,br,dn=0;for(;dn0;let Bn="miter";const Es=2;Bn==="miter"&&jr>Es&&(Bn="bevel"),Bn==="bevel"&&(jr>100&&(Bn="flipbevel"),jr{const Jt=new sr(Yn.x,Yn.y),yr=new sr(Yn.x,Yn.y);Jt.x+=Ei.x*ut,Jt.y+=Ei.y*ut,yr.x-=Ei.x*Math.max(at,1),yr.y-=Ei.y*Math.max(at,1),hr.push(Ei),gr.push(Jt),xr.push(yr)};if(Bn==="miter")tn._mult(jr),Rs(Xt,tn,0,0);else if(Bn==="flipbevel")tn=br.mult(-1),Rs(Xt,tn,0,0),Rs(Xt,tn.mult(-1),0,0);else{const Yn=-Math.sqrt(jr*jr-1),Ei=rn?Yn:0,at=rn?0:Yn;Gt&&Rs(Xt,Tr,Ei,at),pr&&Rs(Xt,br,Ei,at)}}or.geometry=[...gr,...xr.reverse(),gr[0]],or.joinNormals=[...hr,...hr.reverse(),hr[hr.length-1]];const Rr=or.geometry.length-1;for(let Vr=0;VrLt<(Qt.length-1)/2||Lt===Qt.length-1,dt=this.wallMode?[g]:xM(g,500);for(let Lt=dt.length-1;Lt>=0;Lt--){const Qt=dt[Lt];(Qt.length===0||(it=Qt[0]).every(ar=>ar.x<=0)||it.every(ar=>ar.x>=Cr)||it.every(ar=>ar.y<=0)||it.every(ar=>ar.y>=Cr))&&dt.splice(Lt,1)}var it;let pt;if(J)pt=b1e(dt,G,j);else{pt=[];for(const Lt of dt)pt.push({polygon:Lt,bounds:G})}const wt=ne?this.edgeRadius:0,Ct=wt>0&&this.zoom<17,Wt=(Lt,Qt)=>{if(Lt.length===0)return!1;const ar=Lt[Lt.length-1];return Qt.x===ar.x&&Qt.y===ar.y};for(const{polygon:Lt,bounds:Qt}of pt){let ar=0,or=0;for(const fr of Lt)ne&&!fr[0].equals(fr[fr.length-1])&&fr.push(fr[0]),or+=ne?fr.length-1:fr.length;const gr=this.segments.prepareSegment((ne?5:4)*or,this.layoutVertexArray,this.indexArray);ke.footprintSegIdx<0&&(ke.footprintSegIdx=this.footprintSegments.length),ke.polygonSegIdx<0&&(ke.polygonSegIdx=this.polygonSegments.length);const xr={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},hr=new u1e;if(hr.vertexOffset=this.footprintVertices.length,hr.indexOffset=3*this.footprintIndices.length,hr.ringIndices=[],ne){const fr=[],Xt=[];ar=gr.vertexLength;for(let pr=0;pr4&&x1e(Xt[Xt.length-2],Xt[0],Xt[1]),pr=wt?mUe(Xt[Xt.length-2],Xt[0],Xt[1],wt):0;const Tr=[];let br,dn,Rr;dn=Xt[1].sub(Xt[0])._perp()._unit();let Vr=!0;for(let tn=1,us=0;tn0?1:0,Ei=jr.dist(rn);if(us+Ei>32768&&(us=0),wt){Rr=Bn.sub(rn)._perp()._unit();let yr=g1e(jr,rn,Bn,m1e(dn,Rr),wt);isNaN(yr)&&(yr=0);const Pr=rn.sub(jr)._unit();jr=jr.add(Pr.mult(pr))._round(),rn=rn.add(Pr.mult(-yr))._round(),pr=yr,dn=Rr,we&&this.zoom>=17&&(Wt(Tr,jr)||Tr.push(jr),Wt(Tr,rn)||Tr.push(rn))}const at=gr.vertexLength,ut=Xt.length>4&&x1e(jr,rn,Bn);let Jt=v1e(us,Gt,Vr);if(_M(this.layoutVertexArray,jr.x,jr.y,Rs,Yn,0,0,Jt),_M(this.layoutVertexArray,jr.x,jr.y,Rs,Yn,0,1,Jt),this.wallMode){const yr=He(tn-1,Xt),Pr=Be.joinNormals[tn-1];bM(this.wallVertexArray,Pr,yr),bM(this.wallVertexArray,Pr,yr)}if(us+=Ei,Jt=v1e(us,ut,!Vr),Gt=ut,_M(this.layoutVertexArray,rn.x,rn.y,Rs,Yn,0,0,Jt),_M(this.layoutVertexArray,rn.x,rn.y,Rs,Yn,0,1,Jt),this.wallMode){const yr=He(tn,Xt),Pr=Be.joinNormals[tn];bM(this.wallVertexArray,Pr,yr),bM(this.wallVertexArray,Pr,yr)}if(gr.vertexLength+=4,this.indexArray.emplaceBack(at+0,at+1,at+2),this.indexArray.emplaceBack(at+1,at+3,at+2),gr.primitiveLength+=2,wt){const yr=ar+(tn===1?Xt.length-2:tn-2),Pr=tn===1?ar:yr+1;if(this.indexArray.emplaceBack(at+1,yr,at+3),this.indexArray.emplaceBack(yr,Pr,at+3),gr.primitiveLength+=2,br===void 0&&(br=at),!Aae(Bn,Xt[tn],Qt)){const Lr=tn===Xt.length-1?br:gr.vertexLength;this.indexArray.emplaceBack(at+2,at+3,Lr),this.indexArray.emplaceBack(at+3,Lr+1,Lr),this.indexArray.emplaceBack(at+3,Pr,Lr+1),gr.primitiveLength+=3}Vr=!Vr}if(J){const yr=this.layoutVertexExtArray,Pr=X.projectTilePoint(jr.x,jr.y,j),Lr=X.projectTilePoint(rn.x,rn.y,j),hn=X.upVector(j,jr.x,jr.y),mn=X.upVector(j,rn.x,rn.y);wM(yr,Pr,hn),wM(yr,Pr,hn),wM(yr,Lr,mn),wM(yr,Lr,mn)}}ne&&(ar+=Xt.length-1),we&&wt&&this.zoom>=17&&(Tr.length!==0&&Wt(Tr,Tr[0])&&Tr.pop(),this.groundEffect.addData(Tr,Qt,H,wt>0))}this.footprintSegments.push(hr),xr.triangleCount=this.indexArray.length-xr.triangleArrayOffset,this.polygonSegments.push(xr),++ke.footprintSegLen,++ke.polygonSegLen}if(ke.vertexCount=this.layoutVertexArray.length-ke.vertexArrayOffset,ke.groundVertexCount=this.groundEffect.vertexArray.length-ke.groundVertexArrayOffset,ke.vertexCount!==0){if(ke.centroidXY=pe.borders?l1e:this.encodeCentroid(pe,ke),this.centroidData.push(ke),pe.borders){this.featuresOnBorder.push(pe);const Lt=this.featuresOnBorder.length-1;for(let Qt=0;Qtthis.featuresOnBorder[u].borders[l][0]-this.featuresOnBorder[g].borders[l][0])}splitToSubtiles(){const l=[];for(let E=0;ECr),H=2*B+(+(R.min.x+R.max.x>Cr)^B);for(let G=0;GE.triangleSegmentIdx===R.triangleSegmentIdx?E.subtile-R.subtile:E.triangleSegmentIdx-R.triangleSegmentIdx);let g=0,x=0,j=0;for(const E of l){if(E.triangleSegmentIdx!==g)break;j++}const N=l.length;for(;x!==l.length;){g=l[x].triangleSegmentIdx;let E=0,R=x,B=x;for(let H=R;H0&&this.triangleSubSegments.push({segment:J,min:G,max:X}),R=B;for(let ne=R;ne[pe[0]*(1-we[0])+ke[0]*we[0],pe[1]*(1-we[1])+ke[1]*we[1]],J=[],ne=[];for(const pe of this.triangleSubSegments){J[0]=pe.min.x/Cr,J[1]=pe.min.y/Cr,ne[0]=pe.max.x/Cr,ne[1]=pe.max.y/Cr;const ke=X(H,G,J),we=X(H,G,ne);if(new on([ke[0],ke[1],j],[we[0],we[1],N]).intersectsPrecise(g)===0){B&&(x.segments.push(B),B=void 0);continue}const De=pe.segment;B&&B.vertexOffset!==De.vertexOffset&&(x.segments.push(B),B=void 0),B?(B.vertexLength+=De.vertexLength,B.primitiveLength+=De.primitiveLength):B={vertexOffset:De.vertexOffset,primitiveLength:De.primitiveLength,vertexLength:De.vertexLength,primitiveOffset:De.primitiveOffset,sortKey:void 0,vaos:{}}}return B&&x.segments.push(B),x}encodeCentroid(l,u){const g=l.centroid(),x=u.span(),j=Math.min(7,Math.round(x.x*this.tileToMeter/10)),N=Math.min(7,Math.round(x.y*this.tileToMeter/10));return new sr(_e(g.x,1,Cr-1)<<3|j,_e(g.y,1,Cr-1)<<3|N)}encodeBorderCentroid(l){if(!l.borders)return new sr(0,0);const u=l.borders,g=Number.MAX_VALUE;if(u[0][0]!==g||u[1][0]!==g){const x=u[0][0]!==g?0:1;return new sr(6|(u[0][0]!==g?0:65528),(u[x][0]+u[x][1])/2<<3|6)}{const x=u[2][0]!==g?2:3;return new sr((u[x][0]+u[x][1])/2<<3|6,6|(u[2][0]!==g?0:65528))}}showCentroid(l){const u=this.centroidData[l.centroidDataIndex];u.flags&=2147483647,u.centroidXY.x=0,u.centroidXY.y=0,this.writeCentroidToBuffer(u)}writeCentroidToBuffer(l){this.groundEffect.updateHiddenByLandmark(l);const u=l.vertexArrayOffset,g=l.vertexCount+l.vertexArrayOffset,x=l.flags&Qg?l1e:l.centroidXY,j=this.centroidVertexArray.geta_centroid_pos0(u);if(this.centroidVertexArray.geta_centroid_pos1(u)!==x.y||j!==x.x){for(let N=u;NR.max.x||R.min.x>N.max.x||N.min.y>R.max.y||R.min.y>N.max.y||N.footprint.buildingIds.has(R.buildingId)&&(R.flags|=Qg);else for(const R of this.centroidData)if(!(R.flags&Qg||N.min.x>R.max.x||R.min.x>N.max.x||N.min.y>R.max.y||R.min.y>N.max.y))for(let B=0;Bu!=J>u&&l<(this.footprintVertices.int16[2*(H+N.vertexOffset)+0]-G)*(u-X)/(J-X)+G&&(x=!x)}E=R}}return x}getHeightAtTileCoord(l,u){let g=Number.NEGATIVE_INFINITY,x=!0;const j=4*(l+Cr)*Cr+(u+Cr);if(this.partLookup.hasOwnProperty(j)){const N=this.partLookup[j];return N?{height:N.height,hidden:!!(N.flags&Qg)}:void 0}for(const N of this.centroidData)l>N.max.x||N.min.x>l||u>N.max.y||N.min.y>u||N.height<=g||this.footprintContainsPoint(l,u,N)&&(g=N.height,this.partLookup[j]=N,x=!!(N.flags&Qg));if(g!==Number.NEGATIVE_INFINITY)return{height:g,hidden:x};this.partLookup[j]=void 0}}function m1e(h,l){const u=h.add(l)._unit();return h.x*u.x+h.y*u.y}function mUe(h,l,u,g){const x=l.sub(h)._perp()._unit(),j=u.sub(l)._perp()._unit();return g1e(h,l,u,m1e(x,j),g)}function g1e(h,l,u,g,x){const j=Math.sqrt(1-g*g);return Math.min(h.dist(l)/3,l.dist(u)/3,x*j/g)}function Aae(h,l,u){return h.xu[1].x&&l.x>u[1].x||h.yu[1].y&&l.y>u[1].y}function y1e(h,l){return h.xl[1].x||h.yl[1].y}function x1e(h,l,u){if(h.x<0||h.x>=Cr||l.x<0||l.x>=Cr||u.x<0||u.x>=Cr)return!1;const g=u.sub(l),x=g.perp(),j=h.sub(l);return(g.x*j.x+g.y*j.y)/Math.sqrt((g.x*g.x+g.y*g.y)*(j.x*j.x+j.y*j.y))>-.866&&x.x*j.x+x.y*j.y<0}function v1e(h,l,u){const g=l?2|h:-3&h;return u?1|g:-2&g}function _1e(){const h=Math.PI/32,l=Math.tan(h),u=_;return u*Math.sqrt(1+2*l*l)-u}function b1e(h,l,u){const g=1<{for(const wt of it)ne.push({polygon:wt,bounds:pt})},ke=Math.ceil(Math.log2(H)),we=Math.ceil(Math.log2(G)),De=ke-we,Be=[];for(let it=0;it0?0:1);for(let it=0;itpt+1?dt.push({polygons:or,bounds:xr,depth:pt+1}):pe(or,xr)}if(gr.length){const xr=[new sr(wt===0?ar:Ct.x,wt===1?ar:Ct.y),Wt];Be.length>pt+1?dt.push({polygons:gr,bounds:xr,depth:pt+1}):pe(gr,xr)}}return ne}(h,l,Math.ceil((j-x)/11.25),Math.ceil((N-E)/11.25),1,(R,B,H)=>{if(R===0)return .5*(B+H);{const G=ce((u.y+B/Cr)/g);return(V(.5*(ce((u.y+H/Cr)/g)+G))*g-u.y)*Cr}})}function gUe(h,l,u,g,x,j){const N=Math.pow(2,g.z-x.z);for(let E=0;E=R[N]&&(E=l,R=h),E[N]x&&N1e(E,R,N,x),E[N]j&&N1e(R,E,N,j)}}function RP(h,l,u,g,x,j){const N=[];for(let E=0;E=g&&ne.x>=g||(J.x>=g?J=new sr(g,J.y+(g-J.x)/(ne.x-J.x)*(ne.y-J.y))._round():ne.x>=g&&(ne=new sr(g,J.y+(g-J.x)/(ne.x-J.x)*(ne.y-J.y))._round()),J.y>=x&&ne.y>=x||(J.y>=x?J=new sr(J.x+(x-J.y)/(ne.y-J.y)*(ne.x-J.x),x)._round():ne.y>=x&&(ne=new sr(J.x+(x-J.y)/(ne.y-J.y)*(ne.x-J.x),x)._round()),B&&J.equals(B[B.length-1])||(B=[J],N.push(B),j&&j.push({progress:{min:ke+C1e(we,De,J)*pe,max:1},parentIndex:E,prevPoint:we,nextPoint:De})),B.push(ne),j&&(j[j.length-1].progress.max=ke+C1e(we,De,ne)*pe,j[j.length-1].nextPoint=De)))))}if(j&&G>0)for(let X=H;XB.t-H.t);let N=0,E=0,R=[];for(g.push(R);N!==h.length;){if(E===j.length){for(;N!==h.length;)R.length!==0&&R[R.length-1].equals(h[N])||R.push(h[N]),N++;break}j[E].t<=N?(R.length!==0&&R[R.length-1].equals(j[E].point)||R.push(j[E].point),Math.trunc(j[E].t),E++):(R.length!==0&&R[R.length-1].equals(h[N])||R.push(h[N]),N++)}}function C1e(h,l,u){return h.x!==l.x?(u.x-h.x)/(l.x-h.x):h.y!==l.y?(u.y-h.y)/(l.y-h.y):0}function jM(h,l){return h.x*l.x+h.y*l.y}function M1e(h,l){if(h.length===1){let u=0;const g=l[u++];let x;for(;!x||g.equals(x);)if(x=l[u++],!x)return 1/0;for(;u{ar[0]=or,ar[1]=gr,ar[2]=xr,ar[3]=1},Qt=_1e();J>0&&(J+=Qt),ne+=Qt;for(const ar of X){const or=[],gr=[];for(const xr of ar){const hr=xr.x+pe.x,fr=xr.y+pe.y,Xt=G.projection.projectTilePoint(hr,fr,dt),Gt=G.projection.upVector(dt,xr.x,xr.y);let pr=J,Tr=ne;if(we){const br=E1e(hr,fr,J,ne,we,De,Be,He);pr+=br.base,Tr+=br.top}J!==0?Lt(Ct,Xt.x+Gt[0]*wt*pr,Xt.y+Gt[1]*wt*pr,Xt.z+Gt[2]*wt*pr):Lt(Ct,Xt.x,Xt.y,Xt.z),Lt(Wt,Xt.x+Gt[0]*wt*Tr,Xt.y+Gt[1]*wt*Tr,Xt.z+Gt[2]*wt*Tr),Xe(Ct,Ct,ke),Xe(Wt,Wt,ke),or.push(new jv(Ct[0],Ct[1],Ct[2])),gr.push(new jv(Wt[0],Wt[1],Wt[2]))}it.push(or),pt.push(gr)}return[it,pt]}(h,l,u,g,x,j,N,E,R,B,H):N?function(G,X,J,ne,pe,ke,we,De,Be){const He=[],dt=[],it=[0,0,0,1];for(const pt of G){const wt=[],Ct=[];for(const Wt of pt){const Lt=Wt.x+ne.x,Qt=Wt.y+ne.y,ar=E1e(Lt,Qt,X,J,ke,we,De,Be);it[0]=Lt,it[1]=Qt,it[2]=ar.base,it[3]=1,Nt(it,it,pe),it[3]=Math.max(it[3],1e-5);const or=new jv(it[0]/it[3],it[1]/it[3],it[2]/it[3]);it[0]=Lt,it[1]=Qt,it[2]=ar.top,it[3]=1,Nt(it,it,pe),it[3]=Math.max(it[3],1e-5);const gr=new jv(it[0]/it[3],it[1]/it[3],it[2]/it[3]);wt.push(or),Ct.push(gr)}He.push(wt),dt.push(Ct)}return[He,dt]}(l,u,g,x,j,N,E,R,B):function(G,X,J,ne,pe){const ke=[],we=[],De=pe[8]*X,Be=pe[9]*X,He=pe[10]*X,dt=pe[11]*X,it=pe[8]*J,pt=pe[9]*J,wt=pe[10]*J,Ct=pe[11]*J;for(const Wt of G){const Lt=[],Qt=[];for(const ar of Wt){const or=ar.x+ne.x,gr=ar.y+ne.y,xr=pe[0]*or+pe[4]*gr+pe[12],hr=pe[1]*or+pe[5]*gr+pe[13],fr=pe[2]*or+pe[6]*gr+pe[14],Xt=pe[3]*or+pe[7]*gr+pe[15],Gt=xr+De,pr=hr+Be,Tr=fr+He,br=Math.max(Xt+dt,1e-5),dn=xr+it,Rr=hr+pt,Vr=fr+wt,tn=Math.max(Xt+Ct,1e-5);Lt.push(new jv(Gt/br,pr/br,Tr/br)),Qt.push(new jv(dn/tn,Rr/tn,Vr/tn))}ke.push(Lt),we.push(Qt)}return[ke,we]}(l,u,g,x,j)}function E1e(h,l,u,g,x,j,N,E){const R=N*x.getElevationAt(h,l,!0,!0),B=j[0]!==0,H=B?j[1]===0?N*(j[0]/c1e-d1e):N*function(G,X,J){const ne=Math.floor(X[0]/8),pe=Math.floor(X[1]/8),ke=10*(X[0]-8*ne),we=10*(X[1]-8*pe),De=G.getElevationAt(ne,pe,!0,!0),Be=G.getMeterToDEM(J),He=Math.floor(.5*(ke*Be-1)),dt=Math.floor(.5*(we*Be-1)),it=G.tileCoordToPixel(ne,pe),pt=2*He+1,wt=2*dt+1,Ct=function(gr,xr,hr,fr,Xt){return[gr.getElevationAtPixel(xr,hr,!0),gr.getElevationAtPixel(xr+Xt,hr,!0),gr.getElevationAtPixel(xr,hr+Xt,!0),gr.getElevationAtPixel(xr+fr,hr+Xt,!0)]}(G,it.x-He,it.y-dt,pt,wt),Wt=Math.abs(Ct[0]-Ct[1]),Lt=Math.abs(Ct[2]-Ct[3]),Qt=Math.abs(Ct[0]-Ct[2])+Math.abs(Ct[1]-Ct[3]),ar=Math.min(.25,.5*Be*(Wt+Lt)/pt),or=Math.min(.25,.5*Be*Qt/wt);return De+Math.max(ar*ke,or*we)}(x,j,E):R;return{base:R+(u===0?-1:u),top:B?Math.max(H+g,R+u+2):R+g}}class xUe{constructor(l){this._callback=l,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){this._channel=void 0,this._callback=()=>{}}}class vUe{constructor(){this.tasks={},this.taskQueue=[],Ot(["process"],this),this.invoker=new xUe(this.process),this.nextId=0}add(l,u){const g=this.nextId++,x=function({type:j,isSymbolTile:N,zoom:E}){return E=E||0,j==="message"?0:j!=="maybePrepare"||N?j!=="parseTile"||N?j==="parseTile"&&N?300-E:j==="maybePrepare"&&N?400-E:500:200-E:100-E}(u);if(x===0){try{l()}finally{}return null}return this.tasks[g]={fn:l,metadata:u,priority:x,id:g},this.taskQueue.push(g),this.invoker.trigger(),{cancel:()=>{delete this.tasks[g]}}}process(){try{if(this.taskQueue=this.taskQueue.filter(g=>!!this.tasks[g]),!this.taskQueue.length)return;const l=this.pick();if(l===null)return;const u=this.tasks[l];if(delete this.tasks[l],this.taskQueue.length&&this.invoker.trigger(),!u)return;u.fn()}finally{}}pick(){let l=null,u=1/0;for(let x=0;x{g&&delete this.callbacks[E],this.target.postMessage({id:E,type:"",targetMapId:x,sourceMapId:this.mapId})}}}receive(l){const u=l.data;if(!u)return;const g=u.id;if(g&&(!u.targetMapId||this.mapId===u.targetMapId))if(u.type===""){const x=this.cancelCallbacks[g];delete this.cancelCallbacks[g],x&&x.cancel()}else if(u.mustQueue||Ps(self)){const x=this.callbacks[g],j=this.scheduler.add(()=>this.processTask(g,u),x&&x.metadata||{type:"message"});j&&(this.cancelCallbacks[g]=j)}else this.processTask(g,u)}processTask(l,u){if(delete this.cancelCallbacks[l],u.type===""){const g=this.callbacks[l];delete this.callbacks[l],g&&(u.error?g(Am(u.error)):g(null,Am(u.data)))}else{const g=new Set,x=u.hasCallback?(N,E)=>{this.target.postMessage({id:l,type:"",sourceMapId:this.mapId,error:N?dp(N):null,data:dp(E,g)},g)}:()=>{},j=Am(u.data);if(this.parent[u.type])this.parent[u.type](u.sourceMapId,j,x);else if(this.parent.getWorkerSource){const N=u.type.split("."),{source:E,scope:R}=j;this.parent.getWorkerSource(u.sourceMapId,N[0],E,R)[N[1]](j,x)}else x(new Error(`Could not find function ${u.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}var kM={workerUrl:"",workerClass:null,workerParams:void 0};const Eae="mapboxgl_preloaded_worker_pool";class kv{constructor(l){this.active={},this.name=l}acquire(l,u=kv.workerCount){if(!this.workers)for(this.workers=[];this.workers.length{u.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Eae]}numActive(){return Object.keys(this.active).length}}kv.workerCount=2;class aN{constructor(l,u,g="Worker",x=kv.workerCount){this.workerPool=l,this.actors=[],this.currentActor=0,this.id=Et();const j=this.workerPool.acquire(this.id,x);for(let N=0;N{this.ready=!0})}broadcast(l,u,g){kt(this.actors,(x,j)=>{x.send(l,u,j)},g=g||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(l=>{l.remove()}),this.actors=[],this.workerPool.release(this.id)}}let NM,Iae;function FP(){return NM||(NM=new kv),NM}aN.Actor=I1e;const Pae=4096;class _Ue{constructor(l){this.module=l,this.memoryStack=this.module.malloc(Pae),this.memoryStackNextFree=this.memoryStack}createIntArray(l){const u=this.memoryStackNextFree;return this.memoryStackNextFree+=l.length*Int32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>Pae?-1:(new Int32Array(this.module.heap32.buffer,u,l.length).set(l),u)}createFloatArray(l){const u=this.memoryStackNextFree;return this.memoryStackNextFree+=l.length*Float32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>Pae?-1:(new Float32Array(this.module.heapF32.buffer,u,l.length).set(l),u)}readStringBuffer(l){let u="";for(;this.module.heapU8[l]!==0;)u+=String.fromCharCode(this.module.heapU8[l]),++l;return u}setStyle(l){const u=l.normalScale;this.module.setStyle(u[0],u[1],u[2],l.tileToMeters)}setAOOptions(l,u){this.module.setAOOptions(l?1:0,u)}setMetricOptions(l,u){this.module.setMetricOptions(l?1:0,u)}setStructuralOptions(l){this.module.setStructuralOptions(l?1:0)}setFacadeOptions(l,u){this.module.setFacadeOptions(l,u?1:0)}setFauxFacadeOptions(l,u,g){this.module.setFauxFacadeOptions(l?1:0,u?1:0,g)}setFacadeClassifierOptions(l){this.module.setFacadeClassifierOptions(l)}generateMesh(l,u){this.memoryStackNextFree=this.memoryStack;for(const E of l){const R=this.createIntArray(E.ringIndices),B=this.createFloatArray(E.coordinates);if(R===-1||B===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFeature(E.id,E.sourceId,E.minHeight,E.height,E.roofType,B,R,E.ringIndices.length-1)}for(const E of u){let R;R=E.entrances?JSON.parse(E.entrances):[];const B=this.createFloatArray(R),H=this.createFloatArray(E.coordinates);if(B===-1||H===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFacade(E.sourceId,E.crossPerc,E.distanceToRoad,B,R.length,H,E.coordinates.length)}if(!this.module.generateMesh()){const E=this.module.getLastError();return this.readStringBuffer(E)}const g=this.module.getMeshCount(),x=new Array(g);for(let E=0;Ex.arrayBuffer()).then(x=>{l.buffers[u]=x})}function B1e(h,l){const u=h.json.bufferViews[l];return new Uint8Array(h.buffers[u.buffer],u.byteOffset||0,u.byteLength)}function SUe(h,l,u,g){if(h.uri){const x=z1e(h.uri,g);return fetch(x).then(j=>j.blob()).then(j=>createImageBitmap(j)).then(j=>{l.images[u]=j})}if(h.bufferView!==void 0){const x=B1e(l,h.bufferView),j=new Blob([x],{type:h.mimeType});return createImageBitmap(j).then(N=>{l.images[u]=N})}}function $1e(h,l=0,u){const g={json:null,images:[],buffers:[]};if(new Uint32Array(h,l,1)[0]===R1e){const H=new Uint32Array(h,l);let G=2;const X=(H[G++]>>2)-3,J=H[G++]>>2;if(G++,g.json=JSON.parse(F1e.decode(H.subarray(G,G+J))),G+=J,G{const H=[],G=E&&E.includes(Dae),X=E&&E.includes($P);if(G&&H.push(function(){if(!wp)return SM??(SM=function(J){let ne,pe=null;function ke(){ne=new Uint8Array(pe.buffer)}function we(){throw new Error("Unexpected Draco error.")}const De={a:{a:we,d:function(Be,He,dt){return ne.copyWithin(Be,He,He+dt)},c:function(Be){const He=ne.length,dt=Math.max(Be>>>0,Math.ceil(1.2*He)),it=Math.ceil((dt-He)/65536);try{return pe.grow(it),ke(),!0}catch{return!1}},b:we}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(J,De):J.then(Be=>Be.arrayBuffer()).then(Be=>WebAssembly.instantiate(Be,De))).then(Be=>{const{Rb:He,Qb:dt,P:it,T:pt,X:wt,Ja:Ct,La:Wt,Qa:Lt,Va:Qt,Wa:ar,eb:or,jb:gr,f:xr,e:hr,yb:fr,zb:Xt,Ab:Gt,Bb:pr,Db:Tr,Gb:br}=Be.instance.exports;pe=hr;const dn=(()=>{let Rr=0,Vr=0,tn=0,us=0;return jr=>{tn&&(He(us),He(Rr),Vr+=tn,tn=Rr=0),Rr||(Vr+=128,Rr=dt(Vr));const rn=jr.length+7&-8;let Bn=Rr;rn>=Vr&&(tn=rn,Bn=us=dt(rn));for(let Es=0;Es{wp=J,SM=void 0}))}()),X&&H.push(function(){if(Oae)return;const J=function(ne){let pe;const ke=WebAssembly.instantiateStreaming(ne,{}).then(Be=>{pe=Be.instance,pe.exports.__wasm_call_ctors()}),we={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},De={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:ke,supported:!0,decodeGltfBuffer(Be,He,dt,it,pt,wt){(function(Ct,Wt,Lt,Qt,ar,or,gr){const xr=Ct.exports.sbrk,hr=Qt+3&-4,fr=xr(hr*ar),Xt=xr(or.length),Gt=new Uint8Array(Ct.exports.memory.buffer);Gt.set(or,Xt);const pr=Wt(fr,Qt,ar,Xt,or.length);if(pr===0&&gr&&gr(fr,hr,ar),Lt.set(Gt.subarray(fr,fr+Qt*ar)),xr(fr-xr(0)),pr!==0)throw new Error(`Malformed buffer data: ${pr}`)})(pe,pe.exports[De[pt]],Be,He,dt,it,pe.exports[we[wt]])}}}(fetch(O1e()));return J.ready.then(()=>{Oae=J})}()),j)for(let J=0;J{if(G&&N)for(const{primitives:J}of N)for(const ne of J)jUe(ne,g);if(X&&N&&R)for(const J of R)kUe(J,g);return g})})}function U1e(h){return fetch(h).then(l=>l.arrayBuffer()).then(l=>$1e(l,0,h))}function Rae(h){switch(h){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.RGBA;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.DEPTH_COMPONENT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.DEPTH_STENCIL;case WebGL2RenderingContext.R8:case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.RED}}function Fae(h){switch(h){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.UNSIGNED_SHORT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.UNSIGNED_INT_24_8;case WebGL2RenderingContext.R8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.FLOAT}}class zae{constructor(l,u,g,x){this.context=l,this.format=g,this.useMipmap=x&&x.useMipmap,this.texture=l.gl.createTexture(),this.update(u,{premultiply:x&&x.premultiply})}update(l,u){const g=l&&l instanceof HTMLVideoElement&&l.width===0?l.videoWidth:l.width,x=l&&l instanceof HTMLVideoElement&&l.height===0?l.videoHeight:l.height,{context:j}=this,{gl:N}=j,{x:E,y:R}=u&&u.position?u.position:{x:0,y:0},B=E+g,H=R+x;!this.size||this.size[0]===B&&this.size[1]===H||(N.bindTexture(N.TEXTURE_2D,null),N.deleteTexture(this.texture),this.texture=N.createTexture(),this.size=null),N.bindTexture(N.TEXTURE_2D,this.texture),j.pixelStoreUnpackFlipY.set(!1),j.pixelStoreUnpack.set(1),j.pixelStoreUnpackPremultiplyAlpha.set(this.format===N.RGBA8&&(!u||u.premultiply!==!1));const G=l instanceof HTMLImageElement||l instanceof HTMLCanvasElement||l instanceof HTMLVideoElement||l instanceof ImageData||ImageBitmap&&l instanceof ImageBitmap;if(!this.size&&B>0&&H>0){const X=this.useMipmap?Math.floor(Math.log2(Math.max(B,H)))+1:1;N.texStorage2D(N.TEXTURE_2D,X,this.format,B,H),this.size=[B,H]}this.size&&(G?N.texSubImage2D(N.TEXTURE_2D,0,E,R,Rae(this.format),Fae(this.format),l):"data"in l&&l.data&&N.texSubImage2D(N.TEXTURE_2D,0,E,R,g,x,Rae(this.format),Fae(this.format),l.data)),this.useMipmap&&N.generateMipmap(N.TEXTURE_2D)}bind(l,u,g=!1){const{context:x}=this,{gl:j}=x;j.bindTexture(j.TEXTURE_2D,this.texture),l!==this.minFilter&&(j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,l),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,this.useMipmap&&!g?l===j.NEAREST?j.NEAREST_MIPMAP_NEAREST:j.LINEAR_MIPMAP_LINEAR:l),this.minFilter=l),u!==this.wrapS&&(j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,u),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,u),this.wrapS=u)}bindExtraParam(l,u,g,x,j){const{context:N}=this,{gl:E}=N;E.bindTexture(E.TEXTURE_2D,this.texture),u!==this.magFilter&&(E.texParameteri(E.TEXTURE_2D,E.TEXTURE_MAG_FILTER,u),this.magFilter=u),l!==this.minFilter&&(E.texParameteri(E.TEXTURE_2D,E.TEXTURE_MIN_FILTER,this.useMipmap?l===E.NEAREST?E.NEAREST_MIPMAP_NEAREST:E.LINEAR_MIPMAP_LINEAR:l),this.minFilter=l),g!==this.wrapS&&(E.texParameteri(E.TEXTURE_2D,E.TEXTURE_WRAP_S,g),this.wrapS=g),x!==this.wrapT&&(E.texParameteri(E.TEXTURE_2D,E.TEXTURE_WRAP_T,x),this.wrapT=x),j!==this.compareMode&&(j?(E.texParameteri(E.TEXTURE_2D,E.TEXTURE_COMPARE_MODE,E.COMPARE_REF_TO_TEXTURE),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_COMPARE_FUNC,j)):E.texParameteri(E.TEXTURE_2D,E.TEXTURE_COMPARE_MODE,E.NONE),this.compareMode=j)}destroy(){const{gl:l}=this.context;l.deleteTexture(this.texture),this.texture=null}}class MM{constructor(l,u){this.context=l,this.texture=u}bind(l,u){const{context:g}=this,{gl:x}=g;x.bindTexture(x.TEXTURE_2D,this.texture),l!==this.minFilter&&(x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MAG_FILTER,l),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MIN_FILTER,l),this.minFilter=l),u!==this.wrapS&&(x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_S,u),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_T,u),this.wrapS=u)}}const CUe=ks([{name:"a_pos_3f",components:3,type:"Float32"}]),MUe=ks([{name:"a_color_3f",components:3,type:"Float32"}]),TUe=ks([{name:"a_color_4f",components:4,type:"Float32"}]),AUe=ks([{name:"a_uv_2f",components:2,type:"Float32"}]),EUe=ks([{name:"a_normal_3f",components:3,type:"Float32"}]),IUe=ks([{name:"a_normal_matrix0",components:4,type:"Float32"},{name:"a_normal_matrix1",components:4,type:"Float32"},{name:"a_normal_matrix2",components:4,type:"Float32"},{name:"a_normal_matrix3",components:4,type:"Float32"}]),PUe=ks([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function q1e(h,l){const u=UP(h.projection,h.zoom,h.width,h.height),g=function(j,N,E,R,B){const H=new p(E.lng-180*Px,E.lat),G=new p(E.lng+180*Px,E.lat),X=j.project(H.lng,H.lat),J=j.project(G.lng,G.lat),ne=-Math.atan2(J.y-X.y,J.x-X.x),pe=qe.fromLngLat(E);pe.y=_e(pe.y,-1+Px,1-Px);const ke=pe.toLngLat(),we=j.project(ke.lng,ke.lat),De=qe.fromLngLat(ke);De.x+=Px;const Be=De.toLngLat(),He=j.project(Be.lng,Be.lat),dt=H1e(He.x-we.x,He.y-we.y,ne),it=qe.fromLngLat(ke);it.y+=Px;const pt=it.toLngLat(),wt=j.project(pt.lng,pt.lat),Ct=H1e(wt.x-we.x,wt.y-we.y,ne),Wt=Math.abs(dt.x)/Math.abs(Ct.y),Lt=T([]);W(Lt,Lt,-ne*(1-(B?0:R)));const Qt=T([]);return $(Qt,Qt,[1,1-(1-Wt)*R,1]),Qt[4]=-Ct.x/Ct.y*R,W(Qt,Qt,ne),A(Qt,Lt,Qt),Qt}(h.projection,0,h.center,u,l),x=V1e(h);return $(g,g,[x,x,1]),g}function V1e(h){const l=h.projection,u=UP(h.projection,h.zoom,h.width,h.height),g=Bae(l,h.center),x=Bae(l,p.convert(l.center));return Math.pow(2,g*u+(1-u)*x)}function UP(h,l,u,g,x=1/0){const j=h.range;if(!j)return 0;const N=Math.min(x,Math.max(u,g)),E=Math.log2(N/1024);return ze(j[0]+E,j[1]+E,l)}const Px=1/4e4;function Bae(h,l){const u=_e(l.lat,-de,de),g=new p(l.lng-180*Px,u),x=new p(l.lng+180*Px,u),j=h.project(g.lng,u),N=h.project(x.lng,u),E=qe.fromLngLat(g),R=qe.fromLngLat(x),B=N.x-j.x,H=N.y-j.y,G=R.x-E.x,X=R.y-E.y,J=Math.sqrt((G*G+X*X)/(B*B+H*H));return Math.log2(J)}function H1e(h,l,u){const g=Math.cos(u),x=Math.sin(u);return{x:h*g-l*x,y:h*x+l*g}}function W1e(h,l,u){T(h),W(h,h,Qr(l[2])),F(h,h,Qr(l[0])),q(h,h,Qr(l[1])),$(h,h,u),A(h,h,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function qP(h,l,u,g,x,j,N,E){const R=[u[0]-l[0],u[1]-l[1],0],B=[g[0]-l[0],g[1]-l[1],0];if(xe(R)<1e-12||xe(B)<1e-12)return It(h);const H=nt([],R,B);Pe(H,H),ve(B,g,l),R[2]=(j-x)*E,B[2]=(N-x)*E;const G=R;return nt(G,R,B),Pe(G,G),Qs(h,H,G)}function VP(h,l,u=!1){const g=Ex(l.zoom),x=function(j,N,E){const R=N.worldSize,B=[j[12],j[13],j[14]],H=ce(B[1]/R),G=Q(B[0]/R),X=T([]),J=Y(1,H)*R,ne=Y(1,0)*R*ye(H,N.zoom),pe=1/mae(R);let ke=ne*pe;if(E){const He=UP(N.projection,N.zoom,N.width,N.height,1024);ke=pe*N.projection.pixelSpaceConversion(N.center.lat,R,He)}const we=Mx(H,G);fe(we,we,ae([],Pe([],we),J*ke*B[2]));const De=function(He){const dt=[He[0],He[1],He[2]];let it=[0,1,0];const pt=nt([],it,dt);return nt(it,dt,pt),Re(it)===0&&(it=[0,1,0],nt(pt,dt,it)),Pe(pt,pt),Pe(it,it),Pe(dt,dt),[pt[0],pt[1],pt[2],0,it[0],it[1],it[2],0,dt[0],dt[1],dt[2],0,He[0],He[1],He[2],1]}(we);$(X,X,[ke,ke,ke*J]),D(X,X,[-B[0],-B[1],-B[2]]);const Be=A([],N.globeMatrix,De);return A(Be,Be,X),A(Be,Be,j),Be}(h,l,u);if(g>0){const j=function(N,E){const R=E.worldSize,B=Y(1,0)*R*ye(E.center.lat,E.zoom)/mae(R),H=Y(1,E.center.lat)*R,G=T([]);q(G,G,Qr(E.center.lng)),F(G,G,Qr(E.center.lat)),D(G,G,[0,0,dc]),$(G,G,[B,B,B*H]);const X=E.point;return D(G,G,[-X.x,-X.y,0]),A(G,G,N),A(G,E.globeMatrix,G)}(h,l);return function(N,E,R){const B=(ne,pe,ke)=>{const we=xe(ne),De=xe(pe),Be=bp(ne,pe,ke);return ae(Be,Be,1/xe(Be)*Dn(we,De,ke))},H=B([N[0],N[1],N[2]],[E[0],E[1],E[2]],R),G=B([N[4],N[5],N[6]],[E[4],E[5],E[6]],R),X=B([N[8],N[9],N[10]],[E[8],E[9],E[10]],R),J=bp([N[12],N[13],N[14]],[E[12],E[13],E[14]],R);return[H[0],H[1],H[2],0,G[0],G[1],G[2],0,X[0],X[1],X[2],0,J[0],J[1],J[2],1]}(x,j,g)}return x}function $ae(h,l,u,g){const x=on.projectAabbCorners(g,u);let j=Number.MAX_VALUE;for(let E=0;E0||ke===0&&ne[0]*pe[0]+ne[1]*pe[1]>=0&&ne[0]*ne[0]+ne[1]*ne[1]>pe[0]*pe[0]+pe[1]*pe[1])&&(H=J)}G=H}while(G!==B);return R.length>0&&R.push(R[0]),R}(x);if(Ys(h,N))return j}const Nv=64,dN={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function HP(h,l,u,g,x,j,N,E,R,B=!1){const H=u.zoom,G=u.project(g),X=ye(g.lat,H),J=1/X;T(h),D(h,h,[G.x+N[0]*J,G.y+N[1]*J,N[2]]);let ne=1,pe=1;const ke=u.worldSize;if(B){if(u.projection.name==="mercator"){let He=0;u.elevation&&(He=u.elevation.getAtPointOrZero(new qe(G.x/ke,G.y/ke),0));const dt=Nt([],[G.x,G.y,He,1],u.projMatrix)[3]/u.cameraToCenterDistance;ne=dt,pe=dt*ye(u.center.lat,H)}else if(u.projection.name==="globe"){const He=VP(h,u),dt=[0,0,0,1];Nt(dt,dt,A([],u.projMatrix,He));const it=dt[3]/u.cameraToCenterDistance,pt=Ex(H),wt=u.projection.pixelsPerMeter(g.lat,ke)*ye(g.lat,H),Ct=u.projection.pixelsPerMeter(u.center.lat,ke)*ye(u.center.lat,H);ne=it/Dn(wt,be(u.center.lat),pt),pe=it*X/wt,ne*=Ct,pe*=Ct}}else ne=J;$(h,h,[ne,ne,pe]);const we=[...h],De=l.orientation,Be=[];if(W1e(Be,[De[0]+(x?x[0]:0),De[1]+(x?x[1]:0),De[2]+(x?x[2]:0)],j),A(h,we,Be),E&&u.elevation){let He=0;const dt=[];if(R&&u.elevation){He=function(pt,wt,Ct,Wt,Lt){const Qt=wt.elevation;if(!Qt)return 0;const ar=on.projectAabbCorners(Ct,Wt),or=Y(1,Lt.lat)*wt.worldSize,gr=function(Vr,tn){const us=[0,0,1],jr=[{corners:[0,1,3,2],dotProductWithUp:0},{corners:[1,5,2,6],dotProductWithUp:0},{corners:[0,4,1,5],dotProductWithUp:0},{corners:[2,6,3,7],dotProductWithUp:0},{corners:[4,7,5,6],dotProductWithUp:0},{corners:[0,3,4,7],dotProductWithUp:0}];for(const rn of jr){const Bn=Vr[rn.corners[0]],Es=Vr[rn.corners[1]],Rs=Vr[rn.corners[2]],Yn=[Es[0]-Bn[0],Es[1]-Bn[1],tn*(Es[2]-Bn[2])],Ei=nt(Yn,Yn,[Rs[0]-Bn[0],Rs[1]-Bn[1],tn*(Rs[2]-Bn[2])]);Pe(Ei,Ei),rn.dotProductWithUp=Ae(Ei,us)}return jr.sort((rn,Bn)=>rn.dotProductWithUp-Bn.dotProductWithUp),jr[0].corners}(ar,or),xr=ar[gr[0]],hr=ar[gr[1]],fr=ar[gr[2]],Xt=ar[gr[3]],Gt=Qt.getAtPointOrZero(new qe(xr[0]/wt.worldSize,xr[1]/wt.worldSize),0),pr=Qt.getAtPointOrZero(new qe(hr[0]/wt.worldSize,hr[1]/wt.worldSize),0),Tr=Qt.getAtPointOrZero(new qe(fr[0]/wt.worldSize,fr[1]/wt.worldSize),0),br=Qt.getAtPointOrZero(new qe(Xt[0]/wt.worldSize,Xt[1]/wt.worldSize),0),dn=(Gt+br)/2,Rr=(pr+Tr)/2;return dn>Rr?pr=l.gl.NEAREST_MIPMAP_NEAREST}),h.uploaded=!0,h.image=null)}function LUe(h,l,u){h.indexBuffer=l.createIndexBuffer(h.indexArray,!1,!0),h.vertexBuffer=l.createVertexBuffer(h.vertexArray,CUe.members,!1,!0),h.normalArray&&(h.normalBuffer=l.createVertexBuffer(h.normalArray,EUe.members,!1,!0)),h.texcoordArray&&(h.texcoordBuffer=l.createVertexBuffer(h.texcoordArray,AUe.members,!1,!0)),h.colorArray&&(h.colorBuffer=l.createVertexBuffer(h.colorArray,(h.colorArray.bytesPerElement===12?MUe:TUe).members,!1,!0)),h.featureArray&&(h.pbrBuffer=l.createVertexBuffer(h.featureArray,PUe.members,!0)),h.segments=ja.simpleSegment(0,0,h.vertexArray.length,h.indexArray.length);const g=h.material;g.pbrMetallicRoughness.baseColorTexture&&TM(g.pbrMetallicRoughness.baseColorTexture,l),g.pbrMetallicRoughness.metallicRoughnessTexture&&TM(g.pbrMetallicRoughness.metallicRoughnessTexture,l),g.normalTexture&&TM(g.normalTexture,l),g.occlusionTexture&&TM(g.occlusionTexture,l,u),g.emissionTexture&&TM(g.emissionTexture,l)}function Uae(h,l,u){if(h.meshes)for(const g of h.meshes)LUe(g,l,u);if(h.children)for(const g of h.children)Uae(g,l,u)}function WP(h){if(h.meshes)for(const l of h.meshes)l.indexArray.destroy(),l.vertexArray.destroy(),l.colorArray&&l.colorArray.destroy(),l.normalArray&&l.normalArray.destroy(),l.texcoordArray&&l.texcoordArray.destroy(),l.featureArray&&l.featureArray.destroy();if(h.children)for(const l of h.children)WP(l)}function qae(h){if(h.meshes)for(const u of h.meshes)u.vertexBuffer&&(u.vertexBuffer.destroy(),u.indexBuffer.destroy(),u.normalBuffer&&u.normalBuffer.destroy(),u.texcoordBuffer&&u.texcoordBuffer.destroy(),u.colorBuffer&&u.colorBuffer.destroy(),u.pbrBuffer&&u.pbrBuffer.destroy(),u.segments.destroy(),u.material&&((l=u.material).pbrMetallicRoughness.baseColorTexture&&l.pbrMetallicRoughness.baseColorTexture.gfxTexture&&l.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),l.pbrMetallicRoughness.metallicRoughnessTexture&&l.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&l.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),l.normalTexture&&l.normalTexture.gfxTexture&&l.normalTexture.gfxTexture.destroy(),l.emissionTexture&&l.emissionTexture.gfxTexture&&l.emissionTexture.gfxTexture.destroy(),l.occlusionTexture&&l.occlusionTexture.gfxTexture&&l.occlusionTexture.gfxTexture.destroy()));var l;if(h.children)for(const u of h.children)qae(u)}function Sv(h,l){const u=h.json.bufferViews[l.bufferView],g=BP[l.componentType];return new g(h.buffers[u.buffer],(l.byteOffset||0)+(u.byteOffset||0),l.count*(u.byteStride&&u.byteStride!==CM[l.type]*g.BYTES_PER_ELEMENT?u.byteStride/g.BYTES_PER_ELEMENT:CM[l.type]))}function Vae(h,l,u,g){const x=BP[l.componentType],j=function(H){switch(H){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(x),N=h.json.bufferViews[l.bufferView],E=N.byteStride?N.byteStride/x.BYTES_PER_ELEMENT:CM[l.type],R=u.float32,B=R.length/u.capacity;for(let H=0,G=0;H0){for(let ke=0;ke0){j.texcoordArray=new df;const X=l.json.accessors[x.TEXCOORD_0];j.texcoordArray.resize(X.count);const J=Sv(l,X);Vae(l,X,j.texcoordArray,J)}if(x._FEATURE_ID_RGBA4444!==void 0){const X=l.json.accessors[x._FEATURE_ID_RGBA4444];l.json.extensionsUsed&&l.json.extensionsUsed.includes("EXT_meshopt_compression")&&(j.featureData=Sv(l,X))}x._FEATURE_RGBA4444!==void 0&&(j.featureData=new Uint32Array(Sv(l,l.json.accessors[x._FEATURE_RGBA4444]).buffer));const G=h.material;return j.material=function(X,J){const{emissiveFactor:ne=[0,0,0],alphaMode:pe="OPAQUE",alphaCutoff:ke=.5,normalTexture:we,occlusionTexture:De,emissiveTexture:Be,doubleSided:He,name:dt}=X,{baseColorFactor:it=[1,1,1,1],metallicFactor:pt=1,roughnessFactor:wt=1,baseColorTexture:Ct,metallicRoughnessTexture:Wt}=X.pbrMetallicRoughness||{},Lt=De?J[De.index]:void 0;if(De&&De.extensions&&De.extensions.KHR_texture_transform&&Lt){const Qt=De.extensions.KHR_texture_transform;Lt.offsetScale=[Qt.offset[0],Qt.offset[1],Qt.scale[0],Qt.scale[1]]}return{name:dt,pbrMetallicRoughness:{baseColorFactor:new xi(...it),metallicFactor:pt,roughnessFactor:wt,baseColorTexture:Ct?J[Ct.index]:void 0,metallicRoughnessTexture:Wt?J[Wt.index]:void 0},doubleSided:He,emissiveFactor:new xi(...ne),alphaMode:pe,alphaCutoff:ke,normalTexture:we?J[we.index]:void 0,occlusionTexture:Lt,emissionTexture:Be?J[Be.index]:void 0,defined:X.defined===void 0}}(G!==void 0?l.json.materials[G]:{defined:!1},u),j}function K1e(h,l,u){const{matrix:g,rotation:x,translation:j,scale:N,mesh:E,extras:R,children:B,name:H}=h,G={};if(G.name=H,G.localMatrix=g||function(X,J,ne,pe){var ke=J[0],we=J[1],De=J[2],Be=J[3],He=ke+ke,dt=we+we,it=De+De,pt=ke*He,wt=ke*dt,Ct=ke*it,Wt=we*dt,Lt=we*it,Qt=De*it,ar=Be*He,or=Be*dt,gr=Be*it,xr=pe[0],hr=pe[1],fr=pe[2];return X[0]=(1-(Wt+Qt))*xr,X[1]=(wt+gr)*xr,X[2]=(Ct-or)*xr,X[3]=0,X[4]=(wt-gr)*hr,X[5]=(1-(pt+Qt))*hr,X[6]=(Lt+ar)*hr,X[7]=0,X[8]=(Ct+or)*fr,X[9]=(Lt-ar)*fr,X[10]=(1-(pt+Wt))*fr,X[11]=0,X[12]=ne[0],X[13]=ne[1],X[14]=ne[2],X[15]=1,X}([],x||[0,0,0,1],j||[0,0,0],N||[1,1,1]),G.globalMatrix=S(G.localMatrix),E!==void 0){G.meshes=u[E];const X=G.anchor=[0,0];for(const J of G.meshes){const{min:ne,max:pe}=J.aabb;X[0]+=ne[0]+pe[0],X[1]+=ne[1]+pe[1]}X[0]=Math.floor(X[0]/G.meshes.length/2),X[1]=Math.floor(X[1]/G.meshes.length/2)}if(R&&(R.id&&(G.id=R.id),R.lights&&(G.lights=function(X){if(!X.length)return[];const J=function(De){const Be=atob(De),He=new Uint8Array(Be.length);for(let dt=0;dt1&&g[g.length-1].equals(g[0])&&g.pop();let x=0;for(let N=0;N0&&g.reverse();const j=sN(g.flatMap(N=>[N.x,N.y]),[]);return j.length===0?null:{vertices:g,indices:j}}function FUe(h,l){const u=[],g=[];let x=0;const j=[];for(const N of h){x=u.length;const E=N.vertexArray.float32,R=N.indexArray.uint16;for(let B=0;B0&&([g[N+1],g[N+2]]=[g[N+2],g[N+1]])}return{vertices:u,indices:g}}function Hae(h){const l=function(R,B){const H=[],G=WebGL2RenderingContext;if(R.json.textures)for(const X of R.json.textures){const J={magFilter:G.LINEAR,minFilter:G.NEAREST,wrapS:G.REPEAT,wrapT:G.REPEAT};X.sampler!==void 0&&Object.assign(J,R.json.samplers[X.sampler]),H.push({image:B[X.source],sampler:J,uploaded:!1})}return H}(h,h.images),u=function(R,B){const H=[];for(const G of R.json.meshes){const X=[];for(const J of G.primitives)X.push(OUe(J,R,B));H.push(X)}return H}(h,l),{scenes:g,scene:x,nodes:j}=h.json,N=g?g[x||0].nodes:[...j.keys()],E=[];for(const R of N)E.push(K1e(j[R],h,u));return function(R,B,H){const G={},X=new Set;for(let J=0;J0){const J=Array.from(X.values()).sort((ne,pe)=>ne-pe);for(let ne=J.length-1;ne>=0;ne--)R.splice(J[ne],1)}}(E,N,h.json.nodes),E}function zUe(h){h.heightmap=new Float32Array(4096),h.heightmap.fill(-1);const l=h.vertexArray.float32,u=h.aabb.min[0]-1,g=h.aabb.min[1]-1,x=Nv/(h.aabb.max[0]-u+2),j=Nv/(h.aabb.max[1]-g+2);for(let N=0;Nh.heightmap[B*Nv+R]&&(h.heightmap[B*Nv+R]=E)}}function Z1e(h,l,u,g,x){u.reserve(u.length+4*h.length),g.reserve(g.length+10*h.length),x.reserve(x.length+10*h.length);let j=g.length;for(const N of h){const E=Math.min(10,Math.max(4,1.3*N.height))*l,R=[-N.normal[1],N.normal[0],0],B=Math.min(.29,.1*N.width/N.depth),H=N.width-2*N.depth*l*(B+.01),G=je([],N.pos,R,H/2),X=je([],N.pos,R,-H/2),J=[G[0],G[1],G[2]+N.height],ne=[X[0],X[1],X[2]+N.height],pe=je([],N.normal,R,B);ae(pe,pe,E);const ke=je([],N.normal,R,-B);ae(ke,ke,E),fe(pe,G,pe),fe(ke,X,ke),G[2]+=.1,X[2]+=.1,g.emplaceBack(pe[0],pe[1],pe[2]),g.emplaceBack(ke[0],ke[1],ke[2]),g.emplaceBack(G[0],G[1],G[2]),g.emplaceBack(X[0],X[1],X[2]),g.emplaceBack(J[0],J[1],J[2]),g.emplaceBack(ne[0],ne[1],ne[2]),g.emplaceBack(G[0],G[1],G[2]),g.emplaceBack(X[0],X[1],X[2]),g.emplaceBack(pe[0],pe[1],pe[2]),g.emplaceBack(ke[0],ke[1],ke[2]);const we=H/E/2;x.emplaceBack(-we-B,-1,we,.8),x.emplaceBack(we+B,-1,we,.8),x.emplaceBack(-we,0,we,1.3),x.emplaceBack(we,0,we,1.3),x.emplaceBack(we+B,-.8,we,.7),x.emplaceBack(we+B,-.8,we,.7),x.emplaceBack(0,0,we,1.3),x.emplaceBack(0,0,we,1.3),x.emplaceBack(we+B,-1.2,we,.8),x.emplaceBack(we+B,-1.2,we,.8),u.emplaceBack(6+j,4+j,8+j),u.emplaceBack(7+j,9+j,5+j),u.emplaceBack(0+j,1+j,2+j),u.emplaceBack(1+j,3+j,2+j),j+=10}}function BUe(h,l){const u={};u.indexArray=new Ro,u.vertexArray=new su,u.colorArray=new Im,Z1e(h,l,u.indexArray,u.vertexArray,u.colorArray);const g={defined:!0};g.emissiveFactor=xi.black;const x={};return x.baseColorFactor=xi.white,g.pbrMetallicRoughness=x,u.material=g,u.aabb=new on([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),u}const Y1e=ks([{name:"a_pos_3f",components:3,type:"Float32"}]),$Ue=ks([{name:"a_normal_3",components:3,type:"Int16"}]),UUe=ks([{name:"a_centroid_3",components:3,type:"Int16"}]),X1e=ks([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),qUe=ks([{name:"a_faux_facade_color_emissive",components:2,type:"Uint16"}]),VUe=ks([{name:"a_faux_facade_data",components:4,type:"Uint16"}]),HUe=ks([{name:"a_faux_facade_vertical_range",components:2,type:"Uint16"}]),WUe=ks([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),GUe=ks([{name:"a_flood_light_wall_radius_1i16",components:1,type:"Uint16"}]),Q1e=Tt.types,GP=32767;function KUe(h,l){const u=Cr+l;for(const g of h)for(const x of g)if(x.x<-l||x.x>u||x.y<-l||x.y>u)return!1;return!0}function ZUe(h){switch(h){case"flat":return 3;case"hipped":return 1;case"gabled":return 2;case"parapet":return 0;case"mansard":return 4;case"skillion":return 5;case"pyramidal":return 6;default:throw new Error(`Unknown roof shape: ${h}`)}}class Wae{constructor(){this.layoutVertexArray=new su,this.layoutAttenuationArray=new Im,this.layoutColorArray=new iu,this.indexArray=new Ro,this.indexArrayForConflation=new Ro,this.segmentsBucket=new ja}}class Gae{constructor(l){this.layoutFacadePaintArray=null,this.layoutFacadeDataArray=null,this.layoutFacadeVerticalRangeArray=null,this.segmentsBucket=new ja,this.entranceBloom=new Wae;const u=66560;this.layoutVertexArray=new su,this.layoutVertexArray.reserve(u),this.layoutNormalArray=new wx,this.layoutNormalArray.reserve(u),this.layoutCentroidArray=new wx,this.layoutCentroidArray.reserve(u),this.layoutColorArray=new iu,this.layoutColorArray.reserve(u),this.layoutFloodLightDataArray=new Pm,this.layoutFloodLightDataArray.reserve(u),this.layoutAOArray=new Wk,this.layoutAOArray.reserve(u),this.indexArray=new Ro,this.indexArray.reserve(66560),this.indexArrayForConflation=new Ro,this.segmentsBucket=new ja,this.entranceBloom=new Wae,l&&(this.layoutFacadePaintArray=new iu,this.layoutFacadeDataArray=new Kg,this.layoutFacadeVerticalRangeArray=new iu)}reserve(l,u,g){this.layoutVertexArray.reserveForAdditional(l),this.layoutCentroidArray.reserveForAdditional(l),this.layoutFloodLightDataArray.reserveForAdditional(l),this.layoutNormalArray.reserveForAdditional(l),this.layoutAOArray.reserveForAdditional(l),this.layoutColorArray.reserveForAdditional(l),this.indexArray.reserveForAdditional(u),g&&(this.layoutFacadePaintArray.reserveForAdditional(l),this.layoutFacadeDataArray.reserveForAdditional(l),this.layoutFacadeVerticalRangeArray.reserveForAdditional(l))}}class J1e{constructor(l){this.colorBufferUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.footprintsVertices=new df,this.footprintsIndices=new Pm,this.footprintsMin=new sr(1/0,1/0),this.footprintsMax=new sr(-1/0,-1/0),this.featuresOnBorder=[],this.buildingWithoutFacade=new Gae(!1),this.buildingWithFacade=new Gae(!0),this.indexArrayForConflationUploaded=!1,this.featureFootprintLookup=new Map,this.buildingIds=new Set,this.footprintLookup={},this.zoom=l.zoom,this.canonical=l.canonical,this.layers=l.layers,this.layerIds=this.layers.map(u=>u.fqid),this.index=l.index,this.hasPattern=!1,this.worldview=l.worldview,this.lut=l.lut,this.programConfigurations=new jh(l.layers,{zoom:l.zoom,lut:l.lut}),this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.projection=l.projection,this.groundEffect=new Tae(l),this.groundEffect.groundRadiusArray=new pp,this.hasAppearances=null}updateFootprints(l,u){const g=new IP([],[],1),x={vertices:[],indices:new Uint32Array(0),grid:g,min:this.footprintsMin,max:this.footprintsMax,buildingIds:this.buildingIds};u.push({footprint:x,id:l})}updateAppearances(l,u,g,x){}prepare(){return function(){if(zP!=null||P1e!=null)return null;if(cN!=null)return cN;const l=fetch(bs.BUILDING_GEN_URL);return cN=function(u){let g,x,j,N,E;function R(){g=new Uint8Array(E.buffer),x=new Int16Array(E.buffer),j=new Int32Array(E.buffer),N=new Float32Array(E.buffer)}function B(){throw new Error("Unexpected BuildingGen error.")}const H=()=>{},G={a:{a:B,f:function(X){const J=g.length,ne=Math.max(X>>>0,Math.ceil(1.2*J)),pe=Math.ceil((ne-J)/65536);try{return E.grow(pe),R(),!0}catch{return!1}},g:B,b:H,c:H,d:H,e:H}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(u,G):u.then(X=>X.arrayBuffer()).then(X=>WebAssembly.instantiate(X,G))).then(X=>{const J=X.instance.exports;return(0,J.g)(),E=J.f,R(),new _Ue({setStyle:J.h,setAOOptions:J.i,setMetricOptions:J.j,setStructuralOptions:J.k,setFacadeOptions:J.l,setFauxFacadeOptions:J.m,setFacadeClassifierOptions:J.n,addFeature:J.o,addFacade:J.p,generateMesh:J.q,getLastError:J.r,getOuterRingLength:J.s,getMeshCount:J.t,getPositionsPtr:J.u,getPositionsLength:J.v,getNormalsPtr:J.w,getNormalsLength:J.x,getAOPtr:J.y,getAOLength:J.z,getUVPtr:J.A,getUVLength:J.B,getFauxFacadePtr:J.C,getFauxFacadeLength:J.D,getIndicesPtr:J.E,getIndicesLength:J.F,getBuildingPart:J.G,getRingCount:J.H,getRingPtr:J.I,getRingLength:J.J,malloc:J.K,free:J.L,heapU8:g,heap16:x,heap32:j,heapF32:N})})}(l).then(u=>(cN=null,zP=u,zP)).catch(u=>{Br("Could not load building-gen"),cN=null,P1e=u}),cN}()}populate(l,u,g,x){const j=bUe();if(!j)return;const N=Ee(g);this.tileToMeter=N,this.brightness=u.brightness,j.setStyle({normalScale:[1,-1,N],tileToMeters:N}),j.setAOOptions(!1,.3),j.setMetricOptions(!1,16),j.setStructuralOptions(!0),j.setFacadeClassifierOptions(3);const E=new Map,R=new Map;let B=0;for(const{feature:we}of l){if(Q1e[we.type]!=="LineString"){E.set(we.id,we.properties.source_id);continue}const De=this.layers[0]._featureFilter.needGeometry;if(De&&!this.layers[0]._featureFilter.filter(new Qi(this.zoom),we,g))continue;const Be=Pt(we,De);if(!De&&!this.layers[0]._featureFilter.filter(new Qi(this.zoom),Be,g))continue;const He=De?Be.geometry:vt(we,g,x),dt=[];for(const Ct of He)for(const Wt of Ct)dt.push(Wt.x),dt.push(Wt.y);const it={coordinates:dt,crossPerc:we.properties.cross_perc,distanceToRoad:we.properties.distance_to_road,entrances:we.properties.entrances,sourceId:0},pt=we.properties.source_id;let wt=R.get(pt);wt||(wt=[],R.set(pt,wt)),wt.push(it),++B}this.maxHeight=0;const H=new Array,G=new Set,X=we=>{we!=null&&G.add(we)},J=(we,De)=>{we!=null&&H.push({buildingId:we,footprintIndex:De})},ne=64*(l.length-B),pe=ne/2;this.buildingWithFacade.reserve(ne,pe,!0),this.buildingWithoutFacade.reserve(2*ne,2*pe,!1),this.footprintsIndices.reserve(16*(l.length-B)),this.footprintsVertices.reserve(8*(l.length-B));for(const{feature:we,id:De,index:Be,sourceLayerIndex:He}of l){if(Q1e[we.type]==="LineString")continue;const dt=this.layers[0]._featureFilter.needGeometry;if(dt&&!this.layers[0]._featureFilter.filter(new Qi(this.zoom),we,g))continue;let it=null;if(we.properties&&we.properties.hasOwnProperty("building_id")&&(it=we.properties.building_id,G.has(it)))continue;const pt=Pt(we,dt);if(!dt&&!this.layers[0]._featureFilter.filter(new Qi(this.zoom),pt,g))continue;const wt=dt?pt.geometry:vt(we,g,x),Ct=xM(wt,500);let Wt=!1;for(const Tn of Ct)if(Tn.length!==1){Wt=!0;break}if(Wt){X(it);continue}if(!KUe(wt,163)){X(it);continue}const Lt=this.layers[0],Qt=ZUe(Lt.layout.get("building-roof-shape").evaluate(we,{},g)),ar=Lt.layout.get("building-base").evaluate(we,{},g),or=Lt.layout.get("building-height").evaluate(we,{},g),gr=Lt.layout.get("building-flood-light-ground-radius").evaluate(we,{},g),xr=Lt.paint.get("building-ambient-occlusion-intensity"),hr=gr/this.tileToMeter;we.properties["building-part"]="roof";const fr=Lt.paint.get("building-color").evaluate(we,{},this.canonical).toPremultipliedRenderColor(this.lut),Xt=Lt.paint.get("building-emissive-strength").evaluate(we,{},this.canonical);we.properties["building-part"]="wall";const Gt=Lt.paint.get("building-color").evaluate(we,{},this.canonical).toPremultipliedRenderColor(this.lut),pr=Lt.paint.get("building-emissive-strength").evaluate(we,{},this.canonical);we.properties["building-part"]="window";const Tr=Lt.paint.get("building-color").evaluate(we,{},this.canonical).toPremultipliedRenderColor(this.lut),br=Lt.paint.get("building-emissive-strength").evaluate(we,{},this.canonical);we.properties["building-part"]="door";const dn=Lt.paint.get("building-color").evaluate(we,{},this.canonical).toPremultipliedRenderColor(this.lut),Rr=Lt.paint.get("building-emissive-strength").evaluate(we,{},this.canonical);let Vr=Lt.layout.get("building-flood-light-wall-radius").evaluate(we,{},g);Vr=_e(Vr,0,2048);const tn=Vr/2048*GP,us=E.get(De),jr=R.get(us)||[],rn=jr.length!==0&&Lt.layout.get("building-facade").evaluate(we,{},g);j.setFacadeOptions(4,!0),j.setFauxFacadeOptions(rn,!1,1);let Bn=0,Es=0,Rs=0,Yn=0,Ei=0,at=0,ut=0,Jt=0,yr=0,Pr=0,Lr=0;if(rn){let Tn=Math.round(Lt.layout.get("building-facade-floors").evaluate(we,{},g));if(ar===0){Tn=Math.max(1,Tn-(jr.length>0?1:0));let bi=4;if(or>100){const ha=[10,13,15];bi=ha[we.id?we.id%ha.length:0]}else or<=10&&(bi=3);j.setFacadeOptions(bi,!0),Ei=(or<15?1.3:1.61803)*bi/N}else Ei=ar/N;at=or/N,Ei=Math.min(Ei,at),Rs=Lt.layout.get("building-facade-unit-width").evaluate(we,{},g)/N,Yn=(at-Ei)/Tn,j.setFauxFacadeOptions(!0,!0,Rs);const Sa=Lt.layout.get("building-facade-window").evaluate(we,{},g);Bn=Sa[0],Es=Sa[1],ut=Math.floor(65535*Math.min(1,Ei/Cr)),Jt=Math.floor(65535*Math.min(1,at/Cr)),yr=Math.floor(255*Bn)<<8|Math.floor(255*Es),Pr=Math.floor(65535*Math.min(1,Rs/Cr)),Lr=Math.floor(65535*Math.min(1,Yn/Cr))}const hn=Array(Ct.length),mn={x:1/0,y:1/0},Kn={x:-1/0,y:-1/0},ns={x:0,y:0};let ds=0;for(let Tn=0;Tn0){const bi=[],ha=Array(Sa.length+1);ha[0]=0;for(let Bo=0;BoCr||mn.y<0||Kn.y>Cr)&&this.featuresOnBorder.push({featureId:we.id,footprintIndex:this.footprints.length});{const Tn=sN(Ri,null,2);this.footprintsIndices.resize(this.footprintsIndices.length+Tn.length),this.footprintsIndices.uint16.set(Tn,Mn),this.buildingIds.add(it??we.id),this.footprintsMin.x=Math.min(this.footprintsMin.x,Vi.x),this.footprintsMin.y=Math.min(this.footprintsMin.y,Vi.y),this.footprintsMax.x=Math.max(this.footprintsMax.x,Ji.x),this.footprintsMax.y=Math.max(this.footprintsMax.y,Ji.y);const Sa={footprintVertexOffset:Ss,footprintVertexLength:this.footprintsVertices.length-Ss,footprintIndexOffset:Mn,footprintIndexLength:this.footprintsIndices.length-Mn,min:Vi,max:Ji,hiddenFlags:0,indicesOffset:fi,indicesLength:va,bloomIndicesOffset:_i,bloomIndicesLength:$i,groundEffectVertexOffset:no,groundEffectVertexLength:Zi,hasFauxFacade:rn,height:ss,promoteId:De,feature:pt,parts:ei,buildingBloom:ti},bi=this.footprints.length;we.id!==void 0&&this.featureFootprintLookup.set(we.id,bi),J(it,bi),this.footprints.push(Sa)}this.programConfigurations.populatePaintArrays(En.layoutVertexArray.length,we,Be,{},u.availableImages,g,u.brightness),this.groundEffect.addPaintPropertiesData(we,Be,{},u.availableImages,g,u.brightness),u.featureIndex.insert(we,wt,Be,He,this.index,Ii)}H.forEach(({buildingId:we,footprintIndex:De})=>{G.has(we)&&(this.footprints[De].hiddenFlags|=4)});const ke=new Set;this.buildingIds.forEach((we,De,Be)=>{G.has(we)||ke.add(we)}),this.buildingIds=ke,this.groundEffect.prepareBorderSegments()}update(l,u,g,x,j,N,E){this.programConfigurations.updatePaintArrays(l,u,j,g,x,N,E),this.groundEffect.update(l,u,j,g,x,N,E),this.evaluate(this.layers[0],l),this.colorBufferUploaded=!1}isEmpty(){return this.buildingWithoutFacade.layoutVertexArray.length===0&&this.buildingWithFacade.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(l){const u=g=>{g.layoutVertexBuffer=l.createVertexBuffer(g.layoutVertexArray,Y1e.members),g.layoutNormalBuffer=l.createVertexBuffer(g.layoutNormalArray,$Ue.members),g.layoutCentroidBuffer=l.createVertexBuffer(g.layoutCentroidArray,UUe.members),g.layoutFloodLightDataBuffer=l.createVertexBuffer(g.layoutFloodLightDataArray,GUe.members),g.layoutFacadeDataArray&&g.layoutFacadeDataArray.length&&(g.layoutFacadeDataBuffer=l.createVertexBuffer(g.layoutFacadeDataArray,VUe.members)),g.layoutFacadeVerticalRangeArray&&g.layoutFacadeVerticalRangeArray.length&&(g.layoutFacadeVerticalRangeBuffer=l.createVertexBuffer(g.layoutFacadeVerticalRangeArray,HUe.members)),g.entranceBloom.layoutVertexArray.length&&(g.entranceBloom.layoutVertexBuffer=l.createVertexBuffer(g.entranceBloom.layoutVertexArray,Y1e.members),g.entranceBloom.layoutAttenuationBuffer=l.createVertexBuffer(g.entranceBloom.layoutAttenuationArray,WUe.members)),this.uploadUpdatedColorBuffer(l),this.uploadUpdatedIndexBuffer(l)};this.uploaded||(u(this.buildingWithoutFacade),u(this.buildingWithFacade),this.groundEffect.upload(l)),this.groundEffect.uploadPaintProperties(l),this.programConfigurations.upload(l),this.uploaded=!0}destroy(){const l=u=>{u.layoutVertexBuffer&&(u.layoutVertexBuffer.destroy(),u.layoutNormalBuffer.destroy(),u.layoutColorBuffer.destroy(),u.segmentsBucket.destroy(),u.indexBuffer&&u.indexBuffer.destroy(),u.entranceBloom.layoutVertexBuffer&&(u.entranceBloom.layoutVertexBuffer.destroy(),u.entranceBloom.layoutColorBuffer.destroy(),u.entranceBloom.layoutAttenuationBuffer.destroy(),u.entranceBloom.indexBuffer.destroy(),u.entranceBloom.segmentsBucket.destroy()))};l(this.buildingWithoutFacade),l(this.buildingWithFacade),this.groundEffect.destroy(),this.programConfigurations.destroy()}updateFootprintHiddenFlags(l,u,g=!0){let x=!1;const j=g?u:0,N=0|(g?-1:~u);this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const E of l){const R=this.footprints[E],B=R.hiddenFlags&N|j;R.hiddenFlags!==B&&(R.hiddenFlags=B,x=!0,this.groundEffect.updateHiddenByLandmarkRange(R.groundEffectVertexOffset,R.groundEffectVertexLength,R.hiddenFlags!==0))}return x&&(this.indexArrayForConflationUploaded=!1),x}uploadUpdatedIndexBuffer(l){if(this.groundEffect.uploadHiddenByLandmark(l),this.indexArrayForConflationUploaded)return;const u=x=>{x.indexArray.length!==0&&(x.indexArrayForConflation.resize(x.indexArray.length),x.indexArrayForConflation.uint16.set(x.indexArray.uint16),x.entranceBloom.indexArrayForConflation.resize(x.entranceBloom.indexArray.length),x.entranceBloom.indexArrayForConflation.uint16.set(x.entranceBloom.indexArray.uint16))};u(this.buildingWithoutFacade),u(this.buildingWithFacade);for(const x of this.footprints){const j=x.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade,N=x.indicesOffset+x.indicesLength;if(x.hiddenFlags!==0){for(let R=x.indicesOffset;R{x.indexArray.length!==0&&(x.indexBuffer?x.indexBuffer.updateData(x.indexArrayForConflation):x.indexBuffer=l.createIndexBuffer(x.indexArrayForConflation,!0),x.entranceBloom.indexBuffer?x.entranceBloom.indexBuffer.updateData(x.entranceBloom.indexArrayForConflation):x.entranceBloom.indexBuffer=l.createIndexBuffer(x.entranceBloom.indexArrayForConflation,!0))};g(this.buildingWithoutFacade),g(this.buildingWithFacade),this.indexArrayForConflationUploaded=!0}uploadUpdatedColorBuffer(l){const u=g=>{g.layoutColorBuffer?g.layoutColorBuffer.updateData(g.layoutColorArray):g.layoutColorBuffer=l.createVertexBuffer(g.layoutColorArray,X1e.members,!0),g.layoutFacadePaintArray&&(g.layoutFacadePaintBuffer?g.layoutFacadePaintBuffer.updateData(g.layoutFacadePaintArray):g.layoutFacadePaintBuffer=l.createVertexBuffer(g.layoutFacadePaintArray,qUe.members,!0)),g.entranceBloom.layoutColorBuffer?g.entranceBloom.layoutColorBuffer.updateData(g.entranceBloom.layoutColorArray):g.entranceBloom.layoutColorBuffer=l.createVertexBuffer(g.entranceBloom.layoutColorArray,X1e.members,!0)};u(this.buildingWithoutFacade),u(this.buildingWithFacade),this.colorBufferUploaded=!0}evaluate(l,u){const g=l.paint.get("building-ambient-occlusion-intensity");for(const x of this.footprints){if(4&x.hiddenFlags)continue;const j=u[x.promoteId],N=x.feature;N.properties["building-part"]="roof";const E=l.paint.get("building-color").evaluate(N,j,this.canonical).toPremultipliedRenderColor(this.lut),R=l.paint.get("building-emissive-strength").evaluate(N,j,this.canonical);N.properties["building-part"]="wall";const B=l.paint.get("building-color").evaluate(N,j,this.canonical).toPremultipliedRenderColor(this.lut),H=l.paint.get("building-emissive-strength").evaluate(N,j,this.canonical);N.properties["building-part"]="window";const G=l.paint.get("building-color").evaluate(N,j,this.canonical).toPremultipliedRenderColor(this.lut),X=l.paint.get("building-emissive-strength").evaluate(N,j,this.canonical);N.properties["building-part"]="door";const J=l.paint.get("building-color").evaluate(N,j,this.canonical).toPremultipliedRenderColor(this.lut),ne=l.paint.get("building-emissive-strength").evaluate(N,j,this.canonical),pe=x.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade;for(const we of x.parts){let De,Be=E;we.part===1?(Be=E,De=R):we.part===0?(Be=B,De=H):we.part===2?(Be=G,De=X):we.part===3&&(Be=J,De=ne),De=_e(De,0,1);for(let He=0;HeN.max.x||R.max.xN.max.y||R.max.yE.max.x||E.min.x>l||u>E.max.y||E.min.y>u||E.height<=g||YUe(N,this.footprintsVertices.float32.subarray(2*E.footprintVertexOffset,2*(E.footprintVertexOffset+E.footprintVertexLength)),this.footprintsIndices.uint16.subarray(E.footprintIndexOffset,E.footprintIndexOffset+E.footprintIndexLength))&&(g=E.height,this.footprintLookup[j]=E,x=E.hiddenFlags!==0);if(g!==Number.NEGATIVE_INFINITY)return{height:g,hidden:x};this.footprintLookup[j]=void 0}}function YUe(h,l,u){for(let g=0;g1&&(R=l[++E]);const H=Math.abs(B-R.left),G=Math.abs(B-R.right),X=Math.min(H,G);let J;const ne=j/g*(x+1);if(R.isDash){const pe=x-Math.abs(ne);J=Math.sqrt(X*X+pe*pe)}else J=x-Math.sqrt(X*X+ne*ne);this.image.data[N+B]=Math.max(0,Math.min(255,J+128))}}}addRegularDash(l,u){for(let R=l.length-1;R>=0;--R){const B=l[R],H=l[R+1];B.zeroLength?l.splice(R,1):H&&H.isDash===B.isDash&&(H.left=B.left,l.splice(R,1))}const g=l[0],x=l[l.length-1];g.isDash===x.isDash&&(g.left=x.left-this.width,x.right=g.right+this.width);const j=this.width*this.nextRow;let N=0,E=l[N];for(let R=0;R1&&(E=l[++N]);const B=Math.abs(R-E.left),H=Math.abs(R-E.right),G=Math.min(B,H);this.image.data[j+R]=Math.max(0,Math.min(255,(E.isDash?G:-G)+u+128))}}addDash(l,u){const g=this.getKey(l,u);if(this.positions[g])return this.positions[g];const x=u==="round",j=x?7:0,N=2*j+1;if(this.nextRow+N>this.height)return Br("LineAtlas out of space"),null;l.length===0&&l.push(1);let E=0;for(let H=0;Hu.fqid),this.index=l.index,this.projection=l.projection,this.hasPattern=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(u=>{this.gradients[u.id]={}}),this.layoutVertexArray=new zk,this.layoutVertexArray2=new su,this.patternVertexArray=new su,this.indexArray=new Ro,this.programConfigurations=new jh(l.layers,{zoom:l.zoom,lut:l.lut}),this.segments=new ja,this.maxLineLength=0,this.zOffsetVertexArray=new su,this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.tessellationStep=l.tessellationStep?l.tessellationStep:Cr/64,this.worldview=l.worldview,this.hasAppearances=null}updateFootprints(l,u){}updateAppearances(l,u,g,x){}populate(l,u,g,x){this.hasPattern=_ae("line",this.layers,this.pixelRatio,u);const j=this.layers[0].layout.get("line-sort-key");this.tileToMeter=Ee(g);const N=this.layers[0].layout.get("line-elevation-reference");if(N==="hd-road-markup")this.elevationType="road";else{const X=this.layers[0].layout.get("line-z-offset"),J=X.isConstant()&&!X.constantOr(0);this.elevationType=N!=="sea"&&N!=="ground"&&J?"none":"offset",this.elevationType==="offset"&&N==="none"&&Br(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`)}const E=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope=this.elevationType==="offset"&&E!==void 0;const R=[];for(const{feature:X,id:J,index:ne,sourceLayerIndex:pe}of l){const ke=this.layers[0]._featureFilter.needGeometry,we=Pt(X,ke);if(!this.layers[0]._featureFilter.filter(new Qi(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),we,g))continue;const De=j?j.evaluate(we,{},g):void 0,Be={id:J,properties:X.properties,type:X.type,sourceLayerIndex:pe,index:ne,geometry:ke?we.geometry:vt(X,g,x),patterns:{},sortKey:De};R.push(Be)}j&&R.sort((X,J)=>X.sortKey-J.sortKey);const{lineAtlas:B,featureIndex:H}=u,G=this.addConstantDashes(B);for(const X of R){const{geometry:J,index:ne,sourceLayerIndex:pe}=X;if(G&&this.addFeatureDashes(X,B),this.hasPattern){const ke=bae("line",this.layers,X,this.zoom,this.pixelRatio,u);this.patternFeatures.push(ke)}else this.addFeature(X,J,ne,g,B.positions,u.availableImages,u.brightness,u.elevationFeatures);H.insert(l[ne].feature,J,ne,pe,this.index)}}addConstantDashes(l){let u=!1;for(const g of this.layers){const x=g.paint.get("line-dasharray").value,j=g.layout.get("line-cap").value;if(x.kind!=="constant"||j.kind!=="constant")u=!0;else{const N=j.value,E=x.value;if(!E)continue;l.addDash(E,N)}}return u}addFeatureDashes(l,u){const g=this.zoom;for(const x of this.layers){const j=x.paint.get("line-dasharray").value,N=x.layout.get("line-cap").value;if(j.kind==="constant"&&N.kind==="constant")continue;let E,R;if(j.kind==="constant"){if(E=j.value,!E)continue}else E=j.evaluate({zoom:g},l);R=N.kind==="constant"?N.value:N.evaluate({zoom:g},l),u.addDash(E,R),l.patterns[x.id]=[u.getKey(E,R)]}}update(l,u,g,x,j,N,E,R){this.programConfigurations.updatePaintArrays(l,u,j,g,x,N,E,R)}addFeatures(l,u,g,x,j,N){for(const E of this.patternFeatures)this.addFeature(E,E.geometry,E.index,u,g,x,N,l.elevationFeatures)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(l){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=l.createVertexBuffer(this.layoutVertexArray2,rqe)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=l.createVertexBuffer(this.patternVertexArray,sqe)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=l.createVertexBuffer(this.zOffsetVertexArray,JUe.members,!0)),this.layoutVertexBuffer=l.createVertexBuffer(this.layoutVertexArray,eqe),this.indexBuffer=l.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(l),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(l,u){let g,x;if(u&&u>0?(g=`mapbox_clip_start_${u}`,x=`mapbox_clip_end_${u}`):(g="mapbox_clip_start",x="mapbox_clip_end"),l.properties&&l.properties.hasOwnProperty(g)&&l.properties.hasOwnProperty(x))return{start:+l.properties[g],end:+l.properties[x]}}addFeature(l,u,g,x,j,N,E,R){const B=this.layers[0].layout,H=B.get("line-join").evaluate(l,{}),G=B.get("line-cap").evaluate(l,{}),X=B.get("line-miter-limit"),J=B.get("line-round-limit");this.lineClips=this.lineFeatureClips(l),this.lineFeature=l;const ne=!(!l.properties||!l.properties.hasOwnProperty("mapbox_line_metrics"))&&l.properties.mapbox_line_metrics;this.zOffsetValue=B.get("line-z-offset").value;const pe=this.layers[0].paint.get("line-width").value;if(pe.kind!=="constant"&&pe.isLineProgressConstant===!1&&(this.variableWidthValue=pe),this.elevationType==="road"){const ke=this.layoutVertexArray.length;if(!this.addElevatedRoadFeature(l,u,x,R,H,G,X,J)){const[we,De]=this.clipRuntimeLinesToTile(u,1);for(let Be=0;Be0?dt.parentIndex:null)}this.fillNonElevatedRoadSegment(ke)}}else for(let ke=0;ke0?ke:null);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,l,g,j,N,x,E,void 0,this.worldview)}computeSegNextDir(l,u){return l.nextPoint.sub(u.at(-2)).unit()}computeSegPrevDir(l,u){return u[1].sub(l.prevPoint).unit()}clipLinesToTile(l,u){return RP(l,-u,-u,Cr+u,Cr+u)}clipRuntimeLinesToTile(l,u){const g=[];return[RP(l,-u,-u,Cr+u,Cr+u,g),g]}addElevatedRoadFeature(l,u,g,x,j,N,E,R){const B=[],H=ui.getElevationFeature(l,x);if(H){const G=this.clipLinesToTile(u,1),X=this.prepareElevatedLines(G,H,g);for(const J of X)B.push({geometry:J,elevation:H,elevationTileID:g,segment:{progress:{min:0,max:1},nextDir:void 0,prevDir:void 0}})}if(B.length===0)return!1;for(const G of B){const X=this.layoutVertexArray.length;this.addLine(G.geometry,l,g,j,N,E,R);const J=new Ci(g,G.elevationTileID);if(G.elevation)for(let ne=X;ne>1,this.layoutVertexArray.int16[6*ne+1]>>1),ke=J.pointElevation(pe,G.elevation,.05);this.updateHeightRange(ke),this.zOffsetVertexArray.emplaceBack(ke,0,0)}else this.fillNonElevatedRoadSegment(X)}return!0}prepareElevatedLines(l,u,g){if(u.constantHeight!=null)return l;const x=[],j=1/Ee(g);for(const N of l)yUe(N,new Js(u,j),0,x);return x}fillNonElevatedRoadSegment(l){for(let u=l;u0,X=R&&R.progress.max<1;if(this.lineClips){let Ct={min:this.lineClips.start,max:this.lineClips.end},Wt=1;if(R){const ar=this.lineClips.end-this.lineClips.start;Ct=function(or,gr,xr){return{min:Di(or.min,gr,xr),max:Di(or.max,gr,xr)}}(R.progress,{min:0,max:1},Ct),ar>0&&(Wt=(Ct.max-Ct.min)/ar)}const Lt=+u.properties.mapbox_clip_feature_len,Qt=+u.properties.mapbox_clip_seg_len;if(Number.isNaN(Lt)||Number.isNaN(Qt)){for(let or=0;or=2&&l[ne-1].equals(l[ne-2]);)ne--;let pe=0;for(;pe0,Xt=this.overscaling<=16?15*Cr/(512*this.overscaling):0;if(Wt&&Lt==="round"){if(grN&&(Lt="bevel"),Lt==="bevel"&&(gr>2&&(Lt="flipbevel"),gr2*Xt){const Tr=we.sub(we.sub(De)._mult(Xt/Gt)._round());this.updateDistance(De,Tr),this.addCurrentVertex(Tr,He,0,0,ke,wt),De=Tr}this.updateDistance(De,we),ar._mult(gr),this.addCurrentVertex(we,ar,0,0,ke,wt);const pr=we.dist(Be);if(pr>2*Xt){const Tr=we.add(Be.sub(we)._mult(Xt/pr)._round());this.updateDistance(we,Tr),this.addCurrentVertex(Tr,dt,0,0,ke,wt),we=Tr}}else ar._mult(gr),this.addCurrentVertex(we,ar,0,0,ke,wt);else if(Lt==="flipbevel"){if(gr>100)ar=dt.mult(-1);else{const Gt=gr*He.add(dt).mag()/He.sub(dt).mag();ar._perp()._mult(Gt*(fr?-1:1))}this.addCurrentVertex(we,ar,0,0,ke,wt),this.addCurrentVertex(we,ar.mult(-1),0,0,ke,wt)}else if(Lt==="bevel"||Lt==="fakeround"){wt!=null&&De&&this.addCurrentVertex(we,pt||He,-1,-1,ke,wt);const Gt=we.dist(De)<=2*Xt&&Lt!=="bevel",pr=ar.mult(fr?1:-1);pr._mult(gr);const Tr=dt.mult(fr?-1:1),br=He.mult(fr?-1:1),dn=this.evaluateLineProgressFeatures(this.distance);if(wt==null&&(this.addHalfVertex(we,pr.x,pr.y,!1,!fr,0,ke,dn),Gt||this.addHalfVertex(we,pr.x+2*br.x,pr.y+2*br.y,!1,fr,0,ke,dn)),Lt==="fakeround"){const Rr=Math.round(180*xr/Math.PI/20);this.addHalfVertex(we,br.x,br.y,!1,fr,0,ke,dn);for(let Vr=0;Vr1){this.lineSoFar=l.w;const pe=(u.x-l.x)/G,ke=(u.y-l.y)/G,we=(u.z-l.z)/G,De=(u.w-l.w)/G;for(let Be=1;Be=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,H),R.primitiveLength++),N?this.e2=H:this.e1=H,B!=null&&this.zOffsetVertexArray.emplaceBack(B.zOffset,B.variableWidth,B.variableWidth)}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(l,u){this.prevDistance=this.distance,this.distance+=l.dist(u),this.updateScaledDistance()}}function Zae(h,l,u){return h.xu||h.yu}let nve,sve;function ive(h,l,u){return l*(Cr/(h.tileSize*Math.pow(2,u-h.tileID.overscaledZ)))}Yr(Kae,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const ave=(h,l,u)=>(1-u)*h+u*l;function ove(h,l){return 1/ive(h,1,l.tileZoom)}function lve(h,l,u,g){return h.translatePosMatrix(g||l.tileID.projMatrix,l,u.paint.get("line-translate"),u.paint.get("line-translate-anchor"))}const cve=h=>{const l=[];dve(h)&&l.push("RENDER_LINE_DASH"),h.paint.get("line-gradient")&&l.push("RENDER_LINE_GRADIENT");const u=h.paint.get("line-trim-offset");u[0]===0&&u[1]===0||l.push("RENDER_LINE_TRIM_OFFSET"),h.paint.get("line-border-width").constantOr(1)!==0&&l.push("RENDER_LINE_BORDER");const g=h.layout.get("line-join").constantOr("miter")==="none",x=!!h.paint.get("line-pattern").constantOr(1);return g&&x&&l.push("LINE_JOIN_NONE"),l};function dve(h){const l=h.paint.get("line-dasharray").value;return l.kind!=="constant"||l.value}let Yae;const uve=()=>Yae||(Yae={layout:nve||(nve=new Ra({"line-cap":new Ir(Dt.layout_line["line-cap"]),"line-join":new Ir(Dt.layout_line["line-join"]),"line-miter-limit":new kr(Dt.layout_line["line-miter-limit"]),"line-round-limit":new kr(Dt.layout_line["line-round-limit"]),"line-sort-key":new Ir(Dt.layout_line["line-sort-key"]),"line-z-offset":new Ir(Dt.layout_line["line-z-offset"]),"line-elevation-reference":new kr(Dt.layout_line["line-elevation-reference"]),"line-cross-slope":new kr(Dt.layout_line["line-cross-slope"]),visibility:new kr(Dt.layout_line.visibility),"line-width-unit":new kr(Dt.layout_line["line-width-unit"])})),paint:sve||(sve=new Ra({"line-opacity":new Ir(Dt.paint_line["line-opacity"]),"line-color":new Ir(Dt.paint_line["line-color"]),"line-translate":new kr(Dt.paint_line["line-translate"]),"line-translate-anchor":new kr(Dt.paint_line["line-translate-anchor"]),"line-width":new Ir(Dt.paint_line["line-width"]),"line-gap-width":new Ir(Dt.paint_line["line-gap-width"]),"line-offset":new Ir(Dt.paint_line["line-offset"]),"line-blur":new Ir(Dt.paint_line["line-blur"]),"line-dasharray":new Ir(Dt.paint_line["line-dasharray"]),"line-pattern":new Ir(Dt.paint_line["line-pattern"]),"line-pattern-cross-fade":new kr(Dt.paint_line["line-pattern-cross-fade"]),"line-gradient":new Hg(Dt.paint_line["line-gradient"]),"line-trim-offset":new kr(Dt.paint_line["line-trim-offset"]),"line-trim-fade-range":new kr(Dt.paint_line["line-trim-fade-range"]),"line-trim-color":new kr(Dt.paint_line["line-trim-color"]),"line-emissive-strength":new Ir(Dt.paint_line["line-emissive-strength"]),"line-border-width":new Ir(Dt.paint_line["line-border-width"]),"line-border-color":new Ir(Dt.paint_line["line-border-color"]),"line-occlusion-opacity":new kr(Dt.paint_line["line-occlusion-opacity"]),"line-color-use-theme":new Ir({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new Ir({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new Ir({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new Ir({type:"string",default:"default","property-type":"data-driven"})}))},Yae);class lqe extends Ir{possiblyEvaluate(l,u){return u=new Qi(Math.floor(u.zoom),{now:u.now,fadeDuration:u.fadeDuration,transition:u.transition,worldview:u.worldview}),super.possiblyEvaluate(l,u)}evaluate(l,u,g,x){return u=Object.assign({},u,{zoom:Math.floor(u.zoom)}),super.evaluate(l,u,g,x)}}let AM;function hve(h,l){return l>0?l+2*h:h}const cqe=ks([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),dqe=ks([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),uqe=ks([{name:"a_projected_pos",components:4,type:"Float32"}],4);ks([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const hqe=ks([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),fqe=ks([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),pqe=ks([{name:"a_texb",components:2,type:"Uint16"}]),mqe=ks([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),gqe=ks([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);ks([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const fve=ks([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),yqe=ks([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);ks([{name:"triangle",components:3,type:"Uint16"}]),ks([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"},{type:"Uint8",name:"flipState"}]),ks([{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Float32",name:"zOffset"},{type:"Uint8",name:"hasIconTextFit"},{type:"Uint16",name:"elevationFeatureIndex"}]),ks([{type:"Float32",name:"offsetX"}]),ks([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var cl=24;function xqe(h,l,u){return h.sections.forEach(g=>{g.text=function(x,j,N){const E=j.layout.get("text-transform").evaluate(N,{});return E==="uppercase"?x=x.toLocaleUpperCase():E==="lowercase"&&(x=x.toLocaleLowerCase()),fp.applyArabicShaping&&(x=fp.applyArabicShaping(x)),x}(g.text,l,u)}),h}const EM={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function vqe(h){return h==="︶"||h==="﹈"||h==="︸"||h==="﹄"||h==="﹂"||h==="︾"||h==="︼"||h==="︺"||h==="︘"||h==="﹀"||h==="︐"||h==="︓"||h==="︔"||h==="`"||h===" ̄"||h==="︑"||h==="︒"}function _qe(h){return h==="︵"||h==="﹇"||h==="︷"||h==="﹃"||h==="﹁"||h==="︽"||h==="︻"||h==="︹"||h==="︗"||h==="︿"}const Xae=4294967296,pve=1/Xae,mve=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");let KP=class{constructor(h=new Uint8Array(16)){this.buf=ArrayBuffer.isView(h)?h:new Uint8Array(h),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(h,l,u=this.length){for(;this.pos>3,j=this.pos;this.type=7&g,h(x,l,this),this.pos===j&&this.skip(g)}return l}readMessage(h,l){return this.readFields(h,l,this.readVarint()+this.pos)}readFixed32(){const h=this.dataView.getUint32(this.pos,!0);return this.pos+=4,h}readSFixed32(){const h=this.dataView.getInt32(this.pos,!0);return this.pos+=4,h}readFixed64(){const h=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Xae;return this.pos+=8,h}readSFixed64(){const h=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Xae;return this.pos+=8,h}readFloat(){const h=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,h}readDouble(){const h=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,h}readVarint(h){const l=this.buf;let u,g;return g=l[this.pos++],u=127&g,g<128?u:(g=l[this.pos++],u|=(127&g)<<7,g<128?u:(g=l[this.pos++],u|=(127&g)<<14,g<128?u:(g=l[this.pos++],u|=(127&g)<<21,g<128?u:(g=l[this.pos],u|=(15&g)<<28,function(x,j,N){const E=N.buf;let R,B;if(B=E[N.pos++],R=(112&B)>>4,B<128||(B=E[N.pos++],R|=(127&B)<<3,B<128)||(B=E[N.pos++],R|=(127&B)<<10,B<128)||(B=E[N.pos++],R|=(127&B)<<17,B<128)||(B=E[N.pos++],R|=(127&B)<<24,B<128)||(B=E[N.pos++],R|=(1&B)<<31,B<128))return uN(x,R,j);throw new Error("Expected varint not more than 10 bytes")}(u,h,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const h=this.readVarint();return h%2==1?(h+1)/-2:h/2}readBoolean(){return!!this.readVarint()}readString(){const h=this.readVarint()+this.pos,l=this.pos;return this.pos=h,h-l>=12&&mve?mve.decode(this.buf.subarray(l,h)):function(u,g,x){let j="",N=g;for(;N239?4:E>223?3:E>191?2:1;if(N+X>x)break;X===1?E<128&&(G=E):X===2?(R=u[N+1],(192&R)==128&&(G=(31&E)<<6|63&R,G<=127&&(G=null))):X===3?(R=u[N+1],B=u[N+2],(192&R)==128&&(192&B)==128&&(G=(15&E)<<12|(63&R)<<6|63&B,(G<=2047||G>=55296&&G<=57343)&&(G=null))):X===4&&(R=u[N+1],B=u[N+2],H=u[N+3],(192&R)==128&&(192&B)==128&&(192&H)==128&&(G=(15&E)<<18|(63&R)<<12|(63&B)<<6|63&H,(G<=65535||G>=1114112)&&(G=null))),G===null?(G=65533,X=1):G>65535&&(G-=65536,j+=String.fromCharCode(G>>>10&1023|55296),G=56320|1023&G),j+=String.fromCharCode(G),N+=X}return j}(this.buf,l,h)}readBytes(){const h=this.readVarint()+this.pos,l=this.buf.subarray(this.pos,h);return this.pos=h,l}readPackedVarint(h=[],l){const u=this.readPackedEnd();for(;this.pos127;);else if(l===2)this.pos=this.readVarint()+this.pos;else if(l===5)this.pos+=4;else{if(l!==1)throw new Error(`Unimplemented type: ${l}`);this.pos+=8}}writeTag(h,l){this.writeVarint(h<<3|l)}realloc(h){let l=this.length||16;for(;l268435455||h<0?function(l,u){let g,x;if(l>=0?(g=l%4294967296|0,x=l/4294967296|0):(g=~(-l%4294967296),x=~(-l/4294967296),4294967295^g?g=g+1|0:(g=0,x=x+1|0)),l>=18446744073709552e3||l<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");u.realloc(10),function(j,N,E){E.buf[E.pos++]=127&j|128,j>>>=7,E.buf[E.pos++]=127&j|128,j>>>=7,E.buf[E.pos++]=127&j|128,j>>>=7,E.buf[E.pos++]=127&j|128,E.buf[E.pos]=127&(j>>>=7)}(g,0,u),function(j,N){const E=(7&j)<<4;N.buf[N.pos++]|=E|((j>>>=3)?128:0),j&&(N.buf[N.pos++]=127&j|((j>>>=7)?128:0),j&&(N.buf[N.pos++]=127&j|((j>>>=7)?128:0),j&&(N.buf[N.pos++]=127&j|((j>>>=7)?128:0),j&&(N.buf[N.pos++]=127&j|((j>>>=7)?128:0),j&&(N.buf[N.pos++]=127&j)))))}(x,u)}(h,this):(this.realloc(4),this.buf[this.pos++]=127&h|(h>127?128:0),h<=127||(this.buf[this.pos++]=127&(h>>>=7)|(h>127?128:0),h<=127||(this.buf[this.pos++]=127&(h>>>=7)|(h>127?128:0),h<=127||(this.buf[this.pos++]=h>>>7&127))))}writeSVarint(h){this.writeVarint(h<0?2*-h-1:2*h)}writeBoolean(h){this.writeVarint(+h)}writeString(h){h=String(h),this.realloc(4*h.length),this.pos++;const l=this.pos;this.pos=function(g,x,j){for(let N,E,R=0;R55295&&N<57344){if(!E){N>56319||R+1===x.length?(g[j++]=239,g[j++]=191,g[j++]=189):E=N;continue}if(N<56320){g[j++]=239,g[j++]=191,g[j++]=189,E=N;continue}N=E-55296<<10|N-56320|65536,E=null}else E&&(g[j++]=239,g[j++]=191,g[j++]=189,E=null);N<128?g[j++]=N:(N<2048?g[j++]=N>>6|192:(N<65536?g[j++]=N>>12|224:(g[j++]=N>>18|240,g[j++]=N>>12&63|128),g[j++]=N>>6&63|128),g[j++]=63&N|128)}return j}(this.buf,h,this.pos);const u=this.pos-l;u>=128&&gve(l,u,this),this.pos=l-1,this.writeVarint(u),this.pos+=u}writeFloat(h){this.realloc(4),this.dataView.setFloat32(this.pos,h,!0),this.pos+=4}writeDouble(h){this.realloc(8),this.dataView.setFloat64(this.pos,h,!0),this.pos+=8}writeBytes(h){const l=h.length;this.writeVarint(l),this.realloc(l);for(let u=0;u=128&&gve(u,g,this),this.pos=u-1,this.writeVarint(g),this.pos+=g}writeMessage(h,l,u){this.writeTag(h,2),this.writeRawMessage(l,u)}writePackedVarint(h,l){l.length&&this.writeMessage(h,bqe,l)}writePackedSVarint(h,l){l.length&&this.writeMessage(h,wqe,l)}writePackedBoolean(h,l){l.length&&this.writeMessage(h,Nqe,l)}writePackedFloat(h,l){l.length&&this.writeMessage(h,jqe,l)}writePackedDouble(h,l){l.length&&this.writeMessage(h,kqe,l)}writePackedFixed32(h,l){l.length&&this.writeMessage(h,Sqe,l)}writePackedSFixed32(h,l){l.length&&this.writeMessage(h,Cqe,l)}writePackedFixed64(h,l){l.length&&this.writeMessage(h,Mqe,l)}writePackedSFixed64(h,l){l.length&&this.writeMessage(h,Tqe,l)}writeBytesField(h,l){this.writeTag(h,2),this.writeBytes(l)}writeFixed32Field(h,l){this.writeTag(h,5),this.writeFixed32(l)}writeSFixed32Field(h,l){this.writeTag(h,5),this.writeSFixed32(l)}writeFixed64Field(h,l){this.writeTag(h,1),this.writeFixed64(l)}writeSFixed64Field(h,l){this.writeTag(h,1),this.writeSFixed64(l)}writeVarintField(h,l){this.writeTag(h,0),this.writeVarint(l)}writeSVarintField(h,l){this.writeTag(h,0),this.writeSVarint(l)}writeStringField(h,l){this.writeTag(h,2),this.writeString(l)}writeFloatField(h,l){this.writeTag(h,5),this.writeFloat(l)}writeDoubleField(h,l){this.writeTag(h,1),this.writeDouble(l)}writeBooleanField(h,l){this.writeVarintField(h,+l)}};function uN(h,l,u){return u?4294967296*l+(h>>>0):4294967296*(l>>>0)+(h>>>0)}function gve(h,l,u){const g=l<=16383?1:l<=2097151?2:l<=268435455?3:Math.floor(Math.log(l)/(7*Math.LN2));u.realloc(g);for(let x=u.pos-1;x>=h;x--)u.buf[x+g]=u.buf[x]}function bqe(h,l){for(let u=0;u=0&&g>=l&&ZP[this.text.charCodeAt(g)];g--)u--;this.text=this.text.substring(l,u),this.sectionIndex=this.sectionIndex.slice(l,u)}substring(l,u){const g=new hN;return g.text=this.text.substring(l,u),g.sectionIndex=this.sectionIndex.slice(l,u),g.sections=this.sections,g}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((l,u)=>Math.max(l,this.sections[u].scale),0)}addTextSection(l,u){this.text+=l.text,this.sections.push(IM.forText(l.scale,l.fontStack||u));const g=this.sections.length-1;for(let x=0;x=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Jae(h,l,u,g,x,j,N,E,R,B,H,G,X,J,ne,pe=1){const ke=hN.fromFeature(h,x,pe);G===lu.vertical&&ke.verticalizePunctuation(X);let we=[];const De=function(pt,wt,Ct,Wt,Lt,Qt){if(!pt)return[];const ar=[],or=function(fr,Xt,Gt,pr,Tr,br){let dn=0;for(let Rr=0;Rr=0;let xr=0;for(let fr=0;fr0&&ti>Yn&&(Yn=ti)}else{const Ks=Ct[yr.fontStack];if(!Ks)continue;Ks[Lr]&&(Kn=Ks[Lr]);const ei=wt[yr.fontStack];if(!ei)continue;const ti=ei.glyphs[Lr];if(!ti)continue;if(mn=ti.metrics,ds=Lr!==8203?cl:0,br){const _i=ei.ascender!==void 0?Math.abs(ei.ascender):0,$i=ei.descender!==void 0?Math.abs(ei.descender):0,Ii=(_i+$i)*hn;Ei-u/2;){if(N--,N<0)return!1;E-=h[N].dist(j),j=h[N]}E+=h[N].dist(h[N+1]),N++;const R=[];let B=0;for(;Eg;)B-=R.shift().angleDelta;if(B>x)return!1;N++,E+=H.dist(G)}return!0}function Cve(h){let l=0;for(let u=0;uB){const ne=(B-R)/J,pe=Dn(G.x,X.x,ne),ke=Dn(G.y,X.y,ne),we=new Jg(pe,ke,0,X.angleTo(G),H);return!N||Sve(h,we,E,N,l)?we:void 0}R+=J}}function Dqe(h,l,u,g,x,j,N,E,R){const B=Mve(g,j,N),H=Tve(g,x),G=H*N,X=h[0].x===0||h[0].x===R||h[0].y===0||h[0].y===R;return l-G=0&&He=0&&dt=0&&X+B<=H){const it=new Jg(He,dt,0,De,ne);g&&!Sve(h,it,j,g,x)||J.push(it)}}G+=we}return E||J.length||N||(J=Ave(h,G/2,u,g,x,j,N,!0,R)),J}function Eve(h){let l=0,u=0;for(const N of h)l+=N.w*N.h,u=Math.max(u,N.w);h.sort((N,E)=>E.h-N.h);const g=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(l/.95)),u),h:1/0}];let x=0,j=0;for(const N of h)for(let E=g.length-1;E>=0;E--){const R=g[E];if(!(N.w>R.w||N.h>R.h)){if(N.x=R.x,N.y=R.y,j=Math.max(j,N.y+N.h),x=Math.max(x,N.x+N.w),N.w===R.w&&N.h===R.h){const B=g.pop();B&&E1?ne-1:ne,fc.copy(G.data,B,{x:0,y:0},{x:pe,y:ke},G.data,g),fc.copy(G.data,B,{x:0,y:De-ne},{x:pe,y:ke-ne},{width:we,height:ne},g),fc.copy(G.data,B,{x:0,y:0},{x:pe,y:ke+De},{width:we,height:ne},g),fc.copy(G.data,B,{x:we-ne,y:0},{x:pe-ne,y:ke},{width:ne,height:De},g),fc.copy(G.data,B,{x:0,y:0},{x:pe+we,y:ke},{width:ne,height:De},g),fc.copy(G.data,B,{x:we-ne,y:De-ne},{x:pe-ne,y:ke-ne},{width:ne,height:ne},g),fc.copy(G.data,B,{x:0,y:De-ne},{x:pe+we,y:ke-ne},{width:ne,height:ne},g),fc.copy(G.data,B,{x:0,y:0},{x:pe+we,y:ke+De},{width:ne,height:ne},g),fc.copy(G.data,B,{x:we-ne,y:0},{x:pe-ne,y:ke+De},{width:ne,height:ne},g)}this.lut=g,this.image=B,this.iconPositions=x,this.patternPositions=j}addImages(l,u,g,x){for(const[j,N]of l.entries()){const{bin:E,imagePosition:R,imageVariant:B}=soe(j,N,g);u.set(j,R),x.push(E),N.hasRenderCallback&&this.haveRenderCallbacks.push(B.id)}}patchUpdatedImages(l,u,g){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(x=>l.hasImage(x,g)),l.dispatchRenderCallbacks(this.haveRenderCallbacks,g);for(const x of l.getUpdatedImages(g)){for(const j of this.iconPositions.keys()){const N=ap.parse(j);if(Cc.isEqual(N.id,x)){const E=l.getImage(x,g);this.patchUpdatedImage(this.iconPositions.get(j),E,u,null)}}for(const j of this.patternPositions.keys()){const N=ap.parse(j);if(Cc.isEqual(N.id,x)){const E=l.getImage(x,g);this.patchUpdatedImage(this.patternPositions.get(j),E,u,this.lut)}}}}patchUpdatedImage(l,u,g,x=null){if(!l||!u||l.version===u.version)return;l.version=u.version;const[j,N]=l.tl,E=l.sdf;if(this.lut||E){const R={width:u.data.width,height:u.data.height},B=new fc(R);fc.copy(u.data,B,{x:0,y:0},{x:0,y:0},R,x,E),g.update(B,{position:{x:j,y:N}})}else g.update(u.data,{position:{x:j,y:N}})}}Yr(PM,"ImagePosition"),Yr(Ive,"ImageAtlas");const LM=1e20;function Pve(h,l,u,g,x,j,N,E,R){for(let B=l;B-1);R++,j[R]=E,N[R]=B,N[R+1]=LM}for(let E=0,R=0;E{let R=this.entries[j];R||(R=this.entries[j]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let B=R.glyphs[N];if(B!==void 0)return void E(null,{stack:j,id:N,glyph:B});if(B=this._tinySDF(R,j,N),B)return R.glyphs[N]=B,void E(null,{stack:j,id:N,glyph:B});const H=Math.floor(N/256);if(256*H>65535)return Br("glyphs > 65535 not supported"),void E(null,{stack:j,id:N,glyph:B});if(R.ranges[H])return void E(null,{stack:j,id:N,glyph:B});let G=R.requests[H];G||(G=R.requests[H]=[],mN.loadGlyphRange(j,H,x,this.requestManager,(X,J)=>{if(J){R.ascender=J.ascender,R.descender=J.descender;for(const ne in J.glyphs)this._doesCharSupportLocalGlyph(+ne)||(R.glyphs[+ne]=J.glyphs[+ne]);R.ranges[H]=!0}for(const ne of G)ne(X,J);delete R.requests[H]})),G.push((X,J)=>{X?E(X):J&&E(null,{stack:j,id:N,glyph:J.glyphs[N]||null})})},(j,N)=>{if(j)u(j);else if(N){const E={};for(const{stack:R,id:B,glyph:H}of N)E[R]===void 0&&(E[R]={}),E[R].glyphs===void 0&&(E[R].glyphs={}),E[R].glyphs[B]=H&&{id:H.id,bitmap:H.bitmap.clone(),metrics:H.metrics},E[R].ascender=this.entries[R].ascender,E[R].descender=this.entries[R].descender;u(null,E)}})}_doesCharSupportLocalGlyph(l){return this.localGlyphMode!==ioe.none&&(this.localGlyphMode===ioe.all?!!this.localFontFamily:!!this.localFontFamily&&(Cn["CJK Unified Ideographs"](l)||Cn["Hangul Syllables"](l)||Cn.Hiragana(l)||Cn.Katakana(l)||Cn["CJK Symbols and Punctuation"](l)||Cn["CJK Unified Ideographs Extension A"](l)||Cn["CJK Unified Ideographs Extension B"](l)||Cn.Osage(l)))}_tinySDF(l,u,g){const x=this.localFontFamily;if(!x||!this._doesCharSupportLocalGlyph(g))return;let j=l.tinySDF;if(!j){let pe="400";/bold/i.test(u)?pe="900":/medium/i.test(u)?pe="500":/light/i.test(u)&&(pe="200"),j=l.tinySDF=new mN.TinySDF({fontFamily:x,fontWeight:pe,fontSize:24*kp,buffer:3*kp,radius:8*kp}),j.fontWeight=pe}if(this.localGlyphs[j.fontWeight][g])return this.localGlyphs[j.fontWeight][g];const N=String.fromCodePoint(g),{data:E,width:R,height:B,glyphWidth:H,glyphHeight:G,glyphLeft:X,glyphTop:J,glyphAdvance:ne}=j.draw(N);return this.localGlyphs[j.fontWeight][g]={id:g,bitmap:new Ix({width:R,height:B},E),metrics:{width:H/kp,height:G/kp,left:X/kp,top:J/kp-27,advance:ne/kp,localGlyph:!0}}}}mN.loadGlyphRange=function(h,l,u,g,x){const j=256*l,N=j+255,E=g.transformRequest(g.normalizeGlyphsURL(u).replace("{fontstack}",h).replace("{range}",`${j}-${N}`),Pg.Glyphs);zu(E,(R,B)=>{if(R)x(R);else if(B){const H={},G=function(X){return new KP(X).readFields(Aqe,{})}(B);for(const X of G.glyphs)H[X.id]=X;x(null,{glyphs:H,ascender:G.ascender,descender:G.descender})}})},mN.TinySDF=class{constructor({fontSize:h=24,buffer:l=3,radius:u=8,cutoff:g=.25,fontFamily:x="sans-serif",fontWeight:j="normal",fontStyle:N="normal",lang:E=null}={}){this.buffer=l,this.cutoff=g,this.radius=u,this.lang=E;const R=this.size=h+4*l,B=this._createCanvas(R),H=this.ctx=B.getContext("2d",{willReadFrequently:!0});H.font=`${N} ${j} ${h}px ${x}`,H.textBaseline="alphabetic",H.textAlign="left",H.fillStyle="black",this.gridOuter=new Float64Array(R*R),this.gridInner=new Float64Array(R*R),this.f=new Float64Array(R),this.z=new Float64Array(R+1),this.v=new Uint16Array(R)}_createCanvas(h){const l=document.createElement("canvas");return l.width=l.height=h,l}draw(h){const{width:l,actualBoundingBoxAscent:u,actualBoundingBoxDescent:g,actualBoundingBoxLeft:x,actualBoundingBoxRight:j}=this.ctx.measureText(h),N=Math.ceil(u),E=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(j-x))),R=Math.min(this.size-this.buffer,N+Math.ceil(g)),B=E+2*this.buffer,H=R+2*this.buffer,G=Math.max(B*H,0),X=new Uint8ClampedArray(G),J={data:X,width:B,height:H,glyphWidth:E,glyphHeight:R,glyphTop:N,glyphLeft:0,glyphAdvance:l};if(E===0||R===0)return J;const{ctx:ne,buffer:pe,gridInner:ke,gridOuter:we}=this;this.lang&&(ne.lang=this.lang),ne.clearRect(pe,pe,E,R),ne.fillText(h,pe,pe+N);const De=ne.getImageData(pe,pe,E,R);we.fill(LM,0,G),ke.fill(0,0,G);for(let Be=0;Be0?pt*pt:0,ke[it]=pt<0?pt*pt:0}}Pve(we,0,0,B,H,B,this.f,this.v,this.z),Pve(ke,pe,pe,E,R,B,this.f,this.v,this.z);for(let Be=0;Be{const gr=QP(Lt.stretch-De,Be,H,h.left*x),xr=JP(Lt.fixed-it,pt,Lt.stretch,ne),hr=QP(Qt.stretch-He,dt,G,h.top*x),fr=JP(Qt.fixed-wt,Ct,Qt.stretch,pe),Xt=QP(ar.stretch-De,Be,H,h.left*x),Gt=JP(ar.fixed-it,pt,ar.stretch,ne),pr=QP(or.stretch-He,dt,G,h.top*x),Tr=JP(or.fixed-wt,Ct,or.stretch,pe),br=new sr(gr,hr),dn=new sr(Xt,hr),Rr=new sr(Xt,pr),Vr=new sr(gr,pr),tn=new sr(xr/E,fr/E),us=new sr(Gt/E,Tr/E),jr=l*Math.PI/180;if(jr){const Ei=Math.sin(jr),at=Math.cos(jr),ut=[at,-Ei,Ei,at];br._matMult(ut),dn._matMult(ut),Vr._matMult(ut),Rr._matMult(ut)}const rn=Lt.stretch+Lt.fixed,Bn=ar.stretch+ar.fixed,Es=Qt.stretch+Qt.fixed,Rs=or.stretch+or.fixed,Yn=h.imageSecondary;return{tl:br,tr:dn,bl:Vr,br:Rr,texPrimary:{x:N.paddedRect.x+Rm+rn,y:N.paddedRect.y+Rm+Es,w:Bn-rn,h:Rs-Es},texSecondary:Yn?{x:Yn.paddedRect.x+Rm+rn,y:Yn.paddedRect.y+Rm+Es,w:Bn-rn,h:Rs-Es}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:tn,pixelOffsetBR:us,minFontScaleX:pt/E/H,minFontScaleY:Ct/E/G,isSDF:u}};if(g&&(N.stretchX||N.stretchY)){const Lt=Dve(X,ke,ne),Qt=Dve(J,we,pe);for(let ar=0;arj)&&(j=ne.x),(!J||ne.y>N)&&(N=ne.y)}const R=Math.min(j-g,N-x);let B=R/2;const H=new ik([],Bqe);if(R===0)return new sr(g,x);for(let J=g;JG.d||!G.d)&&(G=J,u&&console.log("found best %d after %d probes",Math.round(1e4*J.d)/1e4,X)),J.max-G.d<=l||(B=J.h/2,H.push(new gN(J.p.x-B,J.p.y-B,B,h)),H.push(new gN(J.p.x+B,J.p.y-B,B,h)),H.push(new gN(J.p.x-B,J.p.y+B,B,h)),H.push(new gN(J.p.x+B,J.p.y+B,B,h)),X+=4)}return u&&(console.log(`num probes: ${X}`),console.log(`best distance: ${G.d}`)),G.p}function Bqe(h,l){return l.max-h.max}class gN{constructor(l,u,g,x){this.p=new sr(l,u),this.h=g,this.d=function(j,N){let E=!1,R=1/0;for(let B=0;Bj.y!=pe.y>j.y&&j.x<(pe.x-ne.x)*(j.y-ne.y)/(pe.y-ne.y)+ne.x&&(E=!E),R=Math.min(R,Za(j,ne,pe))}}return(E?1:-1)*Math.sqrt(R)}(this.p,x),this.max=this.d+this.h*Math.SQRT2}}const $qe=Object.keys,ooe=Number.POSITIVE_INFINITY,Uqe=Math.sqrt(2);function Lx(h,l,u,g,x){const j=toe(h)&&h.collisionPadding?h.collisionPadding:[0,0,0,0],N={top:h.top-j[1],bottom:h.bottom+j[3],left:h.left-j[0],right:h.right+j[2],scaled:!1};return g!==void 0&&function(E,R){E.top*=R,E.bottom*=R,E.left*=R,E.right*=R,E.scaled=!0}(N,g),u&&function(E,R){if(!R)return;const B=Qr(R),H=new sr(E.left,E.top),G=new sr(E.right,E.top),X=new sr(E.left,E.bottom),J=new sr(E.right,E.bottom),ne=new sr(0,0);H._rotateAround(B,ne),G._rotateAround(B,ne),X._rotateAround(B,ne),J._rotateAround(B,ne),E.left=Math.min(H.x,G.x,X.x,J.x),E.right=Math.max(H.x,G.x,X.x,J.x),E.top=Math.min(H.y,G.y,X.y,J.y),E.bottom=Math.max(H.y,G.y,X.y,J.y)}(N,u),x&&(N.left+=x[0],N.right+=x[0],N.top+=x[1],N.bottom+=x[1]),l?{top:Math.min(l.top,N.top),bottom:Math.max(l.bottom,N.bottom),left:Math.min(l.left,N.left),right:Math.max(l.right,N.right),scaled:l.scaled||N.scaled}:N}function Fve(h,[l,u]){let g=0,x=0;if(u===ooe){l<0&&(l=0);const j=l/Uqe;switch(h){case"top-right":case"top-left":x=j-7;break;case"bottom-right":case"bottom-left":x=7-j;break;case"bottom":x=7-l;break;case"top":x=l-7}switch(h){case"top-right":case"bottom-right":g=-j;break;case"top-left":case"bottom-left":g=j;break;case"left":g=l;break;case"right":g=-l}}else{switch(l=Math.abs(l),u=Math.abs(u),h){case"top-right":case"top-left":case"top":x=u-7;break;case"bottom-right":case"bottom-left":case"bottom":x=7-u}switch(h){case"top-right":case"bottom-right":case"right":g=-l;break;case"top-left":case"bottom-left":case"left":g=l}}return[g,x]}function qqe(h,l,u,g,x,j,N,E,R,B,H,G,X,J){const ne=h.layers[0],pe=ne.appearances;if(pe.length===0)return{iconBBox:null,iconVerticalBBox:null,textBBox:null,textVerticalBBox:null};const ke={iconBBox:null,iconVerticalBBox:null},we={textBBox:null,textVerticalBBox:null},{baseIconRotate:De,baseTextRotate:Be,iconScaleFactor:He}=function(it,pt,wt){const Ct=it.get("icon-rotate").evaluate(pt,{},wt),Wt=it.get("text-rotate").evaluate(pt,{},wt),[Lt,Qt]=it.get("icon-size-scale-range");return{baseIconRotate:Ct,baseTextRotate:Wt,iconScaleFactor:_e(1,Lt,Qt)}}(g,x,j);l&&(ke.iconBBox=Lx(l,ke.iconBBox,De,N),u)&&(ke.iconVerticalBBox=Lx(u,ke.iconVerticalBBox,De+90,N));const dt=t6(G.horizontal);dt&&(we.textBBox=Lx(dt,we.textBBox,Be,1,J)),G.vertical&&(we.textVerticalBBox=Lx(G.vertical,we.textVerticalBBox,Be+90,1,J));for(const it of pe)it.hasIconProperties()&&Vqe(ke,h,ne,it,x,j,E,De,N,R,l,B,He,H),it.hasTextProperties()&&Hqe(we,ne,it,x,j,J,Be,X,dt,G.vertical);return{iconBBox:ke.iconBBox,iconVerticalBBox:ke.iconVerticalBBox,textBBox:we.textBBox,textVerticalBBox:we.textVerticalBBox}}function Vqe(h,l,u,g,x,j,N,E,R,B,H,G,X,J){const{appearanceIconOffset:ne,appearanceIconRotate:pe,appearanceIconSize:ke}=function(He,dt,it,pt,wt,Ct,Wt,Lt){const Qt=He.hasProperty("icon-offset")?dt.getAppearanceValueAndResolveTokens(He,"icon-offset",it,pt,[]):null,ar=Qt&&Array.isArray(Qt)?Qt:wt,or=He.hasProperty("icon-rotate")?dt.getAppearanceValueAndResolveTokens(He,"icon-rotate",it,pt,[]):null,gr=typeof or=="number"?or:Ct,xr=He.hasProperty("icon-size")?dt.getAppearanceValueAndResolveTokens(He,"icon-size",it,pt,[]):null;return{appearanceIconOffset:ar,appearanceIconRotate:gr,appearanceIconSize:typeof xr=="number"?xr*Lt.iconScaleFactor:Wt}}(g,u,x,j,N,E,R,B);let we=null,De=null,Be=null;g.hasProperty("icon-image")?Be=function(He,dt,it,pt,wt,Ct,Wt){let Lt=null;const Qt=dt.getAppearanceValueAndResolveTokens(it,"icon-image",pt,wt,[]);if(Qt){const ar=He.getResolvedImageFromTokens(Qt),or=it.getUnevaluatedProperty("icon-size"),gr=OM(ar,fN(He.zoom,or,He.worldview),or,wt,He.zoom,pt,He.pixelRatio,Wt,He.worldview);Lt=Ct.get(gr.iconPrimary.toString())}return Lt}(l,u,g,x,j,G,X):H&&(Be=H.imagePrimary),Be&&(we=YP(Be,null,ne,J),l.allowVerticalPlacement&&(De=YP(Be,null,ne,J))),we&&(h.iconBBox=Lx(we,h.iconBBox,pe,ke)),De&&(h.iconVerticalBBox=Lx(De,h.iconVerticalBBox,pe+90,ke))}function Hqe(h,l,u,g,x,j,N,E,R,B){const{appearanceTextOffset:H,appearanceTextRotate:G,appearanceTextSize:X}=function(ne,pe,ke,we,De,Be,He){const dt=ne.hasProperty("text-offset")?pe.getAppearanceValueAndResolveTokens(ne,"text-offset",ke,we,[]):null,it=dt&&Array.isArray(dt)?[dt[0]*cl,dt[1]*cl]:De,pt=ne.hasProperty("text-rotate")?pe.getAppearanceValueAndResolveTokens(ne,"text-rotate",ke,we,[]):null,wt=typeof pt=="number"?pt:Be,Ct=ne.hasProperty("text-size")?pe.getAppearanceValueAndResolveTokens(ne,"text-size",ke,we,[]):null;return{appearanceTextOffset:it,appearanceTextRotate:wt,appearanceTextSize:typeof Ct=="number"?Ct:He}}(u,l,g,x,j,N,E),J=X/E;R&&(h.textBBox=Lx(R,h.textBBox,G,J,H)),B&&(h.textVerticalBBox=Lx(B,h.textVerticalBBox,G+90,J,H))}function e6(h,l,u,g,x,j,N,E,R){if(!l||!l.usvg)return;const B=Nve(g),H=Nve(x),G=j!=="both"&&j!=="width"||!jve(g)?1:H.width/B.width,X=j!=="both"&&j!=="height"||!kve(g)?1:H.height/B.height;u.scaleSelf(G,X);const J=u.toString();N.set(J,u),E.set(J,l);const{imagePosition:ne}=soe(J,l,Cv);R.set(J,ne)}function zve(h,l,u,g,x,j,N,E,R){if(!h)return;const B=function(H,G,X,J,ne,pe){if(H.kind==="camera")return H.maxSize;if(H.kind==="composite"){const ke=G.possiblyEvaluate(new Qi(H.maxZoom,{worldview:pe}),X).evaluate(ne,{},X),we=G.possiblyEvaluate(new Qi(H.minZoom,{worldview:pe}),X).evaluate(ne,{},X);return Math.max(ke,we)}return G.possiblyEvaluate(new Qi(J,{worldview:pe})).evaluate(ne,{},X)}(l,u,g,x,j,R);return h.scaleSelf(B*E*N)}function OM(h,l,u,g,x,j,N,E,R){return{iconPrimary:zve(h.getPrimary(),l,u,g,x,j,N,E,R),iconSecondary:zve(h.getSecondary(),l,u,g,x,j,N,E,R)}}function Wqe(h,l,u){if(!l)return;const g=u.get(h.toString()),x=u.get(l.toString());g&&x&&(g.paddedRect.w===x.paddedRect.w&&g.paddedRect.h===x.paddedRect.h||Br(`Mismatch in icon variant sizes: ${h.toString()} and ${l.toString()}`),g.usvg!==x.usvg&&Br(`Mismatch in icon variant image types: ${h.id} and ${l.id}`))}function Bve(h,l,u,g){if(!h)return;const x=l.get(u.toString());if(h.imagePrimary=x,g){const j=l.get(g.toString());h.imageSecondary=j}}function Gqe(h,l){for(const u in h.horizontal)$ve(h.horizontal[u],l);$ve(h.vertical,l)}function $ve(h,l){if(h){for(const u of h.positionedLines)for(const g of u.positionedGlyphs)if(g.image!==null){const x=g.image.toString();g.rect=l.get(x).paddedRect}}}function loe(h){switch(h){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Kqe(h,l,u,g,x,j,N,E,R){const B=t6(j.horizontal)||j.vertical,H=u.get("icon-text-fit-padding").evaluate(g,{},x);let G,X=l;return l&&R!=="none"&&(h.allowVerticalPlacement&&j.vertical&&(G=roe(l,j.vertical,R,H,E,N)),B&&(X=roe(l,B,R,H,E,N))),{defaultShapedIcon:X,verticallyShapedIcon:G}}function Zqe(h,l,u,g,x,j,N,E,R,B,H,G,X,J,ne,pe,ke,we,De,Be,He,dt,it,pt){let wt=N.textMaxSize.evaluate(l,{},X);wt===void 0?wt=E*N.textScaleFactor:wt*=N.textScaleFactor;const Ct=h.layers[0].layout,Wt=cl,Lt=E*N.textScaleFactor/Wt,Qt=t6(u.horizontal)||u.vertical;if(ke!=="none"&&h.appearanceFeatureData&&l.index18&&pr>2&&(pr>>=1),Math.max(Cr/(512*pr),1)*Ct.get("symbol-spacing")),xr=Ct.get("text-padding")*h.tilePixelRatio,hr=Ct.get("icon-padding")*h.tilePixelRatio,fr=Qr(Ct.get("text-max-angle")),Xt=Ct.get("icon-rotation-alignment")==="map"&&Be!=="point",Gt=gr/2;var pr;h.hasAnyIconTextFit===!1&&ke!=="none"&&(h.hasAnyIconTextFit=!0);const Tr=l.properties?+l.properties[Kt]:null,br=Tr&&h.elevationFeatureIdToIndex?h.elevationFeatureIdToIndex.get(Tr):65535,dn=(Rr,Vr,tn)=>{if(Vr.x<0||Vr.x>=Cr||Vr.y<0||Vr.y>=Cr)return;let us=null;if(ar){const{x:jr,y:rn,z:Bn}=J.projectTilePoint(Vr.x,Vr.y,tn);us={anchor:new Jg(jr,rn,Bn,0,void 0),up:J.upVector(tn,Vr.x,Vr.y)}}(function(jr,rn,Bn,Es,Rs,Yn,Ei,at,ut,Jt,yr,Pr,Lr,hn,mn,Kn,ns,ds,Ns,En,zn,Ks,ei,ti,_i,$i,Ii,oi,fi,ss,Os,va,Mn){const Ss=jr.addToLineVertexArray(rn,Es);let Ri,Vi,Ji,no,Zi,Tn,Sa,bi=0,ha=0,Bo=0,dl=0,No=-1,So=-1;const tl={};let xd=Gj("");const Yi=Bn?Bn.anchor:rn,Ya=oi!=="none";let so=0,Od=0;if(ut._unevaluatedLayout.getValue("text-radial-offset")===void 0){const Ql=ut.layout.get("text-offset").evaluate(zn,{},_i);so=Ql[0]*cl,Od=Ql[1]*cl}else so=ut.layout.get("text-radial-offset").evaluate(zn,{},_i)*cl,Od=ooe;if(jr.allowVerticalPlacement&&Rs.vertical){const Ql=Rs.vertical;if(mn)Tn=coe(Ql),at&&(Sa=coe(at));else{const Yc=ut.layout.get("text-rotate").evaluate(zn,{},_i)+90;Ji=r6(Jt,Yi,rn,yr,Pr,Lr,Ql,hn,Yc,Kn,va),at&&(no=r6(Jt,Yi,rn,yr,Pr,Lr,at,ds,Yc,null,Os))}}if(Yn){const Ql=jr.iconSizeData,Yc=ut.layout.get("icon-rotate").evaluate(zn,{},_i),cu=aoe(Yn,Yc,ei,Ya,Ks.iconScaleFactor),Rx=at?aoe(at,Yc,ei,Ya,Ks.iconScaleFactor):void 0;Vi=r6(Jt,Yi,rn,yr,Pr,Lr,Yn,ds,Yc,null,ss);const jN=function(Mp,JM,a2e,oHe,o2e,l2e,lHe,cHe){const c2e=Mp.layers[0],d2e=c2e.appearances;let kN=JM.length;if(a2e&&(kN=Math.max(kN,a2e.length)),d2e.length===0)return kN;const[dHe,uHe]=oHe.get("icon-size-scale-range"),hHe=_e(1,dHe,uHe);for(const u2e of d2e){const h2e=u2e.getUnevaluatedProperties();if(h2e._values["icon-image"].value!==void 0){const f2e=c2e.getAppearanceValueAndResolveTokens(u2e,"icon-image",o2e,l2e,[]);if(f2e){const p2e=Mp.getResolvedImageFromTokens(f2e);if(p2e){const m2e=h2e._values["icon-size"],fHe=OM(p2e,fN(Mp.zoom,m2e,Mp.worldview),m2e,l2e,Mp.zoom,o2e,Mp.pixelRatio,hHe,Mp.worldview),pHe=lHe.get(fHe.iconPrimary.toString());kN=Math.max(kN,Rqe(pHe,cHe))}}}}return kN}(jr,cu,Rx,ut.layout,zn,_i,jr.iconAtlasPositions,Ya);bi=4*jN;let Cp=null;Ql.kind==="source"?(Cp=[jp*ut.layout.get("icon-size").evaluate(zn,{},_i)*Ks.iconScaleFactor],Cp[0]>ey&&Br(`${jr.layerIds[0]}: Value for "icon-size" is >= ${DM}. Reduce your "icon-size".`)):Ql.kind==="composite"&&(Cp=[jp*Ks.compositeIconSizes[0].evaluate(zn,{},_i)*Ks.iconScaleFactor,jp*Ks.compositeIconSizes[1].evaluate(zn,{},_i)*Ks.iconScaleFactor],(Cp[0]>ey||Cp[1]>ey)&&Br(`${jr.layerIds[0]}: Value for "icon-size" is >= ${DM}. Reduce your "icon-size".`)),jr.addSymbols(jr.icon,cu,Cp,En,Ns,zn,void 0,Bn,rn,Ss.lineStartIndex,Ss.lineLength,-1,ti,_i,$i,Ii,jr.symbolInstances.length,jN),No=jr.icon.placedSymbolArray.length-1,Rx&&(ha=4*jN,jr.addSymbols(jr.icon,Rx,Cp,En,Ns,zn,lu.vertical,Bn,rn,Ss.lineStartIndex,Ss.lineLength,-1,ti,_i,$i,Ii,jr.symbolInstances.length,jN),So=jr.icon.placedSymbolArray.length-1)}for(const Ql in Rs.horizontal){const Yc=Ql,cu=Rs.horizontal[Yc];Ri||(xd=Gj(cu.text),mn?Zi=coe(cu):Ri=r6(Jt,Yi,rn,yr,Pr,Lr,cu,hn,ut.layout.get("text-rotate").evaluate(zn,{},_i),Kn,va));const Rx=cu.positionedLines.length===1;if(Bo+=Uve(jr,Bn,rn,cu,Ei,ut,mn,zn,Kn,Ss,Rs.vertical?lu.horizontal:lu.horizontalOnly,Rx?$qe(Rs.horizontal):[Yc],tl,No,Ks,ti,_i,jr.symbolInstances.length,$i),Rx)break}Rs.vertical&&(dl+=Uve(jr,Bn,rn,Rs.vertical,Ei,ut,mn,zn,Kn,Ss,lu.vertical,["vertical"],tl,So,Ks,ti,_i,jr.symbolInstances.length,$i));let $o=-1;const pf=(Ql,Yc)=>Ql?Math.max(Ql,Yc):Yc;$o=pf(Zi,$o),$o=pf(Tn,$o),$o=pf(Sa,$o);const Fm=$o>-1?1:0;jr.glyphOffsetArray.length>=65535&&Br("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),zn.sortKey!==void 0&&jr.addToSortKeyRanges(jr.symbolInstances.length,zn.sortKey),jr.symbolInstances.emplaceBack(rn.x,rn.y,Yi.x,Yi.y,Yi.z,tl.right>=0?tl.right:-1,tl.center>=0?tl.center:-1,tl.left>=0?tl.left:-1,tl.vertical>=0?tl.vertical:-1,No,So,xd,Ri!==void 0?Ri:jr.collisionBoxArray.length,Ri!==void 0?Ri+1:jr.collisionBoxArray.length,Ji!==void 0?Ji:jr.collisionBoxArray.length,Ji!==void 0?Ji+1:jr.collisionBoxArray.length,Vi!==void 0?Vi:jr.collisionBoxArray.length,Vi!==void 0?Vi+1:jr.collisionBoxArray.length,no||jr.collisionBoxArray.length,no?no+1:jr.collisionBoxArray.length,yr,Bo,dl,bi,ha,Fm,0,so,Od,$o,0,Ya?1:0,fi)})(h,Vr,us,Rr,u,g,j,x,h.layers[0],h.collisionBoxArray,l.index,l.sourceLayerIndex,h.index,xr,De,B,0,hr,Xt,we,l,N,H,G,X,ne,pe,ke,br,He,dt,it)};if(Be==="line")for(const Rr of RP(l.geometry,0,0,Cr,Cr)){const Vr=Dqe(Rr,gr,fr,u.vertical||Qt,g,Wt,or,h.overscaling,Cr);for(const tn of Vr)Qt&&Yqe(h,Qt.text,Gt,tn)||dn(Rr,tn,X)}else if(Be==="line-center"){for(const Rr of l.geometry)if(Rr.length>1){const Vr=Oqe(Rr,fr,u.vertical||Qt,g,Wt,or);Vr&&dn(Rr,Vr,X)}}else if(l.type==="Polygon")for(const Rr of xM(l.geometry,0)){const Vr=zqe(Rr,16);dn(Rr[0],new Jg(Vr.x,Vr.y,0,0,void 0),X)}else if(l.type==="LineString")for(const Rr of l.geometry)dn(Rr,new Jg(Rr[0].x,Rr[0].y,0,0,void 0),X);else if(l.type==="Point")for(const Rr of l.geometry)for(const Vr of Rr)dn([Vr],new Jg(Vr.x,Vr.y,0,0,void 0),X)}const DM=255,ey=DM*jp;function Uve(h,l,u,g,x,j,N,E,R,B,H,G,X,J,ne,pe,ke,we,De){const Be=function(it,pt,wt,Ct,Wt,Lt,Qt,ar){const or=[];if(pt.positionedLines.length===0)return or;const gr=Ct.layout.get("text-rotate").evaluate(Lt,{})*Math.PI/180,xr=function(pr){const Tr=pr[0],br=pr[1],dn=Tr*br;return dn>0?[Tr,-br]:dn<0?[-Tr,br]:Tr===0?[br,Tr]:[br,-Tr]}(wt);let hr=Math.abs(pt.top-pt.bottom);for(const pr of pt.positionedLines)hr-=pr.lineOffset;const fr=pt.positionedLines.length,Xt=hr/fr;let Gt=pt.top-wt[1];for(let pr=0;prey&&Br(`${h.layerIds[0]}: Value for "text-size" is >= ${DM}. Reduce your "text-size".`)):He.kind==="composite"&&(dt=[jp*ne.compositeTextSizes[0].evaluate(E,{},ke)*ne.textScaleFactor,jp*ne.compositeTextSizes[1].evaluate(E,{},ke)*ne.textScaleFactor],(dt[0]>ey||dt[1]>ey)&&Br(`${h.layerIds[0]}: Value for "text-size" is >= ${DM}. Reduce your "text-size".`)),h.addSymbols(h.text,Be,dt,R,N,E,H,l,u,B.lineStartIndex,B.lineLength,J,pe,ke,De,!1,we,Be.length);for(const it of G)X[it]=h.text.placedSymbolArray.length-1;return 4*Be.length}function t6(h){for(const l in h)return h[l];return null}function r6(h,l,u,g,x,j,N,E,R,B,H){let G,X,J,ne;if(G=H?H.top:N.top,X=H?H.bottom:N.bottom,J=H?H.left:N.left,ne=H?H.right:N.right,toe(N)&&N.collisionPadding){const pe=N.collisionPadding;J-=pe[0],G-=pe[1],ne+=pe[2],X+=pe[3]}if(R){const pe=new sr(J,G),ke=new sr(ne,G),we=new sr(J,X),De=new sr(ne,X),Be=Qr(R);let He=new sr(0,0);B&&(He=new sr(B[0],B[1])),pe._rotateAround(Be,He),ke._rotateAround(Be,He),we._rotateAround(Be,He),De._rotateAround(Be,He),J=Math.min(pe.x,ke.x,we.x,De.x),ne=Math.max(pe.x,ke.x,we.x,De.x),G=Math.min(pe.y,ke.y,we.y,De.y),X=Math.max(pe.y,ke.y,we.y,De.y)}return h.emplaceBack(l.x,l.y,l.z,u.x,u.y,J,G,ne,X,E,g,x,j),h.length-1}function coe(h){toe(h)&&h.collisionPadding&&(h.top-=h.collisionPadding[1],h.bottom+=h.collisionPadding[3]);const l=h.bottom-h.top;return l>0?Math.max(10,l):null}function Yqe(h,l,u,g){const x=h.compareText;if(l in x){const j=x[l];for(let N=j.length-1;N>=0;N--)if(g.dist(j[N])Be&&(He(it,or,wt,Ct,Qt,ar),He(or,pt,Qt,ar,Wt,Lt))}He(G,X,g,j,x,j),He(X,J,x,j,x,N),He(J,ne,x,N,g,N),He(ne,G,g,N,g,j),pe-=Be,ke-=Be,we+=Be,De+=Be;const dt=1/Math.max(we-pe,De-ke);return{scale:dt,x:pe*dt,y:ke*dt,x2:we*dt,y2:De*dt,projection:l}}function Vve(h,{x:l,y:u},g=0){return new sr(((l-g)*h.scale-h.x)*Cr,(u*h.scale-h.y)*Cr)}const Xqe=T(new Float32Array(16));class Ox{constructor(l){this.spec=l,this.name=l.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(l,u){return{x:0,y:0,z:0}}unproject(l,u){return new p(0,0)}projectTilePoint(l,u,g){return{x:l,y:u,z:0}}locationPoint(l,u,g,x=!0){return l._coordinatePoint(l.locationCoordinate(u,g),x)}pixelsPerMeter(l,u){return Y(1,l)*u}pixelSpaceConversion(l,u,g){return 1}farthestPixelDistance(l){return qve(l,l.pixelsPerMeter)}pointCoordinate(l,u,g,x){const j=l.horizonLineFromTop(!1),N=new sr(u,Math.max(j,g));return l.rayIntersectionCoordinate(l.pointRayIntersection(N,x))}pointCoordinate3D(l,u,g){const x=new sr(u,g);if(l.elevation)return l.elevation.pointCoordinate(x);{const j=this.pointCoordinate(l,x.x,x.y,0);return[j.x,j.y,j.z]}}isPointAboveHorizon(l,u){if(l.elevation&&l.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(l,u.x,u.y);const g=l.horizonLineFromTop();return u.y0?u<-yN+g&&(u=-yN+g):u>yN-g&&(u=yN-g);const N=j/Math.pow(s6(u),x);let E=N*Math.sin(x*l),R=j-N*Math.cos(x*l);return E=.5*(E/Math.PI+.5),R=.5*(R/Math.PI+.5),{x:E,y:this.southernCenter?R:1-R,z:0}}unproject(l,u){l=(2*l-.5)*Math.PI,this.southernCenter&&(u=1-u),u=(2*(1-u)-.5)*Math.PI;const{n:g,f:x}=this,j=x-u,N=Math.sign(j),E=Math.sign(g)*Math.sqrt(l*l+j*j);let R=Math.atan2(l,Math.abs(j))*N;j*g<0&&(R-=Math.PI*Math.sign(l)*N);const B=_e(ba(R/g)+this.center[0],-180,180),H=_e(ba(2*Math.atan(Math.pow(x/E,1/g))-yN),-de,de);return new p(B,this.southernCenter?-H:H)}}class Hve extends Ox{constructor(l){super(l),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(l,u){return{x:z(l),y:V(u),z:0}}unproject(l,u){const g=Q(l),x=ce(u);return new p(g,x)}}const Wve=Qr(de);class rVe extends Ox{project(l,u){const g=(u=Qr(u))*u,x=g*g;return{x:.5*((l=Qr(l))*(.8707-.131979*g+x*(x*(.003971*g-.001529*x)-.013791))/Math.PI+.5),y:1-.5*(u*(1.007226+g*(.015085+x*(.028874*g-.044475-.005916*x)))/Math.PI+1),z:0}}unproject(l,u){l=(2*l-.5)*Math.PI;let g=u=(2*(1-u)-1)*Math.PI,x=25,j=0,N=g*g;do{N=g*g;const B=N*N;j=(g*(1.007226+N*(.015085+B*(.028874*N-.044475-.005916*B)))-u)/(1.007226+N*(.045255+B*(.259866*N-.311325-.005916*11*B))),g=_e(g-j,-Wve,Wve)}while(Math.abs(j)>1e-6&&--x>0);N=g*g;const E=_e(ba(l/(.8707+N*(N*(N*N*N*(.003971-.001529*N)-.013791)-.131979))),-180,180),R=ba(g);return new p(E,R)}}const Gve=Qr(de);class nVe extends Ox{project(l,u){u=Qr(u),l=Qr(l);const g=Math.cos(u),x=2/Math.PI,j=Math.acos(g*Math.cos(l/2)),N=Math.sin(j)/j,E=.5*(l*x+2*g*Math.sin(l/2)/N)||0,R=.5*(u+Math.sin(u)/N)||0;return{x:.5*(E/Math.PI+.5),y:1-.5*(R/Math.PI+1),z:0}}unproject(l,u){let g=l=(2*l-.5)*Math.PI,x=u=(2*(1-u)-1)*Math.PI,j=25;const N=1e-6;let E=0,R=0;do{const B=Math.cos(x),H=Math.sin(x),G=2*H*B,X=H*H,J=B*B,ne=Math.cos(g/2),pe=Math.sin(g/2),ke=2*ne*pe,we=pe*pe,De=1-J*ne*ne,Be=De?1/De:0,He=De?Math.acos(B*ne)*Math.sqrt(1/De):0,dt=.5*(2*He*B*pe+2*g/Math.PI)-l,it=.5*(He*H+x)-u,pt=.5*Be*(J*we+He*B*ne*X)+1/Math.PI,wt=Be*(ke*G/4-He*H*pe),Ct=.125*Be*(G*pe-He*H*J*ke),Wt=.5*Be*(X*ne+He*we*B)+.5,Lt=wt*Ct-Wt*pt;E=(it*wt-dt*Wt)/Lt,R=(dt*Ct-it*pt)/Lt,g=_e(g-E,-Math.PI,Math.PI),x=_e(x-R,-Gve,Gve)}while((Math.abs(E)>N||Math.abs(R)>N)&&--j>0);return new p(ba(g),ba(x))}}class Kve extends Ox{constructor(l){super(l),this.center=l.center||[0,0],this.parallels=l.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(Qr(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(l,u){const{scale:g,cosPhi:x}=this;return{x:Qr(l)*x*g+.5,y:-Math.sin(Qr(u))/x*g+.5,z:0}}unproject(l,u){const{scale:g,cosPhi:x}=this,j=-(u-.5)/g,N=_e(ba((l-.5)/g)/x,-180,180),E=Math.asin(_e(j*x,-1,1)),R=_e(ba(E),-de,de);return new p(N,R)}}class sVe extends Hve{constructor(l){super(l),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(l,u,g){const x=hM(l,u,g);return Xe(x,x,MP(Nh(g))),{x:x[0],y:x[1],z:x[2]}}locationPoint(l,u,g){const x=Mx(u.lat,u.lng),j=Pe([],x),N=g?l._centerAltitude+g:l.elevation?l.elevation.getAtPointOrZero(l.locationCoordinate(u),l._centerAltitude):l._centerAltitude;je(x,x,j,Y(1,0)*Cr*N);const E=T(new Float64Array(16));return A(E,l.pixelMatrix,l.globeMatrix),Xe(x,x,E),new sr(x[0],x[1])}pixelsPerMeter(l,u){return Y(1,0)*u}pixelSpaceConversion(l,u,g){const x=Y(1,l)*u,j=Dn(Y(1,45)*u,x,g);return this.pixelsPerMeter(l,u)/j}createTileMatrix(l,u,g){const x=pae(Nh(g.canonical));return A(new Float64Array(16),l.globeMatrix,x)}createInversionMatrix(l,u){const{center:g}=l,x=MP(Nh(u));return q(x,x,Qr(g.lng)),F(x,x,Qr(g.lat)),$(x,x,[l._pixelsPerMercatorPixel,l._pixelsPerMercatorPixel,1]),Float32Array.from(x)}pointCoordinate(l,u,g,x){return Ax(l,u,g,!0)||new qe(0,0)}pointCoordinate3D(l,u,g){const x=this.pointCoordinate(l,u,g,0);return[x.x,x.y,x.z]}isPointAboveHorizon(l,u){return!Ax(l,u.x,u.y,!1)}farthestPixelDistance(l){const u=function(x,j){const N=x.cameraToCenterDistance,E=x._centerAltitude*j,R=x._camera,B=x._camera.forward(),H=fe([],ae([],B,-N),[0,0,E]),G=x.worldSize/(2*Math.PI),X=[0,0,-G],J=x.width/x.height,ne=Math.tan(x.fovAboveCenter),pe=ae([],R.up(),ne),ke=ae([],R.right(),ne*J),we=Pe([],fe([],fe([],B,pe),ke)),De=[];let Be;if(new Jr(H,we).closestPointOnSphere(X,G,De)){const He=fe([],De,X),dt=Ce([],He,H);Be=Math.cos(x.fovAboveCenter)*xe(dt)}else{const He=Ce([],H,X),dt=Ce([],X,H);Pe(dt,dt);const it=xe(He)-G;Be=Math.sqrt(it*(it+2*G));const pt=Math.acos(Be/(G+it))-Math.acos(Ae(B,dt));Be*=Math.cos(pt)}return 1.01*Be}(l,this.pixelsPerMeter(l.center.lat,l.worldSize)),g=Ex(l.zoom);if(g>0){const x=qve(l,Y(1,l.center.lat)*l.worldSize),j=l.worldSize/(2*Math.PI),N=Math.max(l.width,l.height)/l.worldSize*Math.PI;return Dn(u,x+j*(1-Math.cos(N)),Math.pow(g,10))}return u}upVector(l,u,g){return hM(u,g,l,1)}upVectorScale(l){return{metersToTile:hf(CP(Nh(l)))}}}function Zve(h){const l=h.parallels,u=!!l&&Math.abs(l[0]+l[1])<.01;switch(h.name){case"mercator":return new Hve(h);case"equirectangular":return new eVe(h);case"naturalEarth":return new rVe(h);case"equalEarth":return new Jqe(h);case"winkelTripel":return new nVe(h);case"albers":return u?new Kve(h):new Qqe(h);case"lambertConformalConic":return u?new Kve(h):new tVe(h);case"globe":return new sVe(h)}throw new Error(`Invalid projection name: ${h.name}`)}const iVe=Tt.types,aVe=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function UM(h,l,u,g,x,j,N,E,R,B,H,G,X){const J=E?Math.min(ey,Math.round(E[0])):0,ne=E?Math.min(ey,Math.round(E[1])):0;h.emplaceBack(l,u,Math.round(32*g),Math.round(32*x),j,N,(J<<1)+(R?1:0),0+(ne<<1),16*B,16*H,256*G,256*X)}function qM(h,l,u){h.emplaceBack(l,u)}function VM(h,l,u,g,x,j,N){h.emplaceBack(l,u,g,x,j,N)}const i6=(h,l,u,g)=>{for(let x=0;x0&&(this.iconTransitioningVertexBuffer=l.createVertexBuffer(this.iconTransitioningVertexArray,pqe.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=l.createVertexBuffer(this.globeExtVertexArray,dqe.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||j)&&(this.zOffsetVertexBuffer=l.createVertexBuffer(this.zOffsetVertexArray,hqe.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=l.createVertexBuffer(this.orientationVertexArray,fqe.members,!0)),this.opacityVertexBuffer.itemSize=1),(g||x)&&this.programConfigurations.upload(l))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.iconTransitioningVertexBuffer&&this.iconTransitioningVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.orientationVertexBuffer&&this.orientationVertexBuffer.destroy())}}Yr(doe,"SymbolBuffers");class uoe{constructor(l,u,g){this.layoutVertexArray=new l,this.layoutAttributes=u,this.indexArray=new g,this.segments=new ja,this.collisionVertexArray=new X3,this.collisionVertexArrayExt=new Im}upload(l){this.layoutVertexBuffer=l.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=l.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=l.createVertexBuffer(this.collisionVertexArray,mqe.members,!0),this.collisionVertexBufferExt=l.createVertexBuffer(this.collisionVertexArrayExt,gqe.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}Yr(uoe,"CollisionBuffers");class a6{constructor(l){this.collisionBoxArray=l.collisionBoxArray,this.zoom=l.zoom,this.overscaling=l.overscaling,this.layers=l.layers,this.layerIds=this.layers.map(N=>N.fqid),this.index=l.index,this.pixelRatio=l.pixelRatio,this.sourceLayerIndex=l.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=T([]),this.placementViewportMatrix=T([]);const u=this.layers[0]._unevaluatedLayout._values;this.worldview=l.worldview,this.localizable=l.localizable,this.textSizeData=fN(this.zoom,u["text-size"],this.worldview),this.iconSizeData=fN(this.zoom,u["icon-size"],this.worldview);const g=this.layers[0].layout,x=g.get("symbol-sort-key"),j=g.get("symbol-z-order");this.lut=l.lut,this.canOverlap=g.get("text-allow-overlap")||g.get("icon-allow-overlap")||g.get("text-ignore-placement")||g.get("icon-ignore-placement"),this.sortFeaturesByKey=j!=="viewport-y"&&x.constantOr(1)!==void 0,this.sortFeaturesByY=(j==="viewport-y"||j==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=g.get("text-writing-mode").map(N=>lu[N]),this.stateDependentLayerIds=this.layers.filter(N=>N.isStateDependent()).map(N=>N.id),this.sourceID=l.sourceID,this.projection=l.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=!1,this.elevationType="none",this.elevationStateComplete=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.hasAnySecondaryIcon=!1,this.hasAppearances=null,this.lastActiveApperance=null,this.featureToAppearanceIndex={}}hasAnyAppearanceProperty(l){const u=this.layers[0].getAppearances();return!(!u||u.length===0)&&u.some(g=>g.getProperty(l)!=null)}createArrays(){this.text=new doe(new jh(this.layers,{zoom:this.zoom,lut:this.lut},l=>l.startsWith("text")||l.startsWith("symbol"))),this.icon=new doe(new jh(this.layers,{zoom:this.zoom,lut:this.lut},l=>l.startsWith("icon")||l.startsWith("symbol"))),this.glyphOffsetArray=new Zk,this.lineVertexArray=new wP,this.symbolInstances=new sM}calculateGlyphDependencies(l,u,g,x,j){for(const N of l){const E=N.codePointAt(0);if(E===void 0)break;if(u[E]=!0,x&&j&&E<=65535){const R=EM[N];R&&(u[R.charCodeAt(0)]=!0)}}}calculateEffectiveAppearanceIconSize(l,u,g,x,j,N){let E=1;const R=l.getUnevaluatedProperties()._values["icon-size"],B=fN(this.zoom,R,this.worldview),H=pN(B,u);if(B.kind!=="constant"&&B.kind!=="camera"||(E=H.uSize),B.kind==="composite"){const{minZoom:G,maxZoom:X}=B,J=R.possiblyEvaluate(new Qi(G,{worldview:this.worldview}),x),ne=R.possiblyEvaluate(new Qi(X,{worldview:this.worldview}),x),pe=J.evaluate(g,{},x,j);E=pe+(ne.evaluate(g,{},x,j)-pe)*H.uSizeT}return B.kind==="source"&&(E=R.possiblyEvaluate(new Qi(this.zoom,{worldview:this.worldview}),x).evaluate(g,{},x,j)),E*N}updateFootprints(l,u){}updateReplacement(l,u){if(u.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=u.updateTime;const g=u.getReplacementRegionsForTile(l.toUnwrapped(),!0);return!LP(this.activeReplacements,g)&&(this.activeReplacements=g,!0)}getResolvedImageFromTokens(l){return typeof l=="string"?Hc.build(l):l}populate(l,u,g,x){const j=this.layers[0],N=j.layout,E=this.projection.name==="globe",R=N.get("text-font"),B=N.get("text-field"),H=N.get("icon-image"),[G,X]=N.get("icon-size-scale-range"),J=_e(u.scaleFactor||1,G,X),ne=(B.value.kind!=="constant"||B.value.value instanceof Vc&&!B.value.value.isEmpty()||B.value.value.toString().length>0)&&(R.value.kind!=="constant"||R.value.value.length>0),pe=H.value.kind!=="constant"||!!H.value.value||Object.keys(H.parameters).length>0,ke=this.hasAnyAppearanceProperty("icon-image"),we=N.get("symbol-sort-key");if(this.features=[],this.appearanceFeatureData=[],!ne&&!pe&&!ke)return;const De=u.iconDependencies,Be=u.glyphDependencies,He=u.availableImages,dt=new Qi(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),it=pt=>{const wt=pt.id.toString();De.has(wt)?De.get(wt).push(pt):De.set(wt,[pt])};for(const pt of l){const{feature:wt,id:Ct,index:Wt,sourceLayerIndex:Lt}=pt,Qt=j._featureFilter.needGeometry,ar=Pt(wt,Qt);if(!j._featureFilter.filter(dt,ar,g))continue;if(Qt||(ar.geometry=vt(wt,g,x)),E&&wt.type!==1&&g.z<=5){const pr=ar.geometry,Tr=.98078528056,br=(dn,Rr)=>Ae(hM(dn.x,dn.y,g,1),hM(Rr.x,Rr.y,g,1)){if(!pr.getProperty("icon-image"))return;const Tr=this.getCombinedIconPrimary(pr,xr,ar,g,He,Xt,J);Tr&&it(Tr)}),or){const pr=R.evaluate(ar,{},g).join(","),Tr=N.get("text-rotation-alignment")==="map"&&N.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(lu.vertical)>=0;for(const br of or.sections)if(br.image){const dn=br.image.getPrimary().scaleSelf(this.pixelRatio),Rr=dn.id.toString(),Vr=De.get(Rr)||[];Vr.push(dn),De.set(Rr,Vr)}else{const dn=lv(or.toString()),Rr=br.fontStack||pr,Vr=Be[Rr]=Be[Rr]||{};this.calculateGlyphDependencies(br.text,Vr,Tr,this.allowVerticalPlacement,dn)}}}if(N.get("symbol-placement")==="line"&&(this.features=function(pt){const wt={},Ct={},Wt=[];let Lt=0;function Qt(xr){Wt.push(pt[xr]),Lt++}function ar(xr,hr,fr){const Xt=Ct[xr];return delete Ct[xr],Ct[hr]=Xt,Wt[Xt].geometry[0].pop(),Wt[Xt].geometry[0]=Wt[Xt].geometry[0].concat(fr[0]),Xt}function or(xr,hr,fr){const Xt=wt[hr];return delete wt[hr],wt[xr]=Xt,Wt[Xt].geometry[0].shift(),Wt[Xt].geometry[0]=fr[0].concat(Wt[Xt].geometry[0]),Xt}function gr(xr,hr,fr){const Xt=fr?hr[0][hr[0].length-1]:hr[0][0];return`${xr}:${Xt.x}:${Xt.y}`}for(let xr=0;xrxr.geometry)}(this.features)),N.get("symbol-elevation-reference")==="hd-road-markup"){if(this.elevationType="road",u.elevationFeatures){!this.elevationFeatures&&u.elevationFeatures.length>0&&(this.elevationFeatures=[],this.elevationFeatureIdToIndex=new Map);for(const pt of u.elevationFeatures)this.elevationFeatureIdToIndex.set(pt.id,this.elevationFeatures.length),this.elevationFeatures.push(pt)}}else N.get("symbol-z-elevate")&&(this.elevationType="offset");this.elevationType!=="none"&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((pt,wt)=>pt.sortKey-wt.sortKey)}getCombinedIconPrimary(l,u,g,x,j,N,E){let R,B;const H=l.getUnevaluatedProperties();if(H._values["icon-image"].value!==void 0){const G=u.getAppearanceValueAndResolveTokens(l,"icon-image",g,x,j);R=this.getResolvedImageFromTokens(G)}else{const G=u.getValueAndResolveTokens("icon-image",g,x,j);R=this.getResolvedImageFromTokens(G)}if(R){const G=H._values["icon-size"]||u._unevaluatedLayout._values["icon-size"];B=OM(R,fN(this.zoom,G,this.worldview),G,x,this.zoom,N,this.pixelRatio,E,this.worldview).iconPrimary}return B}updateAppearanceBasedIconTextures(l,u,g,x){if(!this.appearanceFeatureData||!this.icon.layoutVertexArray||this.icon.layoutVertexArray.length===0)return!1;const j=this.layers[0];let N=!1,E=0;const R=j.layout,[B,H]=R.get("icon-size-scale-range"),G=_e(1,B,H);for(let X=0;X=0){const ke=pe.id,we=u&&ke!==void 0?u[String(ke)]:void 0,De={type:"Point",id:pe.id,properties:pe.properties,geometry:[]},Be=this.layers[0].appearances&&this.layers[0].appearances.find(He=>He.isActive({globals:x,feature:De,canonical:l,featureState:we}));if(pe.activeAppearance===Be){E+=J.numIconVertices;continue}if(Be){pe.activeAppearance=Be;const He=this.getCombinedIconPrimary(Be,j,De,l,g,{sortKey:void 0,text:void 0,icon:null,index:J.featureIndex,sourceLayerIndex:J.featureIndex,geometry:[],properties:pe.properties,type:"Point",id:pe.id},G);if(!He)continue;const dt=He.toString(),it=this.iconAtlasPositions&&this.iconAtlasPositions.get(dt);if(it){const pt=j.getAppearanceValueAndResolveTokens(Be,"icon-offset",De,l,g),wt=pt&&Array.isArray(pt)?pt:[0,0];let Ct=YP(it,void 0,wt,j.layout.get("icon-anchor").evaluate(De,{},l));const Wt=j.getAppearanceValueAndResolveTokens(Be,"icon-rotate",De,l,g),Lt=typeof Wt=="number"?Wt:0,Qt=it.sdf,ar=j.layout.get("icon-text-fit").constantOr("none");ar!=="none"&&pe.textShaping&&pe.iconTextFitPadding&&pe.fontScale&&(Ct=roe(Ct,pe.textShaping,ar,pe.iconTextFitPadding,wt,pe.fontScale));const or=this.calculateEffectiveAppearanceIconSize(Be,x.zoom,De,l,g,G),gr=0,xr=1+(Math.min(ey,Math.round(or*jp))<<1),hr=aoe(Ct,Lt,Qt,ar!=="none",G);pe.isUsingAppearanceVertexData||(pe.isUsingAppearanceVertexData=!0,pe.layoutBasedVertexData=this.icon.getIconVertexData(E,J.numIconVertices));for(let Xt=0;Xt0&&(this.icon.updateIconVertexData(E,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(E+1,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(E+2,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(E+3,0,0,0,0,0,0,0,0,0,0,0,0),N=!0),E+=J.numIconVertices,pe.activeAppearance=null;else if(pe.isUsingAppearanceVertexData){const dt=pe.layoutBasedVertexData.length/12;for(let it=0;it0||X>0,ke=J>0,we=this.elevationFeatures[R.elevationFeatureIndex];if(we){const De=new sr(R.tileAnchorX,R.tileAnchorY),Be=.075+we.pointElevation(De);R.zOffset!==Be&&(u=!0,R.zOffset=Be),Be!==0&&(this.hasAnyZOffset=!0);const He=we.computeSlopeNormal(De,x),dt=Qs(Mt(),ie(0,0,1),He);mt(B,B,dt),mt(H,H,dt),B[2]*=g,H[2]*=g,B[0]===1&&B[1]===0&&B[2]===0&&H[0]===0&&H[1]===1&&H[2]===0||(j=j||pe,N=N||ke)}if(pe&&(i6(this.text.orientationVertexArray,G,B,H),i6(this.text.orientationVertexArray,X,B,H)),ke){const{placedIconSymbolIndex:De,verticalPlacedIconSymbolIndex:Be}=R;De>=0&&i6(this.icon.orientationVertexArray,J,B,H),Be>=0&&i6(this.icon.orientationVertexArray,ne,B,H)}}j||(this.text.orientationVertexArray=void 0),N||(this.icon.orientationVertexArray=void 0),u&&(this.zOffsetBuffersNeedUpload=!0,this.zOffsetSortDirty=!0)}updateZOffset(){const l=(j,N,E)=>{g+=N,g>j.length&&j.resize(g);for(let R=-N;R<0;R++)j.emplace(R+g,E)},u=(j,N,E)=>{x+=N,x>j.length&&j.resize(x);for(let R=-N;R<0;R++)j.emplace(R+x,E)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let g=0,x=0;for(let j=0;j0;if((E>0||R>0)&&(l(this.text.zOffsetVertexArray,E,H),l(this.text.zOffsetVertexArray,R,H)),G){const{placedIconSymbolIndex:X,verticalPlacedIconSymbolIndex:J}=N;X>=0&&u(this.icon.zOffsetVertexArray,B,H),J>=0&&u(this.icon.zOffsetVertexArray,N.numVerticalIconVertices,H)}}this.text.zOffsetVertexBuffer&&this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&&this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray)}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(l,u,g,x,j){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(l),this.iconCollisionBox.upload(l)),this.text.upload(l,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,!1),this.hasAppearances===null&&(this.hasAppearances=this.layers.some(N=>N.appearances&&N.appearances.length>0)),this.icon.upload(l,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,this.hasAppearances),this.uploaded=!0}updateAppearances(l,u,g,x){return!!(l&&u&&g)&&!(!this.icon.layoutVertexArray||this.icon.layoutVertexArray.length===0)&&!!this.icon.layoutVertexArray.arrayBuffer&&void(this.updateAppearanceBasedIconTextures(l,u,g,x)&&this.icon.layoutVertexBuffer&&this.icon.layoutVertexArray.arrayBuffer!==null&&this.icon.layoutVertexArray.length===this.icon.layoutVertexBuffer.length&&this.icon.layoutVertexBuffer.updateData(this.icon.layoutVertexArray))}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=Zve(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(l,u){const g=this.lineVertexArray.length;if(l.segment!==void 0)for(const{x,y:j}of u)this.lineVertexArray.emplaceBack(x,j);return{lineStartIndex:g,lineLength:this.lineVertexArray.length-g}}addSymbols(l,u,g,x,j,N,E,R,B,H,G,X,J,ne,pe,ke,we,De){const Be=l.indexArray,He=l.layoutVertexArray,dt=l.globeExtVertexArray,it=l.segments.prepareSegment(4*De,He,Be,this.canOverlap?N.sortKey:void 0),pt=this.glyphOffsetArray.length,wt=it.vertexLength,Ct=this.allowVerticalPlacement&&E===lu.vertical?Math.PI/2:0,Wt=N.text&&N.text.sections;for(let ar=0;ar=0?u.rightJustifiedTextSymbolIndex:u.centerJustifiedTextSymbolIndex>=0?u.centerJustifiedTextSymbolIndex:u.leftJustifiedTextSymbolIndex>=0?u.leftJustifiedTextSymbolIndex:u.verticalPlacedTextSymbolIndex>=0?u.verticalPlacedTextSymbolIndex:x),N=noe(this.textSizeData,l,j)/cl;return this.tilePixelRatio*N}getSymbolInstanceIconSize(l,u,g){const x=this.icon.placedSymbolArray.get(g),j=noe(this.iconSizeData,l,x);return this.tilePixelRatio*j}_commitDebugCollisionVertexUpdate(l,u,g,x){l.emplaceBack(u,-g,-g,x),l.emplaceBack(u,g,-g,x),l.emplaceBack(u,g,g,x),l.emplaceBack(u,-g,g,x)}_updateTextDebugCollisionBoxes(l,u,g,x,j,N,E){for(let R=x;R0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(l,u){const g=l.placedSymbolArray.get(u),x=g.vertexStartIndex+4*g.numGlyphs;for(let j=g.vertexStartIndex;jx[E]-x[R]||j[R]-j[E]),N}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let l=0;lthis.symbolInstances.get(u).zOffset-this.symbolInstances.get(l).zOffset)}addToSortKeyRanges(l,u){const g=this.sortKeyRanges[this.sortKeyRanges.length-1];g&&g.sortKey===u?g.symbolInstanceEnd=l+1:this.sortKeyRanges.push({sortKey:u,symbolInstanceStart:l,symbolInstanceEnd:l+1})}sortFeatures(l){if(this.sortFeaturesByY&&this.sortedAngle!==l&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(l),this.sortedAngle=l,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const u of this.symbolInstanceIndexes){const g=this.symbolInstances.get(u);this.featureSortOrder.push(g.featureIndex);const{rightJustifiedTextSymbolIndex:x,centerJustifiedTextSymbolIndex:j,leftJustifiedTextSymbolIndex:N,verticalPlacedTextSymbolIndex:E,placedIconSymbolIndex:R,verticalPlacedIconSymbolIndex:B}=g;x>=0&&this.addIndicesForPlacedSymbol(this.text,x),j>=0&&j!==x&&this.addIndicesForPlacedSymbol(this.text,j),N>=0&&N!==j&&N!==x&&this.addIndicesForPlacedSymbol(this.text,N),E>=0&&this.addIndicesForPlacedSymbol(this.text,E),R>=0&&this.addIndicesForPlacedSymbol(this.icon,R),B>=0&&this.addIndicesForPlacedSymbol(this.icon,B)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}getElevationFeatureForText(l){const u=this.symbolInstances.get(this.text.symbolInstanceIndices[l]).elevationFeatureIndex;let g;return this.elevationFeatures&&ug in h?String(h[g]):"")}let Xve,Qve,hoe;Yr(a6,"SymbolBucket",{omit:["layers","collisionBoxArray","compareText","features"]}),a6.addDynamicAttributes=xN;class Jve{constructor(l){this.type=l.property.overrides?l.property.overrides.runtimeType:xh,this.defaultValue=l}evaluate(l){if(l.formattedSection){const u=this.defaultValue.property.overrides;if(u&&u.hasOverride(l.formattedSection))return u.getOverride(l.formattedSection)}return l.feature&&l.featureState?this.defaultValue.evaluate(l.feature,l.featureState):this.defaultValue.property.specification.default}eachChild(l){this.defaultValue.isConstant()||l(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Yr(Jve,"FormatSectionOverride",{omit:["defaultValue"]});const foe=()=>hoe||(hoe={layout:Xve||(Xve=new Ra({"symbol-placement":new kr(Dt.layout_symbol["symbol-placement"]),"symbol-spacing":new kr(Dt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new kr(Dt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Ir(Dt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new kr(Dt.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new kr(Dt.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new kr(Dt.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new kr(Dt.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new kr(Dt.layout_symbol["icon-ignore-placement"]),"icon-optional":new kr(Dt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new kr(Dt.layout_symbol["icon-rotation-alignment"]),"icon-size":new Ir(Dt.layout_symbol["icon-size"]),"icon-size-scale-range":new kr(Dt.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new Ir(Dt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ir(Dt.layout_symbol["icon-text-fit-padding"]),"icon-image":new Ir(Dt.layout_symbol["icon-image"]),"icon-image-use-theme":new kr({type:"string",default:"default","property-type":"data-constant"}),"icon-rotate":new Ir(Dt.layout_symbol["icon-rotate"]),"icon-padding":new kr(Dt.layout_symbol["icon-padding"]),"icon-keep-upright":new kr(Dt.layout_symbol["icon-keep-upright"]),"icon-offset":new Ir(Dt.layout_symbol["icon-offset"]),"icon-anchor":new Ir(Dt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new kr(Dt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new kr(Dt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new kr(Dt.layout_symbol["text-rotation-alignment"]),"text-field":new Ir(Dt.layout_symbol["text-field"]),"text-font":new Ir(Dt.layout_symbol["text-font"]),"text-size":new Ir(Dt.layout_symbol["text-size"]),"text-size-scale-range":new kr(Dt.layout_symbol["text-size-scale-range"]),"text-max-width":new Ir(Dt.layout_symbol["text-max-width"]),"text-line-height":new Ir(Dt.layout_symbol["text-line-height"]),"text-letter-spacing":new Ir(Dt.layout_symbol["text-letter-spacing"]),"text-justify":new Ir(Dt.layout_symbol["text-justify"]),"text-radial-offset":new Ir(Dt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new kr(Dt.layout_symbol["text-variable-anchor"]),"text-anchor":new Ir(Dt.layout_symbol["text-anchor"]),"text-max-angle":new kr(Dt.layout_symbol["text-max-angle"]),"text-writing-mode":new kr(Dt.layout_symbol["text-writing-mode"]),"text-rotate":new Ir(Dt.layout_symbol["text-rotate"]),"text-padding":new kr(Dt.layout_symbol["text-padding"]),"text-keep-upright":new kr(Dt.layout_symbol["text-keep-upright"]),"text-transform":new Ir(Dt.layout_symbol["text-transform"]),"text-offset":new Ir(Dt.layout_symbol["text-offset"]),"text-allow-overlap":new kr(Dt.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new kr(Dt.layout_symbol["text-ignore-placement"]),"text-optional":new kr(Dt.layout_symbol["text-optional"]),visibility:new kr(Dt.layout_symbol.visibility)})),paint:Qve||(Qve=new Ra({"icon-opacity":new Ir(Dt.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new Ir(Dt.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new Ir(Dt.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new Ir(Dt.paint_symbol["text-emissive-strength"]),"icon-color":new Ir(Dt.paint_symbol["icon-color"]),"icon-halo-color":new Ir(Dt.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ir(Dt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ir(Dt.paint_symbol["icon-halo-blur"]),"icon-translate":new kr(Dt.paint_symbol["icon-translate"]),"icon-translate-anchor":new kr(Dt.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new kr(Dt.paint_symbol["icon-image-cross-fade"]),"text-opacity":new Ir(Dt.paint_symbol["text-opacity"]),"text-occlusion-opacity":new Ir(Dt.paint_symbol["text-occlusion-opacity"]),"text-color":new Ir(Dt.paint_symbol["text-color"],{runtimeType:pd,getOverride:h=>h.textColor,hasOverride:h=>!!h.textColor}),"text-halo-color":new Ir(Dt.paint_symbol["text-halo-color"]),"text-halo-width":new Ir(Dt.paint_symbol["text-halo-width"]),"text-halo-blur":new Ir(Dt.paint_symbol["text-halo-blur"]),"text-translate":new kr(Dt.paint_symbol["text-translate"]),"text-translate-anchor":new kr(Dt.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new kr(Dt.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new kr(Dt.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new kr(Dt.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new kr(Dt.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new Ir(Dt.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new Ir({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new Ir({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new Ir({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new Ir({type:"string",default:"default","property-type":"data-driven"})}))},hoe);class o6 extends Kc{constructor(l,u,g,x){super(l,foe(),u,g,x,l.layout?l.layout["icon-image-use-theme"]:null),this._colorAdjustmentMatrix=T([]),this.hasOcclusionOpacityProperties=l.paint!==void 0&&("icon-occlusion-opacity"in l.paint||"text-occlusion-opacity"in l.paint)}_handleSpecialPaintPropertyUpdate(l){l!=="icon-occlusion-opacity"&&l!=="text-occlusion-opacity"||(this.hasOcclusionOpacityProperties=!0)}recalculate(l,u){super.recalculate(l,u),this.appearances&&this.appearances.forEach(x=>{x.recalculate(l,u,this.iconImageUseTheme)}),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const g=this.layout.get("text-writing-mode");if(g){const x=[];for(const j of g)x.indexOf(j)<0&&x.push(j);this.layout._values["text-writing-mode"]=x}else this.layout._values["text-writing-mode"]=this.layout.get("symbol-placement")==="point"?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(l,u,g,x){return this._saturation===l&&this._contrast===u&&this._brightnessMin===g&&this._brightnessMax===x||(this._colorAdjustmentMatrix=function(j,N,E,R){j=ca(j),N=zs(N);const B=C(),H=j/3,G=1-2*H,X=[G,H,H,0,H,G,H,0,H,H,G,0,0,0,0,1],J=.5-.5*N,ne=R-E;return A(B,[ne,0,0,0,0,ne,0,0,0,0,ne,0,E,E,E,1],[N,0,0,0,0,N,0,0,0,0,N,0,J,J,J,1]),A(B,B,X),B}(l,u,g,x),this._saturation=l,this._contrast=u,this._brightnessMin=g,this._brightnessMax=x),this._colorAdjustmentMatrix}getValueAndResolveTokens(l,u,g,x){const j=this.layout.get(l).evaluate(u,{},g,x),N=this._unevaluatedLayout._values[l];return N.isDataDriven()||av(N.value)||!j?j:Yve(u.properties,j)}getAppearanceValueAndResolveTokens(l,u,g,x,j){const N=l.getProperty(u);if(!N)return;const E=N.evaluate(g,{},x,j),R=l.getUnevaluatedProperties()._values[u];return R.isDataDriven()||av(R.value)||!E||typeof E!="string"?E:Yve(g.properties,E)}createBucket(l){return new a6(l)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const l of foe().paint.overridableProperties){if(!o6.hasPaintOverride(this.layout,l))continue;const u=this.paint.get(l),g=new Jve(u),x=new Nk(g,u.property.specification,this.scope,this.options,this.layout.get("icon-image-use-theme"));let j=null;j=u.value.kind==="constant"||u.value.kind==="source"?new vx("source",x):new $g("composite",x,u.value.zoomStops,u.value.interpolationType),this.paint._values[l]=new qg(u.property,j,u.parameters)}}_handleOverridablePaintPropertyUpdate(l,u,g){return!(!this.layout||u.isDataDriven()||g.isDataDriven())&&o6.hasPaintOverride(this.layout,l)}static hasPaintOverride(l,u){const g=l.get("text-field"),x=foe().paint.properties[u];let j=!1;const N=E=>{for(const R of E)if(x.overrides&&x.overrides.hasOverride(R))return void(j=!0)};if(g.value.kind==="constant"&&g.value.value instanceof Vc)N(g.value.value.sections);else if(g.value.kind==="source"){const E=B=>{j||(B instanceof op&&ll(B.value)===H1?N(B.value.sections):B instanceof nf?N(B.sections):B.eachChild(E))},R=g.value;R._styleExpression&&E(R._styleExpression.expression)}return j}getProgramIds(){return["symbol"]}getDefaultProgramParams(l,u,g){return{config:new Lm(this,{zoom:u,lut:g}),overrideFog:!1}}hasElevation(){return this.layout&&this.layout.get("symbol-elevation-reference")==="hd-road-markup"}}let e_e,t_e,r_e,n_e;var poe=ks([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function l6(h,l,u,g,x,j,N,E){const R=[h,l,1,u,g,1,x,j,1],B=[N,E,1],H=w([],R),[G,X,J]=ge(B,B,H);return k(R,R,[G,0,0,0,X,0,0,0,J])}function s_e(h,l,u,g,x,j,N,E){const R=function(B,H,G,X,J,ne,pe,ke){const we=l6(0,0,1,0,1,1,0,1),De=l6(B,H,G,X,J,ne,pe,ke);return k(De,De,w([],we))}(h,l,u,g,x,j,N,E);return[R[2]/R[8]/Cr,R[5]/R[8]/Cr]}function c6(h){return[h[0],Math.min(Math.max(h[1],-de),de)]}class i_e extends Og{constructor(l,u,g,x){super(),this.id=l,this.dispatcher=g,this.coordinates=u.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.onNorthPole=!1,this.onSouthPole=!1,this.setEventedParent(x),this.options=u,this._dirty=!1}load(l,u){if(this._loaded=u||!1,this.fire(new tf("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return l&&(this.coordinates=l),this._loaded=!0,void this._finishLoading();this._imageRequest=ys(this.map._requestManager.transformRequest(this.url,Pg.Image),(g,x)=>{this._imageRequest=null,this._loaded=!0,g?this.fire(new U1(g)):x&&(this.image=x instanceof HTMLImageElement?Do.getImageData(x):x,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,l&&(this.coordinates=l),this._finishLoading())})}loaded(){return this._loaded}updateImage(l){return l.url?(this._imageRequest&&l.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=l.url,this.load(l.coordinates,this._loaded),this):this}setTexture(l){if(!(l.handle instanceof WebGLTexture))throw new Error("The provided handle is not a WebGLTexture instance");return this.texture=new MM(this.map.painter.context,l.handle),this.width=l.dimensions[0],this.height=l.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new tf("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(l){this.map=l,this.load()}onRemove(l){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof MM||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(l){if(this.coordinates=l,this._boundsArray=void 0,this._unsupportedCoords=!1,!l.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let u=l[0][1],g=l[0][1];for(const j of l)j[1]>g&&(g=j[1]),j[1]de?this.onNorthPole=!0:x<-de&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const j=l.map(qe.fromLngLat);this.tileID=function(N){let E=1/0,R=1/0,B=-1/0,H=-1/0;for(const pe of N)E=Math.min(E,pe.x),R=Math.min(R,pe.y),B=Math.max(B,pe.x),H=Math.max(H,pe.y);const G=Math.max(B-E,H-R),X=Math.max(0,Math.floor(-Math.log2(G))),J=Math.pow(2,X);let ne=Math.floor((E+B)/2*J);return ne>1&&(ne-=1),new Bi(X,ne,Math.floor((R+H)/2*J))}(j),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new tf("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof MM||(this.texture.destroy(),this._dirty=!0),this.texture=null,this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(l){for(const we in this.tiles){const De=this.tiles[we];De.state!=="loaded"&&(De.state="loaded",De.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const u=RM(new Bi(0,0,0),this.map.transform.projection),g=[u.projection.project(this.coordinates[0][0],this.coordinates[0][1]),u.projection.project(this.coordinates[1][0],this.coordinates[1][1]),u.projection.project(this.coordinates[2][0],this.coordinates[2][1]),u.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(we){const De=we[1].x-we[0].x,Be=we[1].y-we[0].y,He=we[2].x-we[1].x,dt=we[2].y-we[1].y,it=we[3].x-we[2].x,pt=we[3].y-we[2].y,wt=we[0].x-we[3].x,Ct=we[0].y-we[3].y,Wt=De*dt-He*Be,Lt=He*pt-it*dt,Qt=it*Ct-wt*pt,ar=wt*Be-De*Ct;return Wt>0&&Lt>0&&Qt>0&&ar>0||Wt<0&&Lt<0&&Qt<0&&ar<0}(g))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const x=RM(this.tileID,this.map.transform.projection),[j,N,E,R]=this.coordinates.map(we=>{const De=x.projection.project(we[0],we[1]);return Vve(x,De)._round()});this.perspectiveTransform=s_e(j.x,j.y,N.x,N.y,E.x,E.y,R.x,R.y);const B=this._boundsArray=new jx;B.emplaceBack(j.x,j.y,0,0),B.emplaceBack(N.x,N.y,Cr,0),B.emplaceBack(R.x,R.y,0,Cr),B.emplaceBack(E.x,E.y,Cr,Cr),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=l.createVertexBuffer(B,poe.members),this.boundsSegments=ja.simpleSegment(0,0,4,2);const H=[],G=[c6((X=this.coordinates)[0]),c6(X[1]),c6(X[2]),c6(X[3])];var X;const[J,ne,pe,ke]=function(we){let De=we[0][0],Be=De,He=we[0][1],dt=He;for(let it=1;itBe&&(Be=we[it][0]),we[it][1]dt&&(dt=we[it][1]);return[De,He,Be-De,dt-He]}(G);{const we=new jx,[De,Be,He,dt]=function(hr){let fr=hr[0].x,Xt=fr,Gt=hr[0].y,pr=Gt;for(let Tr=1;TrXt&&(Xt=hr[Tr].x),hr[Tr].ypr&&(pr=hr[Tr].y);return[fr,Gt,Xt-fr,pr-Gt]}(g),it=hr=>[(hr.x-De)/He,(hr.y-Be)/dt],[pt,wt,Ct,Wt]=g.map(it),Lt=function(hr,fr,Xt,Gt,pr,Tr,br,dn){const Rr=l6(0,0,1,0,1,1,0,1);return k(Rr,Rr,w([],l6(hr,fr,Xt,Gt,pr,Tr,br,dn)))}(pt[0],pt[1],wt[0],wt[1],Ct[0],Ct[1],Wt[0],Wt[1]);this.elevatedGlobePerspectiveTransform=s_e(pt[0],pt[1],wt[0],wt[1],Ct[0],Ct[1],Wt[0],Wt[1]);const Qt=(hr,fr)=>{H.push(hr.lng);const Xt=Math.round((hr.lng-J)/pe*Cr),Gt=Math.round((hr.lat-ne)/ke*Cr),pr=it(fr),Tr=ge([],[pr[0],pr[1],1],Lt),br=Math.round(Tr[0]/Tr[2]*Cr),dn=Math.round(Tr[1]/Tr[2]*Cr);we.emplaceBack(Xt,Gt,br,dn)},ar=g[3].x-g[0].x,or=g[3].y-g[0].y,gr=g[2].x-g[1].x,xr=g[2].y-g[1].y;for(let hr=0;hr<65;hr++){const fr=hr/64,Xt=[g[0].x+fr*ar,g[0].y+fr*or],Gt=[g[1].x+fr*gr,g[1].y+fr*xr],pr=Gt[0]-Xt[0],Tr=Gt[1]-Xt[1];for(let br=0;br<65;br++){const dn=br/64,Rr={x:Xt[0]+pr*dn,y:Xt[1]+Tr*dn};Qt(u.projection.unproject(Rr.x,Rr.y),Rr)}}this.elevatedGlobeVertexBuffer=l.createVertexBuffer(we,poe.members)}{this.maxLongitudeTriangleSize=0;let we=[],De=new Ro;const Be=(He,dt,it)=>{De.emplaceBack(He,dt,it);const pt=H[He],wt=H[dt],Ct=H[it],Wt=Math.min(Math.min(pt,wt),Ct),Lt=Math.max(Math.max(pt,wt),Ct)-Wt;Lt>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=Lt),we.push(Wt+Lt/2)};for(let He=0;He<64;He++)for(let dt=0;dt<64;dt++){const it=65*He+dt,pt=it+1,wt=it+65,Ct=wt+1;Be(it,wt,pt),Be(pt,wt,Ct)}[we,De]=function(He,dt){const it=Array.from({length:He.length},(Ct,Wt)=>Wt);it.sort((Ct,Wt)=>He[Ct]-He[Wt]);const pt=[],wt=new Ro;for(let Ct=0;Ct{N.segments.push({vertexOffset:0,primitiveOffset:G,vertexLength:u.segments[0].vertexLength,primitiveLength:X,sortKey:void 0,vaos:{}})},R=.51*this.maxLongitudeTriangleSize;if(Math.abs(g[0]-x)<=R){const G=ya(g,0,g.length,x+R);return G===g.length||E(G,lo(g,G+1,g.length,x+360-R)-G),N}xCr?x-Cr:x,new sr(Math.trunc(x),Math.trunc(g[u+1]))}translationForInstance(l){const u=16*l,g=this.instancedDataArray.float32;return[g[u+4],g[u+5],g[u+6]]}rotationScaleForInstance(l){const u=16*l,g=this.instancedDataArray.float32;return[g[u+7],g[u+8],g[u+9],g[u+10],g[u+11],g[u+12],g[u+13],g[u+14],g[u+15]]}transformForInstance(l){const u=16*l,g=this.instancedDataArray.float32;return[g[u+7],g[u+8],g[u+9],g[u+4],g[u+10],g[u+11],g[u+12],g[u+5],g[u+13],g[u+14],g[u+15],g[u+6],0,0,0,1]}}class yoe{constructor(l){this.zoom=l.zoom,this.canonical=l.canonical,this.overscaledZ=this.canonical.z+Math.log2(l.overscaling),this.layers=l.layers,this.layerIds=this.layers.map(u=>u.fqid),this.projection=l.projection,this.index=l.index,this.worldview=l.worldview,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom>this.canonical.z+1?0:this.zoom>this.canonical.z?256:this.zoom>15?75:100,this.instanceCount=0,this.terrainElevationMin=0,this.terrainElevationMax=0,this.validForDEMTile={id:null,timestamp:0},this.modelUris=[],this.modelsRequested=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.styleDefinedModelURLs=l.styleDefinedModelURLs,this.hasAppearances=null}updateFootprints(l,u){}updateAppearances(l,u,g,x){}populate(l,u,g,x){this.tileToMeter=Ee(g);const j=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);for(const{feature:N,id:E,index:R,sourceLayerIndex:B}of l){const H=E??(N.properties&&N.properties.hasOwnProperty("id")?N.properties.id:void 0),G=Pt(N,j);if(!this.layers[0]._featureFilter.filter(new Qi(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),G,g))continue;const X={id:H,sourceLayerIndex:B,index:R,geometry:j?G.geometry:vt(N,g,x),properties:N.properties,type:N.type,patterns:{}},J=this.addFeature(X,X.geometry,G);J&&u.featureIndex.insert(N,X.geometry,R,B,this.index,this.instancesPerModel[J].instancedDataArray.length,Cr/32)}this.lookup=null}evaluateQueryRenderedFeaturePadding(){const l=this.layers[0].modelManager,u=this.layers[0].scope;let g=0;for(const x of this.modelUris){const j=l.getModel(x,u);if(!j)continue;const N=this.instancesPerModel[x];if(N){const E=.5*Me(j.aabb.max,j.aabb.min)*N.maxScale+N.maxXYTranslationDistance,R=Math.min(Cr,Math.max(E/this.tileToMeter,Cr/32));g=Math.max(R,g)}}return g}update(l,u,g,x){for(const j in this.instancesPerModel){const N=this.instancesPerModel[j];for(const E in l)N.idToFeaturesIndex.hasOwnProperty(E)&&(this.evaluate(N.features[N.idToFeaturesIndex[E]],l[E],N,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let l=!1;for(const u in this.instancesPerModel){const g=this.instancesPerModel[u];for(const x of g.features){const j=this.layers[0],N=x.feature,E=this.canonical,R=j.paint.get("model-rotation").evaluate(N,{},E),B=j.paint.get("model-scale").evaluate(N,{},E),H=j.paint.get("model-translation").evaluate(N,{},E);We(x.rotation,R)&&We(x.scale,B)&&We(x.translation,H)||(this.evaluate(x,x.featureStates,g,!0),l=!0)}}return l}updateReplacement(l,u,g,x){if(u.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=u.updateTime;const j=u.getReplacementRegionsForTile(l.toUnwrapped(),!0);if(LP(this.activeReplacements,j))return!1;this.activeReplacements=j;let N=!1;for(const E in this.instancesPerModel){const R=this.instancesPerModel[E],B=R.instancedDataArray;for(const H of R.features){const G=H.instancedDataOffset,X=H.instancedDataCount;for(let J=0;JCr;pe=ke?pe-Cr:pe;const we=Math.floor(pe),De=Math.floor(B.float32[ne+1]);let Be=!1;for(const He of this.activeReplacements)if(!t1e(He,g,f_e.Model,x)&&!(He.min.x>we||we>He.max.x||He.min.y>De||De>He.max.y)&&(Be=a1e(i1e(we,De,l.canonical,He.footprintTileId.canonical),He.footprint),Be))break;B.float32[ne]=Be?pe+Cr:pe,N=N||Be!==ke}}}return N}isEmpty(){for(const l in this.instancesPerModel)if(this.instancesPerModel[l].instancedDataArray.length!==0)return!1;return!0}uploadPending(){return!this.uploaded}upload(l){if(!this.uploaded)for(const u in this.instancesPerModel){const g=this.instancesPerModel[u];g.instancedDataArray.length<0||g.instancedDataArray.length===0||(g.instancedDataBuffer?g.instancedDataBuffer.updateData(g.instancedDataArray):g.instancedDataBuffer=l.createVertexBuffer(g.instancedDataArray,IUe.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(l){for(const g in this.instancesPerModel){const x=this.instancesPerModel[g];x.instancedDataArray.length!==0&&x.instancedDataBuffer&&x.instancedDataBuffer.destroy()}const u=this.layers[0].modelManager;if(l&&u&&this.modelUris&&this.modelsRequested)for(const g of this.modelUris)u.removeModel(g,"",!0)}addFeature(l,u,g){const x=this.layers[0],j=x.layout.get("model-id").evaluate(g,{},this.canonical);if(!j)return Br(`modelId is not evaluated for layer ${x.id} and it is not going to get rendered.`),j;(goe(j,!1)||this.styleDefinedModelURLs[j]!==void 0)&&(this.modelUris.includes(j)||this.modelUris.push(j)),this.instancesPerModel[j]||(this.instancesPerModel[j]=new m_e);const N=this.instancesPerModel[j],E=N.instancedDataArray,R=new p_e(g,E.length);for(const B of u)for(const H of B){if(H.x<0||H.x>=Cr||H.y<0||H.y>=Cr)continue;if(this.lookupDim!==0){const X=(this.lookupDim-1)/Cr,J=this.lookupDim*(H.y*X|0)+H.x*X|0;if(this.lookup){if(this.lookup[J]!==0)continue;this.lookup[J]=1}}this.instanceCount++;const G=E.length;E.resize(G+1),N.instancesEvaluatedElevation.push(0),E.float32[16*G]=H.x,E.float32[16*G+1]=H.y}return R.instancedDataCount=N.instancedDataArray.length-R.instancedDataOffset,R.instancedDataCount>0&&(l.id&&(N.idToFeaturesIndex[l.id]=N.features.length),N.features.push(R),this.evaluate(R,{},N,!1)),j}getModelUris(){return this.modelUris}evaluate(l,u,g,x){const j=this.layers[0],N=l.feature,E=this.canonical,R=l.rotation=j.paint.get("model-rotation").evaluate(N,u,E),B=l.scale=j.paint.get("model-scale").evaluate(N,u,E),H=l.translation=j.paint.get("model-translation").evaluate(N,u,E),G=Object.assign({},j.paint.get("model-color").evaluate(N,u,E));G.a=j.paint.get("model-color-mix-intensity").evaluate(N,u,E);const X=[];this.maxVerticalOffset0?Math.sqrt(J):0;g.maxScale=Math.max(Math.max(g.maxScale,B[0]),Math.max(B[1],B[2])),g.maxXYTranslationDistance=Math.max(g.maxXYTranslationDistance,ne),this.maxScale=Math.max(Math.max(this.maxScale,B[0]),Math.max(B[1],B[2])),W1e(X,R,B);const pe=Math.round(100*G.a)+G.b/1.05;for(let ke=0;ke10?this.tileToMeter:Ee(E,dt)),Be[De+4]=H[0],Be[De+5]=H[1],Be[De+6]=H[2]+He,Be[De+7]=X[0],Be[De+8]=X[1],Be[De+9]=X[2],Be[De+10]=X[4],Be[De+11]=X[5],Be[De+12]=X[6],Be[De+13]=X[8],Be[De+14]=X[9],Be[De+15]=X[10],g.instancesEvaluatedElevation[we]=H[2]}}}let g_e,y_e;Yr(yoe,"ModelBucket",{omit:["layers"]}),Yr(m_e,"PerModelAttributes"),Yr(p_e,"ModelFeature");class vN{constructor(l,u,g){this._demTile=l,this._dem=this._demTile.dem,this._scale=u,this._offset=g}static create(l,u,g){const x=g||l.findDEMTileFor(u);if(!x||!x.dem)return;const j=x.dem,N=x.tileID,E=1<B.fqid),this.stateDependentLayerIds=this.layers.filter(B=>B.isStateDependent()).map(B=>B.id),this.modelTraits|=dN.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,x&&(this.modelTraits|=dN.HasMapboxMeshFeatures),j&&(this.modelTraits|=dN.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=N,this.worldview=R,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[];for(const B of u)this.nodesInfo.push(new b_e(B)),v_e(B,E.featureIndexArray.length,E.grid),E.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,E.bucketLayerIDs.length-1,0);this.states={},this.hasAppearances=null}updateFootprints(l,u){for(const g of this.getNodesInfo()){const x=g.node;x.footprint&&u.push({footprint:x.footprint,id:l})}}updateAppearances(l,u,g,x){}update(l){const u=Object.keys(l).length!==0;if(u&&!this.stateDependentLayers.length)return;const g=u?this.stateDependentLayers:this.layers;if(!fo(l,this.states))for(const x of g)this.evaluate(x,l);this.states=structuredClone(l)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(l){if(!this.needsUpload)return;const u=this.getNodesInfo();for(const g of u){const x=g.node;this.uploaded?this.updatePbrBuffer(x):Uae(x,l,!0)}for(const g of u)WP(g.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(l){let u=!1;if(!l.meshes)return u;for(const g of l.meshes)g.pbrBuffer&&(g.pbrBuffer.updateData(g.featureArray),u=!0);return u}needsReEvaluation(l,u,g){const x=l.transform.projectionOptions,j=l.style.getBrightness(),N=this.brightness!==j;if(!this.uploaded||this.dirty||x.name!==this.projection.name||HM(g.paint.get("model-color").value,N)||HM(g.paint.get("model-color-mix-intensity").value,N)||HM(g.paint.get("model-roughness").value,N)||HM(g.paint.get("model-emissive-strength").value,N)||HM(g.paint.get("model-height-based-emissive-strength-multiplier").value,N)){this.projection=x,this.brightness=j;const E=this.getNodesInfo();for(const R of E)R.state=null;return!0}return!1}evaluateTransform(l,u){if(l.transform.zoom===this.zoom)return;this.zoom=l.transform.zoom;const g=this.getNodesInfo(),x=this.id.canonical;for(const j of g){const N=j.feature;j.evaluatedTranslation=u.paint.get("model-translation").evaluate(N,{},x),j.evaluatedScale=u.paint.get("model-scale").evaluate(N,{},x)}}evaluate(l,u){const g=this.getNodesInfo();for(const x of g){if(!x.node.meshes)continue;const j=x.feature,N=u&&u[j.id];if(fo(N,x.state))continue;x.state=structuredClone(N);const E=x.node.meshes&&x.node.meshes[0].featureData,R=x.evaluatedColor[2],B=x.evaluatedRMEA[2],H=this.id.canonical;if(x.hasTranslucentParts=!1,E){for(let G=0;G<__e.length;G++){const X=__e[G];X.length&&(j.properties.part=X);const J=l.paint.get("model-color").evaluate(j,N,H).toPremultipliedRenderColor(null),ne=l.paint.get("model-color-mix-intensity").evaluate(j,N,H);x.evaluatedColor[G]=[J.r,J.g,J.b,ne],x.evaluatedRMEA[G][0]=l.paint.get("model-roughness").evaluate(j,N,H),x.evaluatedRMEA[G][2]=l.paint.get("model-emissive-strength").evaluate(j,N,H),x.evaluatedRMEA[G][3]=J.a,x.emissionHeightBasedParams[G]=l.paint.get("model-height-based-emissive-strength-multiplier").evaluate(j,N,H),!x.hasTranslucentParts&&J.a<1&&(x.hasTranslucentParts=!0)}delete j.properties.part,uVe(x,R!==x.evaluatedColor[2]||B!==x.evaluatedRMEA[2],this.modelTraits)}else x.evaluatedRMEA[0][2]=l.paint.get("model-emissive-strength").evaluate(j,N,H);x.evaluatedTranslation=l.paint.get("model-translation").evaluate(j,N,H),x.evaluatedScale=l.paint.get("model-scale").evaluate(j,N,H),this.updatePbrBuffer(x.node)||(this.needsUpload=!0)}this.dirty=!1}elevationUpdate(l,u,g,x){const j=l.findDEMTileFor(g);if(j&&(j.tileID.canonical!==this.terrainTile||u!==this.terrainExaggeration)){if(j.dem&&j.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=j.tileID.overscaledZ;const N=vN.create(l,g,j);if(!N)return;this.modelTraits&dN.HasMapboxMeshFeatures&&this.updateDEM(l,N,g,x);for(const E of this.getNodesInfo()){const R=E.node;if(!R.footprint||!R.footprint.vertices||!R.footprint.vertices.length)continue;const B=R.footprint.vertices;let H=N.getElevationAt(B[0].x,B[0].y,!0,!0);for(let G=1;G=it)continue;const hr=xoe[xr],fr=Math.abs(hr);fr>Lt&&(Wt=hr,Lt=fr,Qt=gr,ar=or)}if(Lt>.1){const or=1-(it+.5*Math.abs(Qt*ar))/ne;let gr=u._dem.get(wt,pt)+Wt*or;const xr=u._dem.get(wt+Qt,pt+ar),hr=u._dem.get(wt-Qt,pt-ar,!0);(gr-xr)*(gr-hr)>0&&(gr=(xr+hr)/2),xoe[Ct]=u._dem.set(wt,pt,gr),Mv[Ct]=it}}}}}E&&(u._demTile.needsDEMTextureUpload=!0,u._dem._timestamp=Do.now())}setFilter(l){this.filter=l?Lk(l):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(l=>this.filter.filter(new Qi(this.id.overscaledZ,{worldview:this.worldview}),l.feature,this.id.canonical)):this.nodesInfo}destroy(){const l=this.getNodesInfo();for(const u of l)WP(u.node),qae(u.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(l,u){if(u.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=u.updateTime;const g=u.getReplacementRegionsForTile(l.toUnwrapped());for(const x of this.getNodesInfo()){const j=x.node.footprint;x.hiddenByReplacement=!!j&&!g.find(N=>N.footprint===j)}}getHeightAtTileCoord(l,u){const g=[],x=[0,0,0],j=T([]);for(const N of this.getNodesInfo()){const E=N.node.meshes[0],R=E.transformedAabb;if(lR.max[0]||u>R.max[1])continue;if(N.node.hidden===!0)return{height:1/0,maxHeight:N.feature.properties.height,hidden:!1,verticalScale:N.evaluatedScale[2]};I(j,N.node.globalMatrix),x[0]=l,x[1]=u,Xe(x,x,j);const B=(x[0]-E.aabb.min[0])/(E.aabb.max[0]-E.aabb.min[0])*Nv|0,H=Math.min(63,(x[1]-E.aabb.min[1])/(E.aabb.max[1]-E.aabb.min[1])*Nv|0)*Nv+Math.min(63,B),G=E.heightmap[H];if(!(G<0&&N.node.footprint))return N.hiddenByReplacement?void 0:{height:G,maxHeight:N.feature.properties.height,hidden:!1,verticalScale:N.evaluatedScale[2]};if(N.node.footprint.grid.query(new sr(l,u),new sr(l,u),g),g.length>0)return{height:void 0,maxHeight:N.feature.properties.height,hidden:N.hiddenByReplacement,verticalScale:N.evaluatedScale[2]}}}}function HM(h,l){return h instanceof vx&&!h.isLightConstant&&l}function dVe(h,l,u,g,x,j,N,E){let R=(61440&l|(61440&l)>>4)>>8,B=(3840&l|(3840&l)>>4)>>4,H=240&l|(240&l)>>4;u[3]>0&&(R=Dn(R,255*u[0],u[3]),B=Dn(B,255*u[1],u[3]),H=Dn(H,255*u[2],u[3]));const G=R<<8|B,X=H<<8|Math.floor(255*g[3]),J=function(it){const pt=_e(it,0,2);return Math.min(Math.round(.5*pt*255),255)}(g[2])<<8|15*g[0]<<4|15*g[1],ne=_e(x[0],0,1),pe=_e(x[1],0,1),ke=_e(x[2],0,1),we=_e(x[3],0,1);let De,Be,He,dt;if(ne!==pe&&N!==j&&pe!==ne){const it=N-j;Be=1/(it*(pe-ne)),He=-(j+it*ne)/(it*(pe-ne));const pt=_e(x[4],-1,1);dt=Math.pow(10,pt),De=255*ke<<8|255*we}else De=65535,Be=0,He=1,dt=1;if(h.emplaceBack(G,X,J,De,Be,He,dt),E){const it=E.length;E.clear();for(let pt=0;pt>16&65535,H=j?R>>16&65535:65535&R,G=(15&H)<8?15&H:0,X=h.evaluatedRMEA[G],J=h.evaluatedColor[G],ne=h.emissionHeightBasedParams[G];let pe;if(E&&G===2&&g.lights&&(pe=new Hk,pe.resize(10*g.lights.length)),dVe(N.featureArray,B,J,X,ne,N.aabb.min[2],N.aabb.max[2],pe),pe&&E){E=!1;const ke=g.meshes[g.lightMeshIndex];ke.featureArray=pe,ke.featureArray._trim()}}N.featureArray._trim(),x++}}Yr(u6,"Tiled3dModelBucket",{omit:["layers"]}),Yr(b_e,"Tiled3dModelFeature");const hVe=["id","tile","layer","source","sourceLayer","state"];class Tv{constructor(l,u,g,x,j){this.type="Feature",this._vectorTileFeature=l,this._z=u,this._x=g,this._y=x,this.properties=l?l.properties:{},this.id=j}clone(){const l=new Tv(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(l.state=Object.assign({},this.state)),this.layer&&(l.layer=Object.assign({},this.layer)),this.source&&(l.source=this.source),this.sourceLayer&&(l.sourceLayer=this.sourceLayer),l}get geometry(){return this._geometry===void 0&&this._vectorTileFeature&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(l){this._geometry=l}toJSON(){const l={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(const u of hVe)this[u]!==void 0&&(l[u]=this[u]);return l}}class Av extends Og{constructor(l,u,g,x){super(),this.id=l,this.type="model",this.models=[],this._loaded=!1,this._options=u,this._modelsInfo=new Map}load(){const l=[];for(const u in this._options.models){const g=this._options.models[u],x=this._modelsInfo.get(u);if(x){const j=x.model;j.position=g.position!=null?new p(g.position[0],g.position[1]):new p(0,0),j.orientation=g.orientation!=null?g.orientation:[0,0,0],x.modelSpec=g,Av.applyModelSpecification(j,g),j.computeBoundsAndApplyParent(),this.models.push(j)}else{const j=U1e(this.map._requestManager.transformRequest(g.uri,Pg.Model).url).then(N=>{if(!N)return;const E=Hae(N),R=new G1e(u,g.uri,g.position,g.orientation,E);Av.applyModelSpecification(R,g),R.computeBoundsAndApplyParent(),this.models.push(R),this._modelsInfo.set(u,{modelSpec:g,model:R})}).catch(N=>{this.fire(new U1(new Error(`Could not load model ${u} from ${g.uri}: ${N.message}`)))});l.push(j)}}Promise.allSettled(l).then(()=>{this._loaded=!0,this.fire(new tf("data",{dataType:"source",sourceDataType:"metadata"}))}).catch(u=>{this._loaded=!0,this.fire(new U1(new Error(`Could not load models: ${u.message}`)))})}static applyModelSpecification(l,u){u.nodeOverrides&&Av.convertNodeOverrides(l,u.nodeOverrides),u.materialOverrides&&Av.convertMaterialOverrides(l,u.materialOverrides),u.nodeOverrideNames&&(l.nodeOverrideNames=[...u.nodeOverrideNames]),u.materialOverrideNames&&(l.materialOverrideNames=[...u.materialOverrideNames]),u.featureProperties&&(l.featureProperties=u.featureProperties)}static convertNodeOverrides(l,u){if(Array.isArray(u)&&u.every(g=>typeof g=="string")){l.nodeOverrideNames=[];for(const g of u)l.nodeOverrideNames.push(g)}else Object.entries(u).forEach(([g,x])=>{const j={orientation:[0,0,0]};if(x.hasOwnProperty("orientation")){const N=x.orientation;N&&(j.orientation=N)}l.nodeOverrides.set(g,j)})}static convertMaterialOverrides(l,u){if(Array.isArray(u)&&u.every(g=>typeof g=="string")){l.materialOverrideNames=[];for(const g of u)l.materialOverrideNames.push(g)}else Object.entries(u).forEach(([g,x])=>{const j={color:new xi(1,1,1),colorMix:0,emissionStrength:0,opacity:1},N=x["model-color"];N!==void 0&&(j.color.r=N[0],j.color.g=N[1],j.color.b=N[2]);const E=x["model-color-mix-intensity"];E!==void 0&&(j.colorMix=E);const R=x["model-emissive-strength"];R!==void 0&&(j.emissionStrength=R);const B=x["model-opacity"];B!==void 0&&(j.opacity=B),l.materialOverrides.set(g,j)})}onAdd(l){this.map=l,this.load()}hasTransition(){return!1}loaded(){return this._loaded}getModels(){return this.models}loadTile(l,u){}serialize(){return this._options}setProperty(l,u){return!1}reload(){const l=wh(this.id,this.scope);this.map.style.clearSource(l),this.models=[],this._modelsInfo.clear(),this._loaded=!1,this.load()}setModels(l){this.models=[];const u=new Map;for(const g in l){const x=l[g];if(this._modelsInfo.has(g)){const j=this._modelsInfo.get(g);j&&j.modelSpec.uri===x.uri&&u.set(g,j)}}this._modelsInfo=u,this._options.models=l,this._loaded=!1,this.load()}}function voe(h,l,u,g){const x=1<He.polygon).flat());const ke=J?E:null,[we,De]=A1e(j,g,G,H,B,N,ke,X,ne,j.center.lat,h.tileID.canonical),Be=h.queryGeometry;return T1e(we,De,Be.isPointQuery()?Be.screenBounds:Be.screenGeometry)}},building:class extends Kc{constructor(h,l,u,g){super(h,{layout:eve||(eve=new Ra({visibility:new kr(Dt.layout_building.visibility),"building-facade":new Ir(Dt.layout_building["building-facade"]),"building-facade-floors":new Ir(Dt.layout_building["building-facade-floors"]),"building-facade-unit-width":new Ir(Dt.layout_building["building-facade-unit-width"]),"building-facade-window":new Ir(Dt.layout_building["building-facade-window"]),"building-roof-shape":new Ir(Dt.layout_building["building-roof-shape"]),"building-height":new Ir(Dt.layout_building["building-height"]),"building-base":new Ir(Dt.layout_building["building-base"]),"building-flood-light-wall-radius":new Ir(Dt.layout_building["building-flood-light-wall-radius"]),"building-flood-light-ground-radius":new Ir(Dt.layout_building["building-flood-light-ground-radius"]),"building-flip-roof-orientation":new Ir(Dt.layout_building["building-flip-roof-orientation"])})),paint:tve||(tve=new Ra({"building-opacity":new kr(Dt.paint_building["building-opacity"]),"building-ambient-occlusion-intensity":new kr(Dt.paint_building["building-ambient-occlusion-intensity"]),"building-ambient-occlusion-ground-intensity":new kr(Dt.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new kr(Dt.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new kr(Dt.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new kr(Dt.paint_building["building-vertical-scale"]),"building-cast-shadows":new kr(Dt.paint_building["building-cast-shadows"]),"building-color":new Ir(Dt.paint_building["building-color"]),"building-emissive-strength":new Ir(Dt.paint_building["building-emissive-strength"]),"building-facade-emissive-chance":new kr(Dt.paint_building["building-facade-emissive-chance"]),"building-cutoff-fade-range":new kr(Dt.paint_building["building-cutoff-fade-range"]),"building-flood-light-color":new kr(Dt.paint_building["building-flood-light-color"]),"building-flood-light-intensity":new kr(Dt.paint_building["building-flood-light-intensity"]),"building-flood-light-ground-attenuation":new kr(Dt.paint_building["building-flood-light-ground-attenuation"]),"building-color-use-theme":new Ir({type:"string",default:"default","property-type":"data-driven"}),"building-flood-light-color-use-theme":new Ir({type:"string",default:"default","property-type":"data-driven"})}))},l,u,g),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(h){return new J1e(h)}cutoffRange(){return this.paint.get("building-cutoff-fade-range")}hasShadowPass(){return this.paint.get("building-cast-shadows")}hasLightBeamPass(){return!0}canCastShadows(){return!0}is3D(h){return!0}queryRadius(h){return 0}queryIntersectsFeature(h,l,u,g,x,j,N,E,R){let B=this.layout.get("building-height").evaluate(l,u);const H=this.layout.get("building-base").evaluate(l,u),G=h.tile.getBucket(this).getFootprint(l);if(G){if(G.hiddenFlags!==0)return!1;B=G.height}const[X,J]=A1e(j,g,H,B,new sr(0,0),N,null,[0,0],1,j.center.lat,h.tileID.canonical),ne=h.queryGeometry;return T1e(X,J,ne.isPointQuery()?ne.screenBounds:ne.screenGeometry)}},line:class extends Kc{constructor(h,l,u,g){const x=uve();super(h,x,l,u,g),x.layout&&(this.layout=new Vg(x.layout)),this.gradientVersion=0,this.hasElevatedBuckets=!1,this.hasNonElevatedBuckets=!1}_handleSpecialPaintPropertyUpdate(h){if(h==="line-gradient"){const l=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=l._styleExpression&&l._styleExpression.expression instanceof ev,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}widthExpression(){return this._transitionablePaint._values["line-width"].value.expression}emissiveStrengthExpression(){return this._transitionablePaint._values["line-emissive-strength"].value.expression}recalculate(h,l){super.recalculate(h,l),this.paint._values["line-floorwidth"]=(()=>{if(AM)return AM;const u=uve();return AM=new lqe(u.paint.properties["line-width"].specification),AM.useIntegerZoom=!0,AM})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,h)}createBucket(h){return new Kae(h)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(h,l,u){const g=cve(this);return{config:new Lm(this,{zoom:l,lut:u}),defines:g,overrideFog:!1}}queryRadius(h){const l=h,u=hve(hc("line-width",this,l),hc("line-gap-width",this,l)),g=hc("line-offset",this,l);return u/2+Math.abs(g)+Il(this.paint.get("line-translate"))}queryIntersectsFeature(h,l,u,g,x,j){if(h.queryGeometry.isAboveHorizon)return!1;const N=au(h.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),j.angle,h.pixelToTileUnitsFactor),E=h.pixelToTileUnitsFactor/2*hve(this.paint.get("line-width").evaluate(l,u),this.paint.get("line-gap-width").evaluate(l,u)),R=this.paint.get("line-offset").evaluate(l,u);return R&&(g=function(B,H){const G=[],X=new sr(0,0);for(let J=0;J=3){for(let ne=0;ne>16&255)/255,(h>>8&255)/255,(255&h)/255,1)}function CVe(h,l,u){h===1?(l.rgb_color=m6(u.readVarint()),l.paint="rgb_color"):h===2?(l.linear_gradient_idx=u.readVarint(),l.paint="linear_gradient_idx"):h===3?(l.radial_gradient_idx=u.readVarint(),l.paint="radial_gradient_idx"):h===5?u.readPackedFloat(l.dasharray):h===6?l.dashoffset=u.readFloat():h===7?l.miterlimit=u.readFloat():h===8?l.opacity=u.readVarint():h===9?l.width=u.readFloat():h===10?l.linecap=u.readVarint():h===11&&(l.linejoin=u.readVarint())}function MVe(h,l,u){h===1?l.transform=p6(u,u.readVarint()+u.pos):h===2?l.spread_method=u.readVarint():h===3?l.stops.push(N_e(u,u.readVarint()+u.pos)):h===4?l.x1=u.readFloat():h===5?l.y1=u.readFloat():h===6?l.x2=u.readFloat():h===7&&(l.y2=u.readFloat())}function N_e(h,l){return h.readFields(TVe,{offset:0,opacity:255,rgb_color:_oe},l)}function TVe(h,l,u){h===1?l.offset=u.readFloat():h===2?l.opacity=u.readVarint():h===3&&(l.rgb_color=m6(u.readVarint()))}function AVe(h,l,u){h===1?l.transform=p6(u,u.readVarint()+u.pos):h===2?l.spread_method=u.readVarint():h===3?l.stops.push(N_e(u,u.readVarint()+u.pos)):h===4?l.cx=u.readFloat():h===5?l.cy=u.readFloat():h===6?l.r=u.readFloat():h===7?l.fx=u.readFloat():h===8?l.fy=u.readFloat():h===9&&(l.fr=u.readFloat())}function EVe(h,l,u){h===1?l.transform=p6(u,u.readVarint()+u.pos):h===2?l.clip_path_idx=u.readVarint():h===3&&l.children.push(f6(u,u.readVarint()+u.pos))}function IVe(h,l,u){h===1?l.left=l.top=u.readFloat():h===2?l.width=l.height=u.readFloat():h===3?l.top=u.readFloat():h===4?l.height=u.readFloat():h===5?l.mask_type=u.readVarint():h===6?l.mask_idx=u.readVarint():h===7&&l.children.push(f6(u,u.readVarint()+u.pos))}class PVe{static calculate(l={},u=[]){const g=new Map,x=new Map;if(Object.keys(l).length===0)return g;u.forEach(j=>{x.set(j.name,j.rgb_color||new xi(0,0,0))});for(const[j,N]of Object.entries(l))x.has(j)?g.set(x.get(j).toString(),N):console.warn(`Ignoring unknown image variable "${j}"`);return g}}function _N(h,l=255,u){const g=l/255,x=h.toString(),j=u.has(x)?u.get(x).clone():h.clone();return j.a*=g,j.toString()}function GM(h,l){if(!eu()){const u=document.createElement("canvas");return u.width=h,u.height=l,u}return new OffscreenCanvas(h,l)}let joe,KM=null;function koe(h,l,u,g,x){for(const j of g.children)S_e(h,l,u,j,x)}function S_e(h,l,u,g,x){g.group?(h.save(),function(j,N,E,R,B){const H=R.mask_idx!=null?E.masks[R.mask_idx]:null,G=R.clip_path_idx!=null?E.clip_paths[R.clip_path_idx]:null;if(R.transform&&(N=bN(R.transform).preMultiplySelf(N)),!function(ne,pe,ke){return ne.opacity!==255||pe||ke}(R,G!=null,H!=null))return void koe(j,N,E,R,B);const X=GM(j.canvas.width,j.canvas.height),J=X.getContext("2d");koe(J,N,E,R,B),G&&P_e(J,N,E,G),H&&L_e(J,N,E,H,B),j.globalAlpha=R.opacity/255,j.drawImage(X,0,0)}(h,l,u,g.group,x),h.restore()):g.path&&(h.save(),function(j,N,E,R,B){j.setTransform(N),R.paint_order===mVe.PAINT_ORDER_FILL_AND_STROKE?(C_e(j,E,R,B),T_e(j,E,R,B)):(T_e(j,E,R,B),C_e(j,E,R,B))}(h,l,u,g.path,x),h.restore())}function C_e(h,l,u,g){const x=u.fill;if(!x)return;const j=x.opacity/255;switch(h.save(),h.beginPath(),O_e(u,h),x.paint){case"rgb_color":h.fillStyle=_N(x.rgb_color,x.opacity,g);break;case"linear_gradient_idx":{const N=l.linear_gradients[x.linear_gradient_idx];N.transform&&h.setTransform(bN(N.transform).preMultiplySelf(h.getTransform())),h.fillStyle=A_e(h,N,j,g);break}case"radial_gradient_idx":{const N=l.radial_gradients[x.radial_gradient_idx];N.transform&&h.setTransform(bN(N.transform).preMultiplySelf(h.getTransform())),h.fillStyle=E_e(h,N,j,g)}}h.fill(M_e(u)),h.restore()}function M_e(h){return h.rule===boe.PATH_RULE_NON_ZERO?"nonzero":h.rule===boe.PATH_RULE_EVEN_ODD?"evenodd":void 0}function T_e(h,l,u,g){const x=u.stroke;if(!x)return;const j=D_e(u);h.lineWidth=x.width,h.miterLimit=x.miterlimit,h.setLineDash(x.dasharray),h.lineDashOffset=x.dashoffset;const N=x.opacity/255;switch(x.paint){case"rgb_color":h.strokeStyle=_N(x.rgb_color,x.opacity,g);break;case"linear_gradient_idx":h.strokeStyle=A_e(h,l.linear_gradients[x.linear_gradient_idx],N,g,!0);break;case"radial_gradient_idx":h.strokeStyle=E_e(h,l.radial_gradients[x.radial_gradient_idx],N,g,!0)}switch(x.linejoin){case h6.LINE_JOIN_MITER_CLIP:case h6.LINE_JOIN_MITER:h.lineJoin="miter";break;case h6.LINE_JOIN_ROUND:h.lineJoin="round";break;case h6.LINE_JOIN_BEVEL:h.lineJoin="bevel"}switch(x.linecap){case woe.LINE_CAP_BUTT:h.lineCap="butt";break;case woe.LINE_CAP_ROUND:h.lineCap="round";break;case woe.LINE_CAP_SQUARE:h.lineCap="square"}h.stroke(j)}function A_e(h,l,u,g,x=!1){if(l.stops.length===1){const X=l.stops[0];return _N(X.rgb_color,X.opacity*u,g)}const{x1:j,y1:N,x2:E,y2:R}=l;let B=new DOMPoint(j,N),H=new DOMPoint(E,R);if(x){const X=bN(l.transform);B=X.transformPoint(B),H=X.transformPoint(H)}const G=h.createLinearGradient(B.x,B.y,H.x,H.y);for(const X of l.stops)G.addColorStop(X.offset,_N(X.rgb_color,X.opacity*u,g));return G}function E_e(h,l,u,g,x=!1){if(l.stops.length===1){const we=l.stops[0];return _N(we.rgb_color,we.opacity*u,g)}const j=bN(l.transform),{fx:N,fy:E,fr:R,cx:B,cy:H,r:G}=l;let X=new DOMPoint(N,E),J=new DOMPoint(B,H),ne=R,pe=G;if(x){X=j.transformPoint(X),J=j.transformPoint(J);const we=(j.a+j.d)/2;ne=R*we,pe=l.r*we}const ke=h.createRadialGradient(X.x,X.y,ne,J.x,J.y,pe);for(const we of l.stops)ke.addColorStop(we.offset,_N(we.rgb_color,we.opacity*u,g));return ke}function I_e(h,l,u,g){const x=g.transform?bN(g.transform).preMultiplySelf(l):l,j=GM(h.canvas.width,h.canvas.height),N=j.getContext("2d");for(const R of g.children)if(R.group)I_e(N,x,u,R.group);else if(R.path){const B=R.path,H=new Path2D;H.addPath(D_e(B),x),N.fill(H,M_e(B))}const E=g.clip_path_idx!=null?u.clip_paths[g.clip_path_idx]:null;E&&P_e(N,x,u,E),h.globalCompositeOperation="source-over",h.drawImage(j,0,0)}function P_e(h,l,u,g){const x=GM(h.canvas.width,h.canvas.height);I_e(x.getContext("2d"),l,u,g),h.globalCompositeOperation="destination-in",h.drawImage(x,0,0)}function L_e(h,l,u,g,x){if(g.children.length===0)return;const j=g.mask_idx!=null?u.masks[g.mask_idx]:null;j&&L_e(h,l,u,j,x);const N=h.canvas.width,E=h.canvas.height,R=GM(N,E),B=R.getContext("2d"),H=g.width,G=g.height,X=g.left,J=g.top,ne=new Path2D,pe=new Path2D;pe.rect(X,J,H,G),ne.addPath(pe,l),B.clip(ne);for(const De of g.children)S_e(B,l,u,De,x);const ke=B.getImageData(0,0,N,E),we=ke.data;if(g.mask_type===w_e.MASK_TYPE_LUMINANCE)for(let De=0;Del[N])return null}else{const E=1/g[N];let R=(h[N]-u[N])*E,B=(l[N]-u[N])*E;if(R>B){const H=R;R=B,B=H}if(R>x&&(x=R),Bj)return null}return x}function z_e(h,l,u,g,x,j,N,E,R,B,H){const G=g-h,X=x-l,J=j-u,ne=N-h,pe=E-l,ke=R-u,we=H[1]*ke-H[2]*pe,De=H[2]*ne-H[0]*ke,Be=H[0]*pe-H[1]*ne,He=G*we+X*De+J*Be;if(Math.abs(He)<1e-15)return null;const dt=1/He,it=B[0]-h,pt=B[1]-l,wt=B[2]-u,Ct=(it*we+pt*De+wt*Be)*dt;if(Ct<0||Ct>1)return null;const Wt=pt*J-wt*X,Lt=wt*G-it*J,Qt=it*X-pt*G,ar=(H[0]*Wt+H[1]*Lt+H[2]*Qt)*dt;return ar<0||Ct+ar>1?null:(ne*Wt+pe*Lt+ke*Qt)*dt}function B_e(h,l,u){return(h-l)/(u-l)}function $_e(h,l,u,g,x,j,N,E,R){const B=1<{const De=ke?1:0,Be=(J+1)*pe-De,He=ne*pe,dt=(ne+1)*pe-De;we[0]=J*pe,we[1]=He,we[2]=Be,we[3]=dt};let G=new R_e(R);const X=[];for(let J=0;J=1;R/=2){const J=E[E.length-1];G=new R_e(R);for(let ne=0;ne0;){const{idx:ne,t:pe,nodex:ke,nodey:we,depth:De}=J.pop();if(this.leaves[ne]){$_e(ke,we,De,l,u,g,x,G,X);const He=1<=xr[2])return pe}continue}let Be=0;for(let He=0;He=B[H[wt]]&&(H.splice(wt,0,He),pt=!0);pt||(H[Be]=He),Be++}}for(let He=0;He=this.dim+1||u<-1||u>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(u+1)*this.stride+(l+1)}static pack(l,u){const g=[0,0,0,0],x=y6.getUnpackVector(u);let j=Math.floor((l+x[3])/x[2]);return g[2]=j%256,j=Math.floor(j/256),g[1]=j%256,j=Math.floor(j/256),g[0]=j,g}getPixels(){return new R0e({width:this.stride,height:this.stride},this.pixels)}backfillBorder(l,u,g){if(this.dim!==l.dim)throw new Error("dem dimension mismatch");let x=u*this.dim,j=u*this.dim+this.dim,N=g*this.dim,E=g*this.dim+this.dim;switch(u){case-1:x=j-1;break;case 1:j=x+1}switch(g){case-1:N=E-1;break;case 1:E=N+1}const R=-u*this.dim,B=-g*this.dim;for(let H=N;H=1;g--){const x=g===1?1:0,j=g===2?1:0;for(let N=0;N>>1^-(1&h[l]);return h}function GVe(h,l){switch(l){case"uint32":return h;case"uint16":for(let u=0;u>4|(61440&g)>>8|(240&x)<<4|61440&x,h[u+1]=15&g|(3840&g)>>4|(15&x)<<8|(3840&x)<<4}return h;case"uint8":for(let u=0;u>6|(192&x)>>4|(192&j)>>2|192&N,h[u+1]=(48&g)>>4|(48&x)>>2|48&j|(48&N)<<2,h[u+2]=(12&g)>>2|12&x|(12&j)<<2|(12&N)<<4,h[u+3]=3&g|(3&x)<<2|(3&j)<<4|(3&N)<<6}return h;default:throw new Error(`Invalid pixel format, "${l}"`)}}Yr(y6,"DEMData"),Yr(U_e,"DemMinMaxQuadTree",{omit:["dem"]});var Sh=Uint8Array,ZM=Uint16Array,KVe=Int32Array,V_e=new Sh([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),H_e=new Sh([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),ZVe=new Sh([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),W_e=function(h,l){for(var u=new ZM(31),g=0;g<31;++g)u[g]=l+=1<>1|(21845&el)<<1;Z_e[el]=((65280&(wN=(61680&(wN=(52428&wN)>>2|(13107&wN)<<2))>>4|(3855&wN)<<4))>>8|(255&wN)<<8)>>1}var YM=function(h,l,u){for(var g=h.length,x=0,j=new ZM(l);x>R]=B;return N},XM=new Sh(288);for(el=0;el<144;++el)XM[el]=8;for(el=144;el<256;++el)XM[el]=9;for(el=256;el<280;++el)XM[el]=7;for(el=280;el<288;++el)XM[el]=8;var Y_e=new Sh(32);for(el=0;el<32;++el)Y_e[el]=5;var QVe=YM(XM,9),JVe=YM(Y_e,5),Soe=function(h){for(var l=h[0],u=1;ul&&(l=h[u]);return l},Np=function(h,l,u){var g=l/8|0;return(h[g]|h[g+1]<<8)>>(7&l)&u},Coe=function(h,l){var u=l/8|0;return(h[u]|h[u+1]<<8|h[u+2]<<16)>>(7&l)},eHe=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Sp=function(h,l,u){var g=new Error(l||eHe[h]);if(g.code=h,Error.captureStackTrace&&Error.captureStackTrace(g,Sp),!u)throw g;return g},tHe=new Sh(0),rHe=typeof TextDecoder<"u"&&new TextDecoder;try{rHe.decode(tHe,{stream:!0})}catch{}const nHe={gzip_data:"gzip"};class ff extends Error{constructor(l){super(l),this.name="MRTError"}}const sHe={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},X_e={uint32:1,uint16:2,uint8:4},iHe={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let Moe;class x6{constructor(l=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=l}getLayer(l){const u=this.layers[l];if(!u)throw new ff(`Layer '${l}' not found`);return u}getHeaderLength(l){const u=new Uint8Array(l),g=new DataView(l);if(u[0]!==13)throw new ff("File is not a valid MRT.");return g.getUint32(1,!0)}parseHeader(l){const u=new Uint8Array(l),g=this.getHeaderLength(l);if(u.length= ${g} but got buffer of length ${u.length}`);const x=new Moe(u.subarray(0,g)).readFields(RVe,{headerLength:0,x:0,y:0,z:0,layers:[]},void 0);if(!isNaN(this.x)&&(this.x!==x.x||this.y!==x.y||this.z!==x.z))throw new ff(`Invalid attempt to parse header ${x.z}/${x.x}/${x.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=x.x,this.y=x.y,this.z=x.z;for(const j of x.layers)this.layers[j.name]=new Q_e(j,{cacheSize:this._cacheSize});return this}createDecodingTask(l){const u=[],g=this.getLayer(l.layerName);for(let x of l.blockIndices){const j=g.dataIndex[x],N=j.firstByte-l.firstByte,E=j.lastByte-l.firstByte;if(g._blocksInProgress.has(x))continue;const R={layerName:g.name,firstByte:N,lastByte:E,pixelFormat:g.pixelFormat,blockIndex:x,blockShape:[j.bands.length].concat(g.bandShape),buffer:g.buffer,codec:j.codec.codec,filters:j.filters.map(B=>B.filter)};g._blocksInProgress.add(x),u.push(R)}return new J_e(u,()=>{u.forEach(x=>g._blocksInProgress.delete(x.blockIndex))},(x,j)=>{if(u.forEach(N=>g._blocksInProgress.delete(N.blockIndex)),x)throw x;j.forEach(N=>{this.getLayer(N.layerName).processDecodedData(N)})})}}class Q_e{constructor({version:l,name:u,units:g,tileSize:x,pixelFormat:j,buffer:N,dataIndex:E},R){if(this.version=l,this.version!==1)throw new ff(`Cannot parse raster layer encoded with MRT version ${l}`);this.name=u,this.units=g,this.tileSize=x,this.buffer=N,this.pixelFormat=sHe[j],this.dataIndex=E,this.bandShape=[x+2*N,x+2*N,X_e[this.pixelFormat]],this._decodedBlocks=new g6(R?R.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return X_e[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:l})=>l).flat()}processDecodedData(l){const u=l.blockIndex.toString();this._decodedBlocks.get(u)||this._decodedBlocks.put(u,l.data)}getBlockForBand(l){let u=0;switch(typeof l){case"string":for(const[g,x]of this.dataIndex.entries()){for(const[j,N]of x.bands.entries())if(N===l)return{bandIndex:u+j,blockIndex:g,blockBandIndex:j};u+=x.bands.length}break;case"number":for(const[g,x]of this.dataIndex.entries()){if(l>=u&&lthis.cacheSize)throw new ff(`Number of blocks to decode (${j.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:u,lastByte:g,blockIndices:x}}hasBand(l){const{blockIndex:u}=this.getBlockForBand(l);return u>=0}hasDataForBand(l){const{blockIndex:u}=this.getBlockForBand(l);return u>=0&&!!this._decodedBlocks.get(u.toString())}getBandView(l){const{blockIndex:u,blockBandIndex:g}=this.getBlockForBand(l);if(u<0)throw new ff(`Band not found: ${JSON.stringify(l)}`);const x=this._decodedBlocks.get(u.toString());if(!x)throw new ff(`Data for band ${JSON.stringify(l)} of layer "${this.name}" not decoded.`);const j=this.dataIndex[u],N=this.bandShape.reduce((B,H)=>B*H,1),E=g*N,R=x.subarray(E,E+N);return{data:R,bytes:new Uint8Array(R.buffer).subarray(R.byteOffset,R.byteOffset+R.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:j.offset,scale:j.scale}}}x6.setPbf=function(h){Moe=h};class J_e{constructor(l,u,g){this.tasks=l,this._onCancel=u,this._onComplete=g,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(l,u){this._finalized||(this._onComplete(l,u),this._finalized=!0)}}x6.performDecoding=function(h,l){const u=new Uint8Array(h);return Promise.all(l.tasks.map(g=>{const{layerName:x,firstByte:j,lastByte:N,pixelFormat:E,blockShape:R,blockIndex:B,filters:H,codec:G}=g,X=u.subarray(j,N+1),J=new Uint32Array(R[0]*R[1]*R[2]);let ne;if(G!=="gzip_data")throw new ff(`Unhandled codec: ${G}`);return ne=function(pe,ke){if(!globalThis.DecompressionStream&&ke==="gzip_data")return Promise.resolve(((He=function(pt){pt[0]==31&&pt[1]==139&&pt[2]==8||Sp(6,"invalid gzip data");var wt=pt[3],Ct=10;4&wt&&(Ct+=2+(pt[10]|pt[11]<<8));for(var Wt=(wt>>3&1)+(wt>>4&1);Wt>0;Wt-=!pt[Ct++]);return Ct+(2&wt)}(Be=pe))+8>Be.length&&Sp(6,"invalid gzip data"),function(pt,wt,Ct,Wt){var Lt=pt.length;if(!Lt||wt.f&&!wt.l)return Ct||new Sh(0);var Qt=!Ct,ar=Qt||wt.i!=2,or=wt.i;Qt&&(Ct=new Sh(3*Lt));var gr,xr,hr=function(Ii){var oi=Ct.length;if(Ii>oi){var fi=new Sh(Math.max(2*oi,Ii));fi.set(Ct),Ct=fi}},fr=wt.f||0,Xt=wt.p||0,Gt=wt.b||0,pr=wt.l,Tr=wt.d,br=wt.m,dn=wt.n,Rr=8*Lt;do{if(!pr){fr=Np(pt,Xt,1);var Vr=Np(pt,Xt+1,3);if(Xt+=3,!Vr){var tn=pt[(Jt=4+((Xt+7)/8|0))-4]|pt[Jt-3]<<8,us=Jt+tn;if(us>Lt){or&&Sp(0);break}ar&&hr(Gt+tn),Ct.set(pt.subarray(Jt,us),Gt),wt.b=Gt+=tn,wt.p=Xt=8*us,wt.f=fr;continue}if(Vr==1)pr=QVe,Tr=JVe,br=9,dn=5;else if(Vr==2){var jr=Np(pt,Xt,31)+257,rn=Np(pt,Xt+10,15)+4,Bn=jr+Np(pt,Xt+5,31)+1;Xt+=14;for(var Es=new Sh(Bn),Rs=new Sh(19),Yn=0;Yn>4)<16)Es[Yn++]=Jt;else{var Pr=0,Lr=0;for(Jt==16?(Lr=3+Np(pt,Xt,3),Xt+=2,Pr=Es[Yn-1]):Jt==17?(Lr=3+Np(pt,Xt,7),Xt+=3):Jt==18&&(Lr=11+Np(pt,Xt,127),Xt+=7);Lr--;)Es[Yn++]=Pr}}var hn=Es.subarray(0,jr),mn=Es.subarray(jr);br=Soe(hn),dn=Soe(mn),pr=YM(hn,br),Tr=YM(mn,dn)}else Sp(1);if(Xt>Rr){or&&Sp(0);break}}ar&&hr(Gt+131072);for(var Kn=(1<>4;if((Xt+=15&Pr)>Rr){or&&Sp(0);break}if(Pr||Sp(2),Ns<256)Ct[Gt++]=Ns;else{if(Ns==256){ds=Xt,pr=null;break}var En=Ns-254;Ns>264&&(En=Np(pt,Xt,(1<<(ei=V_e[Yn=Ns-257]))-1)+K_e[Yn],Xt+=ei);var zn=Tr[Coe(pt,Xt)&ns],Ks=zn>>4;if(zn||Sp(3),Xt+=15&zn,mn=XVe[Ks],Ks>3){var ei=H_e[Ks];mn+=Coe(pt,Xt)&(1<Rr){or&&Sp(0);break}ar&&hr(Gt+131072);var ti=Gt+En;if(Gtgr.length)&&(xr=gr.length),new Sh(gr.subarray(0,xr))):Ct.subarray(0,Gt)}(Be.subarray(He,-8),{i:2},new Sh(((we=Be)[(De=we.length)-4]|we[De-3]<<8|we[De-2]<<16|we[De-1]<<24)>>>0))));var we,De,Be,He;const dt=nHe[ke];if(!dt)throw new Error(`Unhandled codec: ${ke}`);const it=new globalThis.DecompressionStream(dt);return new Response(new Blob([pe]).stream().pipeThrough(it)).arrayBuffer().then(pt=>new Uint8Array(pt))}(X,G).then(pe=>(function(ke,we){ke.readFields(qVe,we)}(new Moe(pe),J),new iHe[E](J.buffer))),ne.then(pe=>{for(let ke=H.length-1;ke>=0;ke--)switch(H[ke]){case"delta_filter":HVe(pe,R);break;case"zigzag_filter":WVe(pe);break;case"bitshuffle_filter":GVe(pe,E);break;default:throw new ff(`Unhandled filter "${H[ke]}"`)}return{layerName:x,blockIndex:B,data:pe}}).catch(pe=>{throw pe})}))},Yr(J_e,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),Yr(x6,"MapboxRasterTile"),Yr(Q_e,"MapboxRasterLayer",{omit:["_blocksInProgress"]});class e2e{constructor(l){this._stringToNumber={},this._numberToString=[];for(let u=0;u=0&&X[3]>=0&&B.insert(R,X[0],X[1],X[2],X[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new Ft(new KP(this.rawTileData)).layers,this.sourceLayerCoder=new e2e(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const l in this.vtLayers)this.vtFeatures[l]=[]}return this.vtLayers}query(l,u){const{tilespaceGeometry:g,transform:x,tileTransform:j,pixelPosMatrix:N,availableImages:E,worldview:R}=u;this.loadVTLayers(),this.serializedLayersCache.clear();const B=u.queryRadius?u.queryRadius:0,H=g.bufferedTilespaceBounds,G=this.grid.query(H.min.x,H.min.y,H.max.x,H.max.y,(pe,ke,we,De)=>Zc(g.bufferedTilespaceGeometry,pe-B,ke-B,we+B,De+B));G.sort(aHe);let X=null;x.elevation&&G.length>0&&(X=vN.create(x.elevation,this.tileID));const J={};let ne;for(let pe=0;pe(De||(De=vt(Be,this.tileID.canonical,j)),He.queryIntersectsFeature(g,Be,dt,De,this.z,x,N,X,it)))}return J}loadMatchingFeature(l,u,g,x,j,N){const{featureIndex:E,bucketIndex:R,sourceLayerIndex:B,layoutVertexArrayOffset:H}=u,G=this.bucketLayerIDs[R],X=g.layers,J=Object.keys(X);if(J.length&&!Wr(J,G))return;const ne=g.sourceCache,pe=this.sourceLayerCoder.decode(B),ke=this.vtLayers[pe].feature(E),we=this.getId(ke,pe);for(let De=0;De`${E.key}: ${E.message}`).join(", ");return void Br(`Failed to create expression for promoteId: ${N}`)}this.promoteIdExpression=j.value}g=this.promoteIdExpression.evaluate({zoom:0},l)}else g=l.properties[x];typeof g=="boolean"&&(g=Number(g))}return g}}function r2e(h,l,u,g,x){return Bt(h,(j,N)=>{const E=l instanceof Vg?l.get(N):null;return E&&E.evaluate?E.evaluate(u,g,void 0,x):E})}function aHe(h,l){return l-h}Yr(t2e,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const n2e=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Toe{static from(l){if(!(l instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[u,g]=new Uint8Array(l,0,2);if(u!==219)throw new Error("Data does not appear to be in a KDBush format.");const x=g>>4;if(x!==1)throw new Error(`Got v${x} data when expected v1.`);const j=n2e[15&g];if(!j)throw new Error("Unrecognized array type.");const[N]=new Uint16Array(l,2,1),[E]=new Uint32Array(l,4,1);return new Toe(E,N,j,l)}constructor(l,u=64,g=Float64Array,x){if(isNaN(l)||l<0)throw new Error(`Unpexpected numItems value: ${l}.`);this.numItems=+l,this.nodeSize=Math.min(Math.max(+u,2),65535),this.ArrayType=g,this.IndexArrayType=l<65536?Uint16Array:Uint32Array;const j=n2e.indexOf(this.ArrayType),N=2*l*this.ArrayType.BYTES_PER_ELEMENT,E=l*this.IndexArrayType.BYTES_PER_ELEMENT,R=(8-E%8)%8;if(j<0)throw new Error(`Unexpected typed array class: ${g}.`);x&&x instanceof ArrayBuffer?(this.data=x,this.ids=new this.IndexArrayType(this.data,8,l),this.coords=new this.ArrayType(this.data,8+E+R,2*l),this._pos=2*l,this._finished=!0):(this.data=new ArrayBuffer(8+N+E+R),this.ids=new this.IndexArrayType(this.data,8,l),this.coords=new this.ArrayType(this.data,8+E+R,2*l),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+j]),new Uint16Array(this.data,2,1)[0]=u,new Uint32Array(this.data,4,1)[0]=l)}add(l,u){const g=this._pos>>1;return this.ids[g]=g,this.coords[this._pos++]=l,this.coords[this._pos++]=u,g}finish(){const l=this._pos>>1;if(l!==this.numItems)throw new Error(`Added ${l} items when expected ${this.numItems}.`);return Aoe(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(l,u,g,x){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:j,coords:N,nodeSize:E}=this,R=[0,j.length-1,0],B=[];for(;R.length;){const H=R.pop()||0,G=R.pop()||0,X=R.pop()||0;if(G-X<=E){for(let ke=X;ke<=G;ke++){const we=N[2*ke],De=N[2*ke+1];we>=l&&we<=g&&De>=u&&De<=x&&B.push(j[ke])}continue}const J=X+G>>1,ne=N[2*J],pe=N[2*J+1];ne>=l&&ne<=g&&pe>=u&&pe<=x&&B.push(j[J]),(H===0?l<=ne:u<=pe)&&(R.push(X),R.push(J-1),R.push(1-H)),(H===0?g>=ne:x>=pe)&&(R.push(J+1),R.push(G),R.push(1-H))}return B}within(l,u,g){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:x,coords:j,nodeSize:N}=this,E=[0,x.length-1,0],R=[],B=g*g;for(;E.length;){const H=E.pop()||0,G=E.pop()||0,X=E.pop()||0;if(G-X<=N){for(let ke=X;ke<=G;ke++)i2e(j[2*ke],j[2*ke+1],l,u)<=B&&R.push(x[ke]);continue}const J=X+G>>1,ne=j[2*J],pe=j[2*J+1];i2e(ne,pe,l,u)<=B&&R.push(x[J]),(H===0?l-g<=ne:u-g<=pe)&&(E.push(X),E.push(J-1),E.push(1-H)),(H===0?l+g>=ne:u+g>=pe)&&(E.push(J+1),E.push(G),E.push(1-H))}return R}}function Aoe(h,l,u,g,x,j){if(x-g<=u)return;const N=g+x>>1;s2e(h,l,N,g,x,j),Aoe(h,l,u,g,N-1,1-j),Aoe(h,l,u,N+1,x,1-j)}function s2e(h,l,u,g,x,j){for(;x>g;){if(x-g>600){const B=x-g+1,H=u-g+1,G=Math.log(B),X=.5*Math.exp(2*G/3),J=.5*Math.sqrt(G*X*(B-X)/B)*(H-B/2<0?-1:1);s2e(h,l,u,Math.max(g,Math.floor(u-H*X/B+J)),Math.min(x,Math.floor(u+(B-H)*X/B+J)),j)}const N=l[2*u+j];let E=g,R=x;for(QM(h,l,g,u),l[2*x+j]>N&&QM(h,l,g,x);EN;)R--}l[2*g+j]===N?QM(h,l,g,R):(R++,QM(h,l,R,x)),R<=u&&(g=R+1),u<=R&&(x=R-1)}}function QM(h,l,u,g){Eoe(h,u,g),Eoe(l,2*u,2*g),Eoe(l,2*u+1,2*g+1)}function Eoe(h,l,u){const g=h[l];h[l]=h[u],h[u]=g}function i2e(h,l,u,g){const x=h-u,j=l-g;return x*x+j*j}a.$=Jj,a.A=ap,a.B=wh,a.C=2,a.D=aN,a.E=Og,a.F=PM,a.G=Eve,a.H=Qj,a.I=Cc,a.J=dP,a.K=cn,a.L=ox,a.M=jk,a.N=iv,a.O=XI,a.P=sr,a.Q=av,a.R=Pg,a.S=Pk,a.T=zae,a.U=Tm,a.V=d6,a.W=B3,a.X=hx,a.Y=ux,a.Z=J1,a._=Wc,a.a=function(h){return bs.API_CDN_URL_REGEX.test(h)},a.a$=ce,a.a0=Fn,a.a1=Bu,a.a2=lf,a.a3=class extends d6{},a.a4=kk,a.a5=YI,a.a6=Dt,a.a7=function(h){const l=h.value;return l?Fn(l)?goe(l,!0)?[]:[new d6(h.key,l,`invalid url "${l}"`)]:[new d6(h.key,l,`string expected, "${cn(l)}" found`)]:[]},a.a8=aP,a.a9=Ra,a.aA=_e,a.aB=A,a.aC=Nt,a.aD=dc,a.aE=zi,a.aF=z,a.aG=Ve,a.aH=function(h,l){const u={};for(let g=0;g{g(j,N)},l):g(j,N),()=>{}}return x.callbacks.push(g),x.cancel||(x.cancel=u((j,N)=>{x.result=[j,N];for(const E of x.callbacks)this.scheduler?this.scheduler.add(()=>{E(j,N)},l):E(j,N);setTimeout(()=>delete this.entries[h],3e3)})),()=>{x.result||(x.callbacks=x.callbacks.filter(j=>j!==g),x.callbacks.length||(x.cancel(),delete this.entries[h]))}}},a.aL=function(h,l,u){const g=JSON.stringify(h.request);return h.data&&(this.deduped.entries[g]={result:[null,h.data]}),this.deduped.request(g,{type:"parseTile",isSymbolTile:h.isSymbolTile,zoom:h.tileZoom},x=>{const j=zu(h.request,(N,E,R)=>{N?x(N):E&&x(null,{rawData:E,vectorTile:u?void 0:new Ft(new KP(E)),responseHeaders:new Map(R.entries())})});return()=>{j.cancel(),x()}},l)},a.aM=function(h){return h?{cacheControl:h.get("Cache-Control"),expires:h.get("Expires")}:{cacheControl:void 0,expires:void 0}},a.aN=qc,a.aO=function(h){Pd++,Pd>xm&&(h.getActor().send("enforceCacheSizeLimit",tp),Pd=0)},a.aP=function(h){return h<=1?1:Math.pow(2,Math.floor(Math.log2(h)))},a.aQ=Ia,a.aR=a_e,a.aS=h_e,a.aT=p,a.aU=i_e,a.aV=function(h,l){const u=document.createElement("video");u.muted=!0,u.onloadstart=function(){l(null,u)};for(let g=0;g{}}},a.aW=MM,a.aX=Av,a.aY=Ot,a.aZ=RM,a.a_=Q,a.aa=kr,a.ab=class{constructor(h){this.specification=h}possiblyEvaluate(h,l){return Gn(h.expression.evaluate(l))}interpolate(h,l,u){return{x:Dn(h.x,l.x,u),y:Dn(h.y,l.y,u),z:Dn(h.z,l.z,u),azimuthal:Dn(h.azimuthal,l.azimuthal,u),polar:Dn(h.polar,l.polar,u)}}},a.ac=Qi,a.ad=$g,a.ae=qe,a.af=Xe,a.ag=xe,a.ah=ze,a.ai=Vg,a.aj=Ex,a.ak=Dn,a.al=Cr,a.am=c3,a.an=Qr,a.ao=xi,a.ap=class{constructor(h){this.specification=h}possiblyEvaluate(h,l){return function([u,g]){const x=Gn([1,u,g]);return{x:x.x,y:x.y,z:x.z}}(h.expression.evaluate(l))}interpolate(h,l,u){return{x:Dn(h.x,l.x,u),y:Dn(h.y,l.y,u),z:Dn(h.z,l.z,u)}}},a.aq=function(h,l,u=0,g=!0){const x=new sr(u,u),j=h.sub(x),N=l.add(x),E=[j,new sr(N.x,j.y),N,new sr(j.x,N.y)];return g&&E.push(j.clone()),E},a.ar=function(h,l){const u=[];for(let g=0;g1)return!1;const u=l.getSource().maxzoom,g=1<1)return l;const x=g.getSource().maxzoom,j=1<{const E=this.getAtTileOffset(h,x,j,N),R=g.upVector(h.canonical,x.x,x.y);return ae(R,R,E*g.upVectorScale(h.canonical,l,u).metersToTile),R}}getForTilePoints(h,l,u,g){if(this.isUsingMockSource())return!1;const x=vN.create(this,h,g);return!!x&&(l.forEach(j=>{j[2]=this.exaggeration()*x.getElevationAt(j[0],j[1],u)}),!0)}getMinMaxForTile(h){if(this.isUsingMockSource())return null;const l=this.findDEMTileFor(h);if(!l||!l.dem)return null;const u=l.dem.tree,g=l.tileID,x=1<0&&(g+=(h[x]-0)*(h[x]-0)),l[x]<0&&(g+=(0-l[x])*(0-l[x]));return g},a.c0=a1e,a.c1=eoe,a.c2=Fve,a.c3=loe,a.c4=Toe,a.c5=ae,a.c6=Fe,a.c7=It,a.c8=function(h,l,u){u*=.5;var g=l[0],x=l[1],j=l[2],N=l[3],E=Math.sin(u),R=Math.cos(u);return h[0]=g*R+x*E,h[1]=x*R-g*E,h[2]=j*R+N*E,h[3]=N*R-j*E,h},a.c9=tr,a.cA=Ne,a.cB=ai,a.cC=V1e,a.cD=Bi,a.cE=b0e,a.cF=function(h,l,u,g,x,j,N,E,R){if(R.name==="globe")return b0e(h,l,new Bi(u,g,x),!1);const B=RM({z:u,x:g,y:x},R);return new on([(j+B.x/B.scale)*l,l*(B.y/B.scale),N],[(j+B.x2/B.scale)*l,l*(B.y2/B.scale),E])},a.cG=function(h,l,u){return h[0]=Math.min(l[0],u[0]),h[1]=Math.min(l[1],u[1]),h[2]=Math.min(l[2],u[2]),h[3]=Math.min(l[3],u[3]),h},a.cH=function(h,l,u){return h[0]=Math.max(l[0],u[0]),h[1]=Math.max(l[1],u[1]),h[2]=Math.max(l[2],u[2]),h[3]=Math.max(l[3],u[3]),h},a.cI=function(h){const l=Math.round((h+45+360)%360/90)%4;return Ka[l]},a.cJ=de,a.cK=Le,a.cL=nN,a.cM=function(h){const l=T(new Float64Array(16));A(l,h.pixelMatrix,h.globeMatrix);const u=[0,Wu,0],g=[0,Gu,0];return Xe(u,u,l),Xe(g,g,l),[u[0]>0&&u[0]<=h.width&&u[1]>0&&u[1]<=h.height&&!gae(h,new p(h.center.lat,90)),g[0]>0&&g[0]<=h.width&&g[1]>0&&g[1]<=h.height&&!gae(h,new p(h.center.lat,-90))]},a.cN=function(h,l){const{scale:u}=h.tileTransform,g=u*Cr/(h.tileSize*Math.pow(2,l.zoom-h.tileID.overscaledZ+h.tileID.canonical.z));return function(x,j,N){var E=j[1],R=j[2],B=j[3],H=N[0],G=N[1];return x[0]=j[0]*H,x[1]=E*H,x[2]=R*G,x[3]=B*G,x}(new Float32Array(4),l.inverseAdjustmentMatrix,[g,g])},a.cO=UP,a.cP=ue,a.cQ=q1e,a.cR=function(h){const l=q1e(h,!0);return y([],[l[0],l[1],l[4],l[5]])},a.cS=$,a.cT=Dr,a.cU=F,a.cV=function(h){const{x:l,y:u}=h.point,{lng:g,lat:x}=h._center;return k0e(l,u,h.worldSize,g,x)},a.cW=Ie,a.cX=ba,a.cY=Na,a.cZ=Xl,a.c_=Hu,a.ca=Aa,a.cb=function(h,l){return h[0]=-l[0],h[1]=-l[1],h[2]=-l[2],h[3]=l[3],h},a.cc=he,a.cd=function(h,l,u,g,x){var j=1/Math.tan(l/2);if(h[0]=j/u,h[1]=0,h[2]=0,h[3]=0,h[4]=0,h[5]=j,h[6]=0,h[7]=0,h[8]=0,h[9]=0,h[11]=-1,h[12]=0,h[13]=0,h[15]=0,x!=null&&x!==1/0){var N=1/(g-x);h[10]=(x+g)*N,h[14]=2*x*g*N}else h[10]=-1,h[14]=-2*g;return h},a.ce=function(h,l,u,g,x,j,N){var E=1/(l-u),R=1/(g-x),B=1/(j-N);return h[0]=-2*E,h[1]=0,h[2]=0,h[3]=0,h[4]=0,h[5]=-2*R,h[6]=0,h[7]=0,h[8]=0,h[9]=0,h[10]=2*B,h[11]=0,h[12]=(l+u)*E,h[13]=(x+g)*R,h[14]=(N+j)*B,h[15]=1,h},a.cf=Y,a.cg=function(h,l,u){h[4*l+0]=u[0],h[4*l+1]=u[1],h[4*l+2]=u[2],h[4*l+3]=u[3]},a.ch=Jk,a.ci=mv,a.cj=Fo,a.ck=uf,a.cl=yv,a.cm=Zve,a.cn=function(){var h=new m(4);return m!=Float32Array&&(h[1]=0,h[2]=0),h[0]=1,h[3]=1,h},a.co=function(h,l,u){var g=l[0],x=l[1],j=l[2],N=l[3],E=Math.sin(u),R=Math.cos(u);return h[0]=g*R+j*E,h[1]=x*R+N*E,h[2]=g*-E+j*R,h[3]=x*-E+N*R,h},a.cp=function(h,l){return h[0]===l[0]&&h[1]===l[1]&&h[2]===l[2]&&h[3]===l[3]},a.cq=We,a.cr=function(h){var l=h[0],u=h[1],g=h[2],x=h[3];return Math.sqrt(l*l+u*u+g*g+x*x)},a.cs=js,a.ct=mt,a.cu=mo,a.cv=3,a.cw=2,a.cx=7,a.cy=6,a.cz=Te,a.d=function(h){return bs.API_TILEJSON_REGEX.test(h)},a.d$=class{constructor(h,l,u,g){this.context=h,this.format=g,this.size=u,this.texture=h.gl.createTexture();const[x,j,N]=this.size,{gl:E}=h;E.bindTexture(E.TEXTURE_3D,this.texture),h.pixelStoreUnpackFlipY.set(!1),h.pixelStoreUnpack.set(1),h.pixelStoreUnpackPremultiplyAlpha.set(!1),"data"in l&&l.data&&E.texImage3D(E.TEXTURE_3D,0,this.format,x,j,N,0,Rae(this.format),Fae(this.format),l.data)}bind(h,l){const{context:u}=this,{gl:g}=u;g.bindTexture(g.TEXTURE_3D,this.texture),h!==this.minFilter&&(g.texParameteri(g.TEXTURE_3D,g.TEXTURE_MAG_FILTER,h),g.texParameteri(g.TEXTURE_3D,g.TEXTURE_MIN_FILTER,h),this.minFilter=h),l!==this.wrapS&&(g.texParameteri(g.TEXTURE_3D,g.TEXTURE_WRAP_S,l),g.texParameteri(g.TEXTURE_3D,g.TEXTURE_WRAP_T,l),this.wrapS=l)}destroy(){const{gl:h}=this.context;h.deleteTexture(this.texture),this.texture=null}},a.d0=function(h){return h*h*h*h*h},a.d1=O,a.d2=45,a.d3=eN,a.d4=function(h,l,u){const g=Math.sqrt(h*h+l*l+u*u),x=g>0?Math.acos(u/g)*po:0;let j=h!==0||l!==0?Math.atan2(-l,-h)*po+90:0;return j<0&&(j+=360),[g,j,x]},a.d5=ie,a.d6=Gn,a.d7=Ee,a.d8=fe,a.d9=on,a.dA=function(h){return h({pluginStatus:Gc,pluginURL:hp}),Ek.on("pluginStateChange",h),h},a.dB=gv,a.dC=class extends mp{constructor(h){super(h),this.current=tN}set(h,l,u){if(this.fetchUniformLocation(h,l)){for(let g=0;g<9;g++)if(u[g]!==this.current[g]){this.current=u,this.gl.uniformMatrix3fv(this.location,!1,u);break}}}},a.dD=dr,a.dE=function(h,l,u){const g=Ex(u.zoom),x=h.style.map._antialias,j=h.terrain&&h.terrain.exaggeration()>0;return g===0&&!x&&!j},a.dF=function(h){const l=h.pixelsPerMeter,u=l/Y(1,h.center.lat),g=T(new Float64Array(16));return D(g,g,[h.point.x,h.point.y,0]),$(g,g,[u,u,l]),Float32Array.from(g)},a.dG=SP,a.dH=function(h){const l=de-5;h=_e(h,-l,l)/l*90;const u=Math.pow(Math.abs(Math.sin(Qr(h))),3);return Math.round(u*(uM.length-1))},a.dI=function(h,l,u,g){const x=l.getNorth(),j=l.getSouth(),N=l.getWest(),E=l.getEast(),R=1<0){const ne=180/g;k(J,J,[ne/B+1,0,0,0,ne/H+1,0,-.5*ne/G,.5*ne/X,1])}return J[2]=R,J[5]=h.x,J[8]=h.y,J},a.dJ=Nh,a.dK=function(h,l,u){const g=T(new Float64Array(16)),x=(l/(1<({u_matrix:new yv(h),u_texsize:new uf(h),u_pixels_to_tile_units:new rN(h),u_device_pixel_ratio:new Fo(h),u_width_scale:new Fo(h),u_floor_width_scale:new Fo(h),u_image:new Jk(h),u_units_to_pixels:new uf(h),u_tile_units_to_pixels:new Fo(h),u_alpha_discard_threshold:new Fo(h),u_trim_offset:new uf(h),u_trim_fade_range:new uf(h),u_trim_color:new eN(h),u_zbias_factor:new Fo(h),u_tile_to_meter:new Fo(h),u_ground_shadow_factor:new mv(h),u_pattern_transition:new Fo(h)}),a.dX=h=>({u_matrix:new yv(h),u_pixels_to_tile_units:new rN(h),u_device_pixel_ratio:new Fo(h),u_width_scale:new Fo(h),u_floor_width_scale:new Fo(h),u_units_to_pixels:new uf(h),u_dash_image:new Jk(h),u_gradient_image:new Jk(h),u_image_height:new Fo(h),u_texsize:new uf(h),u_tile_units_to_pixels:new Fo(h),u_alpha_discard_threshold:new Fo(h),u_trim_offset:new uf(h),u_trim_fade_range:new uf(h),u_trim_color:new eN(h),u_zbias_factor:new Fo(h),u_tile_to_meter:new Fo(h),u_ground_shadow_factor:new mv(h)}),a.dY=h=>({u_camera_to_center_distance:new Fo(h),u_extrude_scale:new rN(h),u_device_pixel_ratio:new Fo(h),u_matrix:new yv(h),u_inv_rot_matrix:new yv(h),u_merc_center:new uf(h),u_tile_id:new mv(h),u_zoom_transition:new Fo(h),u_up_dir:new mv(h),u_emissive_strength:new Fo(h)}),a.dZ=Vk,a.d_=yqe,a.da=ve,a.db=function(h){return[Math.pow(h[0],1/2.2),Math.pow(h[1],1/2.2),Math.pow(h[2],1/2.2)]},a.dc=U1e,a.dd=Hae,a.de=G1e,a.df=goe,a.dg=function(h,l){return h.readFields(gVe,{icons:[]},l)},a.dh=FP,a.di=mN,a.dj=ioe,a.dk=sx,a.dl=cv,a.dm=Du,a.dn=Gj,a.dp=ir,a.dq=function(h){const l=h.indexOf(Gg);return l>=0?h.slice(0,l):h},a.dr=function(h){return h.indexOf(Gg)>=0},a.ds=function(h){const l=h.lastIndexOf(Gg);return l>=0?h.slice(l+1):""},a.dt=function(h){const l=[],u=h.id;return u===void 0&&l.push({message:`layers.${u}: missing required property "id"`}),h.render===void 0&&l.push({message:`layers.${u}: missing required method "render"`}),h.renderingMode&&h.renderingMode!=="2d"&&h.renderingMode!=="3d"&&l.push({message:`layers.${u}: property "renderingMode" must be either "2d" or "3d"`}),l},a.du=function(h,l,u,g){return h.type==="custom"?new cVe(h,l):new pVe[h.type](h,l,u,g)},a.dv=mr,a.dw=function(h){const l=h.indexOf(Gg);return l>=0?h.slice(l+1):""},a.dx=class extends Tv{constructor(h,l){super(h._vectorTileFeature,h._z,h._x,h._y,h.id),h.state&&(this.state=Object.assign({},h.state)),this.target=l.target,this.namespace=l.namespace,l.properties&&(this.properties=l.properties),this.target&&("featuresetId"in this.target&&!this.target.importId||"layerId"in this.target)&&(this.source=h.source,this.sourceLayer=h.sourceLayer,this.layer=h.layer)}toJSON(){const h=super.toJSON();return h.target=this.target,h.namespace=this.namespace,h}},a.dy=Ek,a.dz=ip,a.e=bs,a.e$=me,a.e0=C0e,a.e1=(h,l,u,g,x,j)=>{const N=h.transform,E=N.projection.name==="globe";let R;if(j.paint.get("circle-pitch-alignment")==="map")if(E){const H=j0e(N.zoom,l.canonical)*N._pixelsPerMercatorPixel;R=Float32Array.from([H,0,0,H])}else R=N.calculatePixelsToTileUnitsMatrix(u);else R=new Float32Array([N.pixelsToGLUnits[0],0,0,N.pixelsToGLUnits[1]]);const B={u_camera_to_center_distance:h.transform.getCameraToCenterDistance(N.projection),u_matrix:h.translatePosMatrix(l.projMatrix,u,j.paint.get("circle-translate"),j.paint.get("circle-translate-anchor")),u_device_pixel_ratio:Do.devicePixelRatio,u_extrude_scale:R,u_inv_rot_matrix:P$e,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:j.paint.get("circle-emissive-strength")};if(E){B.u_inv_rot_matrix=g,B.u_merc_center=x,B.u_tile_id=[l.canonical.x,l.canonical.y,1<{const H=h.transform,G=H.pitch<15?ave(.07,.7,_e((14-H.zoom)/5,0,1)):.07,X=u.paint.get("line-trim-color-use-theme").constantOr("default")==="none";return{u_matrix:lve(h,l,u,g),u_texsize:l.imageAtlasTexture?l.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:H.calculatePixelsToTileUnitsMatrix(l),u_device_pixel_ratio:x,u_width_scale:j,u_floor_width_scale:N,u_image:0,u_tile_units_to_pixels:ove(l,H),u_units_to_pixels:[1/H.pixelsToGLUnits[0],1/H.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:E,u_trim_fade_range:u.paint.get("line-trim-fade-range"),u_trim_color:u.paint.get("line-trim-color").toPremultipliedRenderColor(X?null:u.lut).toArray01(),u_zbias_factor:G,u_tile_to_meter:Ee(l.tileID.canonical,0),u_ground_shadow_factor:R,u_pattern_transition:B}},a.e5=(h,l,u,g,x,j,N,E,R,B)=>{const H=h.transform,G=H.calculatePixelsToTileUnitsMatrix(l),X=u.paint.get("line-trim-color-use-theme").constantOr("default")==="none",J=H.pitch<15?ave(.07,.7,_e((14-H.zoom)/5,0,1)):.07;return{u_matrix:lve(h,l,u,g),u_pixels_to_tile_units:G,u_device_pixel_ratio:j,u_width_scale:N,u_floor_width_scale:E,u_units_to_pixels:[1/H.pixelsToGLUnits[0],1/H.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:x,u_texsize:dve(u)&&l.lineAtlasTexture?l.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:ove(l,h.transform),u_alpha_discard_threshold:0,u_trim_offset:R,u_trim_fade_range:u.paint.get("line-trim-fade-range"),u_trim_color:u.paint.get("line-trim-color").toPremultipliedRenderColor(X?null:u.lut).toArray01(),u_zbias_factor:J,u_tile_to_meter:Ee(l.tileID.canonical,0),u_ground_shadow_factor:B}},a.e6=$t,a.e7=fM,a.e8=le,a.e9=Zu,a.eA=function(h,l){var u=2*Math.acos(l[3]),g=Math.sin(u/2);return g>f?(h[0]=l[0]/g,h[1]=l[1]/g,h[2]=l[2]/g):(h[0]=1,h[1]=0,h[2]=0),u},a.eB=voe,a.eC=HP,a.eD=VP,a.eE=[1,1,1],a.eF=vN,a.eG=Ke,a.eH=function(h,l,u,g){var x=l[0],j=l[1],N=l[2],E=l[3];return h[0]=x+g*(u[0]-x),h[1]=j+g*(u[1]-j),h[2]=N+g*(u[2]-N),h[3]=E+g*(u[3]-E),h},a.eI=dN,a.eJ=iu,a.eK=df,a.eL=function(h,l,u,g,x,j,N,E,R,B,H,G,X,J,ne,pe){var ke=new m(16);return ke[0]=h,ke[1]=l,ke[2]=u,ke[3]=g,ke[4]=x,ke[5]=j,ke[6]=N,ke[7]=E,ke[8]=R,ke[9]=B,ke[10]=H,ke[11]=G,ke[12]=X,ke[13]=J,ke[14]=ne,ke[15]=pe,ke},a.eM=_,a.eN=Nx,a.eO=tM,a.eP=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new sr(1/0,1/0),max:new sr(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(h,l=!1){const u=n1e(new sr(0,0),new sr(Cr,Cr),h),g=[];if(l&&!Nae(u,this._globalClipBounds))return g;for(const x of this._activeRegions){if(x.hiddenByOverlap||!Nae(u,x))continue;const j=lUe(x.min,x.max,h);g.push({min:j.min,max:j.max,sourceId:this._sourceIds[x.priority],footprint:x.footprint,footprintTileId:x.tileId,order:x.order,clipMask:x.clipMask,clipScope:x.clipScope})}return g}setSources(h){this._setSources(h.map(l=>({getSourceId:()=>l.cache.id,getFootprints:()=>{const u=[];for(const g of l.cache.getVisibleCoordinates()){const x=l.cache.getTile(g).buckets[l.layer];x&&x.updateFootprints(g.toUnwrapped(),u)}return u},getOrder:()=>l.order,getClipMask:()=>l.clipMask,getClipScope:()=>l.clipScope})))}_addSource(h){const l=h.getFootprints();if(l.length===0)return;const u=h.getOrder(),g=h.getClipMask(),x=h.getClipScope();for(const j of l){if(!j.footprint)continue;const N=n1e(j.footprint.min,j.footprint.max,j.id);this._activeRegions.push({min:N.min,max:N.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:j.id,footprint:j.footprint,order:u,clipMask:g,clipScope:x})}this._sourceIds.push(h.getSourceId())}_computeReplacement(){this._activeRegions.sort((l,u)=>l.priority-u.priority||PP(l.min,u.min)||PP(l.max,u.max)||l.order-u.order||l.clipMask-u.clipMask||function(g,x){const j=(N,E)=>N+E;return g.length-x.length||g.reduce(j,"").localeCompare(x.reduce(j,""))}(l.clipScope,u.clipScope));let h=this._activeRegions.length!==this._prevRegions.length;if(!h){let l=0;for(;!h&&l!==this._activeRegions.length;){const u=this._activeRegions[l],g=this._prevRegions[l];h=u.priority!==g.priority||!r1e(u,g)||u.order!==g.order||u.clipMask!==g.clipMask||!fo(u.clipScope,g.clipScope),this._activeRegions[l].hiddenByOverlap=g.hiddenByOverlap,++l}}if(h){++this._updateTime;for(const u of this._activeRegions)u.order!==vM&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,u.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,u.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,u.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,u.max.y));const l=u=>{const g=this._activeRegions;if(u>=g.length)return u;const x=g[u].priority;for(;u1){let u=0,g=l(u);for(;u!==g;){let x=u;const j=u;for(;x!==g;){const N=this._activeRegions[x];N.hiddenByOverlap=!1;for(let E=0;E=0;l--)this._addSource(h[l]);this._computeReplacement()}},a.eQ=vM,a.eR=class{constructor(h){this._createGrid(h),this._createPoles(h)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const h of this._poleSegments)h.destroy();for(const h of this._gridSegments)h.withSkirts.destroy(),h.withoutSkirts.destroy()}_fillGridMeshWithLods(h,l){const u=new Em,g=new Ro,x=[],j=h+1+2,N=l[0]+1,E=l[0]+1+(1+l.length),R=(B,H,G)=>{let X=B===j-1?B-2:B===0?B:B-1;return X+=G?24575:0,[X,H]};for(let B=0;B0?(ke=2*Math.sqrt(pe+1),h[3]=.25*ke,h[0]=(G-J)/ke,h[1]=(X-R)/ke,h[2]=(E-B)/ke):N>H&&N>ne?(ke=2*Math.sqrt(1+N-H-ne),h[3]=(G-J)/ke,h[0]=.25*ke,h[1]=(E+B)/ke,h[2]=(X+R)/ke):H>ne?(ke=2*Math.sqrt(1+H-N-ne),h[3]=(X-R)/ke,h[0]=(E+B)/ke,h[1]=.25*ke,h[2]=(G+J)/ke):(ke=2*Math.sqrt(1+ne-N-H),h[3]=(E-B)/ke,h[0]=(X+R)/ke,h[1]=(G+J)/ke,h[2]=.25*ke),h},a.f=function(h){return btoa(encodeURIComponent(h).replace(/%([0-9A-F]{2})/g,(l,u)=>String.fromCharCode(+("0x"+u))))},a.f0=function([h,l,u]){const g=Math.hypot(h,l,u),x=Math.atan2(h,u),j=.5*Math.PI-Math.acos(-l/g);return new p(ba(x),ba(j))},a.f1=ft,a.f2=Bae,a.f3=function(h){const l=h.navigator?h.navigator.userAgent:null;return!!function(u){if($a==null){const g=u.navigator?u.navigator.userAgent:null;$a=!!u.safari||!(!g||!(/\b(iPad|iPhone|iPod)\b/.test(g)||g.match("Safari")&&!g.match("Chrome")))}return $a}(h)&&!(!l||!(l.match("Version/15.4")||l.match("Version/15.5")||l.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/)))},a.f4=function(h,l){tp=h,xm=l},a.f5=gae,a.f6=N0e,a.f7=function(h){const l=[0,0,0],u=T(new Float64Array(16));return A(u,h.pixelMatrix,h.globeMatrix),Xe(l,l,u),new sr(l[0],l[1])},a.f8=function(){const h=NM;h&&(h.isPreloaded()&&h.numActive()===1?(h.release(Eae),NM=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},a.f9=function(){FP().acquire(Eae)},a.fA=y6,a.fB=Tt,a.fC=function(h){let l=0;if(new Uint32Array(h,0,1)[0]!==R1e){const u=new Uint32Array(h,0,7),[,,g,x,j,N]=u;l=u.byteLength+x+j+N+j,(g!==h.byteLength||l>=h.byteLength)&&Br("Invalid b3dm header information.")}return $1e(h,l)},a.fD=function(h,l){const u=Hae(h);for(const g of u){for(const x of g.meshes)zUe(x);g.lights&&(g.lightMeshIndex=g.meshes.length,g.meshes.push(BUe(g.lights,l)))}return u},a.fE=u6,a.fF=Ps,a.fG=I1e,a.fH=fp,a.fI=Ld,a.fJ=function(h){fd(),Ru!=null&&Ru.then(l=>{l.keys().then(u=>{for(let g=0;gBr(x.message))}).catch(u=>Br(u.message))}).catch(l=>Br(l.message))},a.fa=dv,a.fb=function(h,l,u=!1){if(Gc===Ld.deferred||Gc===Ld.loading||Gc===Ld.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");hp=Do.resolveURL(h),Gc=Ld.deferred,V3=l,Ak(),u||iP()},a.fc=function(h){oN=Do.resolveURL(h),lN||(lN=new aN(FP(),new Og)),lN.broadcast("setMeshoptUrl",oN)},a.fd=O1e,a.fe=function(h){Lae=Do.resolveURL(h),lN||(lN=new aN(FP(),new Og)),lN.broadcast("setDracoUrl",Lae)},a.ff=L1e,a.fg=kM,a.fh=function(h){const l=Uc();if(!l)return;const u=l.delete(Yl);h&&u.then(()=>h()).catch(h)},a.fi=kv,a.fj=Yr,a.fk=Ix,a.fl=kp,a.fm=e2e,a.fn=t2e,a.fo=rve,a.fp=Kt,a.fq="hd_road_elevation",a.fr=ui,a.fs=Bt,a.ft=Xg,a.fu=soe,a.fv=Cv,a.fw=function(h,l,u,g,x,j,N,E=1,R,B,H){h.createArrays(),h.tilePixelRatio=Cr/(512*h.overscaling),h.compareText={},h.iconsNeedLinear=!1;const G=h.layers[0].layout,X=h.layers[0]._unevaluatedLayout._values,J={};J.scaleFactor=E,J.textSizeScaleRange=G.get("text-size-scale-range"),J.iconSizeScaleRange=G.get("icon-size-scale-range");const[ne,pe]=J.textSizeScaleRange,[ke,we]=J.iconSizeScaleRange;J.textScaleFactor=_e(J.scaleFactor,ne,pe),J.iconScaleFactor=_e(J.scaleFactor,ke,we);const De=X["text-size"],Be=X["icon-size"];if(h.textSizeData.kind==="composite"){const{minZoom:Ct,maxZoom:Wt}=h.textSizeData;J.compositeTextSizes=[De.possiblyEvaluate(new Qi(Ct,{worldview:H}),j),De.possiblyEvaluate(new Qi(Wt,{worldview:H}),j)]}if(h.iconSizeData.kind==="composite"){const{minZoom:Ct,maxZoom:Wt}=h.iconSizeData;J.compositeIconSizes=[Be.possiblyEvaluate(new Qi(Ct,{worldview:H}),j),Be.possiblyEvaluate(new Qi(Wt,{worldview:H}),j)]}J.layoutTextSize=De.possiblyEvaluate(new Qi(N+1,{worldview:H}),j),J.layoutIconSize=Be.possiblyEvaluate(new Qi(N+1,{worldview:H}),j),J.textMaxSize=De.possiblyEvaluate(new Qi(18,{worldview:H}),j);const He=G.get("symbol-placement"),dt=G.get("text-rotation-alignment")==="map"&&He!=="point",it=G.get("text-size");let pt=!1;const wt=[];for(const Ct of h.features){const Wt=G.get("text-font").evaluate(Ct,{},j).join(","),Lt=it.evaluate(Ct,{},j)*J.textScaleFactor,Qt=J.layoutTextSize.evaluate(Ct,{},j)*J.textScaleFactor,ar=J.layoutIconSize.evaluate(Ct,{},j)*J.iconScaleFactor,or={horizontal:{},vertical:void 0},gr=Ct.text;let xr,hr=[0,0];if(gr){const Yn=gr.toString(),Ei=G.get("text-letter-spacing").evaluate(Ct,{},j)*cl,at=G.get("text-line-height").evaluate(Ct,{},j)*cl,ut=U3(Yn)?Ei:0,Jt=G.get("text-anchor").evaluate(Ct,{},j),yr=G.get("text-variable-anchor");if(!yr){const Kn=G.get("text-radial-offset").evaluate(Ct,{},j);if(Kn)hr=Fve(Jt,[Kn*cl,ooe]);else{const ns=G.get("text-offset").evaluate(Ct,{},j);hr=[ns[0]*cl,ns[1]*cl]}}let Pr=dt?"center":G.get("text-justify").evaluate(Ct,{},j);const Lr=He==="point",hn=Lr?G.get("text-max-width").evaluate(Ct,{},j)*cl:1/0,mn=Kn=>{h.allowVerticalPlacement&&lv(Yn)&&(or.vertical=Jae(gr,l,u,x,Wt,hn,at,Jt,Kn,ut,hr,lu.vertical,!0,Qt,Lt,R))};if(!dt&&yr){const Kn=Pr==="auto"?yr.map(ds=>loe(ds)):[Pr];let ns=!1;for(let ds=0;ds=0||!lv(Yn)){const Kn=Jae(gr,l,u,x,Wt,hn,at,Jt,Pr,ut,hr,lu.horizontal,!1,Qt,Lt,R);Kn&&(or.horizontal[Pr]=Kn)}mn(Lr?"left":Pr)}}let fr,Xt,Gt,pr,Tr,br,dn=!1;const Rr=G.get("icon-text-fit").evaluate(Ct,{},j);if(Ct.icon&&Ct.icon.hasPrimary()){const Yn=OM(Ct.icon,h.iconSizeData,X["icon-size"],j,h.zoom,Ct,R,J.iconScaleFactor,H);fr=Yn.iconPrimary,Gt=Yn.iconSecondary;const Ei=fr.toString();if(Xt=g.get(Ei),Xt&&(Tr=G.get("icon-offset").evaluate(Ct,{},j),br=G.get("icon-anchor").evaluate(Ct,{},j),xr=YP(x.get(Ei),Gt?x.get(Gt.toString()):void 0,Tr,br),dn=Xt.sdf,h.sdfIcons===void 0?h.sdfIcons=Xt.sdf:h.sdfIcons!==Xt.sdf&&Br("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(Xt.pixelRatio!==h.pixelRatio||G.get("icon-rotate").constantOr(1)!==0)&&(h.iconsNeedLinear=!0)),Gt){const at=Gt.toString();pr=g.get(at)}}pt=pt||!(!Ct.icon||!Ct.icon.hasSecondary());const Vr=t6(or.horizontal)||or.vertical;h.iconsInText||(h.iconsInText=!!Vr&&Vr.iconsInText);const tn=Qt*J.textScaleFactor/cl,{defaultShapedIcon:us,verticallyShapedIcon:jr}=Kqe(h,xr,G,Ct,j,or,tn,Tr,Rr);Rr!=="none"&&xr&&(jve(xr)||kve(xr))&&(e6(0,Xt,fr,xr,us,Rr,B,g,x),e6(0,pr,Gt,xr,us,Rr,B,g,x),jr&&(e6(0,Xt,fr,xr,jr,Rr,B,g,x),e6(0,pr,Gt,xr,jr,Rr,B,g,x))),xr=us;const{iconBBox:rn,iconVerticalBBox:Bn,textBBox:Es,textVerticalBBox:Rs}=qqe(h,xr,jr,G,Ct,j,ar,Tr,J,x,br,or,Qt,hr);wt.push({feature:Ct,shapedTextOrientations:or,shapedText:Vr,shapedIcon:xr,iconPrimary:fr,iconSecondary:Gt,iconOffset:Tr,iconAnchor:br,verticallyShapedIcon:jr,layoutTextSize:Qt,layoutIconSize:ar,textOffset:hr,isSDFIcon:dn,iconTextFit:Rr,iconCollisionBounds:rn,iconVerticalCollisionBounds:Bn,textCollisionBounds:Es,textVerticalCollisionBounds:Rs})}return{featureData:wt,sizes:J,hasAnySecondaryIcon:pt,textAlongLine:dt,symbolPlacement:He}},a.fx=Ive,a.fy=function(h,l,u,g,x,j,N,E,R,B){h.iconAtlasPositions=B.iconPositions;const{featureData:H,hasAnySecondaryIcon:G,sizes:X,textAlongLine:J,symbolPlacement:ne}=l;for(const pe of H){const{shapedIcon:ke,verticallyShapedIcon:we,feature:De,shapedTextOrientations:Be,shapedText:He,layoutTextSize:dt,textOffset:it,isSDFIcon:pt,iconPrimary:wt,iconSecondary:Ct,iconTextFit:Wt,iconOffset:Lt,iconCollisionBounds:Qt,iconVerticalCollisionBounds:ar,textCollisionBounds:or}=pe;Bve(ke,B.iconPositions,wt,Ct),Bve(we,B.iconPositions,wt,Ct),Gqe(Be,B.iconPositions),Wqe(wt,Ct,B.iconPositions),(He||ke)&&Zqe(h,De,Be,ke,we,R,X,dt,0,it,pt,g,x,N,E,G,Wt,Lt,J,ne,Qt,ar,or)}u&&h.generateCollisionDebugBuffers(j,h.collisionBoxArray,X.textScaleFactor)},a.fz=Ft,a.g=function(h,l){return ip(Object.assign(h,{method:"GET"}),l)},a.h=function(h){return h.indexOf("mapbox:")===0},a.i=function(h){return bs.API_STYLE_REGEX.test(h)&&!_l(h)},a.j=Da,a.k=tu,a.l=function(h){return decodeURIComponent(atob(h).split("").map(l=>"%"+("00"+l.charCodeAt(0).toString(16)).slice(-2)).join(""))},a.m=function(h,l){return ip(Object.assign(h,{type:"json"}),l)},a.n=ys,a.o=Do,a.p=function(h,l){return ip(Object.assign(h,{method:"POST"}),l)},a.q=fc,a.r=eu,a.s=function(h){try{const l=self[h];return l.setItem("_mapbox_test_",1),l.removeItem("_mapbox_test_"),!0}catch{return!1}},a.t=function(){return Iae||(Iae=new kv("ImageRasterizer")),Iae},a.u=function(){return function h(l){return l?(l^Math.random()*(16>>l/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,h)}()},a.v=function(h){return!!h&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(h)},a.w=Br,a.x=Noe,a.y=U1,a.z=tf}),o(["./shared"],function(a){function f(xt){const _e=xt?xt.url.toString():void 0;return _e?performance.getEntriesByName(_e):[]}function m(xt){if(typeof xt=="number"||typeof xt=="boolean"||typeof xt=="string"||xt==null)return JSON.stringify(xt);if(Array.isArray(xt)){let ze="[";for(const tt of xt)ze+=`${m(tt)},`;return`${ze}]`}let _e="{";for(const ze of Object.keys(xt).sort())_e+=`${ze}:${m(xt[ze])},`;return`${_e}}`}function y(xt){let _e="";for(const ze of a.bx)_e+=`/${m(xt[ze])}`;return _e}class v{constructor(_e){this.keyCache={},this._layers={},this._layerConfigs={},_e&&this.replace(_e)}replace(_e,ze){this._layerConfigs={},this._layers={},this.update(_e,[],ze)}update(_e,ze,tt){this._options=tt;for(const bt of _e)this._layerConfigs[bt.id]=bt,(this._layers[bt.id]=a.du(bt,this.scope,null,this._options)).compileFilter(tt),this.keyCache[bt.id]&&delete this.keyCache[bt.id];for(const bt of ze)delete this.keyCache[bt],delete this._layerConfigs[bt],delete this._layers[bt];this.familiesBySource={};const kt=function(bt,Et){const $t={};for(let Bt=0;Btthis._layers[Wr.id]),$t=Et[0];if($t.visibility==="none")continue;const Ot=$t.source||"";let Bt=this.familiesBySource[Ot];Bt||(Bt=this.familiesBySource[Ot]={});const mr=$t.sourceLayer||"_geojsonTileLayer";let ir=Bt[mr];ir||(ir=Bt[mr]=[]),ir.push(Et)}}}const w=1*a.fl;class k{constructor(_e){const ze={},tt=[];for(const $t in _e){const Ot=_e[$t],Bt=ze[$t]={};for(const mr in Ot.glyphs){const ir=Ot.glyphs[+mr];if(!ir||ir.bitmap.width===0||ir.bitmap.height===0)continue;const Wr=ir.metrics.localGlyph?w:1,en={x:0,y:0,w:ir.bitmap.width+2*Wr,h:ir.bitmap.height+2*Wr};tt.push(en),Bt[mr]=en}}const{w:kt,h:bt}=a.G(tt),Et=new a.fk({width:kt||1,height:bt||1});for(const $t in _e){const Ot=_e[$t];for(const Bt in Ot.glyphs){const mr=Ot.glyphs[+Bt];if(!mr||mr.bitmap.width===0||mr.bitmap.height===0)continue;const ir=ze[$t][Bt],Wr=mr.metrics.localGlyph?w:1;a.fk.copy(mr.bitmap,Et,{x:0,y:0},{x:ir.x+Wr,y:ir.y+Wr},mr.bitmap)}}this.image=Et,this.positions=ze}}function C(xt,_e,ze){xt[_e]?ze&&(xt[_e].center=ze):xt[_e]={floorIds:new Set,center:ze||[0,0],floors:{}}}function S(xt,_e,ze,tt){for(const kt of _e)C(xt,kt),xt[kt].floors[ze]=tt,xt[kt].floorIds.add(ze)}function T(xt){return{id:xt.properties.id.toString(),center:xt.properties.center.toString().split(";").map(Number)}}function I(xt){return{id:xt.properties.id.toString(),isDefault:!!xt.properties.is_default&&xt.properties.is_default,connections:xt.properties.connected_floor_ids?new Set(xt.properties.connected_floor_ids.toString().split(";")):new Set,conflicts:xt.properties.conflicted_floor_ids?new Set(xt.properties.conflicted_floor_ids.toString().split(";")):new Set,buildings:xt.properties.building_ids?new Set(xt.properties.building_ids.toString().split(";")):new Set,name:xt.properties.name.toString(),zIndex:xt.properties.z_index}}function A(xt,_e){return _e.every(ze=>xt.properties&&xt.properties[ze]!=null)}function D(xt){return A(xt,["type","id","name"])&&xt.properties.type==="building"}function $(xt){return A(xt,["type","id","name","z_index"])&&xt.properties.type==="floor"}a.fj(k,"GlyphAtlas");class F{constructor(_e){this.tileID=new a.aQ(_e.tileID.overscaledZ,_e.tileID.wrap,_e.tileID.canonical.z,_e.tileID.canonical.x,_e.tileID.canonical.y),this.tileZoom=_e.tileZoom,this.uid=_e.uid,this.zoom=_e.zoom,this.lut=_e.lut,this.canonical=_e.tileID.canonical,this.pixelRatio=_e.pixelRatio,this.tileSize=_e.tileSize,this.source=_e.source,this.scope=_e.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=_e.showCollisionBoxes,this.collectResourceTiming=!!_e.request&&_e.request.collectResourceTiming,this.promoteId=_e.promoteId,this.isSymbolTile=_e.isSymbolTile,this.tileTransform=a.aZ(_e.tileID.canonical,_e.projection),this.projection=_e.projection,this.worldview=_e.worldview,this.localizableLayerIds=_e.localizableLayerIds,this.brightness=_e.brightness,this.extraShadowCaster=!!_e.extraShadowCaster,this.tessellationStep=_e.tessellationStep,this.scaleFactor=_e.scaleFactor,this.worldview=_e.worldview,this.indoor=_e.indoor}parse(_e,ze,tt,kt,bt,Et){this.status="parsing",this.data=_e,this.collisionBoxArray=new a.b3;const $t=new a.fm(Object.keys(_e.layers).sort()),Ot=new a.fn(this.tileID,this.promoteId);Ot.bucketLayerIDs=[];const Bt={},mr=new a.fo(256,256),ir={featureIndex:Ot,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:mr,availableImages:tt,brightness:this.brightness,scaleFactor:this.scaleFactor,elevationFeatures:void 0,activeFloors:void 0};if(this.indoor){const Zn=this.indoor.indoorState.activeFloorsVisible,Wn=function(Gn,Ps,wa){const $a=function(ya,zs){if(!ya)return a.w("No source layers defined in indoor specification"),zs;if(ya.size===0)return zs;const ca=ya.difference(zs);for(const Di of ca)a.w(`Missing source layer required in indoor specification: ${Di}`);return zs.intersection(zs)}(Ps.sourceLayers,new Set(Object.keys(Gn.layers))),Aa=Ps.indoorState,lo=function(ya,zs,ca,Di){const bs=new Set,Da=new Set,_l=new Set,El=new Map,Nc={},ep=Xo=>{const hd=El.get(Xo)||new Set;for(const Qo of bs)if((El.get(Qo)||new Set).has(Xo)||hd.has(Qo))return!0;return!1};for(const Xo of zs){const hd=ya.layers[Xo];if(hd)for(let Qo=0;Qo=ca.maxzoom||ca.visibility==="none")continue;q(zs,this.zoom,ir.brightness,tt,this.worldview);const Di=Bt[ca.id]=ca.createBucket({index:Ot.bucketLayerIDs.length,layers:zs,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:$a,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:kt,worldview:this.worldview,localizable:lo});Ot.bucketLayerIDs.push(zs.map(Da=>a.B(Da.id,Da.scope)));let bs=Di.prepare?Di.prepare():null;bs!=null?(bs=bs.then(()=>Di.populate(Aa,ir,this.tileID.canonical,this.tileTransform)),Wr.push(bs)):Di.populate(Aa,ir,this.tileID.canonical,this.tileTransform)}}const Br=()=>{let Zn,Wn,Gn,Ps,wa,$a;mr.trim();const Aa={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},lo=()=>{if(Zn)return this.status="done",Et(Zn);if(this.extraShadowCaster)this.status="done",Et(null,{buckets:Object.values(Bt).filter(zs=>!zs.isEmpty()),featureIndex:Ot,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:ir.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(Wn&&Gn&&Ps){const zs=new k(Wn),ca=new Map;for(const[Da,_l]of Gn.entries()){const{imagePosition:El}=a.fu(Da,_l,a.fv);ca.set(Da,El)}const Di={};for(const Da in Bt){const _l=Bt[Da];_l instanceof a.b4&&(q(_l.layers,this.zoom,ir.brightness,tt,this.worldview),Di[Da]=a.fw(_l,Wn,zs.positions,Gn,ca,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,wa,this.worldview))}const bs={iconsPending:!0,patternsPending:!0};this.rasterizeIfNeeded(bt,Gn,wa,()=>{bs.iconsPending=!1,ya(Di,zs,bs)}),this.rasterizeIfNeeded(bt,Ps,$a,()=>{bs.patternsPending=!1,ya(Di,zs,bs)})}},ya=(zs,ca,Di,bs)=>{if(Di.iconsPending||Di.patternsPending)return;const Da=new a.fx(Gn,Ps,this.lut);for(const _l in Bt){const El=Bt[_l];if(_l in zs)a.fy(El,zs[_l],this.showCollisionBoxes,tt,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,Gn,Da);else if(El.hasPattern&&(El instanceof a.ba||El instanceof a.bb||El instanceof a.ea)){q(El.layers,this.zoom,ir.brightness,tt,this.worldview);const Nc=Object.fromEntries(Da.patternPositions);El.addFeatures(ir,this.tileID.canonical,Nc,tt,this.tileTransform,this.brightness)}}this.status="done",Et(null,{buckets:Object.values(Bt).filter(_l=>!_l.isEmpty()),featureIndex:Ot,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:ca.image,lineAtlas:mr,imageAtlas:Da,brightness:ir.brightness})};if(!this.extraShadowCaster){const zs=a.fs(ir.glyphDependencies,bs=>Object.keys(bs).map(Number));Object.keys(zs).length?bt.send("getGlyphs",{uid:this.uid,stacks:zs},(bs,Da)=>{Zn||(Zn=bs,Wn=Da,lo())},void 0,!1,Aa):Wn={};const ca=Array.from(ir.iconDependencies.keys()).map(bs=>a.I.parse(bs));ca.length?bt.send("getImages",{images:ca,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(bs,Da)=>{Zn||(Zn=bs,Gn=new Map,wa=this.updateImageMapAndGetImageTaskQueue(Gn,Da,ir.iconDependencies),lo())},void 0,!1,Aa):(Gn=new Map,wa=new Map);const Di=Array.from(ir.patternDependencies.keys()).map(bs=>a.I.parse(bs));Di.length?bt.send("getImages",{images:Di,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(bs,Da)=>{Zn||(Zn=bs,Ps=new Map,$a=this.updateImageMapAndGetImageTaskQueue(Ps,Da,ir.patternDependencies),lo())},void 0,!1,Aa):(Ps=new Map,$a=new Map)}if(ir.elevationFeatures&&ir.elevationFeatures.length>0){const zs=[];for(const Di of Object.values(Bt))if(Di instanceof a.bb){const bs=Di.getUnevaluatedPortalGraph();bs&&zs.push(bs)}const ca=a.ft.evaluate(zs);for(const Di of Object.values(Bt))if(Di instanceof a.bb){const bs=_e.layers[$t.decode(Di.sourceLayerIndex)];Di.setEvaluatedPortalGraph(ca,bs,this.tileID.canonical,ir.availableImages,ir.brightness)}}lo()};Wr.length>0?Promise.allSettled(Wr).then(Br).catch(Et):Br()}updateParameters(_e){this.scaleFactor=_e.scaleFactor,this.showCollisionBoxes=_e.showCollisionBoxes,this.projection=_e.projection,this.brightness=_e.brightness,this.tileTransform=a.aZ(_e.tileID.canonical,_e.projection),this.extraShadowCaster=_e.extraShadowCaster,this.lut=_e.lut,this.worldview=_e.worldview,this.indoor=_e.indoor}rasterizeIfNeeded(_e,ze,tt,kt){Array.from(ze.values()).some(bt=>bt.usvg)?this.rasterize(_e,ze,tt,kt):kt()}updateImageMapAndGetImageTaskQueue(_e,ze,tt){const kt=new Map;for(const bt of ze.keys()){const Et=tt.get(bt)||[];for(const $t of Et){const Ot=$t.toString(),Bt=ze.get($t.id.toString());Bt.usvg?kt.has(Ot)||(kt.set(Ot,$t),_e.set(Ot,Object.assign({},Bt))):_e.set(Ot,Bt)}}return kt}rasterize(_e,ze,tt,kt){this.rasterizeTask=_e.send("rasterizeImages",{scope:this.scope,tasks:tt},(bt,Et)=>{if(!bt)for(const[$t,Ot]of Et.entries()){const Bt=Object.assign(ze.get($t),{data:Ot});ze.set($t,Bt)}kt()})}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function q(xt,_e,ze,tt,kt){const bt=new a.ac(_e,{brightness:ze,worldview:kt});for(const Et of xt)Et.recalculate(bt,tt)}class W extends a.E{constructor(_e,ze,tt,kt,bt,Et,$t){super(),this.actor=_e,this.layerIndex=ze,this.availableImages=tt,this.availableModels=kt,this.loadVectorData=Et||a.aL,this.loading={},this.loaded={},this.deduped=new a.aK(_e.scheduler),this.isSpriteLoaded=bt,this.scheduler=_e.scheduler,this.brightness=$t}loadTile(_e,ze){const tt=_e.uid,kt=_e&&_e.request,bt=kt&&kt.collectResourceTiming,Et=this.loading[tt]=new F(_e);Et.abort=this.loadVectorData(_e,($t,Ot)=>{const Bt=!this.loading[tt];if(delete this.loading[tt],Et.cancelRasterize(),Bt||$t||!Ot)return Et.status="done",Bt||(this.loaded[tt]=Et),ze($t);const mr=Ot.rawData,ir={},Wr=a.aM(Ot.responseHeaders);Wr&&Wr.expires&&(ir.expires=Wr.expires),Wr&&Wr.cacheControl&&(ir.cacheControl=Wr.cacheControl),Et.vectorTile=Ot.vectorTile||new a.fz(new a.bt(mr));const en=()=>{Et.parse(Et.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,(Br,Zn)=>{if(Br||!Zn)return ze(Br);const Wn={};if(bt){const Gn=f(kt);Gn.length>0&&(Wn.resourceTiming=JSON.parse(JSON.stringify(Gn)))}ze(null,Object.assign({rawTileData:mr.slice(0),responseHeaders:Ot.responseHeaders},Zn,ir,Wn))})};this.isSpriteLoaded?en():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(en,{type:"parseTile",isSymbolTile:_e.isSymbolTile,zoom:_e.tileZoom}):en()}),this.loaded=this.loaded||{},this.loaded[tt]=Et})}reloadTile(_e,ze){const tt=this.loaded,kt=_e.uid;if(tt&&tt[kt]){const bt=tt[kt];bt.updateParameters(_e);const Et=($t,Ot)=>{const Bt=bt.reloadCallback;Bt&&(delete bt.reloadCallback,bt.parse(bt.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,Bt)),ze($t,Ot)};bt.status==="parsing"?bt.reloadCallback=Et:bt.status==="done"&&(bt.vectorTile?bt.parse(bt.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,Et):Et())}else ze(null,void 0)}abortTile(_e,ze){const tt=_e.uid,kt=this.loading[tt];kt&&(kt.abort&&kt.abort(),delete this.loading[tt]),ze()}removeTile(_e,ze){const tt=this.loaded,kt=_e.uid;tt&&tt[kt]&&delete tt[kt],ze()}}class K{loadTile(_e,ze){const{uid:tt,encoding:kt,rawImageData:bt,padding:Et}=_e,$t=ImageBitmap&&bt instanceof ImageBitmap?this.getImageData(bt,Et):bt;ze(null,new a.fA(tt,$t,kt,Et<1))}reloadTile(_e,ze){ze(null,null)}abortTile(_e,ze){ze()}removeTile(_e,ze){ze()}getImageData(_e,ze){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(_e.width,_e.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=_e.width,this.offscreenCanvas.height=_e.height,this.offscreenCanvasContext.drawImage(_e,0,0,_e.width,_e.height);const tt=this.offscreenCanvasContext.getImageData(-ze,-ze,_e.width+2*ze,_e.height+2*ze);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),tt}}a.bs.setPbf(a.bt);class Z{constructor(_e){this._mrt=new a.bs(_e.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=_e.uid,this.tileID=_e.tileID,this.source=_e.source}parse(_e,ze){const tt=this._mrt;this.status="parsing",this._entireBuffer=_e;try{tt.parseHeader(_e),this._isHeaderLoaded=!0;const kt=[];for(const bt in tt.layers){const Et=tt.getLayer(bt),$t=Et.getDataRange(Et.getBandList()),Ot=tt.createDecodingTask($t),Bt=_e.slice($t.firstByte,$t.lastByte+1),mr=a.bs.performDecoding(Bt,Ot).then(ir=>Ot.complete(null,ir)).catch(ir=>Ot.complete(ir,null));kt.push(mr)}Promise.allSettled(kt).then(()=>ze(null,tt)).catch(bt=>ze(bt))}catch(kt){ze(kt)}}}class re{constructor(_e){this.actor=_e,this.loading={},this.loaded={}}loadTile(_e,ze){const tt=_e.uid,kt=_e.request,bt=this.loading[tt]=new Z(_e),{cancel:Et}=a.bu(kt,($t,Ot,Bt)=>{const mr=!this.loading[tt];if(delete this.loading[tt],mr||$t||!Ot)return bt.status="done",mr||(this.loaded[tt]=bt),ze($t);bt.parse(Ot,(ir,Wr)=>{if(ir||!Wr)return ze(ir);ze(null,Wr,Bt)}),this.loaded[tt]=bt});bt.abort=Et}reloadTile(_e,ze){ze(null,void 0)}abortTile(_e,ze){const tt=_e.uid,kt=this.loading[tt];kt&&(kt.abort&&kt.abort(),delete this.loading[tt]),ze()}removeTile(_e,ze){const tt=_e.uid;this.loaded[tt]&&delete this.loaded[tt],ze()}decodeRasterArray(_e,ze){a.bs.performDecoding(_e.buffer,_e.task).then(tt=>ze(null,tt)).catch(tt=>ze(tt))}}const he=a.fB.prototype.toGeoJSON;class ue{constructor(_e){this._feature=_e,this.extent=a.al,this.type=_e.type,this.properties=_e.tags,"id"in _e&&!isNaN(_e.id)&&(this.id=parseInt(_e.id,10))}loadGeometry(){if(this._feature.type===1){const _e=[];for(const ze of this._feature.geometry)_e.push([new a.P(ze[0],ze[1])]);return _e}{const _e=[];for(const ze of this._feature.geometry){const tt=[];for(const kt of ze)tt.push(new a.P(kt[0],kt[1]));_e.push(tt)}return _e}}toGeoJSON(_e,ze,tt){return he.call(this,_e,ze,tt)}}class Ne{constructor(_e,ze){this.name=_e,this.extent=a.al,this.length=ze.length,this._jsonFeatures=ze}feature(_e){return new ue(this._jsonFeatures[_e])}}class se{constructor(_e){this.layers={},this.extent=a.al;for(const ze of Object.keys(_e))this.layers[ze]=new Ne(ze,_e[ze])}}const xe=64/4096,ie=128;class me{constructor(){this.features=new Map}clear(){this.features.clear()}load(_e=[],ze){for(const tt of _e){const kt=tt.id;if(kt==null)continue;let bt=this.features.get(kt);bt&&this.updateCache(bt,ze),tt.geometry?(bt=ve(tt),this.updateCache(bt,ze),this.features.set(kt,bt)):this.features.delete(kt),this.updateCache(bt,ze)}}updateCache(_e,ze){for(const{canonical:tt,uid:kt}of Object.values(ze)){const{z:bt,x:Et,y:$t}=tt;fe(_e,Math.pow(2,bt),Et,$t)&&delete ze[kt]}}getTile(_e,ze,tt){const kt=Math.pow(2,_e),bt=[];for(const Et of this.features.values())fe(Et,kt,ze,tt)&&bt.push(ae(Et,kt,ze,tt));return{features:bt}}getFeatures(){return[...this.features.values()]}}function fe({minX:xt,minY:_e,maxX:ze,maxY:tt},kt,bt,Et){return xt<(bt+1+xe)/kt&&_e<(Et+1+xe)/kt&&ze>(bt-xe)/kt&&tt>(Et-xe)/kt}function ve(xt){const{id:_e,geometry:ze,properties:tt}=xt;if(!ze)return;if(ze.type==="GeometryCollection")throw new Error("GeometryCollection not supported in dynamic mode.");const{type:kt,coordinates:bt}=ze,Et={id:_e,type:1,geometry:[],tags:tt,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},$t=Et.geometry;if(kt==="Point")Ie(bt,$t,Et);else if(kt==="MultiPoint")for(const Ot of bt)Ie(Ot,$t,Et);else if(kt==="LineString")Et.type=2,Se(bt,$t,Et);else if(kt==="MultiLineString")Et.type=2,oe(bt,$t,Et);else if(kt==="Polygon")Et.type=3,oe(bt,$t,Et,!0);else{if(kt!=="MultiPolygon")throw new Error("Input data is not a valid GeoJSON object.");Et.type=3;for(const Ot of bt)oe(Ot,$t,Et,!0)}return Et}function Ie([xt,_e],ze,tt){const kt=a.aF(xt);let bt=a.aJ(_e);bt=bt<0?0:bt>1?1:bt,ze.push(kt,bt),tt.minX=Math.min(tt.minX,kt),tt.minY=Math.min(tt.minY,bt),tt.maxX=Math.max(tt.maxX,kt),tt.maxY=Math.max(tt.maxY,bt)}function Se(xt,_e,ze,tt=!1,kt=!1){const bt=[];for(const Et of xt)Ie(Et,bt,ze);_e.push(bt),tt&&function(Et,$t){let Ot=0;for(let Bt=0,mr=Et.length,ir=mr-2;Bt0===$t)for(let Bt=0,mr=Et.length;Bt=Et&&ir>=Et||(Bt>=Et?(mr+=Math.round(Br*((Et-Bt)/en)),Bt=Et):ir>=Et&&(Wr=mr+Math.round(Br*((Et-Bt)/en)),ir=Et),mr>=Et&&Wr>=Et||(mr>=Et?(Bt+=Math.round(en*((Et-mr)/Br)),mr=Et):Wr>=Et&&(ir=Bt+Math.round(en*((Et-mr)/Br)),Wr=Et),$t&&Bt===$t[$t.length-1][0]&&mr===$t[$t.length-1][1]||($t=[[Bt,mr]],kt.push($t)),$t.push([ir,Wr])))))}}function Me(xt,_e,ze,tt,kt){const bt=(ze-xe)/_e,Et=(tt-xe)/_e,$t=(ze+1+xe)/_e,Ot=(tt+1+xe)/_e;function Bt(Wr,en){let Br=0;return Wr$t&&(Br|=2),enOt&&(Br|=8),Br}let mr=[];for(let Wr=1;Wr<=8;Wr*=2){let en=xt[xt.length-2],Br=xt[xt.length-1],Zn=!(Bt(en,Br)&Wr);for(let Wn=0;Wn>31}function nt(xt,_e){const{geometry:ze,type:tt}=xt;let kt=0,bt=0;if(tt===1){_e.writeVarint(Pe(1,ze.length));for(const Et of ze){const $t=Et[0]-kt,Ot=Et[1]-bt;_e.writeVarint(Ae($t)),_e.writeVarint(Ae(Ot)),kt+=$t,bt+=Ot}}else for(const Et of ze){_e.writeVarint(Pe(1,1));const $t=Et.length-(tt===3?1:0);for(let Ot=0;Ot<$t;Ot++){Ot===1&&_e.writeVarint(Pe(2,$t-1));const Bt=Et[Ot][0]-kt,mr=Et[Ot][1]-bt;_e.writeVarint(Ae(Bt)),_e.writeVarint(Ae(mr)),kt+=Bt,bt+=mr}tt===3&&_e.writeVarint(Pe(7,1))}}function Te(xt,_e){const ze=typeof xt;ze==="string"?_e.writeStringField(1,xt):ze==="boolean"?_e.writeBooleanField(7,xt):ze==="number"&&(xt%1!=0?_e.writeDoubleField(3,xt):xt<0?_e.writeSVarintField(6,xt):_e.writeVarintField(5,xt))}const Xe={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:xt=>xt},ge=Math.fround||(mt=new Float32Array(1),xt=>(mt[0]=+xt,mt[0]));var mt;const rt=3,We=5,Ce=6;class et{constructor(_e){this.options=Object.assign(Object.create(Xe),_e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(_e){const{log:ze,minZoom:tt,maxZoom:kt}=this.options;ze&&console.time("total time");const bt=`prepare ${_e.length} points`;ze&&console.time(bt),this.points=_e;const Et=[];for(let Ot=0;Ot<_e.length;Ot++){const Bt=_e[Ot];if(!Bt.geometry)continue;const[mr,ir]=Bt.geometry.coordinates,Wr=ge(Le(mr)),en=ge(ft(ir));Et.push(Wr,en,1/0,Ot,-1,1),this.options.reduce&&Et.push(0)}let $t=this.trees[kt+1]=this._createTree(Et);ze&&console.timeEnd(bt);for(let Ot=kt;Ot>=tt;Ot--){const Bt=+Date.now();$t=this.trees[Ot]=this._createTree(this._cluster($t,Ot)),ze&&console.log("z%d: %d clusters in %dms",Ot,$t.numItems,+Date.now()-Bt)}return ze&&console.timeEnd("total time"),this}getClusters(_e,ze){let tt=((_e[0]+180)%360+360)%360-180;const kt=Math.max(-90,Math.min(90,_e[1]));let bt=_e[2]===180?180:((_e[2]+180)%360+360)%360-180;const Et=Math.max(-90,Math.min(90,_e[3]));if(_e[2]-_e[0]>=360)tt=-180,bt=180;else if(tt>bt){const ir=this.getClusters([tt,kt,180,Et],ze),Wr=this.getClusters([-180,kt,bt,Et],ze);return ir.concat(Wr)}const $t=this.trees[this._limitZoom(ze)],Ot=$t.range(Le(tt),ft(Et),Le(bt),ft(kt)),Bt=$t.data,mr=[];for(const ir of Ot){const Wr=this.stride*ir;mr.push(Bt[Wr+We]>1?Fe(Bt,Wr,this.clusterProps):this.points[Bt[Wr+rt]])}return mr}getChildren(_e){const ze=this._getOriginId(_e),tt=this._getOriginZoom(_e),kt="No cluster with the specified id.",bt=this.trees[tt];if(!bt)throw new Error(kt);const Et=bt.data;if(ze*this.stride>=Et.length)throw new Error(kt);const $t=this.options.radius/(this.options.extent*Math.pow(2,tt-1)),Ot=bt.within(Et[ze*this.stride],Et[ze*this.stride+1],$t),Bt=[];for(const mr of Ot){const ir=mr*this.stride;Et[ir+4]===_e&&Bt.push(Et[ir+We]>1?Fe(Et,ir,this.clusterProps):this.points[Et[ir+rt]])}if(Bt.length===0)throw new Error(kt);return Bt}getLeaves(_e,ze,tt){const kt=[];return this._appendLeaves(kt,_e,ze=ze||10,tt=tt||0,0),kt}getTile(_e,ze,tt){const kt=this.trees[this._limitZoom(_e)],bt=Math.pow(2,_e),{extent:Et,radius:$t}=this.options,Ot=$t/Et,Bt=(tt-Ot)/bt,mr=(tt+1+Ot)/bt,ir={features:[]};return this._addTileFeatures(kt.range((ze-Ot)/bt,Bt,(ze+1+Ot)/bt,mr),kt.data,ze,tt,bt,ir),ze===0&&this._addTileFeatures(kt.range(1-Ot/bt,Bt,1,mr),kt.data,bt,tt,bt,ir),ze===bt-1&&this._addTileFeatures(kt.range(0,Bt,Ot/bt,mr),kt.data,-1,tt,bt,ir),ir.features.length?ir:null}getClusterExpansionZoom(_e){let ze=this._getOriginZoom(_e)-1;for(;ze<=this.options.maxZoom;){const tt=this.getChildren(_e);if(ze++,tt.length!==1)break;_e=tt[0].properties.cluster_id}return ze}_appendLeaves(_e,ze,tt,kt,bt){const Et=this.getChildren(ze);for(const $t of Et){const Ot=$t.properties;if(Ot&&Ot.cluster?bt+Ot.point_count<=kt?bt+=Ot.point_count:bt=this._appendLeaves(_e,Ot.cluster_id,tt,kt,bt):bt1;let mr,ir,Wr;if(Bt)mr=Ke(ze,Ot,this.clusterProps),ir=ze[Ot],Wr=ze[Ot+1];else{const Zn=this.points[ze[Ot+rt]];mr=Zn.properties;const[Wn,Gn]=Zn.geometry.coordinates;ir=Le(Wn),Wr=ft(Gn)}const en={type:1,geometry:[[Math.round(this.options.extent*(ir*bt-tt)),Math.round(this.options.extent*(Wr*bt-kt))]],tags:mr};let Br;Br=Bt||this.options.generateId?ze[Ot+rt]:this.points[ze[Ot+rt]].id,Br!==void 0&&(en.id=Br),Et.features.push(en)}}_limitZoom(_e){return Math.max(this.options.minZoom,Math.min(Math.floor(+_e),this.options.maxZoom+1))}_cluster(_e,ze){const{radius:tt,extent:kt,reduce:bt,minPoints:Et}=this.options,$t=tt/(kt*Math.pow(2,ze)),Ot=_e.data,Bt=[],mr=this.stride;for(let ir=0;irze&&(Wn+=Ot[Ps+We])}if(Wn>Zn&&Wn>=Et){let Gn,Ps=Wr*Zn,wa=en*Zn,$a=-1;const Aa=(ir/mr<<5)+(ze+1)+this.points.length;for(const lo of Br){const ya=lo*mr;if(Ot[ya+2]<=ze)continue;Ot[ya+2]=ze;const zs=Ot[ya+We];Ps+=Ot[ya]*zs,wa+=Ot[ya+1]*zs,Ot[ya+4]=Aa,bt&&(Gn||(Gn=this._map(Ot,ir,!0),$a=this.clusterProps.length,this.clusterProps.push(Gn)),bt(Gn,this._map(Ot,ya)))}Ot[ir+4]=Aa,Bt.push(Ps/Wn,wa/Wn,1/0,Aa,-1,Wn),bt&&Bt.push($a)}else{for(let Gn=0;Gn1)for(const Gn of Br){const Ps=Gn*mr;if(!(Ot[Ps+2]<=ze)){Ot[Ps+2]=ze;for(let wa=0;wa>5}_getOriginZoom(_e){return(_e-this.points.length)%32}_map(_e,ze,tt){if(_e[ze+We]>1){const Et=this.clusterProps[_e[ze+Ce]];return tt?Object.assign({},Et):Et}const kt=this.points[_e[ze+rt]].properties,bt=this.options.map(kt);return tt&&bt===kt?Object.assign({},bt):bt}}function Fe(xt,_e,ze){return{type:"Feature",id:xt[_e+rt],properties:Ke(xt,_e,ze),geometry:{type:"Point",coordinates:[(tt=xt[_e],360*(tt-.5)),Nt(xt[_e+1])]}};var tt}function Ke(xt,_e,ze){const tt=xt[_e+We],kt=tt>=1e4?`${Math.round(tt/1e3)}k`:tt>=1e3?Math.round(tt/100)/10+"k":tt,bt=xt[_e+Ce],Et=bt===-1?{}:Object.assign({},ze[bt]);return Object.assign(Et,{cluster:!0,cluster_id:xt[_e+rt],point_count:tt,point_count_abbreviated:kt})}function Le(xt){return xt/360+.5}function ft(xt){const _e=Math.sin(xt*Math.PI/180),ze=.5-.25*Math.log((1+_e)/(1-_e))/Math.PI;return ze<0?0:ze>1?1:ze}function Nt(xt){const _e=(180-360*xt)*Math.PI/180;return 360*Math.atan(Math.exp(_e))/Math.PI-90}function Mt(xt,_e,ze,tt){let kt=tt;const bt=_e+(ze-_e>>1);let Et,$t=ze-_e;const Ot=xt[_e],Bt=xt[_e+1],mr=xt[ze],ir=xt[ze+1];for(let Wr=_e+3;Wrkt)Et=Wr,kt=en;else if(en===kt){const Br=Math.abs(Wr-bt);Br<$t&&(Et=Wr,$t=Br)}}kt>tt&&(Et-_e>3&&Mt(xt,_e,Et,tt),xt[Et+2]=kt,ze-Et>3&&Mt(xt,Et,ze,tt))}function It(xt,_e,ze,tt,kt,bt){let Et=kt-ze,$t=bt-tt;if(Et!==0||$t!==0){const Ot=((xt-ze)*Et+(_e-tt)*$t)/(Et*Et+$t*$t);Ot>1?(ze=kt,tt=bt):Ot>0&&(ze+=Et*Ot,tt+=$t*Ot)}return Et=xt-ze,$t=_e-tt,Et*Et+$t*$t}function tr(xt,_e,ze,tt){const kt={id:xt??null,type:_e,geometry:ze,tags:tt,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(_e==="Point"||_e==="MultiPoint"||_e==="LineString")Mr(kt,ze);else if(_e==="Polygon")Mr(kt,ze[0]);else if(_e==="MultiLineString")for(const bt of ze)Mr(kt,bt);else if(_e==="MultiPolygon")for(const bt of ze)Mr(kt,bt[0]);return kt}function Mr(xt,_e){for(let ze=0;ze<_e.length;ze+=3)xt.minX=Math.min(xt.minX,_e[ze]),xt.minY=Math.min(xt.minY,_e[ze+1]),xt.maxX=Math.max(xt.maxX,_e[ze]),xt.maxY=Math.max(xt.maxY,_e[ze+1])}function pn(xt,_e,ze,tt){if(!_e.geometry)return;const kt=_e.geometry.coordinates;if(kt&&kt.length===0)return;const bt=_e.geometry.type,Et=Math.pow(ze.tolerance/((1<0&&(Et+=tt?(kt*mr-Bt*bt)/2:Math.sqrt(Math.pow(Bt-kt,2)+Math.pow(mr-bt,2))),kt=Bt,bt=mr}const $t=_e.length-3;_e[2]=1,Mt(_e,0,$t,ze),_e[$t+2]=1,_e.size=Math.abs(Et),_e.start=0,_e.end=_e.size}function js(xt,_e,ze,tt){for(let kt=0;kt1?1:ze}function wr(xt,_e,ze,tt,kt,bt,Et,$t){if(tt/=_e,bt>=(ze/=_e)&&Et=tt)return null;const Ot=[];for(const Bt of xt){const mr=Bt.geometry;let ir=Bt.type;const Wr=kt===0?Bt.minX:Bt.minY,en=kt===0?Bt.maxX:Bt.maxY;if(Wr>=ze&&en=tt)continue;let Br=[];if(ir==="Point"||ir==="MultiPoint")Ts(mr,Br,ze,tt,kt);else if(ir==="LineString")ii(mr,Br,ze,tt,kt,!1,$t.lineMetrics);else if(ir==="MultiLineString")Ta(mr,Br,ze,tt,kt,!1);else if(ir==="Polygon")Ta(mr,Br,ze,tt,kt,!0);else if(ir==="MultiPolygon")for(const Zn of mr){const Wn=[];Ta(Zn,Wn,ze,tt,kt,!0),Wn.length&&Br.push(Wn)}if(Br.length){if($t.lineMetrics&&ir==="LineString"){for(const Zn of Br)Ot.push(tr(Bt.id,ir,Zn,Bt.tags));continue}ir!=="LineString"&&ir!=="MultiLineString"||(Br.length===1?(ir="LineString",Br=Br[0]):ir="MultiLineString"),ir!=="Point"&&ir!=="MultiPoint"||(ir=Br.length===3?"Point":"MultiPoint"),Ot.push(tr(Bt.id,ir,Br,Bt.tags))}}return Ot.length?Ot:null}function Ts(xt,_e,ze,tt,kt){for(let bt=0;bt=ze&&Et<=tt&&ga(_e,xt[bt],xt[bt+1],xt[bt+2])}}function ii(xt,_e,ze,tt,kt,bt,Et){let $t=mi(xt);const Ot=kt===0?vl:Yo;let Bt,mr,ir=xt.start;for(let Wn=0;Wnze&&(mr=Ot($t,Gn,Ps,$a,Aa,ze),Et&&($t.start=ir+Bt*mr)):lo>tt?ya=ze&&(mr=Ot($t,Gn,Ps,$a,Aa,ze),zs=!0),ya>tt&&lo<=tt&&(mr=Ot($t,Gn,Ps,$a,Aa,tt),zs=!0),!bt&&zs&&(Et&&($t.end=ir+Bt*mr),_e.push($t),$t=mi(xt)),Et&&(ir+=Bt)}let Wr=xt.length-3;const en=xt[Wr],Br=xt[Wr+1],Zn=kt===0?en:Br;Zn>=ze&&Zn<=tt&&ga($t,en,Br,xt[Wr+2]),Wr=$t.length-3,bt&&Wr>=3&&($t[Wr]!==$t[0]||$t[Wr+1]!==$t[1])&&ga($t,$t[0],$t[1],$t[2]),$t.length&&_e.push($t)}function mi(xt){const _e=[];return _e.size=xt.size,_e.start=xt.start,_e.end=xt.end,_e}function Ta(xt,_e,ze,tt,kt,bt){for(const Et of xt)ii(Et,_e,ze,tt,kt,bt,!1)}function ga(xt,_e,ze,tt){xt.push(_e,ze,tt)}function vl(xt,_e,ze,tt,kt,bt){const Et=(bt-_e)/(tt-_e);return ga(xt,bt,ze+(kt-ze)*Et,1),Et}function Yo(xt,_e,ze,tt,kt,bt){const Et=(bt-ze)/(kt-ze);return ga(xt,_e+(tt-_e)*Et,bt,1),Et}function Ds(xt,_e){const ze=[];for(let tt=0;tt0&&_e.size<(kt?Et:tt))return void(ze.numPoints+=_e.length/3);const $t=[];for(let Ot=0;Ot<_e.length;Ot+=3)(tt===0||_e[Ot+2]>Et)&&(ze.numSimplified++,$t.push(_e[Ot],_e[Ot+1])),ze.numPoints++;kt&&function(Ot,Bt){let mr=0;for(let ir=0,Wr=Ot.length,en=Wr-2;ir0===Bt)for(let ir=0,Wr=Ot.length;ir24)throw new Error("maxZoom should be in the 0-24 range");if(ze.promoteId&&ze.generateId)throw new Error("promoteId and generateId cannot be used together.");let kt=function(bt,Et){const $t=[];if(bt.type==="FeatureCollection")for(let Ot=0;Ot1&&console.time("creation"),en=this.tiles[Wr]=Ni(_e,ze,tt,kt,Bt),this.tileCoords.push({z:ze,x:tt,y:kt}),mr)){mr>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",ze,tt,kt,en.numFeatures,en.numPoints,en.numSimplified),console.timeEnd("creation"));const zs=`z${ze}`;this.stats[zs]=(this.stats[zs]||0)+1,this.total++}if(en.source=_e,bt==null){if(ze===Bt.indexMaxZoom||en.numPoints<=Bt.indexMaxPoints)continue}else{if(ze===Bt.maxZoom||ze===bt)continue;if(bt!=null){const zs=bt-ze;if(tt!==Et>>zs||kt!==$t>>zs)continue}}if(en.source=null,_e.length===0)continue;mr>1&&console.time("clipping");const Br=.5*Bt.buffer/Bt.extent,Zn=.5-Br,Wn=.5+Br,Gn=1+Br;let Ps=null,wa=null,$a=null,Aa=null,lo=wr(_e,ir,tt-Br,tt+Wn,0,en.minX,en.maxX,Bt),ya=wr(_e,ir,tt+Zn,tt+Gn,0,en.minX,en.maxX,Bt);_e=null,lo&&(Ps=wr(lo,ir,kt-Br,kt+Wn,1,en.minY,en.maxY,Bt),wa=wr(lo,ir,kt+Zn,kt+Gn,1,en.minY,en.maxY,Bt),lo=null),ya&&($a=wr(ya,ir,kt-Br,kt+Wn,1,en.minY,en.maxY,Bt),Aa=wr(ya,ir,kt+Zn,kt+Gn,1,en.minY,en.maxY,Bt),ya=null),mr>1&&console.timeEnd("clipping"),Ot.push(Ps||[],ze+1,2*tt,2*kt),Ot.push(wa||[],ze+1,2*tt,2*kt+1),Ot.push($a||[],ze+1,2*tt+1,2*kt),Ot.push(Aa||[],ze+1,2*tt+1,2*kt+1)}}getTile(_e,ze,tt){_e=+_e,ze=+ze,tt=+tt;const kt=this.options,{extent:bt,debug:Et}=kt;if(_e<0||_e>24)return null;const $t=1<<_e,Ot=po(_e,ze=ze+$t&$t-1,tt);if(this.tiles[Ot])return _s(this.tiles[Ot],bt);Et>1&&console.log("drilling down to z%d-%d-%d",_e,ze,tt);let Bt,mr=_e,ir=ze,Wr=tt;for(;!Bt&&mr>0;)mr--,ir>>=1,Wr>>=1,Bt=this.tiles[po(mr,ir,Wr)];return Bt&&Bt.source?(Et>1&&(console.log("found parent tile z%d-%d-%d",mr,ir,Wr),console.time("drilling down")),this.splitTile(Bt.source,mr,ir,Wr,_e,ze,tt),Et>1&&console.timeEnd("drilling down"),this.tiles[Ot]?_s(this.tiles[Ot],bt):null):null}}function po(xt,_e,ze){return 32*((1<Bt.tags&&"3d_elevation_id"in Bt.tags&&"source"in Bt.tags&&Bt.tags.source==="elevation",bt=tt.features.filter(Bt=>kt(Bt));let Et={_geojsonTileLayer:tt.features};bt.length>0&&(Et={_geojsonTileLayer:tt.features.filter(Bt=>!kt(Bt)),hd_road_elevation:bt});const $t=new se(Et),Ot=function(Bt){const mr=new a.bt;for(const ir of Object.keys(Bt))mr.writeMessage(3,Ue,{name:ir,features:Bt[ir]});return mr.finish()}(Et).buffer;_e(null,{vectorTile:$t,rawData:Ot})}class ba extends W{constructor(_e,ze,tt,kt,bt,Et,$t){super(_e,ze,tt,kt,bt,Qr,$t),Et&&(this.loadGeoJSON=Et),this._dynamicIndex=new me}loadData(_e,ze){const tt=_e&&_e.request,kt=tt&&tt.collectResourceTiming;this._geoJSONIndex=null,this.loadGeoJSON(_e,(bt,Et)=>{if(bt||!Et)return ze(bt);if(typeof Et!="object")return ze(new Error(`Input data given to '${_e.source}' is not a valid GeoJSON object.`));{try{if(_e.filter){const Ot=a.U(_e.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Ot.result==="error")throw new Error(Ot.value.map(Bt=>`${Bt.key}: ${Bt.message}`).join(", "));Et.features=Et.features.filter(Bt=>Ot.value.evaluate({zoom:0},Bt))}_e.dynamic?(Et.type==="Feature"&&(Et={type:"FeatureCollection",features:[Et]}),_e.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(Et.features,this.loaded),_e.cluster&&(Et.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=_e.cluster?new et(function({superclusterOptions:Ot,clusterProperties:Bt}){if(!Bt||!Ot)return Ot;const mr={},ir={},Wr={accumulated:null,zoom:0},en={properties:null},Br=Object.keys(Bt);for(const Zn of Br){const[Wn,Gn]=Bt[Zn],Ps=a.U(Gn),wa=a.U(typeof Wn=="string"?[Wn,["accumulated"],["get",Zn]]:Wn);mr[Zn]=Ps.value,ir[Zn]=wa.value}return Ot.map=Zn=>{en.properties=Zn;const Wn={};for(const Gn of Br)Wn[Gn]=mr[Gn].evaluate(Wr,en);return Wn},Ot.reduce=(Zn,Wn)=>{en.properties=Wn;for(const Gn of Br)Wr.accumulated=Zn[Gn],Zn[Gn]=ir[Gn].evaluate(Wr,en)},Ot}(_e)).load(Et.features):_e.dynamic?this._dynamicIndex:function(Ot,Bt){return new lc(Ot,Bt)}(Et,_e.geojsonVtOptions)}catch(Ot){return ze(Ot)}const $t={};if(kt){const Ot=f(tt);Ot&&($t.resourceTiming={},$t.resourceTiming[_e.source]=JSON.parse(JSON.stringify(Ot)))}ze(null,$t)}})}reloadTile(_e,ze){const tt=this.loaded;return tt&&tt[_e.uid]?_e.partial?ze(null,void 0):super.reloadTile(_e,ze):this.loadTile(_e,ze)}loadGeoJSON(_e,ze){if(_e.request)a.m(_e.request,ze);else{if(typeof _e.data!="string")return ze(new Error(`Input data given to '${_e.source}' is not a valid GeoJSON object.`));setTimeout(()=>{try{return ze(null,JSON.parse(_e.data))}catch{return ze(new Error(`Input data given to '${_e.source}' is not a valid GeoJSON object.`))}},0)}}getClusterExpansionZoom(_e,ze){try{ze(null,this._geoJSONIndex.getClusterExpansionZoom(_e.clusterId))}catch(tt){ze(tt)}}getClusterChildren(_e,ze){try{ze(null,this._geoJSONIndex.getChildren(_e.clusterId))}catch(tt){ze(tt)}}getClusterLeaves(_e,ze){try{ze(null,this._geoJSONIndex.getLeaves(_e.clusterId,_e.limit,_e.offset))}catch(tt){ze(tt)}}}class Ka{constructor(_e,ze,tt){this.tileID=new a.aQ(_e.tileID.overscaledZ,_e.tileID.wrap,_e.tileID.canonical.z,_e.tileID.canonical.x,_e.tileID.canonical.y),this.tileZoom=_e.tileZoom,this.uid=_e.uid,this.zoom=_e.zoom,this.canonical=_e.tileID.canonical,this.pixelRatio=_e.pixelRatio,this.tileSize=_e.tileSize,this.source=_e.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=_e.projection,this.brightness=ze,this.worldview=tt}parse(_e,ze,tt,kt){this.status="parsing";const bt=new a.aQ(tt.tileID.overscaledZ,tt.tileID.wrap,tt.tileID.canonical.z,tt.tileID.canonical.x,tt.tileID.canonical.y),Et=[],$t=ze.familiesBySource[tt.source],Ot=new a.fn(bt,tt.promoteId);Ot.bucketLayerIDs=[],Ot.is3DTile=!0,a.fC(_e).then(Bt=>{if(!Bt)return kt(new Error("Could not parse tile"));const mr=Bt.json.extensionsUsed&&Bt.json.extensionsUsed.includes("MAPBOX_mesh_features")||Bt.json.asset.extras&&Bt.json.asset.extras.MAPBOX_mesh_features,ir=Bt.json.extensionsUsed&&Bt.json.extensionsUsed.includes("EXT_meshopt_compression"),Wr=new a.ac(this.zoom,{brightness:this.brightness,worldview:this.worldview});for(const en in $t)for(const Br of $t[en]){const Zn=Br[0];Ot.bucketLayerIDs.push(Br.map(Ps=>a.B(Ps.id,Ps.scope))),Zn.recalculate(Wr,[]);const Wn=a.fD(Bt,1/a.d7(tt.tileID.canonical)),Gn=new a.fE(Br,Wn,bt,mr,ir,this.brightness,Ot,this.worldview);mr||(Gn.needsUpload=!0),Et.push(Gn),Gn.evaluate(Zn)}this.status="done",kt(null,{buckets:Et,featureIndex:Ot,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})}).catch(Bt=>kt(new Error(Bt.message)))}}class dr{constructor(_e,ze,tt,kt,bt,Et,$t,Ot){this.actor=_e,this.layerIndex=ze,this.availableImages=tt,this.availableModels=kt,this.brightness=$t,this.loading={},this.loaded={},this.worldview=Ot}loadTile(_e,ze){const tt=_e.uid,kt=this.loading[tt]=new Ka(_e,this.brightness,this.worldview);a.bu(_e.request,(bt,Et)=>{const $t=!this.loading[tt];return delete this.loading[tt],$t||bt?(kt.status="done",$t||(this.loaded[tt]=kt),ze(bt)):Et&&Et.byteLength!==0?void kt.parse(Et,this.layerIndex,_e,(Ot,Bt)=>{kt.status="done",this.loaded=this.loaded||{},this.loaded[tt]=kt,Ot||!Bt?ze(Ot):ze(null,Bt)}):(kt.status="done",this.loaded[tt]=kt,ze())})}reloadTile(_e,ze){const tt=this.loaded,kt=_e.uid;if(tt&&tt[kt]){const bt=tt[kt];bt.projection=_e.projection,bt.brightness=_e.brightness;const Et=($t,Ot)=>{bt.reloadCallback&&(delete bt.reloadCallback,this.loadTile(_e,ze)),ze($t,Ot)};bt.status==="parsing"?bt.reloadCallback=Et:bt.status==="done"&&this.loadTile(_e,ze)}}abortTile(_e,ze){const tt=_e.uid;this.loading[tt]&&delete this.loading[tt],ze()}removeTile(_e,ze){const tt=this.loaded,kt=_e.uid;tt&&tt[kt]&&delete tt[kt],ze()}}class Ln{constructor(_e){this.self=_e,this.actor=new a.fG(_e,this),this.layerIndexes={},this.availableImages={},this.availableModels={},this.isSpriteLoaded={},this.imageRasterizer=new a.x,this.rtlPluginParsingListeners=[],this.projections={},this.defaultProjection=a.cm({name:"mercator"}),this.workerSourceTypes={vector:W,geojson:ba,"raster-dem":K,"raster-array":re,"batched-model":dr},this.workerSources={},this.self.registerWorkerSource=(ze,tt)=>{if(this.workerSourceTypes[ze])throw new Error(`Worker source with name "${ze}" already registered.`);this.workerSourceTypes[ze]=tt},this.self.registerRTLTextPlugin=ze=>{if(a.fH.isParsed())throw new Error("RTL text plugin already registered.");a.fH.setState({pluginStatus:a.fI.parsed,pluginURL:a.fH.getPluginURL()}),a.fH.applyArabicShaping=ze.applyArabicShaping,a.fH.processBidirectionalText=ze.processBidirectionalText,a.fH.processStyledBidirectionalText=ze.processStyledBidirectionalText;for(const tt of this.rtlPluginParsingListeners)tt(null,!0);this.rtlPluginParsingListeners=[]}}clearCaches(_e,ze,tt){delete this.layerIndexes[_e],delete this.availableImages[_e],delete this.availableModels[_e],delete this.workerSources[_e],tt()}checkIfReady(_e,ze,tt){tt()}setReferrer(_e,ze){this.referrer=ze}spriteLoaded(_e,ze){this.isSpriteLoaded[_e]||(this.isSpriteLoaded[_e]={});const{scope:tt,isLoaded:kt}=ze;if(this.isSpriteLoaded[_e][tt]=kt,this.workerSources[_e]&&this.workerSources[_e][tt])for(const bt in this.workerSources[_e][tt]){const Et=this.workerSources[_e][tt][bt];for(const $t in Et){const Ot=Et[$t];Ot instanceof W&&(Ot.isSpriteLoaded=kt,Ot.fire(new a.z("isSpriteLoaded")))}}}setImages(_e,ze,tt){this.availableImages[_e]||(this.availableImages[_e]={});const{scope:kt,images:bt}=ze;if(this.availableImages[_e][kt]=bt,this.workerSources[_e]&&this.workerSources[_e][kt]){for(const Et in this.workerSources[_e][kt]){const $t=this.workerSources[_e][kt][Et];for(const Ot in $t)$t[Ot].availableImages=bt}tt()}else tt()}setModels(_e,{scope:ze,models:tt},kt){if(this.availableModels[_e]||(this.availableModels[_e]={}),this.availableModels[_e][ze]=tt,this.workerSources[_e]&&this.workerSources[_e][ze]){for(const bt in this.workerSources[_e][ze]){const Et=this.workerSources[_e][ze][bt];for(const $t in Et)Et[$t].availableModels=tt}kt()}else kt()}setProjection(_e,ze){this.projections[_e]=a.cm(ze)}setBrightness(_e,ze,tt){this.brightness=ze,tt()}setWorldview(_e,ze,tt){this.worldview=ze,tt()}setLayers(_e,ze,tt){this.getLayerIndex(_e,ze.scope).replace(ze.layers,ze.options),tt()}updateLayers(_e,ze,tt){this.getLayerIndex(_e,ze.scope).update(ze.layers,ze.removedIds,ze.options),tt()}loadTile(_e,ze,tt){ze.projection=this.projections[_e]||this.defaultProjection,this.getWorkerSource(_e,ze.type,ze.source,ze.scope).loadTile(ze,tt)}decodeRasterArray(_e,ze,tt){this.getWorkerSource(_e,ze.type,ze.source,ze.scope).decodeRasterArray(ze,tt)}reloadTile(_e,ze,tt){ze.projection=this.projections[_e]||this.defaultProjection,this.getWorkerSource(_e,ze.type,ze.source,ze.scope).reloadTile(ze,tt)}abortTile(_e,ze,tt){this.getWorkerSource(_e,ze.type,ze.source,ze.scope).abortTile(ze,tt)}removeTile(_e,ze,tt){this.getWorkerSource(_e,ze.type,ze.source,ze.scope).removeTile(ze,tt)}removeSource(_e,ze,tt){if(!(this.workerSources[_e]&&this.workerSources[_e][ze.scope]&&this.workerSources[_e][ze.scope][ze.type]&&this.workerSources[_e][ze.scope][ze.type][ze.source]))return;const kt=this.workerSources[_e][ze.scope][ze.type][ze.source];delete this.workerSources[_e][ze.scope][ze.type][ze.source],kt.removeSource!==void 0?kt.removeSource(ze,tt):tt()}loadWorkerSource(_e,ze,tt){try{this.self.importScripts(ze.url),tt()}catch(kt){tt(kt)}}syncRTLPluginState(_e,ze,tt){if(a.fH.isParsed())tt(null,!0);else if(a.fH.isParsing())this.rtlPluginParsingListeners.push(tt);else try{a.fH.setState(ze);const kt=a.fH.getPluginURL();!a.fH.isLoaded()||a.fH.isParsed()||a.fH.isParsing()||kt==null||(a.fH.setState({pluginStatus:a.fI.parsing,pluginURL:a.fH.getPluginURL()}),this.self.importScripts(kt),a.fH.isParsed()?tt(null,!0):this.rtlPluginParsingListeners.push(tt))}catch(kt){tt(kt)}}setDracoUrl(_e,ze){this.dracoUrl=ze}getAvailableImages(_e,ze){this.availableImages[_e]||(this.availableImages[_e]={});let tt=this.availableImages[_e][ze];return tt||(tt=[]),tt}getAvailableModels(_e,ze){this.availableModels[_e]||(this.availableModels[_e]={});let tt=this.availableModels[_e][ze];return tt||(tt={}),tt}getLayerIndex(_e,ze){this.layerIndexes[_e]||(this.layerIndexes[_e]={});let tt=this.layerIndexes[_e][ze];return tt||(tt=this.layerIndexes[_e][ze]=new v,tt.scope=ze),tt}getWorkerSource(_e,ze,tt,kt){const bt=this.workerSources;return bt[_e]||(bt[_e]={}),bt[_e][kt]||(bt[_e][kt]={}),bt[_e][kt][ze]||(bt[_e][kt][ze]={}),this.isSpriteLoaded[_e]||(this.isSpriteLoaded[_e]={}),bt[_e][kt][ze][tt]||(bt[_e][kt][ze][tt]=new this.workerSourceTypes[ze]({send:(Et,$t,Ot,Bt,mr,ir)=>this.actor.send(Et,$t,Ot,_e,mr,ir),scheduler:this.actor.scheduler},this.getLayerIndex(_e,kt),this.getAvailableImages(_e,kt),this.getAvailableModels(_e,kt),this.isSpriteLoaded[_e][kt],void 0,this.brightness,this.worldview)),bt[_e][kt][ze][tt]}rasterizeImagesWorker(_e,ze,tt){const kt=new Map;for(const[bt,{image:Et,imageVariant:$t}]of ze.tasks.entries()){const Ot=this.imageRasterizer.rasterize($t,Et,ze.scope,_e);kt.set(bt,Ot)}tt(void 0,kt)}removeRasterizedImages(_e,ze,tt){this.imageRasterizer.removeImagesFromCacheByIds(ze.imageIds,ze.scope,_e),tt()}enforceCacheSizeLimit(_e,ze){a.fJ(ze)}getWorkerPerformanceMetrics(_e,ze,tt){tt(void 0,void 0)}}return a.fF(self)&&(self.worker=new Ln(self)),Ln}),o(["./shared"],function(a){var f="3.17.0";const m={create:"create",load:"load",fullLoad:"fullLoad"},y={mark(_){performance.mark(_)},measure(_,d,p){performance.measure(_,d,p)}};function v(_){const d=_.name.split("?")[0];return a.a(d)&&d.includes("mapbox-gl.js")?"javascript":a.a(d)&&d.includes("mapbox-gl.css")?"css":a.b(d)?"fontRange":a.c(d)?"sprite":a.i(d)?"style":a.d(d)?"tilejson":"other"}var w,k={},C=function(){if(w)return k;function _(b){return!d(b)}function d(b){return typeof window>"u"||typeof document>"u"?"not a browser":function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var L,O,z=new Blob([""],{type:"text/javascript"}),V=URL.createObjectURL(z);try{O=new Worker(V),L=!0}catch{L=!1}return O&&O.terminate(),URL.revokeObjectURL(V),L}()?function(){var L=document.createElement("canvas");L.width=L.height=1;var O=L.getContext("2d");if(!O)return!1;var z=O.getImageData(0,0,1,1);return z&&z.width===L.width}()?(p[M=b&&b.failIfMajorPerformanceCaveat]===void 0&&(p[M]=function(L){var O,z=function(V){var Y=document.createElement("canvas"),Q=Object.create(_.webGLContextAttributes);return Q.failIfMajorPerformanceCaveat=V,Y.getContext("webgl2",Q)}(L);if(!z)return!1;try{O=z.createShader(z.VERTEX_SHADER)}catch{return!1}return!(!O||z.isContextLost())&&(z.shaderSource(O,"void main() {}"),z.compileShader(O),z.getShaderParameter(O,z.COMPILE_STATUS)===!0)}(M)),p[M]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var M}w=1,k.supported=_,k.notSupportedReason=d;var p={};return _.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},k}();function S(_,d,p){const b=document.createElement(_);return d!=null&&(b.className=d),p&&p.appendChild(b),b}function T(_,d,p){const b=document.createElementNS("http://www.w3.org/2000/svg",_);for(const M of Object.keys(d))b.setAttributeNS(null,M,String(d[M]));return p&&p.appendChild(b),b}const I=typeof document<"u"?document.documentElement&&document.documentElement.style:null,A=I&&I.userSelect!==void 0?"userSelect":"WebkitUserSelect";let D;function $(){I&&A&&(D=I[A],I[A]="none")}function F(){I&&A&&(I[A]=D)}function q(_){_.preventDefault(),_.stopPropagation(),window.removeEventListener("click",q,!0)}function W(){window.addEventListener("click",q,!0),window.setTimeout(()=>{window.removeEventListener("click",q,!0)},0)}function K(_,d){const p=_.getBoundingClientRect();return he(_,p,d)}function Z(_,d){const p=_.getBoundingClientRect(),b=[];for(let M=0;Mthis._skuTokenExpiresAt}transformRequest(d,p){return this._transformRequestFn&&this._transformRequestFn(d,p)||{url:d}}normalizeStyleURL(d,p){if(!a.h(d))return d;const b=ie(d);return b.params.push(`sdk=js-${f}`),b.path=`/styles/v1${b.path}`,this._makeAPIURL(b,this._customAccessToken||p)}normalizeGlyphsURL(d,p){if(!a.h(d))return d;const b=ie(d);return b.path=`/fonts/v1${b.path}`,this._makeAPIURL(b,this._customAccessToken||p)}normalizeModelURL(d,p){if(!a.h(d))return d;const b=ie(d);return b.path=`/models/v1${b.path}`,this._makeAPIURL(b,this._customAccessToken||p)}normalizeSourceURL(d,p,b,M){if(!a.h(d))return d;const L=ie(d);return L.path=`/v4/${L.authority}.json`,L.params.push("secure"),b&&L.params.push(`language=${b}`),M&&L.params.push(`worldview=${M}`),this._makeAPIURL(L,this._customAccessToken||p)}normalizeIconsetURL(d,p){const b=ie(d);return a.h(d)?(b.path=`/styles/v1${b.path}/iconset.pbf`,this._makeAPIURL(b,this._customAccessToken||p)):me(b)}normalizeSpriteURL(d,p,b,M){const L=ie(d);return a.h(d)?(L.path=`/styles/v1${L.path}/sprite${p}${b}`,this._makeAPIURL(L,this._customAccessToken||M)):(L.path+=`${p}${b}`,me(L))}normalizeTileURL(d,p,b){if(this._isSkuTokenExpired()&&this._createSkuToken(),d&&!a.h(d))return d;const M=ie(d);M.path=M.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${p||b&&M.authority!=="raster"&&b===512?"@2x":""}${a.k.supported?".webp":"$1"}`),M.authority==="raster"?M.path=`/${a.e.RASTER_URL_PREFIX}${M.path}`:M.authority==="rasterarrays"?M.path=`/${a.e.RASTERARRAYS_URL_PREFIX}${M.path}`:M.authority==="3dtiles"?M.path=`/${a.e.TILES3D_URL_PREFIX}${M.path}`:(M.path=M.path.replace(/^.+\/v4\//,"/"),M.path=`/${a.e.TILE_URL_VERSION}${M.path}`);const L=this._customAccessToken||function(O){for(const z of O){const V=z.match(/^access_token=(.*)$/);if(V)return V[1]}return null}(M.params)||a.e.ACCESS_TOKEN;return a.e.REQUIRE_ACCESS_TOKEN&&L&&this._skuToken&&M.params.push(`sku=${this._skuToken}`),this._makeAPIURL(M,L)}canonicalizeTileURL(d,p){const b=ie(d);if(!b.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!b.path.match(/\.[\w]+$/))return d;let M="mapbox://";b.path.match(/^\/raster\/v1\//)?M+=`raster/${b.path.replace(`/${a.e.RASTER_URL_PREFIX}/`,"")}`:b.path.match(/^\/rasterarrays\/v1\//)?M+=`rasterarrays/${b.path.replace(`/${a.e.RASTERARRAYS_URL_PREFIX}/`,"")}`:M+=`tiles/${b.path.replace(`/${a.e.TILE_URL_VERSION}/`,"")}`;let L=b.params;return p&&(L=L.filter(O=>!O.match(/^access_token=/))),L.length&&(M+=`?${L.join("&")}`),M}canonicalizeTileset(d,p){const b=!!p&&a.h(p),M=[];for(const L of d.tiles||[])a.j(L)?M.push(this.canonicalizeTileURL(L,b)):M.push(L);return M}_makeAPIURL(d,p){const b="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",M=ie(a.e.API_URL);if(d.protocol=M.protocol,d.authority=M.authority,d.protocol==="http"){const L=d.params.indexOf("secure");L>=0&&d.params.splice(L,1)}if(M.path!=="/"&&(d.path=`${M.path}${d.path}`),!a.e.REQUIRE_ACCESS_TOKEN)return me(d);if(p=p||a.e.ACCESS_TOKEN,!this._silenceAuthErrors){if(!p)throw new Error(`An API access token is required to use Mapbox GL. ${b}`);if(p[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${b}`)}return d.params=d.params.filter(L=>L.indexOf("access_token")===-1),d.params.push(`access_token=${p||""}`),me(d)}}const xe=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function ie(_){const d=_.match(xe);if(!d)throw new Error("Unable to parse URL object");return{protocol:d[1],authority:d[2],path:d[3]||"/",params:d[4]?d[4].split("&"):[]}}function me(_){const d=_.params.length?`?${_.params.join("&")}`:"";return`${_.protocol}://${_.authority}${_.path}${d}`}const fe="mapbox.eventData";function ve(_){if(!_)return null;const d=_.split(".");if(!d||d.length!==3)return null;try{return JSON.parse(a.l(d[1]))}catch{return null}}class Ie{constructor(d){this.type=d,this.anonId=null,this.anonIdTimestamp=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(d){const p=ve(a.e.ACCESS_TOKEN);let b="";return b=p&&p.u?a.f(p.u):a.e.ACCESS_TOKEN||"",d?`${fe}.${d}:${b}`:`${fe}:${b}`}fetchEventData(){const d=a.s("localStorage"),p=this.getStorageKey(),b=this.getStorageKey("uuid"),M=this.getStorageKey("uuidTimestamp");if(d)try{const L=localStorage.getItem(p);L&&(this.eventData=JSON.parse(L));const O=localStorage.getItem(b);O&&(this.anonId=O);const z=localStorage.getItem(M);z&&(this.anonIdTimestamp=Number(z));const V=Date.now()-864e5;(!this.anonIdTimestamp||this.anonIdTimestamp=1&&localStorage.setItem(p,JSON.stringify(this.eventData)),O&&localStorage.setItem(M,O.toString())}catch{a.w("Unable to write to LocalStorage")}}processRequests(d){}postEvent(d,p,b,M){if(!a.e.EVENTS_URL)return;const L=ie(a.e.EVENTS_URL);L.params.push(`access_token=${M||a.e.ACCESS_TOKEN||""}`);const O={event:this.type,created:new Date(d).toISOString()},z=p?Object.assign(O,p):O,V={url:me(L),headers:{"Content-Type":"text/plain"},body:JSON.stringify([z])};this.pendingRequest=a.p(V,Y=>{this.pendingRequest=null,b(Y),this.saveEventData(),this.processRequests(M)})}queueRequest(d,p){this.queue.push(d),this.processRequests(p)}}class Se extends Ie{constructor(d){super("metrics"),d&&(this.data=d)}postMetricsEvent(d){if(!a.e.EVENTS_URL||!d&&!a.e.ACCESS_TOKEN)return;this.anonId||this.fetchEventData(),a.v(this.anonId)||this.refreshUUID();const p=Object.assign({},this.data,{sessionId:this.anonId});this.queueRequest({timestamp:Date.now(),payload:p},d)}processRequests(d){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:p,payload:b}=this.queue.shift();this.postEvent(p,b,()=>{},d)}}const oe=new class extends Ie{constructor(_){super("appUserTurnstile"),this._customAccessToken=_}postTurnstileEvent(_,d){a.e.EVENTS_URL&&a.e.ACCESS_TOKEN&&Array.isArray(_)&&_.some(p=>a.h(p)||a.j(p))&&this.queueRequest(Date.now(),d)}processRequests(_){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.anonIdTimestamp&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const d=ve(a.e.ACCESS_TOKEN),p=d?d.u:a.e.ACCESS_TOKEN;let b=p!==this.eventData.tokenU;a.v(this.anonId)||(this.refreshUUID(),b=!0);const M=this.queue.shift();if(this.eventData.lastSuccess){const L=new Date(this.eventData.lastSuccess),O=new Date(M),z=(M-this.eventData.lastSuccess)/864e5;b=b||z>=1||z<-1||L.getDate()!==O.getDate()}else b=!0;b?this.postEvent(M,{sdkIdentifier:"mapbox-gl-js",sdkVersion:f,skuId:ue,"enabled.telemetry":!1,userId:this.anonId},L=>{L||(this.eventData.lastSuccess=M,this.eventData.tokenU=p)},_):this.processRequests()}},ae=oe.postTurnstileEvent.bind(oe),je=new class extends Ie{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(_,d,p,b){this.skuToken=d,this.errorCb=b,a.e.EVENTS_URL&&(p||a.e.ACCESS_TOKEN?this.queueRequest({id:_,timestamp:Date.now()},p):this.errorCb(new Error(Ne)))}processRequests(_){if(this.pendingRequest||this.queue.length===0)return;const{id:d,timestamp:p}=this.queue.shift();d&&this.success[d]||(this.anonId&&this.anonIdTimestamp||this.fetchEventData(),a.v(this.anonId)||this.refreshUUID(),this.postEvent(p,{sdkIdentifier:"mapbox-gl-js",sdkVersion:f,skuId:ue,skuToken:this.skuToken,userId:this.anonId},b=>{b?this.errorCb(b):d&&(this.success[d]=!0)},_))}remove(){this.errorCb=null}},Me=je.postMapLoadEvent.bind(je),Ue=new class extends Ie{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(_){let d=this.mapInstanceIdMap.get(_);return d||(d=a.u(),this.mapInstanceIdMap.set(_,d)),d}getEventId(_){const d=this.eventIdPerMapInstanceMap.get(_)||0;return this.eventIdPerMapInstanceMap.set(_,d+1),d}postStyleLoadEvent(_,d){const{map:p,style:b,importedStyles:M}=d;if(!a.e.EVENTS_URL||!_&&!a.e.ACCESS_TOKEN)return;const L=this.getMapInstanceId(p),O={mapInstanceId:L,eventId:this.getEventId(L),style:b};M.length&&(O.importedStyles=M),this.queueRequest({timestamp:Date.now(),payload:O},_)}processRequests(_){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:d,payload:p}=this.queue.shift();this.postEvent(d,p,()=>{},_)}},Re=Ue.postStyleLoadEvent.bind(Ue),$e=new Se({attributes:[{name:"maps/js/layer-animations/style-with-appearances"}]}),Pe=$e.postMetricsEvent.bind($e),Ae=new Se({attributes:[{name:"maps/js/layer-animations/runtime-appearances"}]}),nt=Ae.postMetricsEvent.bind(Ae),Te=new class extends Ie{constructor(){super("gljs.performance")}postPerformanceEvent(_,d){a.e.EVENTS_URL&&(_||a.e.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:d},_)}processRequests(_){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:d,performanceData:p}=this.queue.shift(),b=function(M){const L=performance.getEntriesByType("resource"),O=performance.getEntriesByType("mark"),z=function(de){const be={};if(de){for(const ye in de)if(ye!=="other")for(const Oe of de[ye]){const Ee=`${ye}ResolveRangeMin`,qe=`${ye}ResolveRangeMax`,Ze=`${ye}RequestCount`,Ve=`${ye}RequestCachedCount`;be[Ee]=Math.min(be[Ee]||1/0,Oe.startTime),be[qe]=Math.max(be[qe]||-1/0,Oe.responseEnd);const gt=ct=>{be[ct]===void 0&&(be[ct]=0),++be[ct]};Oe.transferSize!==void 0&&Oe.transferSize===0&>(Ve),gt(Ze)}}return be}(function(de,be){const ye={};if(de)for(const Oe of de){const Ee=be(Oe);ye[Ee]===void 0&&(ye[Ee]=[]),ye[Ee].push(Oe)}return ye}(L,v)),V=window.devicePixelRatio,Y=navigator.connection||navigator.mozConnection||navigator.webkitConnection,Q=Y?Y.effectiveType:void 0,ce={counters:[],metadata:[],attributes:[]},le=(de,be,ye)=>{ye!=null&&de.push({name:be,value:ye.toString()})};for(const de in z)le(ce.counters,de,z[de]);if(M.interactionRange[0]!==1/0&&M.interactionRange[1]!==-1/0&&(le(ce.counters,"interactionRangeMin",M.interactionRange[0]),le(ce.counters,"interactionRangeMax",M.interactionRange[1])),O)for(const de of Object.values(m)){const be=O.find(ye=>ye.name===de);be&&le(ce.counters,de,be.startTime)}return le(ce.counters,"visibilityHidden",M.visibilityHidden),le(ce.attributes,"style",function(de){if(de)for(const be of de){const ye=be.name.split("?")[0];if(a.i(ye)){const Oe=ye.split("/").slice(-2);if(Oe.length===2)return`mapbox://styles/${Oe[0]}/${Oe[1]}`}}}(L)),le(ce.attributes,"terrainEnabled",M.terrainEnabled?"true":"false"),le(ce.attributes,"fogEnabled",M.fogEnabled?"true":"false"),le(ce.attributes,"projection",M.projection),le(ce.attributes,"zoom",M.zoom),le(ce.metadata,"devicePixelRatio",V),le(ce.metadata,"connectionEffectiveType",Q),le(ce.metadata,"navigatorUserAgent",navigator.userAgent),le(ce.metadata,"screenWidth",window.screen.width),le(ce.metadata,"screenHeight",window.screen.height),le(ce.metadata,"windowWidth",window.innerWidth),le(ce.metadata,"windowHeight",window.innerHeight),le(ce.metadata,"mapWidth",M.width/V),le(ce.metadata,"mapHeight",M.height/V),le(ce.metadata,"webglRenderer",M.renderer),le(ce.metadata,"webglVendor",M.vendor),le(ce.metadata,"sdkVersion",f),le(ce.metadata,"sdkIdentifier","mapbox-gl-js"),ce}(p);for(const M of b.metadata);for(const M of b.counters);for(const M of b.attributes);this.postEvent(d,b,()=>{},_)}},Xe=Te.postPerformanceEvent.bind(Te),ge=new class extends Ie{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(_,d,p,b){if(!a.e.API_URL||!a.e.SESSION_PATH)return;const M=ie(a.e.API_URL+a.e.SESSION_PATH);M.params.push(`sku=${d||""}`),M.params.push(`access_token=${b||a.e.ACCESS_TOKEN||""}`);const L={url:me(M),headers:{"Content-Type":"text/plain"}};this.pendingRequest=a.g(L,O=>{this.pendingRequest=null,p(O),this.saveEventData(),this.processRequests(b)})}getSessionAPI(_,d,p,b){this.skuToken=d,this.errorCb=b,a.e.SESSION_PATH&&a.e.API_URL&&(p||a.e.ACCESS_TOKEN?this.queueRequest({id:_,timestamp:Date.now()},p):this.errorCb(new Error(Ne)))}processRequests(_){if(this.pendingRequest||this.queue.length===0)return;const{id:d,timestamp:p}=this.queue.shift();d&&this.success[d]||this.getSession(p,this.skuToken,b=>{b?this.errorCb(b):d&&(this.success[d]=!0)},_)}remove(){this.errorCb=null}},mt=ge.getSessionAPI.bind(ge),rt=new Set;function We(_,d){d?rt.add(_):rt.delete(_)}class Ce{constructor(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps=new Set,this._updatedImages={}}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(d,p){this._updatedSourceCaches[d]=p,this.setDirty()}discardSourceCacheUpdate(d){delete this._updatedSourceCaches[d]}updateLayer(d){const p=d.scope;this._updatedLayers[p]=this._updatedLayers[p]||new Set,this._updatedLayers[p].add(d.id),this.setDirty()}removeLayer(d){const p=d.scope;this._removedLayers[p]=this._removedLayers[p]||{},this._updatedLayers[p]=this._updatedLayers[p]||new Set,this._removedLayers[p][d.id]=d,this._updatedLayers[p].delete(d.id),this._updatedPaintProps.delete(d.fqid),this.setDirty()}getRemovedLayer(d){return this._removedLayers[d.scope]?this._removedLayers[d.scope][d.id]:null}discardLayerRemoval(d){this._removedLayers[d.scope]&&delete this._removedLayers[d.scope][d.id]}getLayerUpdatesByScope(){const d={};for(const p in this._updatedLayers)d[p]=d[p]||{},d[p].updatedIds=Array.from(this._updatedLayers[p].values());for(const p in this._removedLayers)d[p]=d[p]||{},d[p].removedIds=Object.keys(this._removedLayers[p]);return d}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(d){this._updatedPaintProps.add(d.fqid),this.setDirty()}getUpdatedImages(d){return this._updatedImages[d]?Array.from(this._updatedImages[d].values()):[]}updateImage(d,p){this._updatedImages[p]=this._updatedImages[p]||new Set,this._updatedImages[p].add(a.I.toString(d)),this.setDirty()}resetUpdatedImages(d){this._updatedImages[d]&&this._updatedImages[d].clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages={}}}function et(_){const{userImage:d}=_;return!!(d&&d.render&&d.render())&&(_.data.replace(new Uint8Array(d.data.buffer)),!0)}class Fe extends a.E{constructor(d){super(),this.imageProviders=new Map,this.images=new Map,this.updatedImages=new Map,this.callbackDispatchedThisFrame=new Map,this.loaded=new Map,this.requestors=[],this.patterns=new Map,this.patternsInFlight=new Set,this.atlasImage=new Map,this.atlasTexture=new Map,this.dirty=!0,this.spriteFormat=d,d!=="raster"&&a.r()&&(this.imageRasterizerDispatcher=new a.D(a.t(),this,"Image Rasterizer Worker",1))}addScope(d){this.loaded.set(d,!1),this.imageProviders.set(d,new Map),this.images.set(d,new Map),this.updatedImages.set(d,new Set),this.callbackDispatchedThisFrame.set(d,new Set),this.patterns.set(d,new Map),this.atlasImage.set(d,new a.q({width:1,height:1}))}removeScope(d){this.loaded.delete(d),this.imageProviders.delete(d),this.images.delete(d),this.updatedImages.delete(d),this.callbackDispatchedThisFrame.delete(d),this.patterns.delete(d),this.atlasImage.delete(d);const p=this.atlasTexture.get(d);p&&(p.destroy(),this.atlasTexture.delete(d))}addImageProvider(d,p){this.imageProviders.has(p)||this.imageProviders.set(p,new Map),this.imageProviders.get(p).set(d.id,d)}removeImageProvider(d,p){this.imageProviders.has(p)&&this.imageProviders.get(p).delete(d)}getPendingImageProviders(){const d=[];for(const p of this.imageProviders.values())for(const b of p.values())b.hasPendingRequests()&&d.push(b);return d}get imageRasterizer(){return this._imageRasterizer||(this._imageRasterizer=new a.x),this._imageRasterizer}isLoaded(){for(const d of this.loaded.keys())if(!this.loaded.get(d))return!1;return!0}setLoaded(d,p){if(this.loaded.get(p)!==d&&(this.loaded.set(p,d),d)){for(const{ids:b,callback:M}of this.requestors)this._notify(b,p,M);this.requestors=[]}}hasImage(d,p){return!!this.getImage(d,p)}getImage(d,p){return this.images.get(p).get(d.toString())}addImage(d,p,b){this._validate(d,b)&&this.images.get(p).set(d.toString(),b)}_validate(d,p){let b=!0;return this._validateStretch(p.stretchX,p.data&&p.data.width)||(this.fire(new a.y(new Error(`Image "${d.name}" has invalid "stretchX" value`))),b=!1),this._validateStretch(p.stretchY,p.data&&p.data.height)||(this.fire(new a.y(new Error(`Image "${d.name}" has invalid "stretchY" value`))),b=!1),this._validateContent(p.content,p)||(this.fire(new a.y(new Error(`Image "${d.name}" has invalid "content" value`))),b=!1),b}_validateStretch(d,p){if(!d)return!0;let b=0;for(const M of d){if(M[0]a.I.from(p))}getImages(d,p,b){const M=[],L=[],O=this.imageProviders.get(p);for(const Q of d){if(!Q.iconsetId){M.push(Q);continue}const ce=O.get(Q.iconsetId);ce&&(this.getImage(Q,p)?L.push(Q):ce.addPendingRequest(Q))}if(M.length===0)return void this._notify(L,p,b);let z=!0;const V=!!this.loaded.get(p),Y=this.images.get(p);if(!V)for(const Q of M)Y.has(Q.toString())||(z=!1);V||z?this._notify(M,p,b):this.requestors.push({ids:M,scope:p,callback:b})}rasterizeImages(d,p){const b=new Map,{tasks:M,scope:L}=d;for(const[O,z]of M.entries()){const V=this.getImage(z.id,L);V&&b.set(O,{image:V,imageVariant:z})}this._rasterizeImages(L,b,p)}_rasterizeImages(d,p,b){if(a.r())this.imageRasterizerDispatcher.getActor().send("rasterizeImagesWorker",{tasks:p,scope:d},b);else{const M=new Map;for(const[L,{image:O,imageVariant:z}]of p.entries())M.set(L,this.imageRasterizer.rasterize(z,O,d,0));b(void 0,M)}}getUpdatedImages(d){return this.updatedImages.get(d)||new Set}_notify(d,p,b){const M=this.images.get(p),L=new Map;for(const O of d){if(!M.get(O.toString())){if(O.iconsetId)continue;this.fire(new a.z("styleimagemissing",{id:O.name}))}const z=M.get(O.toString());if(!z){a.w(`Image "${O.name}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`);continue}const V={data:z.usvg?null:z.data.clone(),pixelRatio:z.pixelRatio,sdf:z.sdf,usvg:z.usvg,version:z.version,stretchX:z.stretchX,stretchY:z.stretchY,content:z.content,hasRenderCallback:!!(z.userImage&&z.userImage.render)};z.usvg&&Object.assign(V,{width:z.icon.usvg_tree.width,height:z.icon.usvg_tree.height}),L.set(a.I.toString(O),V)}b(null,L)}getPixelSize(d){const{width:p,height:b}=this.atlasImage.get(d);return{width:p,height:b}}getPattern(d,p,b){const M=d.toString(),L=this.patterns.get(p),O=L.get(M),z=this.getImage(d,p);if(!z)return null;if(O){if(O.position.version===z.version)return O.position;O.position.version=z.version}else{if(z.usvg&&!z.data){const V=this.getPatternInFlightId(M,p);if(this.patternsInFlight.has(V))return null;this.patternsInFlight.add(V);const Y=new a.A(d).scaleSelf(a.o.devicePixelRatio),Q=new Map([[Y.toString(),{image:z,imageVariant:Y}]]);return this._rasterizeImages(p,Q,(ce,le)=>this.storePatternImage(Y,p,z,b,le)),null}this.storePattern(d,p,z)}return this._updatePatternAtlas(p,b),L.get(M).position}getPatternInFlightId(d,p){return a.B(d,p)}hasPatternsInFlight(){return this.patternsInFlight.size!==0}storePatternImage(d,p,b,M,L){const O=d.toString(),z=L?L.get(O):void 0;z&&(b.data=z,this.storePattern(d.id,p,b),this._updatePatternAtlas(p,M),this.patternsInFlight.delete(this.getPatternInFlightId(d.id.toString(),p)))}storePattern(d,p,b){const M={w:b.data.width+2*a.C,h:b.data.height+2*a.C,x:0,y:0},L=new a.F(M,b,a.C);this.patterns.get(p).set(d.toString(),{bin:M,position:L})}destroyAtlasTextures(){for(const d of this.atlasTexture.values())d&&d.destroy();this.atlasTexture.clear()}bind(d,p){const b=d.gl;let M=this.atlasTexture.get(p);M?this.dirty&&(M.update(this.atlasImage.get(p)),this.dirty=!1):(M=new a.T(d,this.atlasImage.get(p),b.RGBA8),this.atlasTexture.set(p,M)),M.bind(b.LINEAR,b.CLAMP_TO_EDGE)}_updatePatternAtlas(d,p){const b=this.patterns.get(d),M=Array.from(b.values()).map(({bin:Y})=>Y),{w:L,h:O}=a.G(M),z=this.atlasImage.get(d);z.resize({width:L||1,height:O||1});const V=this.images.get(d);for(const[Y,{bin:Q,position:ce}]of b.entries()){let le=ce.padding;const de=Q.x+le,be=Q.y+le,ye=V.get(Y).data,Oe=ye.width,Ee=ye.height;le=le>1?le-1:le,a.q.copy(ye,z,{x:0,y:0},{x:de,y:be},{width:Oe,height:Ee},p),a.q.copy(ye,z,{x:0,y:Ee-le},{x:de,y:be-le},{width:Oe,height:le},p),a.q.copy(ye,z,{x:0,y:0},{x:de,y:be+Ee},{width:Oe,height:le},p),a.q.copy(ye,z,{x:Oe-le,y:0},{x:de-le,y:be},{width:le,height:Ee},p),a.q.copy(ye,z,{x:0,y:0},{x:de+Oe,y:be},{width:le,height:Ee},p),a.q.copy(ye,z,{x:Oe-le,y:Ee-le},{x:de-le,y:be-le},{width:le,height:le},p),a.q.copy(ye,z,{x:0,y:Ee-le},{x:de+Oe,y:be-le},{width:le,height:le},p),a.q.copy(ye,z,{x:0,y:0},{x:de+Oe,y:be+Ee},{width:le,height:le},p),a.q.copy(ye,z,{x:Oe-le,y:0},{x:de-le,y:be+Ee},{width:le,height:le},p)}this.dirty=!0}beginFrame(){for(const d of this.images.keys())this.callbackDispatchedThisFrame.set(d,new Set)}dispatchRenderCallbacks(d,p){const b=this.images.get(p);for(const M of d){if(this.callbackDispatchedThisFrame.get(p).has(M.toString()))continue;this.callbackDispatchedThisFrame.get(p).add(M.toString());const L=b.get(M.toString());et(L)&&this.updateImage(M,p,L)}}destroy(){this.imageRasterizerDispatcher&&this.imageRasterizerDispatcher.remove()}}function Ke(_){const d=_.value,p=_.valueSpec,b=_.style,M=_.styleSpec,L=_.key,O=_.arrayElementValidator||Ds;if(!Array.isArray(d))return[new a.V(L,d,`array expected, ${a.K(d)} found`)];if(p.length&&d.length!==p.length)return[new a.V(L,d,`array length ${p.length} expected, length ${d.length} found`)];if(p["min-length"]&&d.lengthM)return[new a.V(d,p,`${p} is greater than the maximum value ${M}`)]}return[]}function ft(_){const d=_.key,p=_.value;if(!a.H(p))return[new a.V(d,p,`object expected, ${a.K(p)} found`)];const b=_.valueSpec,M=a.J(p.type);let L,O,z,V={};const Y=M!=="categorical"&&p.property===void 0,Q=!Y,ce=function(ye){const Oe=ye.stops;return Array.isArray(Oe)&&Array.isArray(Oe[0])&&a.H(Oe[0][0])}(p),le=Ki({key:_.key,value:_.value,valueSpec:_.styleSpec.function,style:_.style,styleSpec:_.styleSpec,objectElementValidators:{stops:function(ye){if(M==="identity")return[new a.V(ye.key,ye.value,'identity function may not have a "stops" property')];let Oe=[];const Ee=ye.value;return Oe=Oe.concat(Ke({key:ye.key,value:Ee,valueSpec:ye.valueSpec,style:ye.style,styleSpec:ye.styleSpec,arrayElementValidator:de})),Array.isArray(Ee)&&Ee.length===0&&Oe.push(new a.V(ye.key,Ee,"array must have at least one stop")),Oe},default:function(ye){return Ds({key:ye.key,value:ye.value,valueSpec:b,style:ye.style,styleSpec:ye.styleSpec})}}});return M==="identity"&&Y&&le.push(new a.V(_.key,_.value,'missing required property "property"')),M==="identity"||p.stops||le.push(new a.V(_.key,_.value,'missing required property "stops"')),M==="exponential"&&b.expression&&!a.M(b)&&le.push(new a.V(_.key,_.value,"exponential functions not supported")),_.styleSpec.$version>=8&&(Q&&!a.N(b)?le.push(new a.V(_.key,_.value,"property functions not supported")):Y&&!a.O(b)&&le.push(new a.V(_.key,_.value,"zoom functions not supported"))),M!=="categorical"&&!ce||p.property!==void 0||le.push(new a.V(_.key,_.value,'"property" property is required')),le;function de(ye){let Oe=[];const Ee=ye.value,qe=ye.key;if(!Array.isArray(Ee))return[new a.V(qe,Ee,`array expected, ${a.K(Ee)} found`)];if(Ee.length!==2)return[new a.V(qe,Ee,`array length 2 expected, length ${Ee.length} found`)];if(ce){if(!a.H(Ee[0]))return[new a.V(qe,Ee,`object expected, ${a.K(Ee[0])} found`)];const Ze=Ee[0];if(Ze.zoom===void 0)return[new a.V(qe,Ee,"object stop key must have zoom")];if(Ze.value===void 0)return[new a.V(qe,Ee,"object stop key must have value")];const Ve=a.J(Ze.zoom);if(typeof Ve!="number")return[new a.V(qe,Ze.zoom,"stop zoom values must be numbers")];if(z&&z>Ve)return[new a.V(qe,Ze.zoom,"stop zoom values must appear in ascending order")];Ve!==z&&(z=Ve,O=void 0,V={}),Oe=Oe.concat(Ki({key:`${qe}[0]`,value:Ee[0],valueSpec:{zoom:{}},style:ye.style,styleSpec:ye.styleSpec,objectElementValidators:{zoom:Le,value:be}}))}else Oe=Oe.concat(be({key:`${qe}[0]`,value:Ee[0],style:ye.style,styleSpec:ye.styleSpec},Ee));return a.Q(a.S(Ee[1]))?Oe.concat([new a.V(`${qe}[1]`,Ee[1],"expressions are not allowed in function stops.")]):Oe.concat(Ds({key:`${qe}[1]`,value:Ee[1],valueSpec:b,style:ye.style,styleSpec:ye.styleSpec}))}function be(ye,Oe){const Ee=a.K(ye.value),qe=a.J(ye.value),Ze=ye.value!==null?ye.value:Oe;if(L){if(Ee!==L)return[new a.V(ye.key,Ze,`${Ee} stop domain type must match previous stop domain type ${L}`)]}else L=Ee;if(Ee!=="number"&&Ee!=="string"&&Ee!=="boolean"&&typeof qe!="number"&&typeof qe!="string"&&typeof qe!="boolean")return[new a.V(ye.key,Ze,"stop domain value must be a number, string, or boolean")];if(Ee!=="number"&&M!=="categorical"){let Ve=`number expected, ${Ee} found`;return a.N(b)&&M===void 0&&(Ve+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new a.V(ye.key,Ze,Ve)]}return M!=="categorical"||Ee!=="number"||typeof qe=="number"&&isFinite(qe)&&Math.floor(qe)===qe?M!=="categorical"&&Ee==="number"&&typeof qe=="number"&&typeof O=="number"&&O!==void 0&&qenew a.V(`${_.key}${b.key}`,_.value,b.message));const p=d.value.expression||d.value._styleExpression.expression;if(_.expressionContext==="property"&&_.propertyKey==="text-font"&&!p.outputDefined())return[new a.V(_.key,_.value,`Invalid data expression for "${_.propertyKey}". Output values must be contained as literals within the expression.`)];if(_.expressionContext==="property"&&_.propertyType==="layout"&&!a.Z(p))return[new a.V(_.key,_.value,'"feature-state" data expressions are not supported with layout properties.')];if(_.expressionContext==="filter")return Mt(p,_);if(_.expressionContext==="appearance")return It(p,_);if(_.expressionContext&&_.expressionContext.indexOf("cluster")===0){if(!a.X(p,["zoom","feature-state"]))return[new a.V(_.key,_.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(_.expressionContext==="cluster-initial"&&!a.Y(p))return[new a.V(_.key,_.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Mt(_,d){const p=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(d.valueSpec&&d.valueSpec.expression)for(const M of d.valueSpec.expression.parameters)p.delete(M);if(p.size===0)return[];const b=[];return _ instanceof a._&&p.has(_.name)?[new a.V(d.key,d.value,`["${_.name}"] expression is not supported in a filter for a ${d.object.type} layer with id: ${d.object.id}`)]:(_.eachChild(M=>{b.push(...Mt(M,d))}),b)}function It(_,d){const p=new Set;if(d.valueSpec&&d.valueSpec.expression)for(const M of d.valueSpec.expression.parameters)p.add(M);if(p.size===0)return[];const b=[];return _ instanceof a._&&!p.has(_.name)?[new a.V(d.key,d.value,`["${_.name}"] is not an allowed parameter`)]:(_.eachChild(M=>{b.push(...It(M,d))}),b)}function tr(_){const d=_.key,p=_.value,b=_.valueSpec,M=[];return Array.isArray(b.values)?b.values.indexOf(a.J(p))===-1&&M.push(new a.V(d,p,`expected one of [${b.values.join(", ")}], ${JSON.stringify(p)} found`)):Object.keys(b.values).indexOf(a.J(p))===-1&&M.push(new a.V(d,p,`expected one of [${Object.keys(b.values).join(", ")}], ${JSON.stringify(p)} found`)),M}function Mr(_){return a.a2(a.S(_.value))?Nt(Object.assign({},_,{expressionContext:"filter",valueSpec:_.styleSpec[`filter_${_.layerType||"fill"}`]})):pn(_)}function pn(_){const d=_.value,p=_.key;if(!Array.isArray(d))return[new a.V(p,d,`array expected, ${a.K(d)} found`)];if(d.length<1)return[new a.V(p,d,"filter array must have at least 1 element")];const b=_.styleSpec;let M=tr({key:`${p}[0]`,value:d[0],valueSpec:b.filter_operator});const L=()=>{d.length>=2&&(a.a0(d[1])||M.push(new a.V(`${p}[1]`,d[1],`string expected, ${a.K(d[1])} found`)));for(let O=2;O":case">=":d.length>=2&&a.J(d[1])==="$type"&&M.push(new a.V(p,d,`"$type" cannot be use with operator "${d[0]}"`)),d.length!==3&&M.push(new a.V(p,d,`filter array for operator "${d[0]}" must have 3 elements`)),L();break;case"==":case"!=":d.length!==3&&M.push(new a.V(p,d,`filter array for operator "${d[0]}" must have 3 elements`)),L();break;case"in":case"!in":L();break;case"any":case"all":case"none":for(let O=1;O{Y in p&&d.push(new a.V(b,p[Y],`"${Y}" is prohibited for ref layers`))}),M.layers.forEach(Y=>{a.J(Y.id)===z&&(V=Y)}),V?V.ref?d.push(new a.V(b,p.ref,"ref cannot reference another ref layer")):O=a.J(V.type):typeof z=="string"&&d.push(new a.V(b,p.ref,`ref layer "${z}" not found`))}else if(O!=="background"&&O!=="sky"&&O!=="slot")if(p.source)if(a.a0(p.source)){const V=M.sources&&M.sources[p.source],Y=V&&a.J(V.type);V?Y==="vector"&&O==="raster"?d.push(new a.V(b,p.source,`layer "${p.id}" requires a raster source`)):Y==="raster"&&O!=="raster"?d.push(new a.V(b,p.source,`layer "${p.id}" requires a vector source`)):Y!=="vector"||p["source-layer"]?Y==="raster-dem"&&O!=="hillshade"?d.push(new a.V(b,p.source,"raster-dem source can only be used with layer type 'hillshade'.")):Y!=="raster-array"||["raster","raster-particle"].includes(O)?O==="line"&&p.paint&&(p.paint["line-gradient"]||p.paint["line-trim-offset"])&&Y==="geojson"&&!V.lineMetrics?d.push(new a.V(b,p,`layer "${p.id}" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):O==="raster-particle"&&Y!=="raster-array"&&d.push(new a.V(b,p.source,`layer "${p.id}" requires a 'raster-array' source.`)):d.push(new a.V(b,p.source,"raster-array source can only be used with layer type 'raster'.")):d.push(new a.V(b,p,`layer "${p.id}" must specify a "source-layer"`)):d.push(new a.V(b,p.source,`source "${p.source}" not found`))}else d.push(new a.V(`${b}.source`,p.source,'"source" must be a string'));else d.push(new a.V(b,p,'missing required property "source"'));return d=d.concat(Ki({key:b,value:p,valueSpec:L.layer,style:_.style,styleSpec:_.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Ds({key:`${b}.type`,value:p.type,valueSpec:L.layer.type,style:_.style,styleSpec:_.styleSpec,object:p,objectKey:"type"}),filter:V=>Mr(Object.assign({layerType:O},V)),layout:V=>Ki({layer:p,key:V.key,value:V.value,valueSpec:{},style:V.style,styleSpec:V.styleSpec,objectElementValidators:{"*":Y=>js(Object.assign({layerType:O},Y))}}),paint:V=>Ki({layer:p,key:V.key,value:V.value,valueSpec:{},style:V.style,styleSpec:V.styleSpec,objectElementValidators:{"*":Y=>Qn(Object.assign({layerType:O,layer:p},Y))}}),appearances(V){const Y=Ke({key:V.key,value:V.value,valueSpec:V.valueSpec,style:V.style,styleSpec:V.styleSpec,arrayElementValidator:le=>function(de){const{key:be,layer:ye,layerType:Oe}=de,Ee=a.J(de.value),qe=a.J(Ee.name),Ze=a.J(Ee.condition),Ve=Ki({key:be,value:Ee,valueSpec:de.styleSpec.appearance,style:de.style,styleSpec:de.styleSpec,objectElementValidators:{condition:gt=>function(ct){const ht=[];return ht.push(...Nt({key:ct.key,value:ct.object.condition,valueSpec:a.a6.appearance.condition,expressionContext:"appearance"})),ht}(Object.assign({layer:ye,layerType:Oe},gt)),properties:gt=>function(ct){const ht=[],{styleSpec:ot,layer:st,layerType:vt}=ct,Pt=ot[`paint_${vt}`],Tt=ot[`layout_${vt}`],qt=ct.object[ct.objectKey];for(const Vt in qt){const nr=Vt in Pt?"paint":Vt in Tt?"layout":void 0;if(!nr){ht.push(new a.V(ct.key,Vt,`unknown property "${Vt}" for layer type "${vt}"`));continue}const vr=Object.assign({},ct,{key:`${ct.key}.${Vt}`,object:qt,objectKey:Vt,layer:st,layerType:vt,value:qt[Vt],valueSpec:nr==="paint"?Pt[Vt]:Tt[Vt]});ht.push(...fs(vr,nr))}return ht}(Object.assign({layer:ye,layerType:Oe},gt))}});return qe!=="hidden"&&Ze===void 0&&Ve.push(new a.V(de.key,"name",'Appearance with name different than "hidden" must have a condition')),Ve}(Object.assign({layerType:O,layer:p},le))}),Q=Array.isArray(V.value)?V.value:[],ce=new Set;return Q.forEach((le,de)=>{const be=a.J(le.name);if(be)if(ce.has(be)){const ye=a.J(p.id);Y.push(new a.V(V.key,be,`Duplicated appearance name "${be}" for layer "${ye}"`))}else ce.add(be)}),Y}}})),d}function si({key:_,value:d}){return a.a0(d)?[]:[new a.V(_,d,`string expected, ${a.K(d)} found`)]}const wr={promoteId:function _({key:d,value:p}){if(a.a0(p))return si({key:d,value:p});if(Array.isArray(p)){const M=[],L=a.S(p),O=a.U(L);return O.result==="error"&&O.value.forEach(z=>{M.push(new a.V(`${d}${z.key}`,null,`${z.message}`))}),a.X(O.value.expression,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])||M.push(new a.V(`${d}`,null,"promoteId expression should be only feature dependent")),M}if(!a.H(p))return[new a.V(d,p,`string, expression or object expected, "${a.K(p)}" found`)];const b=[];for(const M in p)b.push(..._({key:`${d}.${M}`,value:p[M]}));return b}};function Ts(_){const d=_.value,p=_.key,b=_.styleSpec,M=_.style;if(!a.H(d))return[new a.V(p,d,`object expected, ${a.K(d)} found`)];if(!("type"in d))return[new a.V(p,d,'"type" is required')];const L=a.J(d.type);let O=[];switch(["vector","raster","raster-dem","raster-array"].includes(L)&&("url"in d||"tiles"in d||O.push(new a.a3(p,d,'Either "url" or "tiles" is required.'))),L){case"vector":case"raster":case"raster-dem":case"raster-array":return O=O.concat(Ki({key:p,value:d,valueSpec:b[`source_${L.replace("-","_")}`],style:_.style,styleSpec:b,objectElementValidators:wr})),O;case"geojson":if(O=Ki({key:p,value:d,valueSpec:b.source_geojson,style:M,styleSpec:b,objectElementValidators:wr}),"cluster"in d&&"clusterProperties"in d){if(!a.H(d.clusterProperties))return[new a.V(`${p}.clusterProperties`,d,`object expected, ${a.K(d)} found`)];for(const z in d.clusterProperties){const V=d.clusterProperties[z];if(!Array.isArray(V))return[new a.V(`${p}.clusterProperties.${z}`,V,"array expected")];const[Y,Q]=V,ce=typeof Y=="string"?[Y,["accumulated"],["get",z]]:Y;O.push(...Nt({key:`${p}.${z}.map`,value:Q,expressionContext:"cluster-map"})),O.push(...Nt({key:`${p}.${z}.reduce`,value:ce,expressionContext:"cluster-reduce"}))}}return O;case"video":return Ki({key:p,value:d,valueSpec:b.source_video,style:M,styleSpec:b});case"image":return Ki({key:p,value:d,valueSpec:b.source_image,style:M,styleSpec:b});case"canvas":return[new a.V(p,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return tr({key:`${p}.type`,value:d.type,valueSpec:{values:ii(b)}})}}function ii(_){return _.source.reduce((d,p)=>{const b=_[p];return b.type.type==="enum"&&(d=d.concat(Object.keys(b.type.values||{}))),d},[])}function mi(_){const d=_.value,p=_.styleSpec,b=p.light,M=_.style;if(d===void 0)return[];if(!a.H(d))return[new a.V("light",d,`object expected, ${a.K(d)} found`)];let L=[];for(const O in d){const z=O.match(/^(.*)-transition$/),V=O.match(/^(.*)-use-theme$/);L=L.concat(V&&b[V[1]]?Ds({key:O,value:d[O],valueSpec:{type:"string"},style:M,styleSpec:p}):z&&b[z[1]]&&b[z[1]].transition?Ds({key:O,value:d[O],valueSpec:p.transition,style:M,styleSpec:p}):b[O]?Ds({key:O,value:d[O],valueSpec:b[O],style:M,styleSpec:p}):[new a.V(O,d[O],`unknown property "${O}"`)])}return L}function Ta(_){const d=_.value;if(!d)return[];const p=_.key;if(!a.H(d))return[new a.V(p,d,`object expected, ${a.K(d)} found`)];let b=[];const M=_.styleSpec,L=M["light-3d"],O=_.style,z=_.style.lights;for(const Q of["type","id"])if(!(Q in d))return b=b.concat([new a.V(p,d,`missing property "${Q}"`)]),b;if(!a.a0(d.type))return b=b.concat([new a.V(`${p}.type`,d.type,"string expected")]),b;if(z)for(let Q=0;Q<_.arrayIndex;Q++){const ce=a.J(d.type),le=z[Q];a.J(le.type)===ce&&b.push(new a.V(p,d.id,`duplicate light type "${d.type}", previously defined at line ${le.id.__line__}`))}const V=`properties_light_${d.type}`;if(!(V in M))return b=b.concat([new a.V(`${p}.type`,d,`Invalid light type ${d.type}`)]),b;const Y=M[V];for(const Q in d)if(Q==="properties"){const ce=d[Q];if(!a.H(ce))return b=b.concat([new a.V("properties",ce,`object expected, ${a.K(ce)} found`)]),b;for(const le in ce){const de=le.match(/^(.*)-transition$/),be=le.match(/^(.*)-use-theme$/);b=b.concat(be&&Y[be[1]]?Ds({key:Q,value:ce[le],valueSpec:{type:"string"},style:O,styleSpec:M}):de&&Y[de[1]]&&Y[de[1]].transition?Ds({key:Q,value:d[Q],valueSpec:M.transition,style:O,styleSpec:M}):Y[le]?Ds({key:le,value:ce[le],valueSpec:Y[le],style:O,styleSpec:M}):[new a.a3(_.key,ce[le],`unknown property "${le}"`)])}}else b=b.concat(L[Q]?Ds({key:Q,value:d[Q],valueSpec:L[Q],style:O,styleSpec:M}):[new a.a3(Q,d[Q],`unknown property "${Q}"`)]);return b}function ga(_){const d=_.value,p=_.key,b=_.style,M=_.styleSpec,L=M.terrain;if(d==null)return[];if(!a.H(d))return[new a.V("terrain",d,`object expected, ${a.K(d)} found`)];let O=[];for(const z in d){const V=z.match(/^(.*)-transition$/),Y=z.match(/^(.*)-use-theme$/);O=O.concat(Y&&L[Y[1]]?Ds({key:z,value:d[z],valueSpec:{type:"string"},style:b,styleSpec:M}):V&&L[V[1]]&&L[V[1]].transition?Ds({key:z,value:d[z],valueSpec:M.transition,style:b,styleSpec:M}):L[z]?Ds({key:z,value:d[z],valueSpec:L[z],style:b,styleSpec:M}):[new a.a3(z,d[z],`unknown property "${z}"`)])}if(d.source)if(a.a0(d.source)){const z=b.sources&&b.sources[d.source],V=z&&a.J(z.type);z?V!=="raster-dem"&&O.push(new a.V(`${p}.source`,d.source,`terrain cannot be used with a source of type ${V}, it only be used with a "raster-dem" source type`)):O.push(new a.V(`${p}.source`,d.source,`source "${d.source}" not found`))}else O.push(new a.V(`${p}.source`,d.source,"source must be a string"));else O.push(new a.V(p,d,'terrain is missing required property "source"'));return O}function vl(_){const d=_.value,p=_.style,b=_.styleSpec,M=b.fog;if(d===void 0)return[];if(!a.H(d))return[new a.V("fog",d,`object expected, ${a.K(d)} found`)];let L=[];for(const O in d){const z=O.match(/^(.*)-transition$/),V=O.match(/^(.*)-use-theme$/);L=L.concat(V&&M[V[1]]?Ds({key:O,value:d[O],valueSpec:{type:"string"},style:p,styleSpec:b}):z&&M[z[1]]&&M[z[1]].transition?Ds({key:O,value:d[O],valueSpec:b.transition,style:p,styleSpec:b}):M[O]?Ds({key:O,value:d[O],valueSpec:M[O],style:p,styleSpec:b}):[new a.a3(O,d[O],`unknown property "${O}"`)])}return L}const Yo={"*":()=>[],array:Ke,boolean:function(_){const d=_.value,p=_.key;return a.$(d)?[]:[new a.V(p,d,`boolean expected, ${a.K(d)} found`)]},number:Le,color:function({key:_,value:d}){return a.a0(d)?a.a1.parseCSSColor(d)===null?[new a.V(_,d,`color expected, "${d}" found`)]:[]:[new a.V(_,d,`color expected, ${a.K(d)} found`)]},enum:tr,filter:Mr,function:ft,layer:Qs,object:Ki,source:Ts,model:a.a7,light:mi,"light-3d":Ta,terrain:ga,fog:vl,string:si,formatted:function(_){return si(_).length===0?[]:Nt(_)},resolvedImage:function(_){return si(_).length===0?[]:Nt(_)},projection:function(_){const d=_.value,p=_.styleSpec,b=p.projection,M=_.style;if(a.H(d)){let L=[];for(const O in d)L=L.concat(Ds({key:O,value:d[O],valueSpec:b[O],style:M,styleSpec:p}));return L}return a.a0(d)?[]:[new a.V("projection",d,`object or string expected, ${a.K(d)} found`)]},import:function(_){const d=_.key,{value:p,styleSpec:b}=_;if(!a.H(p))return[new a.V(d,p,"import must be an object")];const{data:M,...L}=p;Object.defineProperty(L,"__line__",{value:p.__line__,enumerable:!1});let O=Ki(Object.assign({},_,{value:L,valueSpec:b.import}));return a.J(L.id)===""&&O.push(new a.V(`${_.key}.id`,L,"import id can't be an empty string")),M&&(O=O.concat(yi(M,b,{key:`${_.key}.data`}))),O},iconset:function(_){const d=_.value,p=_.key,b=_.styleSpec,M=_.style;if(!a.H(d))return[new a.V(p,d,"object expected")];if(!d.type)return[new a.V(p,d,'"type" is required')];const L=a.J(d.type);let O=[];if(O=O.concat(Ki({key:p,value:d,valueSpec:b[`iconset_${L}`],style:M,styleSpec:b})),function(z,V){return!(z!=="source"||!V.source)}(L,d)){const z=M.sources&&M.sources[d.source],V=z&&a.J(z.type);z?V!=="raster-array"&&O.push(new a.V(p,d.source,`iconset cannot be used with a source of type ${String(V)}, it only be used with a "raster-array" source type`)):O.push(new a.V(p,d.source,`source "${d.source}" not found`))}return O}};function Ds(_,d=!1){const p=_.value,b=_.valueSpec,M=_.styleSpec;if(b.expression){if(a.a4(a.J(p)))return ft(_);if(a.Q(a.S(p)))return Nt(_)}if(b.type&&Yo[b.type]){const L=Yo[b.type](_);return d===!0&&L.length>0&&Array.isArray(_.value)?Nt(_):L}return Ki(Object.assign({},_,{valueSpec:b.type?M[b.type]:b}))}function Ki(_){const d=_.key,p=_.value,b=_.valueSpec||{},M=_.objectElementValidators||{},L=_.style,O=_.styleSpec;if(!a.H(p))return[new a.V(d,p,`object expected, ${a.K(p)} found`)];let z=[];for(const V in p){const Y=V.split(".")[0];let Q;M[Y]?Q=M[Y]:b[Y]?Q=Ds:M["*"]?Q=M["*"]:b["*"]&&(Q=Ds),Q?z=z.concat(Q({key:(d&&`${d}.`)+V,value:p[V],valueSpec:b[Y]||b["*"],style:L,styleSpec:O,object:p,objectKey:V},p)):z.push(new a.a3(d,p[V],`unknown property "${V}"`))}for(const V in b){if(M[V])continue;const Y=b[V];Y.required&&Y.default===void 0&&p[V]===void 0&&z.push(new a.V(d,p,`missing required property "${V}"`))}return z}function _s({key:_,value:d}){const p=si({key:_,value:d});if(p.length)return p;const b=d;return b.indexOf("{fontstack}")===-1&&p.push(new a.V(_,d,'"glyphs" url must include a "{fontstack}" token')),b.indexOf("{range}")===-1&&p.push(new a.V(_,d,'"glyphs" url must include a "{range}" token')),p}function yi(_,d=a.a6,p={}){return Ki({key:p.key||"",value:_,valueSpec:Object.assign(d.$root,{"*":{type:"*"}}),styleSpec:d,style:_,objectElementValidators:{glyphs:_s}})}function Ni(_,d=a.a6){return ze(yi(_,d))}const Oo=_=>ze(Ts(_)),sr=_=>ze(mi(_)),fo=_=>ze(Ta(_)),lc=_=>ze(ga(_)),po=_=>ze(vl(_)),Qr=_=>ze(function(d){const p=d.value,b=d.style,M=d.styleSpec,L=M.snow;if(p===void 0)return[];if(!a.H(p))return[new a.V("snow",p,`object expected, ${a.K(p)} found`)];let O=[];for(const z in p){const V=z.match(/^(.*)-transition$/);O=O.concat(V&&L[V[1]]&&L[V[1]].transition?Ds({key:z,value:p[z],valueSpec:M.transition,style:b,styleSpec:M}):L[z]?Ds({key:z,value:p[z],valueSpec:L[z],style:b,styleSpec:M}):[new a.a3(z,p[z],`unknown property "${z}"`)])}return O}(_)),ba=_=>ze(function(d){const p=d.value,b=d.style,M=d.styleSpec,L=M.rain;if(p===void 0)return[];if(!a.H(p))return[new a.V("rain",p,`object expected, ${a.K(p)} found`)];let O=[];for(const z in p){const V=z.match(/^(.*)-transition$/);O=O.concat(V&&L[V[1]]&&L[V[1]].transition?Ds({key:z,value:p[z],valueSpec:M.transition,style:b,styleSpec:M}):L[z]?Ds({key:z,value:p[z],valueSpec:L[z],style:b,styleSpec:M}):[new a.a3(z,p[z],`unknown property "${z}"`)])}return O}(_)),Ka=_=>ze(Qs(_)),dr=_=>ze(Mr(_)),Ln=_=>ze(Qn(_)),xt=_=>ze(js(_)),_e=_=>ze(a.a7(_));function ze(_){return _.slice().sort((d,p)=>d.line&&p.line?d.line-p.line:0)}function tt(_,d){let p=!1;if(d&&d.length)for(const b of d)b instanceof a.a3?a.w(b.message):(_.fire(new a.y(new Error(b.message))),p=!0);return p}const kt=a.a6.light;let bt;class Et extends a.E{constructor(d,p="flat"){super(),this._transitionable=new a.a8(bt||(bt=new a.a9({anchor:new a.aa(kt.anchor),position:new a.ab(kt.position),color:new a.aa(kt.color),intensity:new a.aa(kt.intensity)}))),this.setLight(d,p),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(d,p,b={}){this._validate(sr,d,b)||(this._transitionable.setTransitionOrValue(d),this.id=p)}updateTransitions(d){this._transitioning=this._transitionable.transitioned(d,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(d){this.properties=this._transitioning.possiblyEvaluate(d)}_validate(d,p,b){return(!b||b.validate!==!1)&&tt(this,d.call(Ni,Object.assign({value:p,style:{glyphs:!0,sprite:!0},styleSpec:a.a6})))}}const $t=a.a6.terrain;let Ot=class extends a.E{constructor(_,d,p,b,M){super(),this.scope=p,this._transitionable=new a.a8(new a.a9({source:new a.aa($t.source),exaggeration:new a.aa($t.exaggeration)}),p,b),this._transitionable.setTransitionOrValue(_,b),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=d,this.worldview=M}get(){return this._transitionable.serialize()}set(_,d){this._transitionable.setTransitionOrValue(_,d)}updateTransitions(_){this._transitioning=this._transitionable.transitioned(_,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(_){this.properties=this._transitioning.possiblyEvaluate(_)}getExaggeration(_){return this._transitioning.possiblyEvaluate(new a.ac(_,{worldview:this.worldview})).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;const _=this._transitionable._values.exaggeration;if(!_)return null;const d=_.value.expression;if(!d)return null;let p=-1,b=-1,M=1;for(const L of d.zoomStops)M=d.evaluate(new a.ac(L,{worldview:this.worldview})),M>.01?(p=L,b=-1):b=L;return M<.01&&p>0&&b>p?[p,b]:null}isZoomDependent(){const _=this._transitionable._values.exaggeration;return _!=null&&_.value!=null&&_.value.expression!=null&&_.value.expression instanceof a.ad}};const Bt=45,mr=65,ir=.05;function Wr(_,d,p,b){const M=a.ah(Bt,mr,p),[L,O]=en(_,b);let z=1-Math.min(1,Math.exp((d-L)/(O-L)*-6));return z*=z*z,z=Math.min(1,1.00747*z),z*M*_.alpha}function en(_,d){const p=.5/Math.tan(.5*d);return[_.range[0]+p,_.range[1]+p]}function Br(_,d,p,b,M){const L=a.af([],[d,p,b],M.mercatorFogMatrix);return Wr(_,a.ag(L),M.pitch,M._fov)}function Zn(_,d,p,b,M,L,O){const z=[[p,b,0],[M,b,0],[M,L,0],[p,L,0]];let V=Number.MAX_VALUE,Y=-Number.MAX_VALUE;for(const Q of z){const ce=a.af([],Q,d),le=a.ag(ce);V=Math.min(V,le),Y=Math.max(Y,le)}return[Wr(_,V,O.pitch,O._fov),Wr(_,Y,O.pitch,O._fov)]}const Wn=a.a6.fog;class Gn extends a.E{constructor(d,p,b,M){super();const L=new a.a9({range:new a.aa(Wn.range),color:new a.aa(Wn.color),"color-use-theme":new a.aa({type:"string","property-type":"data-constant",default:"default"}),"high-color":new a.aa(Wn["high-color"]),"high-color-use-theme":new a.aa({type:"string","property-type":"data-constant",default:"default"}),"space-color":new a.aa(Wn["space-color"]),"space-color-use-theme":new a.aa({type:"string","property-type":"data-constant",default:"default"}),"horizon-blend":new a.aa(Wn["horizon-blend"]),"star-intensity":new a.aa(Wn["star-intensity"]),"vertical-range":new a.aa(Wn["vertical-range"])});this._transitionable=new a.a8(L,b,new Map(M)),this.set(d,M),this._transitioning=this._transitionable.untransitioned(),this._transform=p,this.properties=new a.ai(L),this.scope=b}get state(){const d=this._transform,p=d.projection.name==="globe",b=a.aj(d.zoom),M=this.properties.get("range"),L=[.5,3];return{range:p?[a.ak(L[0],M[0],b),a.ak(L[1],M[1],b)]:M,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(d,p,b={}){if(this._validate(po,d,b))return;const M=Object.assign({},d);for(const L of Object.keys(Wn))M[L]===void 0&&(M[L]=Wn[L].default);this._options=M,this._transitionable.setTransitionOrValue(this._options,p)}getOpacity(d){if(!this._transform.projection.supportsFog)return 0;const p=this.properties&&this.properties.get("color")||1;return(this._transform.projection.name==="globe"?1:a.ah(Bt,mr,d))*p.a}getOpacityAtLatLng(d,p){return this._transform.projection.supportsFog?function(b,M,L){const O=a.ae.fromLngLat(M),z=L.elevation?L.elevation.getAtPointOrZero(O):0;return Br(b,O.x,O.y,z,L)}(this.state,d,p):0}getOpacityForTile(d){if(!this._transform.projection.supportsFog)return[1,1];const p=this._transform.calculateFogTileMatrix(d.toUnwrapped());return Zn(this.state,p,0,0,a.al,a.al,this._transform)}getOpacityForBounds(d,p,b,M,L){return this._transform.projection.supportsFog?Zn(this.state,d,p,b,M,L,this._transform):[1,1]}getFovAdjustedRange(d){return this._transform.projection.supportsFog?en(this.state,d):[0,1]}isVisibleOnFrustum(d){if(!this._transform.projection.supportsFog)return!1;const p=[4,5,6,7];for(const b of p){const M=d.points[b];let L;if(M[2]>=0)L=M;else{const O=d.points[b-4];L=a.am(O,M,O[2]/(O[2]-M[2]))}if(Br(this.state,L[0],L[1],0,this._transform)>=ir)return!0}return!1}updateConfig(d){this._transitionable.setTransitionOrValue(this._options,new Map(d))}updateTransitions(d){this._transitioning=this._transitionable.transitioned(d,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(d){this.properties=this._transitioning.possiblyEvaluate(d)}_validate(d,p,b){return(!b||b.validate!==!1)&&tt(this,d.call(Ni,Object.assign({value:p,style:{glyphs:!0,sprite:!0},styleSpec:a.a6})))}}let Ps,wa,$a,Aa,lo=class extends a.E{constructor(_,d,p,b){super();const M=Ps||(Ps=new a.a9({density:new a.aa(a.a6.snow.density),intensity:new a.aa(a.a6.snow.intensity),color:new a.aa(a.a6.snow.color),opacity:new a.aa(a.a6.snow.opacity),vignette:new a.aa(a.a6.snow.vignette),"vignette-color":new a.aa(a.a6.snow["vignette-color"]),"center-thinning":new a.aa(a.a6.snow["center-thinning"]),direction:new a.aa(a.a6.snow.direction),"flake-size":new a.aa(a.a6.snow["flake-size"])}));this._transitionable=new a.a8(M,p,new Map(b)),this.set(_,b),this._transitioning=this._transitionable.untransitioned(),this.properties=new a.ai(M),this.scope=p}get state(){const _=this.properties.get("opacity"),d=this.properties.get("color"),p=this.properties.get("direction"),b=a.an(p[0]),M=-Math.max(a.an(p[1]),.01),L=[Math.cos(b)*Math.cos(M),Math.sin(b)*Math.cos(M),Math.sin(M)],O=this.properties.get("vignette"),z=this.properties.get("vignette-color");return z.a=O,{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new a.ao(d.r,d.g,d.b,d.a*_),direction:L,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:z}}get(){return this._transitionable.serialize()}set(_,d,p={}){if(this._validate(Qr,_,p))return;const b=Object.assign({},_),M=a.a6.snow;for(const L of Object.keys(M))b[L]===void 0&&(b[L]=M[L].default);this._options=b,this._transitionable.setTransitionOrValue(this._options,d)}updateConfig(_){this._transitionable.setTransitionOrValue(this._options,new Map(_))}updateTransitions(_){this._transitioning=this._transitionable.transitioned(_,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(_){this.properties=this._transitioning.possiblyEvaluate(_)}_validate(_,d,p){return(!p||p.validate!==!1)&&tt(this,_.call(Ni,Object.assign({value:d,style:{glyphs:!0,sprite:!0},styleSpec:a.a6})))}},ya=class extends a.E{constructor(_,d,p,b){super();const M=wa||(wa=new a.a9({density:new a.aa(a.a6.rain.density),intensity:new a.aa(a.a6.rain.intensity),color:new a.aa(a.a6.rain.color),opacity:new a.aa(a.a6.rain.opacity),vignette:new a.aa(a.a6.rain.vignette),"vignette-color":new a.aa(a.a6.rain["vignette-color"]),"center-thinning":new a.aa(a.a6.rain["center-thinning"]),direction:new a.aa(a.a6.rain.direction),"droplet-size":new a.aa(a.a6.rain["droplet-size"]),"distortion-strength":new a.aa(a.a6.rain["distortion-strength"])}));this._transitionable=new a.a8(M,p,new Map(b)),this.set(_,b),this._transitioning=this._transitionable.untransitioned(),this.properties=new a.ai(M),this.scope=p}get state(){const _=this.properties.get("opacity"),d=this.properties.get("color"),p=this.properties.get("direction"),b=a.an(p[0]),M=-Math.max(a.an(p[1]),.01),L=[Math.cos(b)*Math.cos(M),Math.sin(b)*Math.cos(M),Math.sin(M)],O=this.properties.get("vignette-color");return O.a=this.properties.get("vignette"),{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new a.ao(d.r,d.g,d.b,d.a*_),direction:L,centerThinning:this.properties.get("center-thinning"),dropletSize:this.properties.get("droplet-size"),distortionStrength:this.properties.get("distortion-strength"),vignetteColor:O}}get(){return this._transitionable.serialize()}set(_,d,p={}){if(this._validate(ba,_,p))return;const b=Object.assign({},_),M=a.a6.rain;for(const L of Object.keys(M))b[L]===void 0&&(b[L]=M[L].default);this._options=b,this._transitionable.setTransitionOrValue(this._options,d)}updateConfig(_){this._transitionable.setTransitionOrValue(this._options,new Map(_))}updateTransitions(_){this._transitioning=this._transitionable.transitioned(_,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(_){this.properties=this._transitioning.possiblyEvaluate(_)}_validate(_,d,p){return(!p||p.validate!==!1)&&tt(this,_.call(Ni,Object.assign({value:d,style:{glyphs:!0,sprite:!0},styleSpec:a.a6})))}};class zs extends a.E{constructor(d,p,b,M){super(),this.scope=b,this._options=d,this.properties=new a.ai(p),this._transitionable=new a.a8(p,b,new Map(M)),this._transitionable.setTransitionOrValue(d.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(d){this._transitionable.setTransitionOrValue(this._options.properties,new Map(d))}updateTransitions(d){this._transitioning=this._transitionable.transitioned(d,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(d){this.properties=this._transitioning.possiblyEvaluate(d)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(d,p){this._options=d,this._transitionable.setTransitionOrValue(d.properties,p)}shadowsEnabled(){return!!this.properties&&this.properties.get("cast-shadows")===!0}}class ca{constructor(d,p,b){this.screenBounds=d,this.cameraPoint=b.getCameraPoint(),this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=p,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,b)}static createFromScreenPoints(d,p){let b,M;if(d instanceof a.P||typeof d[0]=="number"){const L=a.P.convert(d);b=[L],M=p.isPointAboveHorizon(L)}else{const L=a.P.convert(d[0]),O=a.P.convert(d[1]),z=L.add(O)._div(2);b=[L,O],M=a.aq(L,O).every(V=>p.isPointAboveHorizon(V))&&p.isPointAboveHorizon(z)}return new ca(b,M,p)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(d){return a.aq(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],d)}bufferedCameraGeometry(d){const p=this.screenBounds[0],b=this.screenBounds.length===1?this.screenBounds[0].add(new a.P(1,1)):this.screenBounds[1],M=a.aq(p,b,0,!1);return this.cameraPoint.y>b.y&&(this.cameraPoint.x>p.x&&this.cameraPoint.x=b.x?M[2]=this.cameraPoint:this.cameraPoint.x<=p.x&&(M[3]=this.cameraPoint)),a.ar(M,d)}bufferedCameraGeometryGlobe(d){const p=this.screenBounds[0],b=this.screenBounds.length===1?this.screenBounds[0].add(new a.P(1,1)):this.screenBounds[1],M=a.aq(p,b,d),L=this.cameraPoint.clone();switch(3*((L.y>p.y)+(L.y>b.y))+((L.x>p.x)+(L.x>b.x))){case 0:M[0]=L,M[4]=L.clone();break;case 1:M.splice(1,0,L);break;case 2:M[1]=L;break;case 3:M.splice(4,0,L);break;case 5:M.splice(2,0,L);break;case 6:M[3]=L;break;case 7:M.splice(3,0,L);break;case 8:M[2]=L}return M}containsTile(d,p,b,M=0){const L=Math.max(d.queryPadding,d.evaluateQueryRenderedFeaturePadding())/p._pixelsPerMercatorPixel+1,O=b?this._bufferedCameraMercator(L,p):this._bufferedScreenMercator(L,p);let z=d.tileID.wrap+(O.unwrapped?M:0);const V=O.polygon.map(Oe=>a.as(d.tileTransform,Oe,z));if(!a.at(V,0,0,a.al,a.al))return;z=d.tileID.wrap+(this.screenGeometryMercator.unwrapped?M:0);const Y=this.screenGeometryMercator.polygon.map(Oe=>a.au(d.tileTransform,Oe,z)),Q=Y.map(Oe=>new a.P(Oe[0],Oe[1])),ce=p.getFreeCameraOptions().position||new a.ae(0,0,0),le=a.au(d.tileTransform,ce,z),de=Y.map(Oe=>{const Ee=a.av(Oe,Oe,le);return a.aw(Ee,Ee),new a.ax(le,Ee)}),be=a.ay(d,1,p.zoom)*p._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:Q,tilespaceRays:de,bufferedTilespaceGeometry:V,bufferedTilespaceBounds:(ye=a.az(V),ye.min.x=a.aA(ye.min.x,0,a.al),ye.min.y=a.aA(ye.min.y,0,a.al),ye.max.x=a.aA(ye.max.x,0,a.al),ye.max.y=a.aA(ye.max.y,0,a.al),ye),tile:d,tileID:d.tileID,pixelToTileUnitsFactor:be};var ye}_bufferedScreenMercator(d,p){const b=Da(d);if(this._screenRaycastCache[b])return this._screenRaycastCache[b];{let M;return M=p.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(d),p):{polygon:this.bufferedScreenGeometry(d).map(L=>p.pointCoordinate3D(L)),unwrapped:!0},this._screenRaycastCache[b]=M,M}}_bufferedCameraMercator(d,p){const b=Da(d);if(this._cameraRaycastCache[b])return this._cameraRaycastCache[b];{let M;return M=p.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(d),p):{polygon:this.bufferedCameraGeometry(d).map(L=>p.pointCoordinate3D(L)),unwrapped:!0},this._cameraRaycastCache[b]=M,M}}_projectAndResample(d,p){const b=function(L,O){const z=a.aB([],O.pixelMatrix,O.globeMatrix),V=[0,-a.aD,0,1],Y=[0,a.aD,0,1],Q=[0,0,0,1];a.aC(V,V,z),a.aC(Y,Y,z),a.aC(Q,Q,z);const ce=new a.P(V[0]/V[3],V[1]/V[3]),le=new a.P(Y[0]/Y[3],Y[1]/Y[3]),de=a.aE(L,ce)&&V[3]1?Di(L.slice(0,Oe),O):[],Ze=Oenew a.P(bs(ht.x),ht.y)),Ze=Ze.map(ht=>new a.P(bs(ht.x),ht.y));const Ve=[...qe];Ve.length===0&&Ve.push(Ze[Ze.length-1]);const gt=a.ak(Ve[Ve.length-1].y,(Ze.length===0?qe[0]:Ze[0]).y,Ee);let ct;return ct=de?[new a.P(0,gt),new a.P(0,0),new a.P(1,0),new a.P(1,gt)]:[new a.P(1,gt),new a.P(1,1),new a.P(0,1),new a.P(0,gt)],Ve.push(...ct),Ze.length===0?Ve.push(qe[0]):Ve.push(...Ze),{polygon:Ve.map(ht=>new a.ae(ht.x,ht.y)),unwrapped:!1}}(d,p);if(b)return b;const M=function(L,O){let z=!1,V=-1/0,Y=0;for(let ce=0;ceV&&(V=L[ce].x,Y=ce);for(let ce=0;ce.5&&(de.x{ce.x-=1}),{polygon:L,unwrapped:z}}(Di(d,p).map(L=>new a.P(bs(L.x),L.y)),p);return{polygon:M.polygon.map(L=>new a.ae(L.x,L.y)),unwrapped:M.unwrapped}}}function Di(_,d){return a.aG(_,p=>{const b=d.pointCoordinate3D(p);p.x=b.x,p.y=b.y},1/256)}function bs(_){return _<0?1+_%1:_%1}function Da(_){return 100*_|0}function _l(_,d,p,b,M){const L=function(z,V){if(z)return M(z);if(V){if(_.url&&V.tiles&&_.tiles&&delete _.tiles,V.variants){if(!Array.isArray(V.variants))return M(new Error("variants must be an array"));for(const Q of V.variants){if(Q==null||typeof Q!="object"||Q.constructor!==Object)return M(new Error("variant must be an object"));if(!Array.isArray(Q.capabilities))return M(new Error("capabilities must be an array"));if(Q.capabilities.length===1&&Q.capabilities[0]==="meshopt"){V=Object.assign(V,Q);break}}}const Y=a.aH(Object.assign({},V,_),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","extra_bounds","scheme","tileSize","encoding","vector_layers","raster_layers","worldview_options","worldview_default","worldview"]);Y.tiles=d.canonicalizeTileset(Y,_.url),M(null,Y)}},O=function(z,V,Y){if(!z)return null;if(!V&&!Y)return z;Y=Y||z.worldview_default;const Q=Object.values(z.language||{});if(Q.length===0)return null;const ce=Object.values(z.worldview||{});if(ce.length===0)return null;const le=Q.every(be=>be===V),de=ce.every(be=>be===Y);return le&&de?z:V in(z.language_options||{})||Y in(z.worldview_options||{})?null:z.language_options&&z.worldview_options?z:null}(_.data,p,b);return O?a.o.frame(()=>L(null,O)):_.url?a.m(d.transformRequest(d.normalizeSourceURL(_.url,null,p,b),a.R.Source),L):a.o.frame(()=>{const{data:z,...V}=_;L(null,V)})}function El(_,d){const p=Math.pow(2,d.z),b=Math.floor(a.aF(_.getWest())*p),M=Math.floor(a.aJ(_.getNorth())*p),L=Math.ceil(a.aF(_.getEast())*p),O=Math.ceil(a.aJ(_.getSouth())*p);return d.x>=b&&d.x=M&&d.ythis.maxzoom||d.z{if(this._tileJSONRequest=null,this._loaded=!0,M)p&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${p}`),b&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${b}`),this.fire(new a.y(M));else if(L){if(Object.assign(this,L),this.hasWorldviews=!!L.worldview_options,L.worldview_default&&(this.worldviewDefault=L.worldview_default),L.vector_layers){this.vectorLayers=L.vector_layers,this.vectorLayerIds=[],this.localizableLayerIds=new Set;for(const O of L.vector_layers)this.vectorLayerIds.push(O.id),L.worldview&&L.worldview[O.source]&&this.localizableLayerIds.add(O.id)}this.tileBounds=Nc.fromTileJSON(L),ae(L.tiles,this.map._requestManager._customAccessToken),this.fire(new a.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.z("data",{dataType:"source",sourceDataType:"content"}))}d&&d(M)})}loaded(){return this._loaded}hasTile(d){return!this.tileBounds||this.tileBounds.contains(d.canonical)}onAdd(d){this.map=d,this.load()}reload(){this.cancelTileJSONRequest();const d=a.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(d))}setTiles(d){return this._options.tiles=d,this.reload(),this}setUrl(d){return this.url=d,this._options.url=d,this.reload(),this}onRemove(d){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}loadTile(d,p){const b=d.tileID.canonical.url(this.tiles,this.scheme),M=this.map._requestManager.normalizeTileURL(b),L=this.map._requestManager.transformRequest(M,a.R.Tile),O=this.map.style?this.map.style.getLut(this.scope):null,z=O?{image:O.image.clone()}:null,V={request:L,data:void 0,uid:d.uid,tileID:d.tileID,tileZoom:d.tileZoom,zoom:d.tileID.overscaledZ,maxZoom:this.maxzoom,lut:z,tileSize:this.tileSize*d.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,pixelRatio:a.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:d.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:d.isExtraShadowCaster,tessellationStep:this.map._tessellationStep,scaleFactor:this.map.getScaleFactor(),worldview:this.map.getWorldview()||this.worldviewDefault,indoor:this.map.indoor?this.map.indoor.getIndoorTileOptions(this.id,this.scope):null};if(this.hasWorldviews&&a.h(b)&&(V.localizableLayerIds=this.localizableLayerIds),V.request.collectResourceTiming=this._collectResourceTiming,d.actor&&d.state!=="expired")d.state==="loading"?d.reloadCallback=p:d.request=d.actor.send("reloadTile",V,Y.bind(this));else if(d.actor=this._tileWorkers[M]=this._tileWorkers[M]||this.dispatcher.getActor(),this.dispatcher.ready)d.request=d.actor.send("loadTile",V,Y.bind(this),void 0,!0);else{const Q=a.aL.call({deduped:this._deduped},V,(ce,le)=>{if(ce||!le)Y.call(this,ce);else{const de=a.aM(le.responseHeaders);V.data={rawData:le.rawData.slice(0),expires:de.expires,cacheControl:de.cacheControl},d.actor&&d.actor.send("loadTile",V,Y.bind(this),void 0,!0)}},!0);d.request={cancel:Q}}function Y(Q,ce){return delete d.request,d.aborted?p(null):Q&&Q instanceof a.aN&&Q.status!==404?p(Q):(ce&&ce.resourceTiming&&(d.resourceTiming=ce.resourceTiming),this.map._refreshExpiredTiles&&ce&&d.setExpiryData(ce),d.loadVectorData(ce,this.map.painter),a.aO(this.dispatcher),p(null,ce),void(d.reloadCallback&&(this.loadTile(d,d.reloadCallback),d.reloadCallback=null)))}}abortTile(d){d.request&&(d.request.cancel(),delete d.request),d.actor&&d.actor.send("abortTile",{uid:d.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(d,p){d.actor&&d.actor.send("removeTile",{uid:d.uid,type:this.type,source:this.id,scope:this.scope}),d.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class Xo extends a.E{constructor(d,p,b,M){super(),this.id=d,this.dispatcher=b,this.setEventedParent(M),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=Object.assign({type:"raster"},p),Object.assign(this,a.aH(p,["url","scheme","tileSize"]))}load(d){this._loaded=!1,this.fire(new a.z("dataloading",{dataType:"source"}));const p=this.map.getWorldview();this._tileJSONRequest=_l(this._options,this.map._requestManager,null,p,(b,M)=>{this._tileJSONRequest=null,this._loaded=!0,b?this.fire(new a.y(b)):M&&(Object.assign(this,M),M.raster_layers&&(this.rasterLayers=M.raster_layers,this.rasterLayerIds=this.rasterLayers.map(L=>L.id)),this.tileBounds=Nc.fromTileJSON(M),ae(M.tiles),this.fire(new a.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.z("data",{dataType:"source",sourceDataType:"content"}))),d&&d(b)})}loaded(){return this._loaded}onAdd(d){this.map=d,this.load()}reload(){this.cancelTileJSONRequest();const d=a.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(d))}setTiles(d){return this._options.tiles=d,this.reload(),this}setUrl(d){return this.url=d,this._options.url=d,this.reload(),this}onRemove(d){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}hasTile(d){return!this.tileBounds||this.tileBounds.contains(d.canonical)}loadTile(d,p){const b=a.o.devicePixelRatio>=2,M=this.map._requestManager.normalizeTileURL(d.tileID.canonical.url(this.tiles,this.scheme),b,this.tileSize);d.request=a.n(this.map._requestManager.transformRequest(M,a.R.Tile),(L,O,z)=>{if(delete d.request,d.aborted)return d.state="unloaded",p(null);if(L)return d.state="errored",p(L);if(!O)return p(null);const V=a.aM(z);this.map._refreshExpiredTiles&&d.setExpiryData(V),d.setTexture(O,this.map.painter),d.state="loaded",a.aO(this.dispatcher),p(null)})}abortTile(d,p){d.request&&(d.request.cancel(),delete d.request),p&&p()}unloadTile(d,p){d.texture&&d.texture instanceof a.T?(d.destroy(!1),d.texture&&d.texture instanceof a.T&&this.map.painter.saveTileTexture(d.texture)):d.destroy(),p&&p()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}function hd([_,d],p,b,{scaled:M=!0}={}){const{tileSize:L,buffer:O}=b,{x:z,y:V,z:Y}=p;if(!isFinite(z)||!isFinite(V)||!isFinite(Y))throw new Error("Invalid MRT header");const Q=2**Y,ce=Q*a.aF(_),le=Q*a.aJ(d);return function([de,be],ye,{scaled:Oe=!0}={}){if(!ye)throw new Error("bandView is undefined");const{data:Ee,tileSize:qe,buffer:Ze,offset:Ve,scale:gt,dimension:ct}=ye;if(de<-Ze||de>qe+Ze||be<-Ze||be>qe+Ze)throw new Error(`Point (${de}, ${be}) out of bounds for tileSize=${qe}, buffer=${Ze}`);const ht=(be+Ze)*(qe+2*Ze)+(de+Ze);if(new Uint32Array(Ee.buffer)[ht]===4294967295)return null;let ot=[];ot=Oe?[]:new ye.data.constructor(ct);for(let st=0;st{if(delete d.request,d.aborted)return d.state="unloaded",p(null);if(z)return z.name==="AbortError"?void 0:(d.state="errored",p(z));if(this.map._refreshExpiredTiles&&V){const Q=a.aM(Y);d.setExpiryData(Q)}if(this.partial&&d.state!=="expired")d.state="empty";else if(!this.partial){if(!V)return p(null);d.state="loaded",d._isHeaderLoaded=!0,d._mrt=V}p(null)};d.request=this.partial?d.fetchHeader(void 0,O.bind(this)):d.actor.send("loadTile",L,O.bind(this),void 0,!0)}abortTile(d){d.request&&(d.request.cancel(),delete d.request),d.actor&&d.actor.send("abortTile",{uid:d.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(d,p){const b=d.texturePerLayer;if(d.flushAllQueues(),b.size){d.destroy(!1);for(const M of b.values())this.map.painter.saveTileTexture(M)}else d.destroy()}prepareTile(d,p,b,M){d._isHeaderLoaded&&(d.state!=="empty"&&(d.state="reloading"),d.fetchBandForRender(p,b,M,(L,O)=>{if(L)return d.state="errored",this.fire(new a.y(L)),void this.triggerRepaint(d);O&&(d._isHeaderLoaded=!0,d.setTexturePerLayer(b,O,this.map.painter),d.state="loaded",this.triggerRepaint(d))}))}getInitialBand(d){if(!this.rasterLayers)return 0;const p=this.rasterLayers.find(({id:L})=>L===d),b=p&&p.fields,M=b&&b.bands&&b.bands;return M?M[0]:0}getTextureDescriptor(d,p,b){if(!d)return;const M=p.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!M)return;let L=null;p instanceof a.aR?L=p.paint.get("raster-array-band"):p instanceof a.aS&&(L=p.paint.get("raster-particle-array-band"));const O=L||this.getInitialBand(M);if(O==null)return;if(!d.textureDescriptorPerLayer.get(p.id))return void this.prepareTile(d,M,p.id,O);if(d.updateNeeded(p.id,O)&&!b)return;const z=d.textureDescriptorPerLayer.get(p.id);return Object.assign({},z,{texture:d.texturePerLayer.get(p.id)})}getImages(d,p){const b=new Map;for(const M of d)for(const L of p){const[O,z]=L.split("/"),V=M.getLayer(O);if(!V||!V.hasBand(z)||!V.hasDataForBand(z))continue;const{bytes:Y,tileSize:Q,buffer:ce}=V.getBandView(z),le=Q+2*ce,de={data:new a.q({width:le,height:le},Y),pixelRatio:2,sdf:!1,usvg:!1,version:0};b.set(L,de)}return b}queryRasterArrayValueByBandId(d,p,b){const M=p._mrt;return new Promise(L=>{const O={},z=new Set;for(const[V,Y]of Object.entries(M.layers)){if(b.layerName&&V!==b.layerName)continue;const Q={};O[V]=Q;for(const{bands:ce}of Y.dataIndex)for(const le of ce)b.bands&&!b.bands.includes(le)||(z.add(a.B(V,le)),p.fetchBand(V,null,le,de=>{a.o.frame(()=>{Q[le]=de?null:hd([d.lng,d.lat],M,Y.getBandView(le)),z.delete(a.B(V,le)),z.size===0&&L(O)})},!1))}z.size===0&&L(O)})}_loadTileForQuery(d,p){if(this._loadTileLoaded[d.uid])return void p(null,d._mrt);if(this._loadTilePending[d.uid])return void this._loadTilePending[d.uid].push(p);this._loadTilePending[d.uid]=[p];const b=this.map._requestManager.normalizeTileURL(d.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),M=this.map._requestManager.transformRequest(b,a.R.Tile);d.actor.send("loadTile",{request:M,uid:d.uid,tileID:d.tileID,type:this.type,source:this.id,scope:this.scope,partial:!1},(L,O,z)=>{if(L)return this._loadTilePending[d.uid].forEach(V=>V(L,null)),void delete this._loadTilePending[d.uid];if(!O)return this._loadTilePending[d.uid].forEach(V=>V(null,null)),void delete this._loadTilePending[d.uid];if(this.map._refreshExpiredTiles&&O){const V=a.aM(z);d.setExpiryData(V)}d._mrt=O,d._isHeaderLoaded=!0,d.state="loaded",this._loadTilePending[d.uid].forEach(V=>V(null,O)),this._loadTileLoaded[d.uid]=!0,delete this._loadTilePending[d.uid]},void 0,!0)}queryRasterArrayValueByAllBands(d,p,b){return new Promise((M,L)=>{this._loadTileForQuery(p,(O,z)=>{O?L(O):M(z?this.queryRasterArrayValueByBandId(d,p,b):null)})})}queryRasterArrayValue(d,p){const b=a.aT.convert(d),M=this.findLoadedParent(b);return M&&M._mrt?p.bands||!this.partial?this.queryRasterArrayValueByBandId(b,M,p):this.queryRasterArrayValueByAllBands(b,M,p):Promise.resolve(null)}findLoadedParent(d){const p=a.ae.fromLngLat(d,this.map.transform.tileSize),b=this.maxzoom+1,M=1<0&&(z[new a.aQ(_.overscaledZ,M,d.z,b,d.y-1).key]={backfilled:!1},z[new a.aQ(_.overscaledZ,_.wrap,d.z,d.x,d.y-1).key]={backfilled:!1},z[new a.aQ(_.overscaledZ,O,d.z,L,d.y-1).key]={backfilled:!1}),d.y+1{if(this._loaded=!0,this._pendingLoad=null,b)this.fire(new a.y(b));else{const L={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&M&&M.resourceTiming&&M.resourceTiming[this.id]&&(L.resourceTiming=M.resourceTiming[this.id]),_&&(this._partialReload=!0),this.fire(new a.z("data",L)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(_),this._coalesce=!1)})}loaded(){return this._loaded}reload(){const _=a.B(this.id,this.scope);this.map.style.clearSource(_),this._updateWorkerData()}loadTile(_,d){const p=_.actor?"reloadTile":"loadTile";_.actor=this.actor;const b=this.map.style?this.map.style.getLut(this.scope):null,M=b?{image:b.image.clone()}:null,L=this._partialReload,O={type:this.type,uid:_.uid,tileID:_.tileID,tileZoom:_.tileZoom,zoom:_.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:M,scope:this.scope,pixelRatio:a.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:_.isExtraShadowCaster,scaleFactor:this.map.getScaleFactor(),partial:L,worldview:this.map.getWorldview(),indoor:this.map.indoor?this.map.indoor.getIndoorTileOptions(this.id,this.scope):null};_.request=this.actor.send(p,O,(z,V)=>L&&!V?(_.state="loaded",d(null)):(delete _.request,_.destroy(!1),_.aborted?d(null):z?d(z):(_.loadVectorData(V,this.map.painter,p==="reloadTile"),d(null))),void 0,p==="loadTile")}abortTile(_){_.request&&(_.request.cancel(),delete _.request),_.aborted=!0}unloadTile(_,d){this.actor.send("removeTile",{uid:_.uid,type:this.type,source:this.id,scope:this.scope}),_.destroy()}onRemove(_){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return Object.assign({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends a.aU{constructor(_,d,p,b){super(_,d,p,b),this.roundZoom=!0,this.type="video",this.options=d}load(){this._loaded=!1;const _=this.options;this.urls=[];for(const d of _.urls)this.urls.push(this.map._requestManager.transformRequest(d,a.R.Source).url);a.aV(this.urls,(d,p)=>{this._loaded=!0,d?this.fire(new a.y(d)):p&&(this.video=p,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(_){if(this.video){const d=this.video.seekable;_d.end(0)?this.fire(new a.y(new a.V(`sources.${this.id}`,null,`Playback for this video can be set only between the ${d.start(0)} and ${d.end(0)}-second mark.`))):this.video.currentTime=_}}getVideo(){return this.video}onAdd(_){this.map||(this.map=_,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const _=this.map.painter.context,d=_.gl;this.texture?this.video.paused||(this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE),d.texSubImage2D(d.TEXTURE_2D,0,0,0,d.RGBA,d.UNSIGNED_BYTE,this.video)):(this.texture=new a.T(_,this.video,d.RGBA8),this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(_)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:a.aU,model:a.aX,"batched-model":class extends a.E{constructor(_,d,p,b){super(),this.type="batched-model",this.id=_,this.tileSize=512,this._options=d,this.tiles=this._options.tiles,this.maxzoom=d.maxzoom||19,this.minzoom=d.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=p,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(b)}onAdd(_){this.map=_,this.load()}reload(){this.cancelTileJSONRequest();const _=a.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(_))}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}load(_){this._loaded=!1,this.fire(new a.z("dataloading",{dataType:"source"}));const d=Array.isArray(this.map._language)?this.map._language.join():this.map._language,p=this.map.getWorldview();this._tileJSONRequest=_l(this._options,this.map._requestManager,d,p,(b,M)=>{this._tileJSONRequest=null,this._loaded=!0,b?(d&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${d}`),p&&p.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${p}`),this.fire(new a.y(b))):M&&(Object.assign(this,M),M.bounds&&(this.tileBounds=new Nc(M.bounds,this.minzoom,this.maxzoom)),ae(M.tiles,this.map._requestManager._customAccessToken),this.fire(new a.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.z("data",{dataType:"source",sourceDataType:"content"}))),_&&_(b)})}hasTransition(){return!1}hasTile(_){return!this.tileBounds||this.tileBounds.contains(_.canonical)}loaded(){return this._loaded}loadTile(_,d){const p=this.map._requestManager.normalizeTileURL(_.tileID.canonical.url(this.tiles,this.scheme)),b={request:this.map._requestManager.transformRequest(p,a.R.Tile),data:void 0,uid:_.uid,tileID:_.tileID,tileZoom:_.tileZoom,zoom:_.tileID.overscaledZ,tileSize:this.tileSize*_.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:_.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,pixelRatio:a.o.devicePixelRatio,promoteId:this.promoteId};if(_.actor&&_.state!=="expired")if(_.state==="loading")_.reloadCallback=d;else{if(_.buckets){const L=Object.values(_.buckets);for(const O of L)O.dirty=!0;return void(_.state="loaded")}_.request=_.actor.send("reloadTile",b,M.bind(this))}else _.actor=this.dispatcher.getActor(),_.request=_.actor.send("loadTile",b,M.bind(this),void 0,!0);function M(L,O){return _.aborted?d(null):L&&L.status!==404?d(L):(this.map._refreshExpiredTiles&&O&&_.setExpiryData(O),_.loadModelData(O,this.map.painter),_.state="loaded",void d(null))}}serialize(){return Object.assign({},this._options)}},canvas:class extends a.aU{constructor(_,d,p,b){super(_,d,p,b),d.coordinates?Array.isArray(d.coordinates)&&d.coordinates.length===4&&!d.coordinates.some(M=>!Array.isArray(M)||M.length!==2||M.some(L=>typeof L!="number"))||this.fire(new a.y(new a.V(`sources.${_}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new a.y(new a.V(`sources.${_}`,null,'missing required property "coordinates"'))),d.animate&&typeof d.animate!="boolean"&&this.fire(new a.y(new a.V(`sources.${_}`,null,'optional "animate" property must be a boolean value'))),d.canvas?typeof d.canvas=="string"||d.canvas instanceof HTMLCanvasElement||this.fire(new a.y(new a.V(`sources.${_}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new a.y(new a.V(`sources.${_}`,null,'missing required property "canvas"'))),this.options=d,this.animate=d.animate===void 0||d.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new a.y(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(_){this.map=_,this.load(),this.canvas&&this.animate&&this.play()}onRemove(_){this.pause()}prepare(){let _=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,_=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,_=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const d=this.map.painter.context;this.texture?!_&&!this._playing||this.texture instanceof a.aW||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new a.T(d,this.canvas,d.gl.RGBA8,{premultiply:!0}),this._prepareData(d)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const _ of[this.canvas.width,this.canvas.height])if(isNaN(_)||_<=0)return!0;return!1}},custom:class extends a.E{constructor(_,d,p,b){super(),this.id=_,this.type="custom",this._dataType="raster",this._dispatcher=p,this._implementation=d,this.setEventedParent(b),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new a.y(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new a.y(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new Nc(this._implementation.bounds,this.minzoom,this.maxzoom)),d.update=this._update.bind(this),d.clearTiles=this._clearTiles.bind(this),d.coveringTiles=this._coveringTiles.bind(this),Object.assign(this,a.aH(d,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return a.aH(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new a.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.z("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(_){this.map=_,this._loaded=!1,this.fire(new a.z("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(_),this.load()}onRemove(_){this._implementation.onRemove&&this._implementation.onRemove(_)}hasTile(_){if(this._implementation.hasTile){const{x:d,y:p,z:b}=_.canonical;return this._implementation.hasTile({x:d,y:p,z:b})}return!this.tileBounds||this.tileBounds.contains(_.canonical)}loadTile(_,d){const{x:p,y:b,z:M}=_.tileID.canonical,L=new AbortController;_.request=Promise.resolve(this._implementation.loadTile({x:p,y:b,z:M},{signal:L.signal})).then((function(O){return delete _.request,_.aborted?(_.state="unloaded",d(null)):O===void 0?(_.state="errored",d(null)):O===null?(this.loadTileData(_,{width:this.tileSize,height:this.tileSize,data:null}),_.state="loaded",d(null)):function(z){return z instanceof ImageData||z instanceof HTMLCanvasElement||z instanceof ImageBitmap||z instanceof HTMLImageElement}(O)?(this.loadTileData(_,O),_.state="loaded",void d(null)):(_.state="errored",d(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}).bind(this)).catch(O=>{O.name!=="AbortError"&&(_.state="errored",d(O))}),_.request.cancel=()=>L.abort()}loadTileData(_,d){_.setTexture(d,this.map.painter)}unloadTile(_,d){if(_.texture&&_.texture instanceof a.T?(_.destroy(!1),_.texture&&_.texture instanceof a.T&&this.map.painter.saveTileTexture(_.texture)):_.destroy(),this._implementation.unloadTile){const{x:p,y:b,z:M}=_.tileID.canonical;this._implementation.unloadTile({x:p,y:b,z:M})}d&&d()}abortTile(_,d){_.request&&_.request.cancel&&(_.request.cancel(),delete _.request),d&&d()}hasTransition(){return!1}_coveringTiles(){return this.map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map(_=>({x:_.canonical.x,y:_.canonical.y,z:_.canonical.z}))}_clearTiles(){const _=a.B(this.id,this.scope);this.map.style.clearSource(_)}_update(){this.fire(new a.z("data",{dataType:"source",sourceDataType:"content"}))}}},Do=function(_,d,p,b){const M=new eu[d.type](_,d,p,b);if(M.id!==_)throw new Error(`Expected Source id to be ${_} instead of ${M.id}`);return a.aY(["load","abort","unload","serialize","prepare"],M),M};function ef(_,d,p=""){return`${p}:${d.id||""}:${d.layer.id}:${function(b){if("layerId"in b)return`layer:${b.layerId}`;{const{featuresetId:M,importId:L}=b;return`featureset:${M}${L?`:import:${L}`:""}`}}(_.target)}`}function Du(_,d,p,b=""){if(_.uniqueFeatureID){const M=ef(_,d,b);if(p.has(M))return!0;p.add(M)}return!1}function Yl(_,d,p,b,M=!1){const L=d.sourceCache.transform,O=d.sourceCache.tilesIn(_,d.has3DLayers,M);O.sort($c);const z=[];for(const V of O){const Y=V.tile.queryRenderedFeatures(d,V,p,b,L,M);Object.keys(Y).length&&z.push({wrappedTileID:V.tile.tileID.wrapped().key,queryResults:Y})}for(const V in d.layers){const Y=d.layers[V];if(Y.styleLayer){const Q=Y.styleLayer.queryRenderedFeatures(_,d.sourceCache,b);Object.keys(Q).length&&z.push({wrappedTileID:0,queryResults:Q})}}return z.length===0?{}:function(V){const Y={},Q={};for(const ce of V){const le=ce.queryResults,de=ce.wrappedTileID,be=Q[de]=Q[de]||{};for(const ye in le){const Oe=le[ye],Ee=be[ye]=be[ye]||{},qe=Y[ye]=Y[ye]||[];for(const Ze of Oe)Ee[Ze.featureIndex]||(Ee[Ze.featureIndex]=!0,qe.push(Ze))}}return Y}(z)}function tp(_,d,p,b,M,L){const O={},z=b.queryRenderedSymbols(_),V=[];for(const Y of Object.keys(z).map(Number))V.push(M[Y]);V.sort($c);for(const Y of V){const Q=Y.featureIndex.lookupSymbolFeatures(z[Y.bucketInstanceId],Y.bucketIndex,Y.sourceLayerIndex,d,p,L);for(const ce in Q){const le=O[ce]=O[ce]||[],de=Q[ce];de.sort((be,ye)=>{const Oe=Y.featureSortOrder;if(Oe){const Ee=Oe.indexOf(be.featureIndex);return Oe.indexOf(ye.featureIndex)-Ee}return ye.featureIndex-be.featureIndex});for(const be of de)le.push(be)}}return O}function xm(_,d){const p=_.getRenderableIds().map(L=>_.getTileByID(L)),b=[],M={};for(let L=0;Ld.getLayer(L)).filter(Boolean);if(M.length!==0){b.layers=M,b.stateDependentLayerIds&&(b.stateDependentLayers=b.stateDependentLayerIds.map(L=>M.filter(O=>O.id===L)[0]));for(const L of M)p[L.fqid]=b}}return p}const Sc=32,Uc=33,fd=new Uint16Array(8184);for(let _=0;_<2046;_++){let d=_+2,p=0,b=0,M=0,L=0,O=0,z=0;for(1&d?M=L=O=Sc:p=b=z=Sc;(d>>=1)>1;){const Y=p+M>>1,Q=b+L>>1;1&d?(M=p,L=b,p=O,b=z):(p=M,b=L,M=O,L=z),O=Y,z=Q}const V=4*_;fd[V+0]=p,fd[V+1]=b,fd[V+2]=M,fd[V+3]=L}const Pd=new Uint16Array(2178),tu=new Uint8Array(1089),Fu=new Uint16Array(1089);function rp(_){return _===0?-.03125:_===32?.03125:0}const nx={type:2,extent:a.al,loadGeometry:()=>[[new a.P(0,0),new a.P(a.al+1,0),new a.P(a.al+1,a.al+1),new a.P(0,a.al+1),new a.P(0,0)]]};class np{constructor(d,p,b,M,L,O){this.tileID=d,this.uid=a.b2(),this.uses=0,this.tileSize=p,this.tileZoom=b,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=L,M&&M.style&&(this._lastUpdatedBrightness=M.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",M&&M.transform&&(this.projection=M.transform.projection),this.worldview=O,this._hasAppearances=null}registerFadeDuration(d){const p=d+this.timeAdded;pb)M=!1;else if(p)if(this.expirationTimeb.appearances&&b.appearances.length>0))return!0;return!1}updateBuckets(d,p){if(!this.latestFeatureIndex||!d.style)return;const b=d.style.listImages(),M=d.style.getBrightness();for(const L in this.buckets){if(!d.style.hasLayer(L))continue;const O=this.buckets[L],z=O.layers[0],V=z.sourceLayer||"_geojsonTileLayer",Y=d.style.getLayerSourceCache(z);let Q={};Y&&(Q=Y._state.getState(V,void 0));const ce=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},le=Object.keys(Q).length>0&&!p;O.hasAppearances=O.layers.some(ye=>ye.appearances&&ye.appearances.length>0);const de=le?O.stateDependentLayers:O.layers;if(le&&O.stateDependentLayers.length!==0||p){const ye=this.latestFeatureIndex.loadVTLayers();O.update(Q,ye[V],b,ce,de,p,M)}if(le&&O.stateDependentLayers.length!==0||p||O.hasAppearances){const ye={zoom:d.transform.zoom,pitch:d.transform.pitch,brightness:d.style.getBrightness()||0,worldview:d.worldview};O.updateAppearances(this.tileID.canonical,Q,b,ye)}(O instanceof a.ba||O instanceof a.bb)&&d._terrain&&d._terrain.enabled&&Y&&O.uploadPending()&&d._terrain._clearRenderCacheForTile(Y.id,this.tileID);const be=d&&d.style&&d.style.getOwnLayer(L);be&&(this.queryPadding=Math.max(this.queryPadding,be.queryRadius(O)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil=0;Oe--){const Ee=4*Oe,qe=fd[Ee+0],Ze=fd[Ee+1],Ve=fd[Ee+2],gt=fd[Ee+3],ct=qe+Ve>>1,ht=Ze+gt>>1,ot=ct+ht-Ze,st=ht+qe-ct,vt=Ze*Uc+qe,Pt=gt*Uc+Ve,Tt=ht*Uc+ct,qt=Math.hypot((Pd[2*vt+0]+Pd[2*Pt+0])/2-Pd[2*Tt+0],(Pd[2*vt+1]+Pd[2*Pt+1])/2-Pd[2*Tt+1])>=16;tu[Tt]=tu[Tt]||(qt?1:0),Oe<1022&&(tu[Tt]=tu[Tt]||tu[(Ze+st>>1)*Uc+(qe+ot>>1)]||tu[(gt+st>>1)*Uc+(Ve+ot>>1)])}const ce=new a.b1,le=new a.b0;let de=0;function be(Oe,Ee){const qe=Ee*Uc+Oe;return Fu[qe]===0&&(ce.emplaceBack(Pd[2*qe+0],Pd[2*qe+1],Oe*a.al/Sc,Ee*a.al/Sc),Fu[qe]=++de),Fu[qe]-1}function ye(Oe,Ee,qe,Ze,Ve,gt){const ct=Oe+qe>>1,ht=Ee+Ze>>1;if(Math.abs(Oe-Ve)+Math.abs(Ee-gt)>1&&tu[ht*Uc+ct])ye(Ve,gt,Oe,Ee,ct,ht),ye(qe,Ze,Ve,gt,ct,ht);else{const ot=be(Oe,Ee),st=be(qe,Ze),vt=be(Ve,gt);le.emplaceBack(ot,st,vt)}}return ye(0,0,Sc,Sc,Sc,0),ye(Sc,Sc,0,0,0,Sc),{vertices:ce,indices:le}}(this.tileID.canonical,p);M=O.vertices,L=O.indices}else{M=new a.b1,L=new a.b0;for(const{x:z,y:V}of b)M.emplaceBack(z,V,0,0);const O=a.bh(M.int16.subarray(0,4*M.length),void 0,4);for(let z=0;z0&&(V=a.bl(new Float64Array(16),p.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(d,M,p,O,V,z),this._makeGlobeTileDebugTextBuffer(d,M,p,O,V,z)}_globePoint(d,p,b,M,L,O,z){let V=a.bm(d,p,b);if(O){const Y=1<.5?de=-1:le<-.5&&(de=1);let be=(d/a.al+b.x)/Y+de,ye=(p/a.al+b.y)/Y;be=(be-Q)*M._pixelsPerMercatorPixel+Q,ye=(ye-ce)*M._pixelsPerMercatorPixel+ce;const Oe=[be*M.worldSize,ye*M.worldSize,0];a.af(Oe,Oe,O),V=a.bn(V,Oe,z)}return a.af(V,V,L)}_makeGlobeTileDebugBorderBuffer(d,p,b,M,L,O){const z=new a.bd,V=new a.be,Y=new a.bo,Q=(le,de,be,ye,Oe)=>{const Ee=(be-le)/(Oe-1),qe=(ye-de)/(Oe-1),Ze=z.length;for(let Ve=0;Vece*de+be;for(let de=0;de{if(L)p(L);else try{const V=b.getHeaderLength(O);if(V>d)return void(this.request=this.fetchHeader(V,p));b.parseHeader(O),this._isHeaderLoaded=!0;let Y=0;for(const Q of Object.values(b.layers))Y=Math.max(Y,Q.dataIndex[Q.dataIndex.length-1].lastByte);O.byteLength>=Y&&(this.entireBuffer=O),p(null,this.entireBuffer||O,z)}catch(V){p(V)}}),this.request}fetchBandForRender(d,p,b,M){this.fetchBand(d,p,b,L=>{if(L)return void M(L);this.updateTextureDescriptor(d,p,b);const O=this.textureDescriptorPerLayer.get(p);M(null,O?O.img:null)})}fetchBand(d,p,b,M,L=!0){const O=this._mrt;if(!this._isHeaderLoaded||!O)return void M(new Error("Tile header is not ready"));const z=this.actor;if(!z)return void M(new Error("Can't fetch tile band without an actor"));let V;const Y=a.B(String(b),a.B(this.tileID.key,d));let Q=this._taskQueue.get(Y);Q?Q.add(M):(Q=new Set,Q.add(M),this._taskQueue.set(Y,Q));const ce=(ye,Oe)=>{V.complete(ye,Oe),ye?M(ye):(Q.forEach(Ee=>Ee(null,Oe)),this._taskQueue.delete(Y))},le=(ye,Oe)=>{if(ye)return M(ye);const Ee=z.send("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:Oe,task:V},ce,void 0,!0);if(p!==null){const qe=this._workQueuePerLayer.get(p)||[];qe.push(()=>{Ee&&Ee.cancel(),V.cancel()}),this._workQueuePerLayer.has(p)||this._workQueuePerLayer.set(p,qe)}};let de;try{de=O.getLayer(d)}catch(ye){if(this.state==="reloading")return;throw ye}if(!de)return void M(new Error(`Unknown sourceLayer "${d}"`));if(de.hasDataForBand(b))return Q.forEach(ye=>ye(null,null)),void this._taskQueue.delete(Y);const be=de.getDataRange([b]);if(V=O.createDecodingTask(be),!V||V.tasks.length)if(p!==null&&this.flushQueues(p),this.entireBuffer)le(null,this.entireBuffer.slice(be.firstByte,be.lastByte+1));else{const ye=Object.assign({},this.requestParams,{headers:{Range:`bytes=${be.firstByte}-${be.lastByte}`}}),Oe=a.bu(ye,le);if(p!==null){const Ee=this._fetchQueuePerLayer.get(p)||[];Ee.push(()=>{Oe.cancel(),V.cancel()}),this._fetchQueuePerLayer.has(p)||this._fetchQueuePerLayer.set(p,Ee)}}}updateNeeded(d,p){return(!this.textureDescriptorPerLayer.get(d)||this.textureDescriptorPerLayer.get(d).band!==p||this.refreshedUponExpiration)&&this.state!=="errored"}updateTextureDescriptor(d,p,b){if(!this._mrt)return;const M=this._mrt.getLayer(d);if(!M||!M.hasBand(b)||!M.hasDataForBand(b))return;const{bytes:L,tileSize:O,buffer:z,offset:V,scale:Y}=M.getBandView(b),Q=O+2*z,ce=new a.q({width:Q,height:Q},L),le=this.texturePerLayer.get(p);le&&le instanceof a.T&&le.update(ce,{premultiply:!1}),this.textureDescriptorPerLayer.set(p,{layer:d,band:b,img:ce,buffer:z,offset:V,tileSize:O,format:M.pixelFormat,mix:[Y,256*Y,65536*Y,16777216*Y]})}destroy(d=!1){if(super.destroy(d),delete this._mrt,!d)for(const p of this.texturePerLayer.values())p&&p instanceof a.T&&p.destroy();this.texturePerLayer.clear(),this.textureDescriptorPerLayer.clear(),this.fbo&&(this.fbo.destroy(),delete this.fbo),delete this.request,delete this.requestParams,this._isHeaderLoaded=!1}}class Wj{constructor(d,p){this.max=d,this.onRemove=p,this.reset()}reset(){for(const d in this.data)for(const p of this.data[d])p.timeout&&clearTimeout(p.timeout),this.onRemove(p.value);return this.data={},this.order=[],this}add(d,p,b){const M=d.wrapped().key;this.data[M]===void 0&&(this.data[M]=[]);const L={value:p,timeout:void 0};if(b!==void 0&&(L.timeout=setTimeout(()=>{this.remove(d,L)},b)),this.data[M].push(L),this.order.push(M),this.order.length>this.max){const O=this._getAndRemoveByKey(this.order[0]);O&&this.onRemove(O)}return this}has(d){return d.wrapped().key in this.data}getAndRemove(d){return this.has(d)?this._getAndRemoveByKey(d.wrapped().key):null}_getAndRemoveByKey(d){const p=this.data[d].shift();return p.timeout&&clearTimeout(p.timeout),this.data[d].length===0&&delete this.data[d],this.order.splice(this.order.indexOf(d),1),p.value}getByKey(d){const p=this.data[d];return p?p[0].value:null}get(d){return this.has(d)?this.data[d.wrapped().key][0].value:null}remove(d,p){if(!this.has(d))return this;const b=d.wrapped().key,M=p===void 0?0:this.data[b].indexOf(p),L=this.data[b][M];return this.data[b].splice(M,1),L.timeout&&clearTimeout(L.timeout),this.data[b].length===0&&delete this.data[b],this.onRemove(L.value),this.order.splice(this.order.indexOf(b),1),this}setMaxSize(d){for(this.max=d;this.order.length>this.max;){const p=this._getAndRemoveByKey(this.order[0]);p&&this.onRemove(p)}return this}filter(d){const p=[];for(const b in this.data)for(const M of this.data[b])d(M.value)||p.push(M);for(const b of p)this.remove(b.value.tileID,b)}}class Pg{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(d,p,b){const M=String(p);if(this.stateChanges[d]=this.stateChanges[d]||{},this.stateChanges[d][M]=this.stateChanges[d][M]||{},Object.assign(this.stateChanges[d][M],b),this.deletedStates[d]===null){this.deletedStates[d]={};for(const L in this.state[d])L!==M&&(this.deletedStates[d][L]=null)}else if(this.deletedStates[d]&&this.deletedStates[d][M]===null){this.deletedStates[d][M]={};for(const L in this.state[d][M])b[L]||(this.deletedStates[d][M][L]=null)}else for(const L in b)this.deletedStates[d]&&this.deletedStates[d][M]&&this.deletedStates[d][M][L]===null&&delete this.deletedStates[d][M][L]}removeFeatureState(d,p,b){if(this.deletedStates[d]===null)return;const M=String(p);if(this.deletedStates[d]=this.deletedStates[d]||{},b&&p!==void 0)this.deletedStates[d][M]!==null&&(this.deletedStates[d][M]=this.deletedStates[d][M]||{},this.deletedStates[d][M][b]=null);else if(p!==void 0)if(this.stateChanges[d]&&this.stateChanges[d][M])for(b in this.deletedStates[d][M]={},this.stateChanges[d][M])this.deletedStates[d][M][b]=null;else this.deletedStates[d][M]=null;else this.deletedStates[d]=null}getState(d,p){const b=this.state[d]||{},M=this.stateChanges[d]||{},L=this.deletedStates[d];if(L===null)return{};if(p!==void 0){const z=String(p),V=Object.assign({},b[z],M[z]);if(L){const Y=L[p];if(Y===null)return{};for(const Q in Y)delete V[Q]}return V}const O=Object.assign({},b,M);if(L)for(const z in L)delete O[z];return O}initializeTileState(d,p){d.refreshFeatureState(p)}coalesceChanges(d,p){const b={};for(const M in this.stateChanges){this.state[M]=this.state[M]||{};const L={};for(const O in this.stateChanges[M])this.state[M][O]||(this.state[M][O]={}),Object.assign(this.state[M][O],this.stateChanges[M][O]),L[O]=this.state[M][O];b[M]=L}for(const M in this.deletedStates){this.state[M]=this.state[M]||{};const L={};if(this.deletedStates[M]===null)for(const O in this.state[M])L[O]={},this.state[M][O]={};else for(const O in this.deletedStates[M]){if(this.deletedStates[M][O]===null)this.state[M][O]={};else if(this.state[M][O])for(const z of Object.keys(this.deletedStates[M][O]))delete this.state[M][O][z];L[O]=this.state[M][O]}b[M]=b[M]||{},Object.assign(b[M],L)}if(this.stateChanges={},this.deletedStates={},Object.keys(b).length!==0)for(const M in d)d[M].refreshFeatureState(p)}}class qc extends a.E{constructor(d,p,b){super(),this.id=d,this._onlySymbols=b,p.on("data",M=>{M.dataType==="source"&&M.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&M.dataType==="source"&&M.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),p.on("error",()=>{this._sourceErrored=!0}),this._source=p,this._tiles={},this._cache=new Wj(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=p.minTileCacheSize,this._maxTileCacheSize=p.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new Pg,this._isRaster=this._source.type==="raster"||this._source.type==="raster-dem"||this._source.type==="raster-array"||this._source.type==="custom"&&this._source._dataType==="raster"}onAdd(d){this.map=d,this._minTileCacheSize=this._minTileCacheSize===void 0&&d?d._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=this._maxTileCacheSize===void 0&&d?d._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const d in this._tiles)if(!this._tiles[d].loaded())return!1;return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const d=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,d&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(d,p){return d.isSymbolTile=this._onlySymbols,d.isExtraShadowCaster=this._shadowCasterTiles[d.tileID.key],this._source.loadTile(d,p)}_unloadTile(d){if(this._source.unloadTile)return this._source.unloadTile(d)}_abortTile(d){if(this._source.abortTile)return this._source.abortTile(d)}serialize(){return this._source.serialize()}prepare(d){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const p in this._tiles){const b=this._tiles[p];b.upload(d,this.map?this.map.painter:void 0),b.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return Object.values(this._tiles).map(d=>d.tileID).sort(sx).map(d=>d.key)}getRenderableIds(d,p){const b=[];for(const M in this._tiles)this._isIdRenderable(+M,d,p)&&b.push(this._tiles[M]);return d?b.sort((M,L)=>{const O=M.tileID,z=L.tileID,V=new a.P(O.canonical.x,O.canonical.y)._rotate(this.transform.angle),Y=new a.P(z.canonical.x,z.canonical.y)._rotate(this.transform.angle);return O.overscaledZ-z.overscaledZ||Y.y-V.y||Y.x-V.x}).map(M=>M.tileID.key):b.map(M=>M.tileID).sort(sx).map(M=>M.key)}hasRenderableParent(d){const p=this.findLoadedParent(d,0);return!!p&&this._isIdRenderable(p.tileID.key)}_isIdRenderable(d,p,b){return this._tiles[d]&&this._tiles[d].hasData()&&!this._coveredTiles[d]&&(p||!this._tiles[d].holdingForFade())&&(b||!this._shadowCasterTiles[d])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const d in this._tiles)this._tiles[d].state!=="errored"&&this._reloadTile(+d,"reloading")}}_reloadTile(d,p){const b=this._tiles[d];b&&(b.state!=="loading"&&(b.state=p),this._loadTile(b,this._tileLoaded.bind(this,b,d,p)))}_tileLoaded(d,p,b,M,L){if(M){if(d.state="errored",M.status!==404)this._source.fire(new a.y(M,{tile:d}));else{if(this._source.fire(new a.z("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:d})),!(d.tileID.key in this._loadedParentTiles))return;if(this._source.type==="raster-dem"&&this.usedForTerrain&&this.map.painter.terrain){const z=this.map.painter.terrain;this.update(this.transform,z.getScaledDemTileSize(),!0),z.resetTileLookupCache(this.id)}else this.update(this.transform)}return}d.timeAdded=a.o.now(),b==="expired"&&(d.refreshedUponExpiration=!0),this._setTileReloadTimer(p,d),this._source.type==="raster-dem"&&d.dem&&this._backfillDEM(d),this._state.initializeTileState(d,this.map?this.map.painter:null);let O=new Map;L&&L.responseHeaders&&(O=L.responseHeaders),this._source.fire(new a.z("data",{dataType:"source",tile:d,coord:d.tileID,sourceCacheId:this.id,responseHeaders:O}))}_backfillDEM(d){const p=this.getRenderableIds();for(let M=0;M1||(Math.abs(O)>1&&(Math.abs(O+V)===1?O+=V:Math.abs(O-V)===1&&(O-=V)),L.dem&&M.dem&&(M.dem.backfillBorder(L.dem,O,z),M.neighboringTiles&&M.neighboringTiles[Y]&&(M.neighboringTiles[Y].backfilled=!0)))}}getTile(d){return this.getTileByID(d.key)}getTileByID(d){return this._tiles[d]}_retainLoadedChildren(d,p,b,M){for(const L in this._tiles){let O=this._tiles[L];if(M[L]||!O.hasData()||O.tileID.overscaledZ<=p||O.tileID.overscaledZ>b)continue;let z=O.tileID;for(;O&&O.tileID.overscaledZ>p+1;){const Y=O.tileID.scaledTo(O.tileID.overscaledZ-1);O=this._tiles[Y.key],O&&O.hasData()&&(z=Y)}let V=z;for(;V.overscaledZ>p;)if(V=V.scaledTo(V.overscaledZ-1),d[V.key]){M[z.key]=z;break}}}findLoadedParent(d,p){if(d.key in this._loadedParentTiles){const b=this._loadedParentTiles[d.key];return b&&b.tileID.overscaledZ>=p?b:null}for(let b=d.overscaledZ-1;b>=p;b--){const M=d.scaledTo(b),L=this._getLoadedTile(M);if(L)return L}}_getLoadedTile(d){const p=this._tiles[d.key];return p&&p.hasData()?p:this._cache.getByKey(this._source.reparseOverscaled?d.wrapped().key:d.canonical.key)}updateCacheSize(d,p){p=p||this._source.tileSize;const b=Math.ceil(d.width/p)+1,M=Math.ceil(d.height/p)+1,L=Math.floor(b*M*5),O=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,L):L,z=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,O):O;this._cache.setMaxSize(z)}handleWrapJump(d){const p=Math.round((d-(this._prevLng===void 0?d:this._prevLng))/360);if(this._prevLng=d,p){const b={};for(const M in this._tiles){const L=this._tiles[M];L.tileID=L.tileID.unwrapTo(L.tileID.wrap+p),b[L.tileID.key]=L}this._tiles=b;for(const M in this._timers)clearTimeout(this._timers[M]),delete this._timers[M];for(const M in this._tiles)this._setTileReloadTimer(+M,this._tiles[M])}}update(d,p,b,M,L){if(this.transform=d,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!b)return;this.updateCacheSize(d,p),this.transform.projection.name!=="globe"&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};const O=this._source.type==="batched-model";let z,V=this._source.maxzoom;const Y=this.map&&this.map.painter?this.map.painter._terrain:null;if(Y&&Y.sourceCache===this&&Y.attenuationRange()){const le=Y.attenuationRange()[0],de=Math.floor(le)-Math.log2(Y.getDemUpscale());V>de&&(V=de)}if(this.used||this.usedForTerrain){if(this._source.tileID)z=d.getVisibleUnwrappedCoordinates(this._source.tileID).map(le=>new a.aQ(le.canonical.z,le.wrap,le.canonical.z,le.canonical.x,le.canonical.y));else if(this.tileCoverLift!==0){const le=d.clone();le.tileCoverLift=this.tileCoverLift,z=le.coveringTiles({tileSize:p||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:V,roundZoom:this._source.roundZoom&&!b,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:O}),this._source.minzoom<=1&&d.projection.name==="globe"&&(z.push(new a.aQ(1,0,1,0,0)),z.push(new a.aQ(1,0,1,1,0)),z.push(new a.aQ(1,0,1,0,1)),z.push(new a.aQ(1,0,1,1,1)))}else if(z=d.coveringTiles({tileSize:p||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:V,roundZoom:this._source.roundZoom&&!b,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:O}),this._source.hasTile){const le=this._source.hasTile.bind(this._source);z=z.filter(de=>le(de))}}else z=[];if(z.length>0&&this.transform.projection.name!=="globe"&&!this.usedForTerrain&&!ip(this._source.type)){const le=d.coveringZoomLevel({tileSize:p||this._source.tileSize,roundZoom:this._source.roundZoom&&!b}),de=Math.min(le,this._source.maxzoom);if(O){const be=d.extendTileCover(z,de);for(const ye of be)z.push(ye)}else if(L){const be=d.extendTileCoverToNearPlane(z,this.transform.getFrustum(de),de);for(const ye of be)z.push(ye)}else if(this.castsShadows&&M){const be=d.extendTileCover(z,de,M,16);for(const ye of be)this._shadowCasterTiles[ye.key]=!0,z.push(ye)}}const Q=this._updateRetainedTiles(z);if(ip(this._source.type)&&z.length!==0){const le={},de={},be=Object.keys(Q);for(const Oe of be){const Ee=Q[Oe],qe=this._tiles[Oe];if(!qe||qe.fadeEndTime&&qe.fadeEndTime<=a.o.now())continue;const Ze=this.findLoadedParent(Ee,Math.max(Ee.overscaledZ-qc.maxOverzooming,this._source.minzoom));Ze&&(this._addTile(Ze.tileID),le[Ze.tileID.key]=Ze.tileID),de[Oe]=Ee}const ye=z[z.length-1].overscaledZ;for(const Oe in this._tiles){const Ee=this._tiles[Oe];if(Q[Oe]||!Ee.hasData())continue;let qe=Ee.tileID;for(;qe.overscaledZ>ye;){qe=qe.scaledTo(qe.overscaledZ-1);const Ze=this._tiles[qe.key];if(Ze&&Ze.hasData()&&de[qe.key]){Q[Oe]=Ee.tileID;break}}}for(const Oe in le)Q[Oe]||(this._coveredTiles[Oe]=!0,Q[Oe]=le[Oe])}for(const le in Q)this._tiles[le].clearFadeHold();const ce=a.bv(this._tiles,Q);for(const le of ce){const de=this._tiles[le];de.hasSymbolBuckets&&!de.holdingForFade()?de.setHoldDuration(this.map._fadeDuration):de.hasSymbolBuckets&&!de.symbolFadeFinished()||this._removeTile(+le)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const d in this._tiles)this._tiles[d].holdingForFade()&&this._removeTile(+d)}_updateRetainedTiles(d){const p={};if(d.length===0)return p;const b={},M=d.reduce((Y,Q)=>Math.min(Y,Q.overscaledZ),1/0),L=d[0].overscaledZ,O=Math.max(L-qc.maxOverzooming,this._source.minzoom),z=Math.max(L+qc.maxUnderzooming,this._source.minzoom),V={};for(const Y of d){const Q=this._addTile(Y);p[Y.key]=Y,Q.hasData()||M=this._source.maxzoom){const le=Y.children(this._source.maxzoom)[0],de=this.getTile(le);if(de&&de.hasData()){p[le.key]=le;continue}}else{const le=Y.children(this._source.maxzoom);if(p[le[0].key]&&p[le[1].key]&&p[le[2].key]&&p[le[3].key])continue}let ce=Q.wasRequested();for(let le=Y.overscaledZ-1;le>=O;--le){const de=Y.scaledTo(le);if(b[de.key]||(b[de.key]=!0,Q=this.getTile(de),!Q&&ce&&(Q=this._addTile(de)),Q&&(p[de.key]=de,ce=Q.wasRequested(),Q.hasData())))break}}return p}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const d in this._tiles){const p=[];let b,M=this._tiles[d].tileID;for(;M.overscaledZ>0;){if(M.key in this._loadedParentTiles){b=this._loadedParentTiles[M.key];break}p.push(M.key);const L=M.scaledTo(M.overscaledZ-1);if(b=this._getLoadedTile(L),b)break;M=L}for(const L of p)this._loadedParentTiles[L]=b}}_addTile(d){let p=this._tiles[d.key];if(p)return p.isExtraShadowCaster!==!0||this._shadowCasterTiles[d.key]||this._reloadTile(d.key,"reloading"),p;p=this._cache.getAndRemove(d),p&&(this._setTileReloadTimer(d.key,p),p.tileID=d,this._state.initializeTileState(p,this.map?this.map.painter:null),this._cacheTimers[d.key]&&(clearTimeout(this._cacheTimers[d.key]),delete this._cacheTimers[d.key],this._setTileReloadTimer(d.key,p)));const b=!!p;if(!b){const M=this.map?this.map.painter:null,L=this._source.tileSize*d.overscaleFactor();p=this._source.type==="raster-array"?new sp(d,L,this.transform.tileZoom,M,this._isRaster):new np(d,L,this.transform.tileZoom,M,this._isRaster,this._source.worldview),this._loadTile(p,this._tileLoaded.bind(this,p,d.key,p.state))}return p.uses++,this._tiles[d.key]=p,b||this._source.fire(new a.z("dataloading",{tile:p,coord:p.tileID,dataType:"source"})),p}_setTileReloadTimer(d,p){d in this._timers&&(clearTimeout(this._timers[d]),delete this._timers[d]);const b=p.getExpiryTimeout();b&&(this._timers[d]=setTimeout(()=>{this._reloadTile(d,"expired"),delete this._timers[d]},b))}_removeTile(d){const p=this._tiles[d];p&&(p.uses--,delete this._tiles[d],this._timers[d]&&(clearTimeout(this._timers[d]),delete this._timers[d]),p.uses>0||(p.hasData()&&p.state!=="reloading"||p.state==="empty"?this._cache.add(p.tileID,p,p.getExpiryTimeout()):(p.aborted=!0,this._abortTile(p),this._unloadTile(p))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const d in this._tiles)this._removeTile(+d);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(d,p,b){const M=[],L=this.transform;if(!L)return M;const O=L.projection.name==="globe",z=a.aF(L.center.lng);for(const V in this._tiles){const Y=this._tiles[V];if(b&&Y.clearQueryDebugViz(),Y.holdingForFade())continue;let Q;if(O){const ce=Y.tileID.canonical;if(ce.z===0){const le=[Math.abs(a.aA(z,...zu(ce,-1))-z),Math.abs(a.aA(z,...zu(ce,1))-z)];Q=[0,2*le.indexOf(Math.min(...le))-1]}else{const le=[Math.abs(a.aA(z,...zu(ce,-1))-z),Math.abs(a.aA(z,...zu(ce,0))-z),Math.abs(a.aA(z,...zu(ce,1))-z)];Q=[le.indexOf(Math.min(...le))-1]}}else Q=[0];for(const ce of Q){const le=d.containsTile(Y,L,p,ce);le&&M.push(le)}}return M}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(d){return this._getRenderableCoordinates(d)}_getRenderableCoordinates(d,p){const b=this.getRenderableIds(d,p).map(L=>this._tiles[L].tileID),M=this.transform.projection.name==="globe";for(const L of b)L.projMatrix=this.transform.calculateProjMatrix(L.toUnwrapped()),L.expandedProjMatrix=M?this.transform.calculateProjMatrix(L.toUnwrapped(),!1,!0):L.projMatrix;return b}sortCoordinatesByDistance(d){const p=d.slice(),b=this.transform._camera.position,M=this.transform._camera.forward(),L={};for(const O of p){const z=1/(1<L[O.key]-L[z.key]),p}hasTransition(){if(this._source.hasTransition())return!0;if(ip(this._source.type))for(const d in this._tiles){const p=this._tiles[d];if(p.fadeEndTime!==void 0&&p.fadeEndTime>=a.o.now())return!0}return!1}setFeatureState(d,p,b){this._state.updateState(d=d||"_geojsonTileLayer",p,b)}removeFeatureState(d,p,b){this._state.removeFeatureState(d=d||"_geojsonTileLayer",p,b)}getFeatureState(d,p){return this._state.getState(d=d||"_geojsonTileLayer",p)}setDependencies(d,p,b){const M=this._tiles[d];M&&M.setDependencies(p,b)}reloadTilesForDependencies(d,p){for(const b in this._tiles)this._tiles[b].hasDependency(d,p)&&this._reloadTile(+b,"reloading");this._cache.filter(b=>!b.hasDependency(d,p))}_preloadTiles(d,p){if(!this._sourceLoaded){const V=()=>{this._sourceLoaded&&(this._source.off("data",V),this._preloadTiles(d,p))};return void this._source.on("data",V)}const b=new Map,M=Array.isArray(d)?d:[d],L=this.map.painter.terrain,O=this.usedForTerrain&&L?L.getScaledDemTileSize():this._source.tileSize;for(const V of M){const Y=V.coveringTiles({tileSize:O,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const Q of Y)b.set(Q.key,Q);this.usedForTerrain&&V.updateElevation(!1)}const z=Array.from(b.values());a.bw(z,(V,Y)=>{const Q=new np(V,this._source.tileSize*V.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster,this._source.worldview);this._loadTile(Q,ce=>{this._source.type==="raster-dem"&&Q.dem&&this._backfillDEM(Q),Y(ce,Q)})},p)}}function sx(_,d){const p=Math.abs(2*_.wrap)-+(_.wrap<0),b=Math.abs(2*d.wrap)-+(d.wrap<0);return _.overscaledZ-d.overscaledZ||b-p||d.canonical.y-_.canonical.y||d.canonical.x-_.canonical.x}function ip(_){return _==="raster"||_==="image"||_==="video"||_==="custom"}function zu(_,d){const p=1<<_.z;return[_.x/p+d,(_.x+1)/p+d]}qc.maxOverzooming=10,qc.maxUnderzooming=3;class a3{constructor(d){this.style=d,this.layersGotHidden=!1,this.layers=[]}processLayersChanged(){this.layers=[];const d=!1,p=!1;for(const b in this.style._mergedLayers){const M=this.style._mergedLayers[b];if(M.type==="fill-extrusion"||M.type==="building")this.layers.push({layer:M,visible:d,visibilityChanged:p});else if(M.type==="model"){const L=this.style.getLayerSource(M);L&&L.type==="batched-model"&&this.layers.push({layer:M,visible:d,visibilityChanged:p})}}}onNewFrame(d){this.layersGotHidden=!1;for(const p of this.layers){const b=p.layer;let M=!1;b.type==="fill-extrusion"?M=!b.isHidden(d)&&b.paint.get("fill-extrusion-opacity")>0:b.type==="building"?M=!b.isHidden(d)&&b.paint.get("building-opacity")>0:b.type==="model"&&(M=!b.isHidden(d)&&b.paint.get("model-opacity").constantOr(1)>0),this.layersGotHidden=this.layersGotHidden||!M&&p.visible,p.visible=M}}updateZOffset(d,p){this.currentBuildingBuckets=[];for(const M of this.layers){const L=M.layer,O=this.style.getLayerSourceCache(L);let z=1;L.type==="fill-extrusion"?z=M.visible?L.paint.get("fill-extrusion-vertical-scale"):0:L.type==="building"&&(z=M.visible?L.paint.get("building-vertical-scale"):0);let V=O?O.getTile(p):null;if(!V&&O)for(const Y in O._tiles){const Q=O._tiles[Y];if(p.canonical.isChildOf(Q.tileID.canonical)){V=Q;break}}this.currentBuildingBuckets.push({bucket:V?V.getBucket(L):null,tileID:V?V.tileID:p,verticalScale:z})}d.hasAnyZOffset=!1;let b=!1;for(let M=0;M{b in d&&(p[b]=d[b])}),p}function Sr(_){_=_.slice();const d=Object.create(null);for(let p=0;p<_.length;p++)d[_[p].id]=_[p];for(let p=0;p<_.length;p++)"ref"in _[p]&&(_[p]=jt(_[p],d[_[p].ref]));return _}const lr={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setSlot:"setSlot",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight",setTerrain:"setTerrain",setFog:"setFog",setSnow:"setSnow",setRain:"setRain",setCamera:"setCamera",setLights:"setLights",setProjection:"setProjection",addImport:"addImport",removeImport:"removeImport",updateImport:"updateImport",addIconset:"addIconset",removeIconset:"removeIconset"};function ys(_,d,p){p.push({command:lr.addSource,args:[_,d[_]]})}function Ls(_,d,p){d.push({command:lr.removeSource,args:[_]}),p[_]=!0}function jo(_,d,p,b){Ls(_,p,b),ys(_,d,p)}function eo(_,d,p){let b;for(b in _[p])if(_[p].hasOwnProperty(b)&&b!=="data"&&!a.by(_[p][b],d[p][b]))return!1;for(b in d[p])if(d[p].hasOwnProperty(b)&&b!=="data"&&!a.by(_[p][b],d[p][b]))return!1;return!0}function to(_,d,p,b,M,L){let O;for(O in d=d||{},_=_||{})_.hasOwnProperty(O)&&(a.by(_[O],d[O])||p.push({command:L,args:[b,O,d[O],M]}));for(O in d)d.hasOwnProperty(O)&&!_.hasOwnProperty(O)&&(a.by(_[O],d[O])||p.push({command:L,args:[b,O,d[O],M]}))}function Lg(_){return _.id}function $1(_,d){return _[d.id]=d,_}function o3(_,d,p){const b=d.createTileMatrix(_,_.worldSize,p.toUnwrapped());return a.aB(new Float32Array(16),_.projMatrix,b)}function Gj(_,d,p){if(d.projection.name===p.projection.name)return _.projMatrix;const b=p.clone();return b.setProjection(d.projection),o3(b,d.getProjection(),_)}function tf(_,d,p){return d.name===p.projection.name?_.projMatrix:o3(p,d,_)}class U1{constructor(d,p){this.reset(d,p)}reset(d,p){this.points=d||[],this._distances=[0];for(let b=1;b0?(M-O)/z:0;return this.points[L].mult(1-V).add(this.points[p].mult(V))}}class l3{constructor(d,p,b){const M=this.boxCells=[],L=this.circleCells=[];this.xCellCount=Math.ceil(d/b),this.yCellCount=Math.ceil(p/b);for(let O=0;Othis.width||M<0||p>this.height)return!L&&[];const z=[];if(d<=0&&p<=0&&this.width<=b&&this.height<=M){if(L)return!0;for(let V=0;V0:z}_queryCircle(d,p,b,M,L){const O=d-b,z=d+b,V=p-b,Y=p+b;if(z<0||O>this.width||Y<0||V>this.height)return!M&&[];const Q=[];return this._forEachCell(O,V,z,Y,this._queryCellCircle,Q,{hitTest:M,circle:{x:d,y:p,radius:b},seenUids:{box:{},circle:{}}},L),M?Q.length>0:Q}query(d,p,b,M,L){return this._query(d,p,b,M,!1,L)}hitTest(d,p,b,M,L){return this._query(d,p,b,M,!0,L)}hitTestCircle(d,p,b,M){return this._queryCircle(d,p,b,!0,M)}_queryCell(d,p,b,M,L,O,z,V){const Y=z.seenUids,Q=this.boxCells[L];if(Q!==null){const le=this.bboxes;for(const de of Q)if(!Y.box[de]){Y.box[de]=!0;const be=4*de;if(d<=le[be+2]&&p<=le[be+3]&&b>=le[be+0]&&M>=le[be+1]&&(!V||V(this.boxKeys[de]))){if(z.hitTest)return O.push(!0),!0;O.push({key:this.boxKeys[de],x1:le[be],y1:le[be+1],x2:le[be+2],y2:le[be+3]})}}}const ce=this.circleCells[L];if(ce!==null){const le=this.circles;for(const de of ce)if(!Y.circle[de]){Y.circle[de]=!0;const be=3*de;if(this._circleAndRectCollide(le[be],le[be+1],le[be+2],d,p,b,M)&&(!V||V(this.circleKeys[de]))){if(z.hitTest)return O.push(!0),!0;{const ye=le[be],Oe=le[be+1],Ee=le[be+2];O.push({key:this.circleKeys[de],x1:ye-Ee,y1:Oe-Ee,x2:ye+Ee,y2:Oe+Ee})}}}}}_queryCellCircle(d,p,b,M,L,O,z,V){const Y=z.circle,Q=z.seenUids,ce=this.boxCells[L];if(ce!==null){const de=this.bboxes;for(const be of ce)if(!Q.box[be]){Q.box[be]=!0;const ye=4*be;if(this._circleAndRectCollide(Y.x,Y.y,Y.radius,de[ye+0],de[ye+1],de[ye+2],de[ye+3])&&(!V||V(this.boxKeys[be])))return O.push(!0),!0}}const le=this.circleCells[L];if(le!==null){const de=this.circles;for(const be of le)if(!Q.circle[be]){Q.circle[be]=!0;const ye=3*be;if(this._circlesCollide(de[ye],de[ye+1],de[ye+2],Y.x,Y.y,Y.radius)&&(!V||V(this.circleKeys[be])))return O.push(!0),!0}}}_forEachCell(d,p,b,M,L,O,z,V){const Y=this._convertToXCellCoord(d),Q=this._convertToYCellCoord(p),ce=this._convertToXCellCoord(b),le=this._convertToYCellCoord(M);for(let de=Y;de<=ce;de++)for(let be=Q;be<=le;be++)if(L.call(this,d,p,b,M,this.xCellCount*be+de,O,z,V))return}_convertToXCellCoord(d){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(d*this.xScale)))}_convertToYCellCoord(d){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(d*this.yScale)))}_circlesCollide(d,p,b,M,L,O){const z=M-d,V=L-p,Y=b+O;return Y*Y>z*z+V*V}_circleAndRectCollide(d,p,b,M,L,O,z){const V=(O-M)/2,Y=Math.abs(d-(M+V));if(Y>V+b)return!1;const Q=(z-L)/2,ce=Math.abs(p-(L+Q));if(ce>Q+b)return!1;if(Y<=V||ce<=Q)return!0;const le=Y-V,de=ce-Q;return le*le+de*de<=b*b}}const vm={unknown:0,flipRequired:1,flipNotRequired:2},Og=Math.tan(85*Math.PI/180);function Cc(_,d,p,b,M,L,O){const z=a.bC();if(p)if(L.name==="globe"){const V=a.bD(M,d);a.aB(z,z,V)}else{const V=a.bE([],O);z[0]=V[0],z[1]=V[1],z[4]=V[2],z[5]=V[3],b||a.bB(z,z,M.angle)}else a.aB(z,M.labelPlaneMatrix,_);return z}function Kj(_,d,p,b,M,L,O){const z=Cc(_,d,p,b,M,L,O);return L.name==="globe"&&p||(z[2]=z[6]=z[10]=z[14]=0),z}function q1(_,d,p,b,M,L,O){if(p){if(L.name==="globe"){const z=Cc(_,d,p,b,M,L,O);return a.bl(z,z),a.aB(z,_,z),z}{const z=a.bz(_),V=a.bA([]);return V[0]=O[0],V[1]=O[1],V[4]=O[2],V[5]=O[3],a.aB(z,z,V),b||a.bB(z,z,-M.angle),z}}return M.glCoordMatrix}function Bu(_,d,p,b){const M=[_,d,p,1];p?a.aC(M,M,b):fn(M,M,b);const L=M[3];return M[0]/=L,M[1]/=L,M[2]/=L,M}function xi(_,d){return Math.min(.5+_/d*.5,1.5)}function SI(_,d){const p=_[0]/_[3],b=_[1]/_[3];return p>=-d[0]&&p<=d[0]&&b>=-d[1]&&b<=d[1]}function CI(_,d,p,b,M,L,O,z,V,Y,Q=1){const ce=p.transform,le=b?_.textSizeData:_.iconSizeData,de=a.bK(le,p.transform.zoom,Q),be=ce.projection.name==="globe",ye=[256/p.width*2+1,256/p.height*2+1],Oe=b?_.text.dynamicLayoutVertexArray:_.icon.dynamicLayoutVertexArray;Oe.clear();let Ee=null;be&&(Ee=b?_.text.globeExtVertexArray:_.icon.globeExtVertexArray);const qe=_.lineVertexArray,Ze=b?_.text.placedSymbolArray:_.icon.placedSymbolArray,Ve=p.transform.width/p.transform.height;let gt,ct=!1;for(let ht=0;htMath.abs(p)?{useVertical:!0}:_===a.bL.vertical?b>0?{needsFlipping:!0}:null:d!==vm.unknown&&function(M,L){return M===0||Math.abs(L/M)>Og}(p,b)?d===vm.flipRequired?{needsFlipping:!0}:null:p<0?{needsFlipping:!0}:null}function c3(_,d,p,b,M,L,O,z,V,Y,Q,ce,le,de,be,ye,Oe,Ee,qe,Ze){const Ve=d/24,gt=_.lineOffsetX*Ve,ct=_.lineOffsetY*Ve,{lineStartIndex:ht,glyphStartIndex:ot,numGlyphs:st,segment:vt,writingMode:Pt,flipState:Tt}=_,qt=ht+_.lineLength,Vt=nr=>{if(Q){const[Kt,Ut,ur]=nr.up,Ar=Y.length;a.bN(Q,Ar+0,Kt,Ut,ur),a.bN(Q,Ar+1,Kt,Ut,ur),a.bN(Q,Ar+2,Kt,Ut,ur),a.bN(Q,Ar+3,Kt,Ut,ur)}const[vr,Ft,St]=nr.point;a.bO(Y,vr,Ft,St,nr.angle)};if(st>1){const nr=MI(Ve,z,gt,ct,p,ce,le,_,V,L,de,ye,!1,Oe,Ee,qe,Ze);if(!nr)return{notEnoughRoom:!0};if(b&&!p){let[vr,Ft,St]=nr.first.point,[Kt,Ut,ur]=nr.last.point;[vr,Ft]=Bu(vr,Ft,St,O),[Kt,Ut]=Bu(Kt,Ut,ur,O);const Ar=Dn(Pt,Tt,(Kt-vr)*be,Ut-Ft);if(_.flipState=Ar&&Ar.needsFlipping?vm.flipRequired:vm.flipNotRequired,Ar)return Ar}Vt(nr.first);for(let vr=ot+1;vr0?Kt:$u(le,St,vr,1,M,void 0,Oe,Ee.canonical),ur=Dn(Pt,Tt,(Ut[0]-vr[0])*be,Ut[1]-vr[1]);if(_.flipState=ur&&ur.needsFlipping?vm.flipRequired:vm.flipNotRequired,ur)return ur}const nr=ix(Ve*z.getoffsetX(ot),gt,ct,p,ce,le,vt,ht,qt,V,L,de,ye,!1,!1,Oe,Ee,qe,Ze);if(!nr)return{notEnoughRoom:!0};Vt(nr)}return{}}function V1(_,d,p,b,M){const{x:L,y:O,z}=b.projectTilePoint(_.x,_.y,d);if(!M)return Bu(L,O,z,p);const[V,Y,Q]=M.getElevation(_,M.elevation,M.elevationFeature);return Bu(L+V,O+Y,z+Q,p)}function $u(_,d,p,b,M,L,O,z){const V=V1(_.sub(d)._unit()._add(_),z,M,O,L);return a.av(V,p,V),a.aw(V,V),a.bH(V,p,V,b)}function ix(_,d,p,b,M,L,O,z,V,Y,Q,ce,le,de,be,ye,Oe,Ee,qe){const Ze=b?_-d:_+d;let Ve=Ze>0?1:-1,gt=0;b&&(Ve*=-1,gt=Math.PI),Ve<0&&(gt+=Math.PI);let ct=z+O+(Ve>0?0:1)|0,ht=M,ot=M,st=0,vt=0;const Pt=Math.abs(Ze),Tt=[],qt=[];let Vt=L,nr=Vt,vr=a.bF([]);const Ft=()=>$u(nr,Vt,ot,Pt-st+1,Q,le,ye,Oe.canonical);for(;st+vt<=Pt;){if(ct+=Ve,ct=V)return null;if(ot=ht,nr=Vt,Tt.push(ot),de&&qt.push(nr),Vt=new a.P(Y.getx(ct),Y.gety(ct)),ht=ce[ct],!ht){const Jr=V1(Vt,Oe.canonical,Q,ye,le);ht=Jr[3]>0?ce[ct]=Jr:Ft()}st+=vt;const _r=a.av([],ht,ot),nn=a.bG(ot,ht);if(p&&nn>0&&vt>0&&a.bJ(vr,_r)/(vt*nn)0,Ze),ht=Y*ct.perspectiveRatio,ot=(b.x1*p+z.x-b.padding)*ht+ct.point.x,st=(b.y1*p+z.y-b.padding)*ht+ct.point.y,vt=(b.x2*p+z.x+b.padding)*ht+ct.point.x,Pt=(b.y2*p+z.y+b.padding)*ht+ct.point.y,Tt=ct.perspectiveRatio<=.55||ct.occluded;return!this.isInsideGrid(ot,st,vt,Pt)||!V&&this.grid.hitTest(ot,st,vt,Pt,ce)||Tt?{box:[],offscreen:!1,occluded:ct.occluded}:{box:[ot,st,vt,Pt],offscreen:this.isOffscreen(ot,st,vt,Pt),occluded:!1}}placeCollisionCircles(d,p,b,M,L,O,z,V,Y,Q,ce,le,de,be,ye,Oe){const Ee=[],qe=this.transform.elevation,Ze=d.getProjection(),Ve=d.elevationType==="road",gt=!!qe||Ve,ct=a.bV.getAtTileOffsetFunc(Oe,this.transform.center.lat,this.transform.worldSize,Ze),ht=new a.P(b.tileAnchorX,b.tileAnchorY),ot=new a.P(b.tileAnchorX,b.tileAnchorY);let{x:st,y:vt,z:Pt}=Ze.projectTilePoint(ot.x,ot.y,Oe.canonical),Tt=null;if(gt){const nn=Ve?d.getElevationFeatureForText(M):null;Tt={getElevation:ct,elevation:qe,elevationFeature:nn};const[Jr,Dr,qr]=ct(ht,qe,nn);st+=Jr,vt+=Dr,Pt+=qr}const qt=Ze.name==="globe",Vt=this.projectAndGetPerspectiveRatio(V,st,vt,Pt,Oe,qt||!!qe||this.transform.pitch>0,Ze),{perspectiveRatio:nr}=Vt,vr=(le?z/nr:z*nr)/a.bY,Ft=Bu(st,vt,Pt,Y),St=b.lineOffsetX*vr,Kt=b.lineOffsetY*vr,Ut=a.an(d.layers[0].layout.get("text-max-angle")),ur=Math.cos(Ut),Ar=Vt.signedDistanceFromCamera>0?MI(vr,O,St,Kt,Ve&&b.flipState===1,Ft,ot,b,L,Y,{},gt&&!le?Tt:null,le&>,Ze,Oe,le,ur):null;let Ur=!1,Nr=!1,_r=!0;if(Ar&&!Vt.occluded){const nn=.5*be*nr+ye,Jr=new a.P(-100,-100),Dr=new a.P(this.screenRightBoundary,this.screenBottomBoundary),qr=new U1,{first:wn,last:Hn}=Ar,As=wn.path.length;let ai=[];for(let Un=As-1;Un>=1;Un--)ai.push(wn.path[Un]);for(let Un=1;Un(gt&&!qt&&(Ci=ct(viUn[3]<=0)&&(ai=[]));let Js=[];if(ai.length>0){let Un=1/0,ui=-1/0,Ci=1/0,vi=-1/0;for(const Ys of ai)Un=Math.min(Un,Ys[0]),Ci=Math.min(Ci,Ys[1]),ui=Math.max(ui,Ys[0]),vi=Math.max(vi,Ys[1]);ui>=Jr.x&&Un<=Dr.x&&vi>=Jr.y&&Ci<=Dr.y&&(Js=[ai.map(Ys=>new a.P(Ys[0],Ys[1]))],(UnDr.x||CiDr.y)&&(Js=a.bW(Js,Jr.x,Jr.y,Dr.x,Dr.y)))}for(const Un of Js){qr.reset(Un,.25*nn);let ui=0;ui=qr.length<=.5*nn?1:Math.ceil(qr.paddedLength/on)+1;for(let Ci=0;Ci0?(a.aC(V,V,d),this.fogState&&L&&z.name!=="globe"&&(Y=function(le,de,be,ye,Oe,Ee){const qe=Ee.calculateFogTileMatrix(Oe),Ze=[de,be,ye];return a.af(Ze,Ze,qe),Wr(le,a.ag(Ze),Ee.pitch,Ee._fov)}(this.fogState,p,b,M,L.toUnwrapped(),this.transform)>.9)):fn(V,V,d);const Q=V[3];return{point:new a.P((V[0]/Q+1)/2*this.transform.width+Bs,(-V[1]/Q+1)/2*this.transform.height+Bs),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(z)/Q*.5,1.5),signedDistanceFromCamera:Q,occluded:O&&V[2]>Q||Y}}isOffscreen(d,p,b,M){return b=this.screenRightBoundary||Mthis.screenBottomBoundary}isInsideGrid(d,p,b,M){return b>=0&&d=0&&pb.collisionGroupID===p}}return this.collisionGroups[d]}}function cc(_,d,p,b,M){const{horizontalAlign:L,verticalAlign:O}=a.c1(_),z=-(L-.5)*d,V=-(O-.5)*p,Y=a.c2(_,b);return new a.P(z+Y[0]*M,V+Y[1]*M)}function ko(_,d,p,b,M){const L=new a.P(_,d);return p&&L._rotate(b?M:-M),L}class Lie{constructor(d,p,b,M,L,O){this.transform=d.clone(),this.projection=d.projection.name,this.collisionIndex=new Si(this.transform,L),this.buildingIndex=O,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=p,this.retainedQueryData={},this.collisionGroups=new W1(b),this.collisionCircleArrays={},this.prevPlacement=M,M&&(M.prevPlacement=void 0),this.placedOrientations={},this.lastReplacementSourceUpdateTime=0}getBucketParts(d,p,b,M,L=1){const O=b.getBucket(p),z=b.latestFeatureIndex;if(!O||!z||p.fqid!==O.layerIds[0])return;const V=O.layers[0].layout,Y=O.layers[0].paint,Q=b.collisionBoxArray,ce=Math.pow(2,this.transform.zoom-b.tileID.overscaledZ),le=b.tileSize/a.al,de=b.tileID.toUnwrapped();this.transform.setProjection(O.projection);const be=(ye=b.tileID,Oe=O.getProjection(),Ee=this.transform,Oe.name===this.projection?Ee.calculateProjMatrix(ye.toUnwrapped()):o3(Ee,Oe,ye));var ye,Oe,Ee;const qe=V.get("text-pitch-alignment")==="map",Ze=V.get("text-rotation-alignment")==="map";p.compileFilter(p.options);const Ve=p.dynamicFilter(),gt=p.dynamicFilterNeedsFeature(),ct=this.transform.calculatePixelsToTileUnitsMatrix(b),ht=Kj(be,b.tileID.canonical,qe,Ze,this.transform,O.getProjection(),ct);let ot=null;const st=O.getProjection().createInversionMatrix(this.transform,b.tileID.canonical);if(qe){const St=q1(be,b.tileID.canonical,qe,Ze,this.transform,O.getProjection(),ct);ot=a.aB([],this.transform.labelPlaneMatrix,St)}let vt=null;Ve&&b.latestFeatureIndex&&(vt={unwrappedTileID:de,dynamicFilter:Ve,dynamicFilterNeedsFeature:gt}),this.retainedQueryData[O.bucketInstanceId]=new H1(O.bucketInstanceId,z,O.sourceLayerIndex,O.index,b.tileID);const[Pt,Tt]=O.layers[0].layout.get("text-size-scale-range"),qt=a.aA(L,Pt,Tt),[Vt,nr]=V.get("icon-size-scale-range"),vr=a.aA(L,Vt,nr),Ft={bucket:O,layout:V,paint:Y,posMatrix:be,invMatrix:st,mercatorCenter:[a.aF(this.transform.center.lng),a.aJ(this.transform.center.lat)],textLabelPlaneMatrix:ht,labelToScreenMatrix:ot,clippingData:vt,scale:ce,textPixelRatio:le,holdingForFade:b.holdingForFade(),collisionBoxArray:Q,partiallyEvaluatedTextSize:a.bK(O.textSizeData,this.transform.zoom,qt),partiallyEvaluatedIconSize:a.bK(O.iconSizeData,this.transform.zoom,vr),collisionGroup:this.collisionGroups.get(O.sourceID),latestFeatureIndex:b.latestFeatureIndex};if(M)for(const St of O.sortKeyRanges){const{sortKey:Kt,symbolInstanceStart:Ut,symbolInstanceEnd:ur}=St;d.push({sortKey:Kt,symbolInstanceStart:Ut,symbolInstanceEnd:ur,parameters:Ft})}else d.push({symbolInstanceStart:0,symbolInstanceEnd:O.symbolInstances.length,parameters:Ft})}attemptAnchorPlacement(d,p,b,M,L,O,z,V,Y,Q,ce,le,de,be,ye,Oe,Ee,qe,Ze,Ve,gt){const{textOffset0:ct,textOffset1:ht,crossTileID:ot}=ye,st=[ct,ht],vt=cc(d,O,z,st,V),Pt=this.collisionIndex.placeCollisionBox(Ee,V,p,b,M,L,ko(vt.x,vt.y,Y,Q,this.transform.angle),be,ce,le,de.predicate);if(Ze){const Tt=Ee.getSymbolInstanceIconSize(gt,this.transform.zoom,ye.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(Ee,Tt,Ze,b,M,L,ko(vt.x,vt.y,Y,Q,this.transform.angle),be,ce,le,de.predicate).box.length===0)return}if(Pt.box.length>0){let Tt;return this.prevPlacement&&this.prevPlacement.variableOffsets[ot]&&this.prevPlacement.placements[ot]&&this.prevPlacement.placements[ot].text&&(Tt=this.prevPlacement.variableOffsets[ot].anchor),this.variableOffsets[ot]={textOffset:st,width:O,height:z,anchor:d,textScale:V,prevAnchor:Tt},this.markUsedJustification(Ee,d,ye,qe),Ee.allowVerticalPlacement&&(this.markUsedOrientation(Ee,qe,ye),this.placedOrientations[ot]=qe),{shift:vt,placedGlyphBoxes:Pt}}}placeLayerBucketPart(d,p,b,M,L=1){const{bucket:O,layout:z,paint:V,posMatrix:Y,textLabelPlaneMatrix:Q,labelToScreenMatrix:ce,clippingData:le,textPixelRatio:de,mercatorCenter:be,invMatrix:ye,holdingForFade:Oe,collisionBoxArray:Ee,partiallyEvaluatedTextSize:qe,partiallyEvaluatedIconSize:Ze,collisionGroup:Ve,latestFeatureIndex:gt}=d.parameters,ct=z.get("text-optional"),ht=z.get("icon-optional"),ot=z.get("text-allow-overlap"),st=z.get("icon-allow-overlap"),vt=z.get("text-rotation-alignment")==="map",Pt=z.get("icon-rotation-alignment")==="map",Tt=z.get("text-pitch-alignment")==="map",qt=V.get("symbol-z-offset"),Vt=z.get("symbol-elevation-reference")==="sea",nr=z.get("symbol-placement"),[vr,Ft]=z.get("text-size-scale-range"),[St,Kt]=z.get("icon-size-scale-range"),Ut=a.aA(L,vr,Ft),ur=a.aA(L,St,Kt),Ar=z.get("text-variable-anchor"),Ur=vt&&nr!=="point",Nr=Pt&&nr!=="point",_r=Ar&&O.hasTextData(),nn=O.hasIconTextFit()&&_r&&O.hasIconData();this.transform.setProjection(O.projection);const Jr=_r||Ur,Dr=Nr||nn;let qr=ot&&(st||!O.hasIconData()||ht),wn=st&&(ot||!O.hasTextData()||ct);const Hn=!qt.isConstant();!O.collisionArrays&&Ee&&O.deserializeCollisionBoxes(Ee),b&&M&&O.updateCollisionDebugBuffers(this.transform.zoom,Ee,Ut,ur);const As=(on,Js,Un)=>{const{crossTileID:ui,numVerticalGlyphVertices:Ci}=on;let vi=null;if(le&&le.dynamicFilterNeedsFeature||Hn){const Fa=this.retainedQueryData[O.bucketInstanceId];vi=gt.loadFeature({featureIndex:on.featureIndex,bucketIndex:Fa.bucketIndex,sourceLayerIndex:Fa.sourceLayerIndex,layoutVertexArrayOffset:0});const ro=vi.properties?vi.properties.worldview:null;if(O.localizable&&O.worldview&&typeof ro=="string")if(ro==="all")vi.properties.$localized=!0;else{if(!ro.split(",").includes(O.worldview))return;vi.properties.$localized=!0,vi.properties.worldview=O.worldview}}if(le&&!(0,le.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch,worldview:O.worldview},vi,this.retainedQueryData[O.bucketInstanceId].tileID.canonical,new a.P(on.tileAnchorX,on.tileAnchorY),this.transform.calculateDistanceTileData(le.unwrappedTileID)))return this.placements[ui]=new gi(!1,!1,!1,!0),void p.add(ui);const Ys=qt.evaluate(vi,{});if(p.has(ui))return;if(Oe)return void(this.placements[ui]=new gi(!1,!1,!1));let ts=!1,ci=!1,Ea=!0,ua=!1,hi=!1,Hs=null,rs={box:null,offscreen:null,occluded:null},na={box:null},Za=null,ka=null,zi=null,Zc=0,Xl=0,zo=0;Un.textFeatureIndex?Zc=Un.textFeatureIndex:on.useRuntimeCollisionCircles&&(Zc=on.featureIndex),Un.verticalTextFeatureIndex&&(Xl=Un.verticalTextFeatureIndex);const uc=O.elevationFeatures?O.elevationFeatures[on.elevationFeatureIndex]:void 0,hc=Fa=>{Fa.tileID=this.retainedQueryData[O.bucketInstanceId].tileID;const ro=this.transform.elevation;Fa.elevation=Vt?Ys:Ys+a.bV.getAtTileOffset(Fa.tileID,new a.P(Fa.tileAnchorX,Fa.tileAnchorY),ro,uc),Fa.elevation+=on.zOffset},Il=Un.textBox;if(Il){hc(Il);const Fa=Bi=>{let mo=a.bL.horizontal;if(O.allowVerticalPlacement&&!Bi&&this.prevPlacement){const Ia=this.prevPlacement.placedOrientations[ui];Ia&&(this.placedOrientations[ui]=Ia,mo=Ia,this.markUsedOrientation(O,mo,on))}return mo},ro=(Bi,mo)=>{if(O.allowVerticalPlacement&&Ci>0&&Un.verticalTextBox){for(const Ia of O.writingModes)if(Ia===a.bL.vertical?(rs=mo(),na=rs):rs=Bi(),rs&&rs.box&&rs.box.length)break}else rs=Bi()};if(Ar){let Bi=Ar;if(this.prevPlacement&&this.prevPlacement.variableOffsets[ui]){const Na=this.prevPlacement.variableOffsets[ui];Bi.indexOf(Na.anchor)>0&&(Bi=Bi.filter(Zu=>Zu!==Na.anchor),Bi.unshift(Na.anchor))}const mo=(Na,Zu,_v)=>{const kh=O.getSymbolInstanceTextSize(qe,on,this.transform.zoom,Js),bv=(Na.x2-Na.x1)*kh+2*Na.padding,Tx=(Na.y2-Na.y1)*kh+2*Na.padding,hf=on.hasIconTextFit&&!st?Zu:null;hf&&hc(hf);let vp={box:[],offscreen:!1,occluded:!1};const Ax=ot?2*Bi.length:Bi.length;for(let Om=0;Om=Bi.length,on,Js,O,_v,hf,qe,Ze);if(_p&&(vp=_p.placedGlyphBoxes,vp&&vp.box&&vp.box.length)){ts=!0,Hs=_p.shift;break}}return vp};ro(()=>mo(Il,Un.iconBox,a.bL.horizontal),()=>{const Na=Un.verticalTextBox;return Na&&hc(Na),O.allowVerticalPlacement&&!(rs&&rs.box&&rs.box.length)&&Ci>0&&Na?mo(Na,Un.verticalIconBox,a.bL.vertical):{box:null,offscreen:null,occluded:null}}),rs&&(ts=rs.box,Ea=rs.offscreen,ua=rs.occluded);const Ia=Fa(!(!rs||!rs.box));if(!ts&&this.prevPlacement){const Na=this.prevPlacement.variableOffsets[ui];Na&&(this.variableOffsets[ui]=Na,this.markUsedJustification(O,Na.anchor,on,Ia))}}else{const Bi=(mo,Ia)=>{const Na=O.getSymbolInstanceTextSize(qe,on,this.transform.zoom,Js),Zu=this.collisionIndex.placeCollisionBox(O,Na,mo,be,ye,Jr,new a.P(0,0),ot,de,Y,Ve.predicate);return Zu&&Zu.box&&Zu.box.length&&(this.markUsedOrientation(O,Ia,on),this.placedOrientations[ui]=Ia),Zu};ro(()=>Bi(Il,a.bL.horizontal),()=>{const mo=Un.verticalTextBox;return O.allowVerticalPlacement&&Ci>0&&mo?(hc(mo),Bi(mo,a.bL.vertical)):{box:null,offscreen:null,occluded:null}}),Fa(!!(rs&&rs.box&&rs.box.length))}}if(Za=rs,ts=Za&&Za.box&&Za.box.length>0,Ea=Za&&Za.offscreen,ua=Za&&Za.occluded,on.useRuntimeCollisionCircles){const Fa=on.centerJustifiedTextSymbolIndex>=0?on.centerJustifiedTextSymbolIndex:on.verticalPlacedTextSymbolIndex,ro=O.text.placedSymbolArray.get(Fa),Bi=a.bM(O.textSizeData,qe,ro),mo=z.get("text-padding");ka=this.collisionIndex.placeCollisionCircles(O,ot,ro,Fa,O.lineVertexArray,O.glyphOffsetArray,Bi,Y,Q,ce,b,Tt,Ve.predicate,on.collisionCircleDiameter*Bi/a.bY,mo,this.retainedQueryData[O.bucketInstanceId].tileID),ts=ot||ka.circles.length>0&&!ka.collisionDetected,Ea=Ea&&ka.offscreen,ua=ka.occluded}if(Un.iconFeatureIndex&&(zo=Un.iconFeatureIndex),Un.iconBox){const Fa=ro=>{hc(ro);const Bi=on.hasIconTextFit&&Hs?ko(Hs.x,Hs.y,vt,Tt,this.transform.angle):new a.P(0,0),mo=O.getSymbolInstanceIconSize(Ze,this.transform.zoom,on.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(O,mo,ro,be,ye,Dr,Bi,st,de,Y,Ve.predicate)};na&&na.box&&na.box.length&&Un.verticalIconBox?(zi=Fa(Un.verticalIconBox),ci=zi.box.length>0):(zi=Fa(Un.iconBox),ci=zi.box.length>0),Ea=Ea&&zi.offscreen,hi=zi.occluded}const au=ct||on.numHorizontalGlyphVertices===0&&Ci===0,Ku=ht||on.numIconVertices===0;if(au||Ku?Ku?au||(ci=ci&&ts):ts=ci&&ts:ci=ts=ci&&ts,ts&&Za&&Za.box&&this.collisionIndex.insertCollisionBox(Za.box,z.get("text-ignore-placement"),O.bucketInstanceId,na&&na.box&&Xl?Xl:Zc,Ve.ID),ci&&zi&&this.collisionIndex.insertCollisionBox(zi.box,z.get("icon-ignore-placement"),O.bucketInstanceId,zo,Ve.ID),ka&&(ts&&this.collisionIndex.insertCollisionCircles(ka.circles,z.get("text-ignore-placement"),O.bucketInstanceId,Zc,Ve.ID),b)){const Fa=O.bucketInstanceId;let ro=this.collisionCircleArrays[Fa];ro===void 0&&(ro=this.collisionCircleArrays[Fa]=new Zj);for(let Bi=0;Bi=0;--Js){const Un=on[Js];As(O.symbolInstances.get(Un),Un,O.collisionArrays[Un])}O.hasAnyZOffset&&a.w(`${O.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(O.hasAnyZOffset){const on=O.getSortedIndexesByZOffset();for(let Js=0;Js=0&&(d.text.placedSymbolArray.get(L).crossTileID=ce>=0&&L!==ce?0:Y),O>=0&&(d.text.placedSymbolArray.get(O).crossTileID=ce>=0&&O!==ce?0:Y),z>=0&&(d.text.placedSymbolArray.get(z).crossTileID=ce>=0&&z!==ce?0:Y),V>=0&&(d.text.placedSymbolArray.get(V).crossTileID=ce>=0&&V!==ce?0:Y)}markUsedOrientation(d,p,b){const M=p===a.bL.horizontal||p===a.bL.horizontalOnly?p:0,L=p===a.bL.vertical?p:0,{leftJustifiedTextSymbolIndex:O,centerJustifiedTextSymbolIndex:z,rightJustifiedTextSymbolIndex:V,verticalPlacedTextSymbolIndex:Y}=b,Q=d.text.placedSymbolArray;O>=0&&(Q.get(O).placedOrientation=M),z>=0&&(Q.get(z).placedOrientation=M),V>=0&&(Q.get(V).placedOrientation=M),Y>=0&&(Q.get(Y).placedOrientation=L)}commit(d){this.commitTime=d,this.zoomAtLastRecencyCheck=this.transform.zoom;const p=this.prevPlacement;let b=!1;this.prevZoomAdjustment=p?p.zoomAdjustment(this.transform.zoom):0;const M=p?p.symbolFadeChange(d):1,L=p?p.opacities:{},O=p?p.variableOffsets:{},z=p?p.placedOrientations:{};for(const V in this.placements){const Y=this.placements[V],Q=L[V];Q?(this.opacities[V]=new rf(Q,M,Y.text,Y.icon,null,Y.clipped),b=b||Y.text!==Q.text.placed||Y.icon!==Q.icon.placed):(this.opacities[V]=new rf(null,M,Y.text,Y.icon,Y.skipFade,Y.clipped),b=b||Y.text||Y.icon)}for(const V in L){const Y=L[V];if(!this.opacities[V]){const Q=new rf(Y,M,!1,!1);Q.isHidden()||(this.opacities[V]=Q,b=b||Y.text.placed||Y.icon.placed)}}for(const V in O)this.variableOffsets[V]||!this.opacities[V]||this.opacities[V].isHidden()||(this.variableOffsets[V]=O[V]);for(const V in z)this.placedOrientations[V]||!this.opacities[V]||this.opacities[V].isHidden()||(this.placedOrientations[V]=z[V]);b?this.lastPlacementChangeTime=d:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=p?p.lastPlacementChangeTime:d)}updateLayerOpacities(d,p,b,M){M&&(this.lastReplacementSourceUpdateTime=M.updateTime);const L=new Set;for(const O of p){const z=O.getBucket(d);z&&O.latestFeatureIndex&&d.fqid===z.layerIds[0]&&(this.updateBucketOpacities(z,L,O,O.collisionBoxArray,b,M,O.tileID,d.scope),z.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(z,O.tileID),z.elevationType==="road"&&z.updateRoadElevation(O.tileID.canonical),z.updateZOffset())}}updateBucketOpacities(d,p,b,M,L,O,z,V){d.hasTextData()&&d.text.opacityVertexArray.clear(),d.hasIconData()&&d.icon.opacityVertexArray.clear(),d.hasIconCollisionBoxData()&&d.iconCollisionBox.collisionVertexArray.clear(),d.hasTextCollisionBoxData()&&d.textCollisionBox.collisionVertexArray.clear();const Y=d.layers[0].layout,Q=d.layers[0].paint,ce=!!d.layers[0].dynamicFilter(),le=new rf(null,0,!1,!1,!0),de=Y.get("text-allow-overlap"),be=Y.get("icon-allow-overlap"),ye=Y.get("text-variable-anchor"),Oe=Y.get("text-rotation-alignment")==="map",Ee=Y.get("text-pitch-alignment")==="map",qe=Q.get("symbol-z-offset"),Ze=Y.get("symbol-elevation-reference")==="sea",Ve=!qe.isConstant(),gt=new rf(null,0,de&&(be||!d.hasIconData()||Y.get("icon-optional")),be&&(de||!d.hasTextData()||Y.get("text-optional")),!0);!d.collisionArrays&&M&&(d.hasIconCollisionBoxData()||d.hasTextCollisionBoxData())&&d.deserializeCollisionBoxes(M);const ct=(ot,st,vt)=>{for(let Pt=0;Pt0||Pt>0,Ar=qt>0,Ur=this.placedOrientations[Tt],Nr=Ur===a.bL.vertical,_r=Ur===a.bL.horizontal||Ur===a.bL.horizontalOnly;!ur&&!Ar||Ut.isHidden()||ht++;let nn=!1;if((ur||Ar)&&O)for(const Jr of d.activeReplacements){if(a.bZ(Jr,L,a.b_.Symbol,V)||Jr.min.x>Vt||Vt>Jr.max.x||Jr.min.y>nr||nr>Jr.max.y)continue;const Dr=a.b$(Vt,nr,z.canonical,Jr.footprintTileId.canonical);if(nn=a.c0(Dr,Jr.footprint),nn)break}if(ur){const Jr=nn?Dg:Hc(Ut.text);ct(d.text,vt,Nr?Dg:Jr),ct(d.text,Pt,_r?Dg:Jr);const Dr=Ut.text.isHidden(),{leftJustifiedTextSymbolIndex:qr,centerJustifiedTextSymbolIndex:wn,rightJustifiedTextSymbolIndex:Hn,verticalPlacedTextSymbolIndex:As}=st,ai=d.text.placedSymbolArray,on=Dr||Nr?1:0;qr>=0&&(ai.get(qr).hidden=on),wn>=0&&(ai.get(wn).hidden=on),Hn>=0&&(ai.get(Hn).hidden=on),As>=0&&(ai.get(As).hidden=Dr||_r?1:0);const Js=this.variableOffsets[Tt];Js&&this.markUsedJustification(d,Js.anchor,st,Ur);const Un=this.placedOrientations[Tt];Un&&(this.markUsedJustification(d,"left",st,Un),this.markUsedOrientation(d,Un,st))}if(Ar){const Jr=nn?Dg:Hc(Ut.icon),{placedIconSymbolIndex:Dr,verticalPlacedIconSymbolIndex:qr}=st,wn=d.icon.placedSymbolArray,Hn=Ut.icon.isHidden()?1:0;Dr>=0&&(ct(d.icon,qt,Nr?Dg:Jr),wn.get(Dr).hidden=Hn),qr>=0&&(ct(d.icon,st.numVerticalIconVertices,_r?Dg:Jr),wn.get(qr).hidden=Hn)}if(d.hasIconCollisionBoxData()||d.hasTextCollisionBoxData()){const Jr=d.collisionArrays[ot];if(Jr){let Dr=new a.P(0,0),qr=!0;if(Jr.textBox||Jr.verticalTextBox){if(ye){const Hn=this.variableOffsets[Tt];Hn?(Dr=cc(Hn.anchor,Hn.width,Hn.height,Hn.textOffset,Hn.textScale),Oe&&Dr._rotate(Ee?this.transform.angle:-this.transform.angle)):qr=!1}ce&&(qr=!Ut.clipped),Jr.textBox&&_m(d.textCollisionBox.collisionVertexArray,Ut.text.placed,!qr||Nr,St,Ze,Dr.x,Dr.y),Jr.verticalTextBox&&_m(d.textCollisionBox.collisionVertexArray,Ut.text.placed,!qr||_r,St,Ze,Dr.x,Dr.y)}const wn=qr&&!!(!_r&&Jr.verticalIconBox);Jr.iconBox&&_m(d.iconCollisionBox.collisionVertexArray,Ut.icon.placed,wn,St,Ze,st.hasIconTextFit?Dr.x:0,st.hasIconTextFit?Dr.y:0),Jr.verticalIconBox&&_m(d.iconCollisionBox.collisionVertexArray,Ut.icon.placed,!wn,St,Ze,st.hasIconTextFit?Dr.x:0,st.hasIconTextFit?Dr.y:0)}}}if(d.fullyClipped=ht===0,d.sortFeatures(this.transform.angle),this.retainedQueryData[d.bucketInstanceId]&&(this.retainedQueryData[d.bucketInstanceId].featureSortOrder=d.featureSortOrder),d.hasTextData()&&d.text.opacityVertexBuffer&&d.text.opacityVertexBuffer.updateData(d.text.opacityVertexArray),d.hasIconData()&&d.icon.opacityVertexBuffer&&d.icon.opacityVertexBuffer.updateData(d.icon.opacityVertexArray),d.hasIconCollisionBoxData()&&d.iconCollisionBox.collisionVertexBuffer&&d.iconCollisionBox.collisionVertexBuffer.updateData(d.iconCollisionBox.collisionVertexArray),d.hasTextCollisionBoxData()&&d.textCollisionBox.collisionVertexBuffer&&d.textCollisionBox.collisionVertexBuffer.updateData(d.textCollisionBox.collisionVertexArray),d.bucketInstanceId in this.collisionCircleArrays){const ot=this.collisionCircleArrays[d.bucketInstanceId];d.placementInvProjMatrix=ot.invProjMatrix,d.placementViewportMatrix=ot.viewportMatrix,d.collisionCircleArray=ot.circles,delete this.collisionCircleArrays[d.bucketInstanceId]}}symbolFadeChange(d){return this.fadeDuration===0?1:(d-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(d){return Math.max(0,(this.transform.zoom-d)/1.5)}hasTransitions(d){return this.stale||d-this.lastPlacementChangeTimed}isStale(){return this.stale}setStale(){this.stale=!0}}function _m(_,d,p,b,M,L,O){_.emplaceBack(d?1:0,p?1:0,L||0,O||0,b,M?1:0),_.emplaceBack(d?1:0,p?1:0,L||0,O||0,b,M?1:0),_.emplaceBack(d?1:0,p?1:0,L||0,O||0,b,M?1:0),_.emplaceBack(d?1:0,p?1:0,L||0,O||0,b,M?1:0)}const d3=Math.pow(2,25),G1=Math.pow(2,24),Yj=Math.pow(2,17),u3=Math.pow(2,16),Xj=Math.pow(2,9),Vc=Math.pow(2,8),ap=Math.pow(2,1);function Hc(_){if(_.opacity===0&&!_.placed)return 0;if(_.opacity===1&&_.placed)return 4294967295;const d=_.placed?1:0,p=Math.floor(127*_.opacity);return p*d3+d*G1+p*Yj+d*u3+p*Xj+d*Vc+p*ap+d}const Dg=0;class ax{constructor(d){this._sortAcrossTiles=d.layout.get("symbol-z-order")!=="viewport-y"&&d.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(d,p,b,M,L,O){const z=this._bucketParts;for(;this._currentTileIndexV.sortKey-Y.sortKey));this._currentPartIndex{const V=a.o.now()-O;return!this._forceFullPlacement&&V>2};for(;this._currentPlacementIndex>=0;){const V=p[d[this._currentPlacementIndex]],Y=this.placement.collisionIndex.transform.zoom;if(V.type==="symbol"&&V.visibility!=="none"&&(!V.minzoom||V.minzoom<=Y)&&(!V.maxzoom||V.maxzoom>Y)){const Q=V,ce=Q.layout.get("symbol-z-elevate"),le=Q.layout.get("symbol-sort-key").constantOr(1)!==void 0,de=Q.layout.get("symbol-z-order"),be=de==="viewport-y"||de==="auto"&&!(de!=="viewport-y"&&le),ye=Q.layout.get("text-allow-overlap")||Q.layout.get("icon-allow-overlap")||Q.layout.get("text-ignore-placement")||Q.layout.get("icon-ignore-placement"),Oe=be&&ye,Ee=this._inProgressLayer=this._inProgressLayer||new ax(Q),qe=a.B(V.source,V.scope);if(Ee.continuePlacement(ce||Oe?M[qe]:b[qe],this.placement,this._showCollisionBoxes,V,z,L))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(d){return this.placement.commit(d),this.placement}}const Uu=512/a.al/2;class op{constructor(d,p,b){this.tileID=d,this.bucketInstanceId=b,this.index=new a.c4(p.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const M=d.canonical.x*a.al,L=d.canonical.y*a.al;for(let O=0;OOe-Ee);for(const Oe of ye){const Ee=this.crossTileIDs[Oe];if(this.keys[Oe]===Q&&!b.has(Ee)){b.add(Ee),Y.crossTileID=Ee;break}}}}}class Jo{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class h3{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(d){const p=Math.round((d-this.lng)/360);if(p!==0)for(const b in this.indexes){const M=this.indexes[b],L={};for(const O in M){const z=M[O];z.tileID=z.tileID.unwrapTo(z.tileID.wrap+p),L[z.tileID.key]=z}this.indexes[b]=L}this.lng=d}addBucket(d,p,b){if(this.indexes[d.overscaledZ]&&this.indexes[d.overscaledZ][d.key]){if(this.indexes[d.overscaledZ][d.key].bucketInstanceId===p.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(d.overscaledZ,this.indexes[d.overscaledZ][d.key])}for(let L=0;Ld.overscaledZ)for(const z in O){const V=O[z];V.tileID.isChildOf(d)&&V.findMatches(p.symbolInstances,d,M)}else{const z=O[d.scaledTo(Number(L)).key];z&&z.findMatches(p.symbolInstances,d,M)}}for(let L=0;L{p[b]=!0});for(const b in this.layerIndexes)p[b]||delete this.layerIndexes[b]}}const nf=771;class Jn{constructor(d,p,b,M){this.blendFunction=d,this.blendColor=p.toNonPremultipliedRenderColor(null),this.mask=b,this.blendEquation=M}}Jn.Replace=[1,0,1,0],Jn.disabled=new Jn(Jn.Replace,a.ao.transparent,[!1,!1,!1,!1]),Jn.unblended=new Jn(Jn.Replace,a.ao.transparent,[!0,!0,!0,!0]),Jn.alphaBlended=new Jn([1,nf,1,nf],a.ao.transparent,[!0,!0,!0,!0]),Jn.alphaBlendedNonPremultiplied=new Jn([770,nf,770,nf],a.ao.transparent,[!0,!0,!0,!0]),Jn.multiply=new Jn([774,0,774,0],a.ao.transparent,[!0,!0,!0,!0]),Jn.additive=new Jn([1,1,1,1],a.ao.transparent,[!0,!0,!0,!0]);class cn{constructor(d,p,b){this.func=d,this.mask=p,this.range=b}}cn.ReadOnly=!1,cn.ReadWrite=!0,cn.disabled=new cn(519,cn.ReadOnly,[0,1]);const Qj=7680;class Fn{constructor(d,p,b,M,L,O){this.test=d,this.ref=p,this.mask=b,this.fail=M,this.depthFail=L,this.pass=O}}Fn.disabled=new Fn({func:519,mask:0},0,0,Qj,Qj,Qj);const ox=1029,Jj=2305;class Rn{constructor(d,p,b){this.enable=d,this.mode=p,this.frontFace=b}}function sf(_,d){const p=a.ca(_,3);a.cc(_,d),a.cg(_,3,p)}function f3(_,d){const p=a.c7([]);return a.c8(p,p,-d),a.c9(p,p,-_),p}function ek(_,d){const p=[_[0],_[1],0],b=[d[0],d[1],0];if(a.ag(p)>=1e-15){const O=a.aw([],p);a.c5(b,O,a.bJ(b,O)),d[0]=b[0],d[1]=b[1]}const M=a.bI([],d,_);if(a.c6(M)<1e-15)return null;const L=Math.atan2(-M[1],M[0]);return f3(Math.atan2(Math.sqrt(_[0]*_[0]+_[1]*_[1]),-_[2]),L)}Rn.disabled=new Rn(!1,ox,Jj),Rn.backCCW=new Rn(!0,ox,Jj),Rn.backCW=new Rn(!0,ox,2304),Rn.frontCW=new Rn(!0,1028,2304),Rn.frontCCW=new Rn(!0,1028,Jj);class Wc{constructor(d,p){this.position=d,this.orientation=p}get position(){return this._position}set position(d){if(d){const p=d instanceof a.ae?d:new a.ae(d[0],d[1],d[2]);this._renderWorldCopies&&(p.x=a.bT(p.x,0,1)),this._position=p}else this._position=null}lookAtPoint(d,p,b){if(this.orientation=null,!this.position)return;const M=this.position,L=b||(this._elevation?this._elevation.getAtPointOrZero(a.ae.fromLngLat(d)):0),O=a.ae.fromLngLat(d,L),z=[O.x-M.x,O.y-M.y,O.z-M.z];p||(p=[0,0,1]),p[2]=Math.abs(p[2]),this.orientation=ek(z,p)}setPitchBearing(d,p){this.orientation=f3(a.an(d),a.an(-p))}}class tk{constructor(d,p){this._transform=a.bA([]),this.orientation=p,this.position=d}get mercatorPosition(){const d=this.position;return new a.ae(d[0],d[1],d[2])}get position(){const d=a.ca(this._transform,3);return[d[0],d[1],d[2]]}set position(d){var p;d&&a.cg(this._transform,3,[(p=d)[0],p[1],p[2],1])}get orientation(){return this._orientation}set orientation(d){this._orientation=d||a.c7([]),d&&sf(this._transform,this._orientation)}getPitchBearing(){const d=this.forward(),p=this.right();return{bearing:Math.atan2(-p[1],p[0]),pitch:Math.atan2(Math.sqrt(d[0]*d[0]+d[1]*d[1]),-d[2])}}setPitchBearing(d,p){this._orientation=f3(d,p),sf(this._transform,this._orientation)}forward(){const d=a.ca(this._transform,2);return[-d[0],-d[1],-d[2]]}up(){const d=a.ca(this._transform,1);return[-d[0],-d[1],-d[2]]}right(){const d=a.ca(this._transform,0);return[d[0],d[1],d[2]]}getCameraToWorld(d,p){const b=new Float64Array(16);return a.bl(b,this.getWorldToCamera(d,p)),b}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(d,p,b){const M=this.position;a.c5(M,M,-d);const L=new Float64Array(16);return a.bq(L,[b,b,b]),a.br(L,L,M),L[10]*=p,L}getWorldToCamera(d,p){const b=new Float64Array(16),M=new Float64Array(4),L=this.position;return a.cb(M,this._orientation),a.c5(L,L,-d),a.cc(b,M),a.br(b,b,L),b[1]*=-1,b[5]*=-1,b[9]*=-1,b[13]*=-1,b[8]*=p,b[9]*=p,b[10]*=p,b[11]*=p,b}getCameraToClipPerspective(d,p,b,M){const L=new Float64Array(16);return a.cd(L,d,p,b,M),L}getCameraToClipOrthographic(d,p,b,M,L,O){const z=new Float64Array(16);return a.ce(z,d,p,b,M,L,O),z}getDistanceToElevation(d,p=!1){const b=d===0?0:a.cf(d,p?a.a$(this.position[1]):this.position[1]),M=this.forward();return(b-this.position[2])/M[2]}clone(){return new tk([...this.position],[...this.orientation])}}const bl={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,LUT:10,ShadowMap0:11};class rk{constructor(d=0,p=0,b=0,M=0){if(isNaN(d)||d<0||isNaN(p)||p<0||isNaN(b)||b<0||isNaN(M)||M<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=d,this.bottom=p,this.left=b,this.right=M}interpolate(d,p,b){return p.top!=null&&d.top!=null&&(this.top=a.ak(d.top,p.top,b)),p.bottom!=null&&d.bottom!=null&&(this.bottom=a.ak(d.bottom,p.bottom,b)),p.left!=null&&d.left!=null&&(this.left=a.ak(d.left,p.left,b)),p.right!=null&&d.right!=null&&(this.right=a.ak(d.right,p.right,b)),this}getCenter(d,p){const b=a.aA((this.left+d-this.right)/2,0,d),M=a.aA((this.top+p-this.bottom)/2,0,p);return new a.P(b,M)}equals(d){return this.top===d.top&&this.bottom===d.bottom&&this.left===d.left&&this.right===d.right}clone(){return new rk(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const _h=15;class p3{constructor(d,p,b,M,L,O,z){this.tileSize=512,this._renderWorldCopies=L===void 0||L,this._minZoom=d||0,this._maxZoom=p||22,this._minPitch=b??0,this._maxPitch=M??60,this.setProjection(O),this.setMaxBounds(z),this.width=0,this.height=0,this._center=new a.aT(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new rk,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new tk,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._tileCoverLift=0,this.freezeTileCoverage=!1,this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1,this._allowWorldUnderZoom=!1}clone(){const d=new p3(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection(),this.maxBounds);return d._elevation=this._elevation,d._centerAltitude=this._centerAltitude,d._centerAltitudeValidForExaggeration=this._centerAltitudeValidForExaggeration,d.tileSize=this.tileSize,d.mercatorFromTransition=this.mercatorFromTransition,d.width=this.width,d.height=this.height,d.cameraElevationReference=this.cameraElevationReference,d._center=this._center,d._setZoom(this.zoom),d._seaLevelZoom=this._seaLevelZoom,d.angle=this.angle,d._fov=this._fov,d._pitch=this._pitch,d._nearZ=this._nearZ,d._farZ=this._farZ,d._averageElevation=this._averageElevation,d._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,d._unmodified=this._unmodified,d._edgeInsets=this._edgeInsets.clone(),d._camera=this._camera.clone(),d._calcMatrices(),d.freezeTileCoverage=this.freezeTileCoverage,d.frustumCorners=this.frustumCorners,d._allowWorldUnderZoom=this._allowWorldUnderZoom,d}get isOrthographic(){return this.projection.name!=="globe"&&this._orthographicProjectionAtLowPitch&&this.pitch<_h}get elevation(){return this._elevation}set elevation(d){this._elevation!==d&&(this._elevation=d,this._updateCameraOnTerrain(),this._calcMatrices())}get depthOcclusionForSymbolsAndCircles(){return this.projection.name!=="globe"&&!this.isOrthographic}updateElevation(d,p=!1){const b=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForExaggeration;(this._seaLevelZoom==null||b)&&this._updateCameraOnTerrain(),(d||b)&&this._constrainCamera(p),this._calcMatrices()}getProjection(){return a.aH(this.projection,["name","center","parallels"])}setProjection(d){this.projectionOptions=d||{name:"mercator"};const p=this.projection?this.getProjection():void 0;this.projection=a.cm(this.projectionOptions);const b=this.getProjection(),M=!a.by(p,b);return M&&this._calcMatrices(),this.mercatorFromTransition=!1,M}setOrthographicProjectionAtLowPitch(d){return this._orthographicProjectionAtLowPitch!==d&&(this._orthographicProjectionAtLowPitch=d,this._calcMatrices(),!0)}setMercatorFromTransition(){const d=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=a.cm({name:"mercator"});const p=d!==this.projection.name;return p&&this._calcMatrices(),p}get minZoom(){return this._minZoom}set minZoom(d){this._minZoom!==d&&(this._minZoom=d,this.zoom=Math.max(this.zoom,d))}get maxZoom(){return this._maxZoom}set maxZoom(d){this._maxZoom!==d&&(this._maxZoom=d,this.zoom=Math.min(this.zoom,d))}get minPitch(){return this._minPitch}set minPitch(d){this._minPitch!==d&&(this._minPitch=d,this.pitch=Math.max(this.pitch,d))}get maxPitch(){return this._maxPitch}set maxPitch(d){this._maxPitch!==d&&(this._maxPitch=d,this.pitch=Math.min(this.pitch,d))}get renderWorldCopies(){return this._renderWorldCopies&&this.projection.supportsWorldCopies===!0}set renderWorldCopies(d){d===void 0?d=!0:d===null&&(d=!1),this._renderWorldCopies=d}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){const d=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(d))}get cameraWorldSize(){const d=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(d))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return a.cf(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new a.P(this.width,this.height)}get bearing(){return a.bT(this.rotation,-180,180)}set bearing(d){this.rotation=d}get rotation(){return-this.angle/Math.PI*180}set rotation(d){const p=-d*Math.PI/180;this.angle!==p&&(this._unmodified=!1,this.angle=p,this._calcMatrices(),this.rotationMatrix=a.cn(),a.co(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(d){const p=a.aA(d,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==p&&(this._unmodified=!1,this._pitch=p,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}set fov(d){d=Math.max(.01,Math.min(60,d)),this._fov!==d&&(this._unmodified=!1,this._fov=a.an(d),this._calcMatrices())}get fovX(){return this._fov}get fovY(){const d=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/d)}get averageElevation(){return this._averageElevation}set averageElevation(d){this._averageElevation=d,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(d){const p=Math.min(Math.max(d,this.minZoom),this.maxZoom);this._zoom!==p&&(this._unmodified=!1,this._setZoom(p),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(d){this._zoom=d,this.scale=this.zoomScale(d),this.tileZoom=Math.floor(d),this.zoomFraction=d-this.tileZoom}get tileCoverLift(){return this._tileCoverLift}set tileCoverLift(d){this._tileCoverLift!==d&&(this._tileCoverLift=d)}_updateCameraOnTerrain(){const d=this.elevation?this.elevation.getAtPoint(this.locationCoordinate(this.center),Number.NEGATIVE_INFINITY):Number.NEGATIVE_INFINITY,p=this.elevation&&d===Number.NEGATIVE_INFINITY&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>0&&this._centerAltitudeValidForExaggeration;if(!this._elevation||d===Number.NEGATIVE_INFINITY&&(!p||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const b=this._elevation;p||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&b.exaggeration()&&this._centerAltitudeValidForExaggeration!==b.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*b.exaggeration(),this._centerAltitudeValidForExaggeration=b.exaggeration()):(this._centerAltitude=d||0,this._centerAltitudeValidForExaggeration=b.exaggeration()),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){if(this._centerAltitudeValidForExaggeration===void 0)return;const d=Math.max(0,(this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize);this._seaLevelZoom=this._zoomFromMercatorZ(d)}sampleAverageElevation(){if(!this._elevation)return 0;const d=this._elevation,p=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],b=this.horizonLineFromTop();let M=0,L=0;for(let O=0;O{const Oe=a.cY(le,ce,de,be,ye);V.has(Oe)||(L.push(new a.aQ(ce,le,de,be,ye)),V.add(Oe))};for(let ce=0;cele.canonical.z)continue;const de=le.canonical,be=le.overscaledZ,ye=le.wrap,Oe=1<0,Ze=de.y+10,gt=le.wrap-(qe?0:1),ct=le.wrap+(Ee?0:1),ht=qe?de.x-1:Oe-1,ot=Ee?de.x+1:0;if(O)b[0]<0?(Y(be,ct,de.z,ot,de.y),b[1]<0&&Ze&&(Y(be,ye,de.z,de.x,de.y+1),Y(be,ct,de.z,ot,de.y+1)),b[1]>0&&Ve&&(Y(be,ye,de.z,de.x,de.y-1),Y(be,ct,de.z,ot,de.y-1))):b[0]>0?(Y(be,gt,de.z,ht,de.y),b[1]<0&&Ze&&(Y(be,ye,de.z,de.x,de.y+1),Y(be,gt,de.z,ht,de.y+1)),b[1]>0&&Ve&&(Y(be,ye,de.z,de.x,de.y-1),Y(be,gt,de.z,ht,de.y-1))):b[1]<0&&Ze?Y(be,ye,de.z,de.x,de.y+1):Ve&&Y(be,ye,de.z,de.x,de.y-1);else{const st=le.visibleQuadrants;1&st&&(Y(be,gt,de.z,ht,de.y),Ve&&(Y(be,ye,de.z,de.x,de.y-1),Y(be,gt,de.z,ht,de.y-1))),2&st&&(Y(be,ct,de.z,ot,de.y),Ve&&(Y(be,ye,de.z,de.x,de.y-1),Y(be,ct,de.z,ot,de.y-1))),4&st&&(Y(be,gt,de.z,ht,de.y),Ze&&(Y(be,ye,de.z,de.x,de.y+1),Y(be,gt,de.z,ht,de.y+1))),8&st&&(Y(be,ct,de.z,ot,de.y),Ze&&(Y(be,ye,de.z,de.x,de.y+1),Y(be,ct,de.z,ot,de.y+1)))}}const Q=[];for(const ce of L)L.some(le=>ce.isChildOf(le))||Q.push(ce);if(L=Q.filter(ce=>!d.some(le=>!!(ce.overscaledZ{const Ee=Oe.canonical.x+.5-de[0],qe=Oe.canonical.y+.5-de[1];return Ee*Ee+qe*qe{const ht=a.cY(Ze,qe,Ve,gt,ct);L.has(ht)||(M.push(new a.aQ(qe,Ze,Ve,gt,ct)),L.add(ht))},z=d.reduce((qe,Ze)=>Math.max(qe,Ze.overscaledZ),b),V=1<{const Ve=Math.floor(qe[0]),gt=Math.floor(qe[1]),ct=(qe[0]-Ve)*a.al,ht=(qe[1]-gt)*a.al,ot=Math.floor(Ze[0]),st=Math.floor(Ze[1]),vt=(Ze[0]-ot)*a.al,Pt=(Ze[1]-st)*a.al;for(let Tt=-1;Tt<=1;Tt++){const qt=Ve+Tt;if(!(qt<0||qt>=V)){Q.x=ct-Tt*a.al,ce.x=vt-(qt-ot)*a.al;for(let Vt=-1;Vt<=1;Vt++){const nr=gt+Vt;Q.y=ht-Vt*a.al,ce.y=Pt-(nr-st)*a.al,a.cZ(Q,ce,Y)&&O(z,0,b,qt,nr)}}}},de=p.points,be=de[a.cv],ye=de[a.cw],Oe=this._projectToGround(be,de[a.cx]),Ee=this._projectToGround(ye,de[a.cy]);return le(be,Oe),le(ye,Ee),M}_projectToGround(d,p){return a.cz(a.cA(),d,p,d[2]/(d[2]-p[2]))}coveringTiles(d){let p=this.coveringZoomLevel(d);const b=p,M=this.elevation&&this.elevation.exaggeration(),L=M&&!d.isTerrainDEM,O=this.projection.name==="mercator";if(d.minzoom!==void 0&&pd.maxzoom&&(p=d.maxzoom);const z=this.locationCoordinate(this.center),V=this.center.lat,Y=1<{const Ut=new a.ae(St.x+25e-6,St.y,St.z),ur=new a.ae(St.x,St.y+25e-6,St.z),Ar=St.toLngLat(),Ur=Ut.toLngLat(),Nr=ur.toLngLat(),_r=this.locationCoordinate(Ar),nn=this.locationCoordinate(Ur),Jr=this.locationCoordinate(Nr),Dr=Math.hypot(nn.x-_r.x,nn.y-_r.y),qr=Math.hypot(Jr.x-_r.x,Jr.y-_r.y);return Math.sqrt(Dr*qr)*ht/25e-6},st=St=>{const Kt=gt,Ut=ct;return{aabb:a.cF(this,Y,0,0,0,St,Ut,Kt,this.projection),zoom:0,x:0,y:0,minZ:Ut,maxZ:Kt,wrap:St,fullyVisible:!1}},vt=[];let Pt=[];const Tt=p,qt=d.reparseOverscaled?b:p,Vt=(Oe-this._centerAltitude)*ye,nr=St=>{if(!this._elevation||!St.tileID||!O)return;const Kt=this._elevation.getMinMaxForTile(St.tileID),Ut=St.aabb;Kt?(Ut.min[2]=Kt.min,Ut.max[2]=Kt.max,Ut.center[2]=(Ut.min[2]+Ut.max[2])/2):(St.shouldSplit=Ft(St),St.shouldSplit||(Ut.min[2]=Ut.max[2]=Ut.center[2]=this._centerAltitude))},vr=(St,Kt)=>{if(.707*Kt{if(St.zoom=.9)return!0}else if(L&&(ur=St.aabb.distanceZ(Ee)*ye),this.projection.isReprojectedInTileSpace&&b<=5){const qr=Math.pow(2,St.zoom),wn=ot(new a.ae((St.x+.5)/qr,(St.y+.5)/qr));Ar=wn>.85?1:wn}if(!O&&!ce){const qr=Math.sqrt(Kt*Kt+Ut*Ut+ur*ur);let wn=(1<0;){const St=vt.pop(),Kt=St.x,Ut=St.y;let ur=St.fullyVisible;const Ar=()=>this.projection.name==="globe"&&(St.y===0||St.y===(1<>1),nn={aabb:O?St.aabb.quadrant(Ur):a.cF(this,Y,St.zoom+1,Nr,_r,St.wrap,St.minZ,St.maxZ,this.projection),zoom:St.zoom+1,x:Nr,y:_r,wrap:St.wrap,fullyVisible:ur,tileID:void 0,shouldSplit:void 0,minZ:St.minZ,maxZ:St.maxZ};L&&!ce&&(nn.tileID=new a.aQ(St.zoom+1===Tt?qt:St.zoom+1,St.wrap,St.zoom+1,Nr,_r),nr(nn)),vt.push(nn)}else{const Ur=St.zoom===Tt?qt:St.zoom;if(d.minzoom&&d.minzoom>Ur)continue;let Nr=0;if(!ur){let Dr=qe?St.aabb.intersectsPrecise(de):St.aabb.intersectsPreciseFlat(de);if(Dr===0&&Ar()){const qr=new a.cD(St.zoom,Kt,Ut);Dr=a.cE(this,Y,qr,!0).intersectsPrecise(de)}if(Dr===0)continue;if(d.calculateQuadrantVisibility)if(de.containsPoint(St.aabb.center))Nr=15;else for(let qr=0;qr<4;qr++)St.aabb.quadrant(qr).intersects(de)!==0&&(Nr|=1<{const ur=[0,0,0,1],Ar=[a.al,a.al,0,1],Ur=this.calculateFogTileMatrix(Ut.tileID.toUnwrapped());a.aC(ur,ur,Ur),a.aC(Ar,Ar,Ur);const Nr=a.cG([],ur,Ar),_r=a.cH([],ur,Ar),nn=a.c$(Nr,_r);if(nn===0)return!0;let Jr=!1;const Dr=this._elevation;if(Dr&&nn>St&&Kt!==0){const qr=this.calculateProjMatrix(Ut.tileID.toUnwrapped());let wn;d.isTerrainDEM||(wn=Dr.getMinMaxForTile(Ut.tileID)),wn||(wn={min:ct,max:gt});const Hn=a.cI(this.rotation),As=[Hn[0]*a.al,Hn[1]*a.al,wn.max];a.af(As,As,qr),Jr=(1-As[1])*this.height*.5St.distanceSq-Kt.distanceSq).map(St=>St.tileID)}resize(d,p){this.width=d,this.height=p,this.pixelsToGLUnits=[2/d,-2/p],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(d){return Math.pow(2,d)}scaleZoom(d){return Math.log2(d)}project(d){const p=a.aA(d.lat,-a.cJ,a.cJ),b=this.projection.project(d.lng,p);return new a.P(b.x*this.worldSize,b.y*this.worldSize)}unproject(d){return this.projection.unproject(d.x/this.worldSize,d.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/a.cf(1,this.center.lat)/this.worldSize}setLocationAtPoint(d,p){let b,M;const L=this.centerPoint;if(this.projection.name==="globe"){const z=this.worldSize;b=(p.x-L.x)/z,M=(p.y-L.y)/z}else{const z=this.pointCoordinate(p),V=this.pointCoordinate(L);b=z.x-V.x,M=z.y-V.y}const O=this.locationCoordinate(d);this.setLocation(new a.ae(O.x-b,O.y-M))}setLocation(d){this.center=this.coordinateLocation(d),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(d,p){return this.projection.locationPoint(this,d,p)}locationPoint3D(d,p){return this.projection.locationPoint(this,d,p,!0)}pointLocation(d){return this.coordinateLocation(this.pointCoordinate(d))}pointLocation3D(d,p){return this.coordinateLocation(this.pointCoordinate3D(d,p))}locationCoordinate(d,p){const b=p?a.cf(p,d.lat):void 0,M=this.projection.project(d.lng,d.lat);return new a.ae(M.x,M.y,b)}coordinateLocation(d){return this.projection.unproject(d.x,d.y)}pointRayIntersection(d,p){const b=p??this._centerAltitude,M=[d.x,d.y,0,1],L=[d.x,d.y,1,1];a.aC(M,M,this.pixelMatrixInverse),a.aC(L,L,this.pixelMatrixInverse);const O=L[3];a.cK(M,M,1/M[3]),a.cK(L,L,1/O);const z=M[2],V=L[2];return{p0:M,p1:L,t:z===V?0:(b-z)/(V-z)}}screenPointToMercatorRay(d){const p=[d.x,d.y,0,1],b=[d.x,d.y,1,1];return a.aC(p,p,this.pixelMatrixInverse),a.aC(b,b,this.pixelMatrixInverse),a.cK(p,p,1/p[3]),a.cK(b,b,1/b[3]),p[2]=a.cf(p[2],this._center.lat)*this.worldSize,b[2]=a.cf(b[2],this._center.lat)*this.worldSize,a.cK(p,p,1/this.worldSize),a.cK(b,b,1/this.worldSize),new a.ax([p[0],p[1],p[2]],a.aw([],a.av([],b,p)))}rayIntersectionCoordinate(d){const{p0:p,p1:b,t:M}=d,L=a.cf(p[2],this._center.lat),O=a.cf(b[2],this._center.lat);return new a.ae(a.ak(p[0],b[0],M)/this.worldSize,a.ak(p[1],b[1],M)/this.worldSize,a.ak(L,O,M))}pointCoordinate(d,p=this._centerAltitude){return this.projection.pointCoordinate(this,d.x,d.y,p)}pointCoordinate3D(d,p){if(!this.elevation)return this.pointCoordinate(d,p);let b=this.projection.pointCoordinate3D(this,d.x,d.y);if(b)return new a.ae(b[0],b[1],b[2]);let M=0,L=this.horizonLineFromTop();if(d.y>L)return this.pointCoordinate(d,p);const O=.02*L,z=d.clone();for(let V=0;V<10&&L-M>O;V++){z.y=a.ak(M,L,.66);const Y=this.projection.pointCoordinate3D(this,z.x,z.y);Y?(L=z.y,b=Y):M=z.y}return b?new a.ae(b[0],b[1],b[2]):this.pointCoordinate(d)}isPointAboveHorizon(d){return this.projection.isPointAboveHorizon(this,d)}isPointOnSurface(d){if(d.y<0||d.y>this.height||d.x<0||d.x>this.width)return!1;if(this.elevation||this.zoom>=a.cL)return!this.isPointAboveHorizon(d);const p=this.pointCoordinate(d);return p.y>=0&&p.y<=1}_coordinatePoint(d,p){const b=p&&this.elevation?this.elevation.getAtPointOrZero(d,this._centerAltitude):this._centerAltitude,M=[d.x*this.worldSize,d.y*this.worldSize,b+d.toAltitude(),1];return a.aC(M,M,this.pixelMatrix),M[3]>0?new a.P(M[0]/M[3],M[1]/M[3]):new a.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:d,left:p}=this._edgeInsets,b=this.height-this._edgeInsets.bottom,M=this.width-this._edgeInsets.right,L=this.pointLocation3D(new a.P(p,d)),O=this.pointLocation3D(new a.P(M,d)),z=this.pointLocation3D(new a.P(M,b)),V=this.pointLocation3D(new a.P(p,b));let Y=Math.min(L.lng,O.lng,z.lng,V.lng),Q=Math.max(L.lng,O.lng,z.lng,V.lng),ce=Math.min(L.lat,O.lat,z.lat,V.lat),le=Math.max(L.lat,O.lat,z.lat,V.lat);const de=Math.pow(2,-this.zoom)/16*270,be=this.projection.name==="globe"?1:4,ye=(Oe,Ee,qe,Ze,Ve)=>{const gt=(Oe+qe)/2,ct=(Ee+Ze)/2,ht=new a.P(gt,ct),{lng:ot,lat:st}=this.pointLocation3D(ht),vt=Math.max(0,Y-ot,ce-st,ot-Q,st-le);Y=Math.min(Y,ot),Q=Math.max(Q,ot),ce=Math.min(ce,st),le=Math.max(le,st),(Vede)&&(ye(Oe,Ee,gt,ct,Ve+1),ye(gt,ct,qe,Ze,Ve+1))};if(ye(p,d,M,d,1),ye(M,d,M,b,1),ye(M,b,p,b,1),ye(p,b,p,d,1),this.projection.name==="globe"){const[Oe,Ee]=a.cM(this);Oe?(le=90,Q=180,Y=-180):Ee&&(ce=-90,Q=180,Y=-180)}return new a.aI(new a.aT(Y,ce),new a.aT(Q,le))}_getBoundsRectangular(d,p){const{top:b,left:M}=this._edgeInsets,L=this.height-this._edgeInsets.bottom,O=this.width-this._edgeInsets.right,z=new a.P(M,b),V=new a.P(O,b),Y=new a.P(O,L),Q=new a.P(M,L);let ce=this.pointCoordinate(z,d),le=this.pointCoordinate(V,d);const de=this.pointCoordinate(Y,p),be=this.pointCoordinate(Q,p),ye=(Oe,Ee)=>(Ee.y-Oe.y)/(Ee.x-Oe.x);return ce.y>1&&le.y>=0?ce=new a.ae((1-be.y)/ye(be,ce)+be.x,1):ce.y<0&&le.y<=1&&(ce=new a.ae(-be.y/ye(be,ce)+be.x,0)),le.y>1&&ce.y>=0?le=new a.ae((1-de.y)/ye(de,le)+de.x,1):le.y<0&&ce.y<=1&&(le=new a.ae(-de.y/ye(de,le)+de.x,0)),new a.aI().extend(this.coordinateLocation(ce)).extend(this.coordinateLocation(le)).extend(this.coordinateLocation(be)).extend(this.coordinateLocation(de))}_getBoundsRectangularTerrain(){const d=this.elevation;if(!d.visibleDemTiles.length||d.isUsingMockSource())return this._getBoundsRectangular(0,0);const p=d.visibleDemTiles.reduce((b,M)=>{if(M.dem){const L=M.dem.tree;b.min=Math.min(b.min,L.minimums[0]),b.max=Math.max(b.max,L.maximums[0])}return b},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(p.min*d.exaggeration(),p.max*d.exaggeration())}getBounds(){return this.projection.name==="mercator"||this.projection.name==="equirectangular"?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(d=!0){const p=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,b=this.height/2-p*(1-this._horizonShift);return d?Math.max(0,b):b}getMaxBounds(){return this.maxBounds}setMaxBounds(d){this.maxBounds=d,this.minLat=-a.cJ,this.maxLat=a.cJ,this.minLng=-180,this.maxLng=180,d&&(this.minLat=d.getSouth(),this.maxLat=d.getNorth(),this.minLng=d.getWest(),this.maxLng=d.getEast(),this.maxLngce&&(z=ce-Y),ce-Qde&&(O=de-V),de-le{for(let Ft=0;Ft<16;Ft++)qt[Ft]=a.ak(Vt[Ft],nr[Ft],vr)})(z,z,V,a.d0(this.pitch>=_h?1:this.pitch/_h))}else z=V;const Y=a.cP([],V,O);let Q=a.cP([],z,O);if(this.projection.isReprojectedInTileSpace){const st=this.locationCoordinate(this.center),vt=a.bA([]);a.br(vt,vt,[st.x*this.worldSize,st.y*this.worldSize,0]),a.aB(vt,vt,a.cQ(this)),a.br(vt,vt,[-st.x*this.worldSize,-st.y*this.worldSize,0]),a.aB(Q,Q,vt),a.aB(Y,Y,vt),this.inverseAdjustmentMatrix=a.cR(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=a.cS([],Q,[this.worldSize,this.worldSize,this.worldSize/L,1]),this.projMatrix=Q,this.invProjMatrix=a.bl(new Float64Array(16),this.projMatrix),p){const st=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);st[8]=2*-d.x/this.width,st[9]=2*d.y/this.height,this.expandedFarZProjMatrix=a.cP([],st,O)}else this.expandedFarZProjMatrix=this.projMatrix;const ce=a.bl([],z);this.frustumCorners=a.cT.fromInvProjectionMatrix(ce,this.horizonLineFromTop(),this.height),this.cameraFrustum=a.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!p);const le=new Float32Array(16);a.bA(le),a.cS(le,le,[1,-1,1]),a.cU(le,le,this._pitch),a.bB(le,le,this.angle);const de=a.cd(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=a.bz(de);const be=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;de[8]=2*-d.x/this.width,de[9]=2*(d.y+be)/this.height,this.skyboxMatrix=a.aB(le,de,le);const ye=this.point,Oe=ye.x,Ee=ye.y,qe=this.width%2/2,Ze=this.height%2/2,Ve=Math.cos(this.angle),gt=Math.sin(this.angle),ct=Oe-Math.round(Oe)+Ve*qe+gt*Ze,ht=Ee-Math.round(Ee)+Ve*Ze+gt*qe,ot=new Float64Array(Q);if(a.br(ot,ot,[ct>.5?ct-1:ct,ht>.5?ht-1:ht,0]),this.alignedProjMatrix=ot,Q=a.bC(),a.cS(Q,Q,[this.width/2,-this.height/2,1]),a.br(Q,Q,[1,-1,0]),this.labelPlaneMatrix=Q,Q=a.bC(),a.cS(Q,Q,[1,-1,1]),a.br(Q,Q,[-1,-1,0]),a.cS(Q,Q,[2/this.width,2/this.height,1]),this.glCoordMatrix=Q,this.pixelMatrix=a.aB(new Float64Array(16),this.labelPlaneMatrix,Y),this._calcFogMatrices(),this._distanceTileDataCache={},Q=a.bl(new Float64Array(16),this.pixelMatrix),!Q)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=Q,this.projection.name==="globe"||this.mercatorFromTransition){this.globeMatrix=a.cV(this);const st=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=a.af(st,st,O),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=Q;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const d=this.cameraWorldSizeForFog,p=this.cameraPixelsPerMeter,b=this._camera.position,M=1/this.height/this._pixelsPerMercatorPixel,L=[d,d,p];a.c5(L,L,M),a.c5(b,b,-1),a.cW(b,b,L);const O=a.bC();a.br(O,O,b),a.cS(O,O,L),this.mercatorFogMatrix=O,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(d,p,M)}_computeCameraPosition(d){const p=(d=d||this.pixelsPerMeter)/this.pixelsPerMeter,b=this._camera.forward(),M=this.point,L=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*p-d/this.worldSize*this._centerAltitude;return[M.x/this.worldSize-b[0]*L,M.y/this.worldSize-b[1]*L,d/this.worldSize*this._centerAltitude-b[2]*L]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(d){const p=this._maxCameraBoundsDistance()*Math.cos(this._pitch),b=this._camera.position[2],M=d[2];let L=1;this.projection.wrap&&(this.center=this.center.wrap()),M>0&&(L=Math.min((p-b)/M,1)),this._camera.position=a.bH([],this._camera.position,d,L),this._updateStateFromCamera()}_updateStateFromCamera(){const d=this._camera.position,p=this._camera.forward(),{pitch:b,bearing:M}=this._camera.getPitchBearing(),L=a.cf(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,O=this._mercatorZfromZoom(this._maxZoom)*Math.cos(a.an(this._maxPitch)),z=Math.max((d[2]-L)/Math.cos(b),O),V=this._zoomFromMercatorZ(z);a.bH(d,d,p,z),this._pitch=a.aA(b,a.an(this.minPitch),a.an(this.maxPitch)),this.angle=a.bT(M,-Math.PI,Math.PI),this._setZoom(a.aA(V,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new a.ae(d[0],d[1],d[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(d){return Math.pow(2,d)*this.tileSize}_mercatorZfromZoom(d){return this.cameraToCenterDistance/this._worldSizeFromZoom(d)}_minimumHeightOverTerrain(){const d=Math.min(this._seaLevelZoom!=null?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(d)}_zoomFromMercatorZ(d){return this.scaleZoom(this.cameraToCenterDistance/(Math.max(0,d)*this.tileSize))}zoomFromMercatorZAdjusted(d){let p=0,b=a.cL,M=0,L=1/0;for(;b-p>1e-6&&b>p;){const O=p+.5*(b-p),z=this.tileSize*Math.pow(2,O),V=this.getCameraToCenterDistance(this.projection,O,z),Y=this.scaleZoom(V/(Math.max(0,d)*this.tileSize)),Q=Math.abs(O-Y);QY||le.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+a.cX(this.fovAboveCenter)>88||this.anyCornerOffEdge(new a.P(0,0),new a.P(this.width,this.height))}zoomDeltaToMovement(d,p){const b=a.ag(a.av([],this._camera.position,d)),M=this._zoomFromMercatorZ(b)+p;return b-this._mercatorZfromZoom(M)}getCameraPoint(){if(this.projection.name==="globe"){const d=function([p,b,M],L){const O=[p,b,M,1];a.aC(O,O,L);const z=O[3]=Math.max(O[3],1e-6);return O[0]/=z,O[1]/=z,O[2]/=z,O}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new a.P(d[0],d[1])}{const d=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new a.P(0,d))}}getCameraToCenterDistance(d,p=this.zoom,b=this.worldSize){const M=a.cO(d,p,this.width,this.height,1024),L=d.pixelSpaceConversion(this.center.lat,b,M);let O=.5/Math.tan(.5*this._fov)*this.height*L;return this.isOrthographic&&(O=a.ak(1,O,a.d0(this.pitch>=_h?1:this.pitch/_h))),O}getWorldToCameraMatrix(){const d=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?this.pixelsPerMeter:1);return this.projection.name==="globe"&&a.aB(d,d,this.globeMatrix),d}getFrustum(d){return a.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,d,this.projection.zAxisUnit==="meters")}}const bm=(_,d)=>{if(d>0&&_.terrain&&a.w("Cutoff is currently disabled on terrain"),d<=0||_.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const p=_.transform,b=Math.max(Math.abs(p._zoom-(_.minCutoffZoom-1)),1),M=p.isLODDisabled(!1)?a.ah(60,45,p.pitch):a.ah(30,15,p.pitch),L=p._farZ-p._nearZ,O=d*p.height,z=((1-(V=M))*p.cameraToCenterDistance+V*(p._farZ+O))*b;var V;return{shouldRenderCutoff:M<1,uniformValues:{u_cutoff_params:[p._nearZ,p._farZ,(z-p._nearZ)/L,(z-O-p._nearZ)/L]}}},qu=2048;class K1{constructor(d,p){this.aabb=d,this.lastCascade=p}}class Oie{add(d,p){const b=this.receivers[d.key];b!==void 0?(b.aabb.min[0]=Math.min(b.aabb.min[0],p.min[0]),b.aabb.min[1]=Math.min(b.aabb.min[1],p.min[1]),b.aabb.min[2]=Math.min(b.aabb.min[2],p.min[2]),b.aabb.max[0]=Math.max(b.aabb.max[0],p.max[0]),b.aabb.max[1]=Math.max(b.aabb.max[1],p.max[1]),b.aabb.max[2]=Math.max(b.aabb.max[2],p.max[2])):this.receivers[d.key]=new K1(p,null)}clear(){this.receivers={}}get(d){return this.receivers[d.key]}computeRequiredCascades(d,p,b){const M=a.d9.fromPoints(d.points);let L=0;for(const O in this.receivers){const z=this.receivers[O];if(!z||!M.intersectsAabb(z.aabb))continue;z.aabb.min=M.closestPoint(z.aabb.min),z.aabb.max=M.closestPoint(z.aabb.max);const V=z.aabb.getCorners();for(let Y=0;Y1||le[1]<-1||le[1]>1){Q=!1;break}}if(z.lastCascade=Y,L=Math.max(L,Y),Q)break}}return L+1}}class lx{constructor(d){this.painter=d,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new Oie,this._depthMode=new cn(d.context.gl.LEQUAL,cn.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this.useNormalOffset=!1}destroy(){for(const d of this._cascades)d.texture.destroy(),d.framebuffer.destroy();this._cascades=[]}updateShadowParameters(d,p){const b=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!p||!p.properties)return;const M=p.properties.get("shadow-intensity");if(!p.shadowsEnabled()||M<=0||(this._shadowLayerCount=b.style.order.reduce((be,ye)=>{const Oe=b.style._mergedLayers[ye];return be+(Oe.hasShadowPass()&&!Oe.isHidden(d.zoom)?1:0)},0),this._enabled=this._shadowLayerCount>0,!this.enabled))return;const L=b.context,O=qu,z=qu;if(this._cascades.length===0||qu!==this._cascades[0].texture.size[0]){this._cascades=[];for(let be=0;be<2;++be){const ye=b._shadowMapDebug,Oe=L.gl,Ee=L.createFramebuffer(O,z,ye?1:0,"texture"),qe=new a.T(L,{width:O,height:z,data:null},Oe.DEPTH_COMPONENT16);if(Ee.depthAttachment.set(qe.texture),ye){const Ze=new a.T(L,{width:O,height:z,data:null},Oe.RGBA8);Ee.colorAttachment0.set(Ze.texture)}this._cascades.push({framebuffer:Ee,texture:qe,matrix:[],far:0,boundingSphereRadius:0,frustum:new a.cB,scale:0})}}this.shadowDirection=Y1(p);let V=0;if(d.elevation){const be=d.elevation,ye=[1e4,-1e4];be.visibleDemTiles.filter(Oe=>Oe.dem).forEach(Oe=>{const Ee=Oe.dem.tree;ye[0]=Math.min(ye[0],Ee.minimums[0]),ye[1]=Math.max(ye[1],Ee.maximums[0])}),ye[0]!==1e4&&(V=(ye[1]-ye[0])*be.exaggeration())}const Y=1.5*d.cameraToCenterDistance,Q=3*Y,ce=new Float64Array(16);for(let be=0;be=0)return{};const L=function(V,Y,Q){const ce=Q/(1<0&&(a.d8(L[1],L[1],[M[0]*O,0,0]),a.d8(L[2],L[2],[M[0]*O,0,0])),M[1]<0?(a.d8(L[0],L[0],[0,M[1]*O,0]),a.d8(L[1],L[1],[0,M[1]*O,0])):M[1]>0&&(a.d8(L[2],L[2],[0,M[1]*O,0]),a.d8(L[3],L[3],[0,M[1]*O,0]));const z={};return z.vertices=L,z.planes=[Z1(L[1],L[0],L[4]),Z1(L[2],L[1],L[5]),Z1(L[3],L[2],L[6]),Z1(L[0],L[3],L[7])],z}addShadowReceiver(d,p,b){this._receivers.add(d,a.d9.fromTileIdAndHeight(d,p,b))}getMaxCascadeForTile(d){const p=this._receivers.get(d);return p&&p.lastCascade?p.lastCascade:0}}function Z1(_,d,p){const b=a.av([],p,d),M=a.av([],_,d),L=a.bI([],b,M),O=a.ag(L);return O===0?[0,0,1,0]:(a.c5(L,L,1/O),[L[0],L[1],L[2],-a.bJ(L,d)])}function Y1(_){const d=_.properties.get("direction"),p=a.d4(d.x,d.y,d.z);p[2]=a.aA(p[2],0,75);const b=a.d6([p[0],p[1],p[2]]);return a.d5(b.x,b.y,b.z)}function lp(_,d,p){const b=d.properties.get("color-use-theme")==="none",M=d.properties.get("color"),L=d.properties.get("intensity"),O=d.properties.get("direction"),z=[O.x,O.y,O.z],V=p.properties.get("color-use-theme")==="none",Y=p.properties.get("color"),Q=p.properties.get("intensity"),ce=Math.max(a.bJ([0,0,1],z),0),le=[0,0,0];a.c5(le,Y.toPremultipliedRenderColor(V?null:_.getLut(d.scope)).toArray01Linear().slice(0,3),Q);const de=[0,0,0];return a.c5(de,M.toPremultipliedRenderColor(b?null:_.getLut(p.scope)).toArray01Linear().slice(0,3),ce*L),a.db([le[0]>0?le[0]/(le[0]+de[0]):0,le[1]>0?le[1]/(le[1]+de[1]):0,le[2]>0?le[2]/(le[2]+de[2]):0])}function wm(_,d,p,b,M,L){const O=_.zoom,z=_.scale,V=_.worldSize,Y=1/V,Q=_.aspect,ce=Math.sqrt(1+Q*Q)*Math.tan(.5*_.fovX),le=ce*ce,de=b-p,be=b+p;let ye,Oe;le>de/be?(ye=b,Oe=b*ce):(ye=.5*be*(1+le),Oe=.5*Math.sqrt(de*de+2*(b*b+p*p)*le+be*be*le*le));const Ee=_.projection.pixelsPerMeter(_.center.lat,V),qe=_._camera.getCameraToWorldMercator(),Ze=[0,0,-ye*Y];a.af(Ze,Ze,qe);let Ve=Oe*Y;const gt=_._edgeInsets;if(!(gt.left===0&>.top===0&>.right===0&>.bottom===0||gt.left===gt.right&>.top===gt.bottom)){const ur=_._camera.getWorldToCamera(_.worldSize,_.projection.zAxisUnit==="meters"?Ee:1),Ar=_._camera.getCameraToClipPerspective(_._fov,_.width/_.height,p,b);Ar[8]=2*-_.centerOffset.x/_.width,Ar[9]=2*_.centerOffset.y/_.height;const Ur=new Float64Array(16);a.cP(Ur,Ar,ur);const Nr=new Float64Array(16);a.bl(Nr,Ur);const _r=a.cB.fromInvProjectionMatrix(Nr,V,O,!0);for(const nn of _r.points){const Jr=((ct=nn)[0]/=z,ct[1]/=z,ct[2]=a.cf(ct[2],_._center.lat),ct);Ve=Math.max(Ve,a.c6(a.da([],Ze,Jr)))}}var ct;Ve*=M/(M-1);const ht=Math.acos(d[2]),ot=Math.atan2(-d[0],-d[1]),st=new tk;st.position=Ze,st.setPitchBearing(ht,ot);const vt=st.getWorldToCamera(V,Ee),Pt=Ve*V,Tt=Math.min(_._mercatorZfromZoom(17)*V*-2,-2*Pt),qt=st.getCameraToClipOrthographic(-Pt,Pt,-Pt,Pt,Tt,(Pt+L*Ee)/d[2]),Vt=new Float64Array(16);a.aB(Vt,qt,vt);const nr=a.d5(Math.floor(1e6*Ze[0])/1e6*V,Math.floor(1e6*Ze[1])/1e6*V,0),vr=.5*M,Ft=[0,0,0];a.af(Ft,nr,Vt),a.c5(Ft,Ft,vr);const St=[Math.floor(Ft[0]),Math.floor(Ft[1]),Math.floor(Ft[2])],Kt=[0,0,0];a.av(Kt,Ft,St),a.c5(Kt,Kt,-1/vr);const Ut=new Float64Array(16);return a.bA(Ut),a.br(Ut,Ut,Kt),a.aB(Vt,Ut,Vt),[Vt,Pt]}class Die extends a.E{constructor(d){super(),this.requestManager=d,this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}loadModel(d,p){return a.dc(this.requestManager.transformRequest(p,a.R.Model).url).then(b=>{if(!b)return;const M=a.dd(b),L=new a.de(d,p,void 0,void 0,M);return L.computeBoundsAndApplyParent(),L}).catch(b=>{if(b&&b.status===404)return null;this.fire(new a.y(new Error(`Could not load model ${d} from ${p}: ${b.message}`)))})}load(d,p,b={forceReload:!1}){this.models[p]||(this.models[p]={});const M=Object.keys(d),L=[],O=[];for(const z of M){const V=d[z];this.hasURLBeenRequested(V)&&!b.forceReload||(this.modelByURL[V]={modelId:z,scope:p},L.push(this.loadModel(z,V)),O.push(z)),this.models[p][z]||(this.models[p][z]={model:null,numReferences:1})}this.numModelsLoading[p]=(this.numModelsLoading[p]||0)+O.length,Promise.allSettled(L).then(z=>{for(let V=0;V{this.fire(new a.y(new Error(`Could not load models: ${z.message}`)))})}isLoaded(){for(const d in this.numModelsLoading)if(this.numModelsLoading[d]>0)return!1;return!0}hasModel(d,p,b={exactIdMatch:!1}){return!!(b.exactIdMatch?this.getModel(d,p):this.getModelByURL(this.modelUris[p][d]))}getModel(d,p){return this.models[p]||(this.models[p]={}),this.models[p][d]?this.models[p][d].model:void 0}getModelByURL(d){if(!d)return null;const p=this.modelByURL[d];return p?this.models[p.scope][p.modelId].model:null}hasModelBeenAdded(d,p){return this.models[p]&&this.models[p][d]!==void 0}getModelURIs(d){return this.modelUris[d]||{}}addModel(d,p,b){this.models[b]||(this.models[b]={}),this.modelUris[b]||(this.modelUris[b]={});const M=this.requestManager.normalizeModelURL(p);if((this.hasModel(d,b,{exactIdMatch:!0})||this.hasModelBeenAdded(d,b))&&this.modelUris[b][d]===M)this.models[b][d].numReferences++;else if(this.hasURLBeenRequested(M)){const{scope:L,modelId:O}=this.modelByURL[M];this.models[L][O].numReferences++}else this.modelUris[b][d]=M,this.load({[d]:this.modelUris[b][d]},b)}addModelURLs(d,p){this.models[p]||(this.models[p]={}),this.modelUris[p]||(this.modelUris[p]={});const b=this.modelUris[p];for(const M in d)b[M]=this.requestManager.normalizeModelURL(d[M])}reloadModels(d){this.load(this.modelUris[d],d,{forceReload:!0})}addModelsFromBucket(d,p){this.models[p]||(this.models[p]={}),this.modelUris[p]||(this.modelUris[p]={});const b={};for(const M of d)this.hasModel(M,p,{exactIdMatch:!0})||this.hasURLBeenRequested(M)?this.models[p][M].numReferences++:this.modelUris[p][M]&&!this.hasURLBeenRequested(M)?b[M]=this.modelUris[p][M]:!this.hasURLBeenRequested(M)&&a.df(M,!1)&&(this.modelUris[p][M]=this.requestManager.normalizeModelURL(M),b[M]=this.modelUris[p][M]);this.load(b,p)}hasURLBeenRequested(d){return this.modelByURL[d]!==void 0}removeModel(d,p,b=!1,M=!1){if(this.models[p]&&this.models[p][d]&&(this.models[p][d].numReferences--,this.models[p][d].numReferences===0||M)){const L=this.modelUris[p][d];b||delete this.modelUris[p][d],delete this.modelByURL[L];const O=this.models[p][d].model;if(!O)return;delete this.models[p][d],O.destroy()}}destroy(){for(const d of Object.keys(this.models))for(const p of Object.keys(this.models[d])){const b=this.models[d][p].model;delete this.models[d][p],b&&b.destroy()}this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}listModels(d){return this.models[d]||(this.models[d]={}),Object.keys(this.models[d])}upload(d,p){this.models[p]||(this.models[p]={});for(const b in this.models[p])this.models[p][b].model&&this.models[p][b].model.upload(d.context)}}const m3=a.a6.colorTheme,Rie=new a.a9({data:new a.aa(m3.data)});function TI(_){if(!_.metadata||!_.metadata.content_area)return;const d=a.o.devicePixelRatio,{left:p,top:b,width:M,height:L}=_.metadata.content_area,O=p*d,z=b*d;return[O,z,O+M*d,z+L*d]}function AI(_){if(_)return _.map(([d,p])=>[d*a.o.devicePixelRatio,p*a.o.devicePixelRatio])}class g3{constructor(d,p,b){this.id=d,this.scope=p,this.sourceCache=b,this.pendingRequests=new Set,this.missingRequests=new Set}addPendingRequest(d){this.missingRequests.has(d.name)||this.pendingRequests.has(d.name)||this.pendingRequests.add(d.name)}hasPendingRequests(){return this.pendingRequests.size>0}resolvePendingRequests(){const d=new Map;if(!this.sourceCache.loaded())return d;const p=this.sourceCache.getVisibleCoordinates();if(p.length===0)return d;const b=this.sourceCache.getSource();if(!(b instanceof Qo))return d;const M=p.map(O=>this.sourceCache.getTile(O)),L=b.getImages(M,Array.from(this.pendingRequests));for(const[O,z]of L)d.set(a.I.from({name:O,iconsetId:this.id}),z),this.pendingRequests.delete(O);for(const O of this.pendingRequests)this.missingRequests.add(O);return this.pendingRequests.clear(),d}}const jm=(_,d)=>tt(_,d&&d.filter(p=>p.identifier!=="source.canvas")),EI=a.aH(lr,["addLayer","removeLayer","setLights","setPaintProperty","setLayoutProperty","setLayerProperty","setSlot","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setSnow","setRain","setProjection","setCamera","addImport","removeImport","updateImport","addIconset","removeIconset"]),II=a.aH(lr,["setCenter","setZoom","setBearing","setPitch"]),nk=new Set(["background","sky","slot","custom"]),km={version:8,layers:[],sources:{}},X1={duration:300,delay:0};class Vu extends a.E{constructor(d,p={}){super(),this.map=d,this.scope=p.scope||"",this.globalId=null,this.fragments=[],this.importDepth=p.importDepth||0,this.importsCache=p.importsCache||new Map,this.resolvedImports=p.resolvedImports||new Set,this.transition=Object.assign({},X1),this._buildingIndex=new a3(this),this.crossTileSymbolIndex=new vh,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers={},this._mergedIndoor={},this._mergedSourceCaches={},this._mergedOtherSourceCaches={},this._mergedSymbolSourceCaches={},this._clipLayerPresent=!1,this._hasAppearances=!1,this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._importedAsBasemap=!1,this._changes=p.styleChanges||new Ce,this._hasDataDrivenEmissive=!1,this.dispatcher=p.dispatcher?p.dispatcher:new a.D(a.dh(),this),p.imageManager?this.imageManager=p.imageManager:(this.imageManager=new Fe(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.addScope(this.scope),this.glyphManager=p.glyphManager?p.glyphManager:new a.di(d._requestManager,p.localFontFamily?a.dj.all:p.localIdeographFontFamily?a.dj.ideographs:a.dj.none,p.localFontFamily||p.localIdeographFontFamily),p.modelManager?this.modelManager=p.modelManager:(this.modelManager=new Die(d._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._precompileDone=!1,this._shouldPrecompile=!1,this._availableImages=[],this._availableModels={},this._order=[],this._markersNeedUpdate=!1,this.options=p.configOptions?p.configOptions:new Map,this._configDependentLayers=p.configDependentLayers?p.configDependentLayers:new Set,this._indoorDependentLayers=p.indoorDependentLayers?p.indoorDependentLayers:new Set,this._config=p.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:p.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=p.initialConfig,this.dispatcher.broadcast("setReferrer",a.dk());const b=this;this._rtlTextPluginCallback=Vu.registerForPluginStateChange(M=>{b.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:M.pluginStatus,pluginURL:M.pluginURL},(L,O)=>{if(a.dl(L),O&&O.every(z=>z))for(const z in b._sourceCaches){const V=b._sourceCaches[z],Y=V.getSource().type;Y!=="vector"&&Y!=="geojson"||V.reload()}})}),this.on("data",M=>{if(M.dataType!=="source"||M.sourceDataType!=="metadata")return;const L=this.getOwnSource(M.sourceId);if(L&&L.vectorLayerIds)for(const O in this._layers){const z=this._layers[O];z.source===L.id&&this._validateLayer(z)}})}load(d){return d?(typeof d=="string"?this.loadURL(d):this.loadJSON(d),this):this}_getGlobalId(d){if(!d)return null;if(typeof d=="string"){if(a.h(d))return d;const p=a.dm(d);if(!p.startsWith("http"))try{return new URL(p,location.href).toString()}catch{return p}return p}return`json://${a.dn(JSON.stringify(d))}`}_diffStyle(d,p,b){this.globalId=this._getGlobalId(d);const M=(L,O)=>{try{O(null,this.setState(L,b))}catch(z){O(z,!1)}};if(typeof d=="string"){const L=this.map._requestManager.normalizeStyleURL(d),O=this.map._requestManager.transformRequest(L,a.R.Style);a.m(O,(z,V)=>{z?this.fire(new a.y(z)):V&&M(V,p)})}else typeof d=="object"&&M(d,p)}loadURL(d,p={}){this.fire(new a.z("dataloading",{dataType:"style"}));const b=typeof p.validate=="boolean"?p.validate:!a.h(d);this.globalId=this._getGlobalId(d),d=this.map._requestManager.normalizeStyleURL(d,p.accessToken),this.resolvedImports.add(d);const M=this.importsCache.get(d);if(M)return this._load(M,b);const L=this.map._requestManager.transformRequest(d,a.R.Style);this._request=a.m(L,(O,z)=>{if(this._request=null,O)this.fire(new a.y(O));else if(z)return this.importsCache.set(d,z),this._load(z,b)})}loadJSON(d,p={}){this.fire(new a.z("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(d),this._request=a.o.frame(()=>{this._request=null,this._load(d,p.validate!==!1)})}loadEmpty(){this.fire(new a.z("dataloading",{dataType:"style"})),this._load(km,!1)}_loadImports(d,p,b){if(this.importDepth>=4)return a.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const M=[];for(const L of d){const O=this._createFragmentStyle(L),z=new Promise(Q=>{O.once("style.import.load",Q),O.once("error",Q)}).then(()=>this.mergeAll());if(M.push(z),this.resolvedImports.has(L.url)){O.loadEmpty();continue}const V=L.data||this.importsCache.get(L.url);V?(O.loadJSON(V,{validate:p}),this._isInternalStyle(V)&&(O.globalId=null)):L.url?O.loadURL(L.url,{validate:p}):O.loadEmpty();const Y={style:O,id:L.id,config:L.config};if(b){const Q=this.fragments.findIndex(({id:ce})=>ce===b);this.fragments=this.fragments.slice(0,Q).concat(Y).concat(this.fragments.slice(Q))}else this.fragments.push(Y)}return Promise.allSettled(M)}getImportGlobalIds(d=this,p=new Set){for(const b of d.fragments)b.style.globalId&&p.add(b.style.globalId),this.getImportGlobalIds(b.style,p);return[...p.values()]}_createFragmentStyle(d){const p=this.scope?a.B(d.id,this.scope):d.id;let b;const M=this._initialConfig&&this._initialConfig[p];(d.config||M)&&(b=Object.assign({},d.config,M));const L=new Vu(this.map,{scope:p,styleChanges:this._changes,importDepth:this.importDepth+1,importsCache:this.importsCache,resolvedImports:new Set(this.resolvedImports),dispatcher:this.dispatcher,imageManager:this.imageManager,glyphManager:this.glyphManager,modelManager:this.modelManager,config:b,configOptions:this.options,colorThemeOverride:d["color-theme"],configDependentLayers:this._configDependentLayers,indoorDependentLayers:this._indoorDependentLayers});return L.setEventedParent(this.map,{style:L}),L}_reloadImports(){this.mergeAll(),this._updateMapProjection(),this.updateConfigDependencies(),this._updateLayers(this._indoorDependentLayers),this.map._triggerCameraUpdate(this.camera),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),this._shouldPrecompile=this.map._precompilePrograms&&this.isRootStyle()}_isInternalStyle(d){return this.isRootStyle()&&(d.fragment||!!d.schema&&d.fragment!==!1)}_load(d,p){if(this._isInternalStyle(d)){const L=Object.assign({},km,{imports:[{id:"basemap",data:d,url:""}]},d.center?{center:d.center}:{},d.bearing?{bearing:d.bearing}:{},d.pitch?{pitch:d.pitch}:{},d.zoom?{zoom:d.zoom}:{},d.light?{light:d.light}:{});return this._importedAsBasemap=!0,void this._load(L,p)}if(this.updateConfig(this._config,d.schema),p&&jm(this,Ni(d)))return;this._loaded=!0,this.stylesheet=a.dp(d);const b=()=>{for(const V in d.sources)this.addSource(V,d.sources[V],{validate:!1,isInitialLoad:!0});if(d.iconsets)for(const V in d.iconsets)this.addIconset(V,d.iconsets[V]);d.sprite?this._loadIconset(d.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),!this.glyphManager.url&&d.glyphs&&this.glyphManager.setURL(d.glyphs);const L=Sr(this.stylesheet.layers);if(this._order=L.map(V=>V.id),this.stylesheet.light&&a.w("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights)if(this.stylesheet.lights.length===1&&this.stylesheet.lights[0].type==="flat"){const V=this.stylesheet.lights[0];this.light=new Et(V.properties,V.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new Et(this.stylesheet.light)),this._layers={};for(const V of L){const Y=a.du(V,this.scope,this._styleColorTheme.lut,this.options);Y.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(Y.fqid),Y.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(Y.fqid),this._hasAppearances=this._hasAppearances||Y.getAppearances().length!==0,Y.setEventedParent(this,{layer:{id:Y.id}}),this._layers[Y.id]=Y;const Q=this.getOwnLayerSourceCache(Y),ce=!!this.directionalLight&&this.directionalLight.shadowsEnabled();Q&&Y.canCastShadows()&&ce&&(Q.castsShadows=!0)}this.stylesheet.featuresets&&this.setFeaturesetSelectors(this.stylesheet.featuresets),this.stylesheet.models&&this.addModelURLs(this.stylesheet.models);const O=this.stylesheet.terrain;O&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(O,1)),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this.stylesheet.snow&&this._createSnow(this.stylesheet.snow),this.stylesheet.rain&&this._createRain(this.stylesheet.rain),this.stylesheet.transition&&this.setTransition(this.stylesheet.transition),this.fire(new a.z("data",{dataType:"style"}));const z=this.isRootStyle();d.imports?this._loadImports(d.imports,p).then(()=>{this._reloadImports(),this.fire(new a.z(z?"style.load":"style.import.load"))}).catch(V=>{this.fire(new a.y(new Error("Failed to load imports",V))),this.fire(new a.z(z?"style.load":"style.import.load"))}):(this._reloadImports(),this.fire(new a.z(z?"style.load":"style.import.load")))};this._styleColorTheme.colorTheme=this.stylesheet["color-theme"];const M=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(M){const L=this._evaluateColorThemeData(M);this._loadColorTheme(L).then(()=>{b()}).catch(O=>{a.w(`Couldn't load color theme from the stylesheet: ${O}`),b()})}else this._styleColorTheme.lut=null,b()}isRootStyle(){return this.importDepth===0}hasAppearances(){return this._hasAppearances||this.fragments.some(d=>d.style.hasAppearances())}mergeAll(){let d,p,b,M,L,O,z,V,Y,Q;const ce={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(le=>{if(le.stylesheet){if(le.light!=null&&(d=le.light),le.stylesheet.lights)for(const de of le.stylesheet.lights)de.type==="ambient"&&le.ambientLight!=null&&(p=le.ambientLight),de.type==="directional"&&le.directionalLight!=null&&(b=le.directionalLight);M=this._prioritizeTerrain(M,le.terrain,le.stylesheet.terrain),le.stylesheet.fog&&le.fog!=null&&(L=le.fog),le.stylesheet.snow&&le.snow!=null&&(O=le.snow),le.stylesheet.rain&&le.rain!=null&&(z=le.rain),le.stylesheet.camera!=null&&(Q=le.stylesheet.camera),le.stylesheet.projection!=null&&(V=le.stylesheet.projection),le.stylesheet.transition!=null&&(Y=le.stylesheet.transition),ce[le.scope]=le._styleColorTheme}}),this.light=d,this.ambientLight=p,this.directionalLight=b,this.fog=L,this.snow=O,this.rain=z,this._styleColorThemeForScope=ce,M===null?delete this.terrain:this.terrain=M,this.camera=Q||{"camera-projection":"perspective"},this.projection=V||{name:"mercator"},this.transition=Object.assign({},X1,Y),this.mergeSources(),this.mergeLayers(),this.mergeIndoor()}forEachFragmentStyle(d){const p=b=>{for(const M of b.fragments)p(M.style);d(b)};p(this)}_prioritizeTerrain(d,p,b){const M=d&&d.drapeRenderMode===0;return b===null?p&&p.drapeRenderMode===0?p:M?d:null:p!=null&&(!d||M||p&&p.drapeRenderMode===1)?p:d}mergeTerrain(){let d;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(p=>{d=this._prioritizeTerrain(d,p.terrain,p.stylesheet.terrain)}),d===null?delete this.terrain:this.terrain=d}mergeProjection(){let d;this.forEachFragmentStyle(p=>{p.stylesheet.projection!=null&&(d=p.stylesheet.projection)}),this.projection=d||{name:"mercator"}}mergeSources(){const d={},p={},b={};this.forEachFragmentStyle(M=>{for(const L in M._sourceCaches){const O=a.B(L,M.scope);d[O]=M._sourceCaches[L]}for(const L in M._otherSourceCaches){const O=a.B(L,M.scope);p[O]=M._otherSourceCaches[L]}for(const L in M._symbolSourceCaches){const O=a.B(L,M.scope);b[O]=M._symbolSourceCaches[L]}}),this._mergedSourceCaches=d,this._mergedOtherSourceCaches=p,this._mergedSymbolSourceCaches=b}mergeIndoor(){this.forEachFragmentStyle(d=>{if(d.stylesheet&&d.stylesheet.indoor)for(const p of Object.values(d.stylesheet.indoor)){const b=p,M=a.B(b.sourceId,d.scope);this._mergedIndoor[M]=new Set(b.sourceLayers||[])}})}mergeLayers(){const d={},p=[],b={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(O=>{for(const z of O._order){const V=O._layers[z];if(V.type==="slot"){const Y=a.dq(z);if(d[Y])continue;d[Y]=[]}V.slot&&d[V.slot]?d[V.slot].push(V):p.push(V)}}),this._mergedOrder=[];let M=-1;const L=(O=[])=>{for(const z of O)if(z.type==="slot"){const V=a.dq(z.id);d[V]&&L(d[V]),this._mergedSlots.push(V)}else{const V=a.B(z.id,z.scope);this._mergedOrder.push(V),b[V]=z,z.is3D(!!this.terrain)&&(this._has3DLayers=!0,M=this._mergedOrder.length-1),z.type==="circle"&&(this._hasCircleLayers=!0),z.type==="symbol"&&(this._hasSymbolLayers=!0),z.type==="clip"&&(this._clipLayerPresent=!0)}};if(L(p),this._has3DLayers){const O={};for(let z=0;zO[z]-O[V])}this._mergedLayers=b,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged(),this._updateDataDrivenEmissiveStrength()}terrainSetForDrapingOnly(){return!!this.terrain&&this.terrain.drapeRenderMode===0}getCamera(){return this.stylesheet.camera}setCamera(d){return this.stylesheet.camera=Object.assign({},this.stylesheet.camera,d),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(d){return d.data?function(p,b,M,L){const O=Object.assign({},b);for(const V of Object.keys(m3))O[V]===void 0&&(O[V]=m3[V].default);const z=new a.a8(Rie,p,new Map(M));return z.setTransitionOrValue(O,M),z.untransitioned().possiblyEvaluate(new a.ac(0,{worldview:void 0}))}(this.scope,d,this.options).get("data"):null}_loadColorTheme(d){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const p=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((b,M)=>{const L="data:image/png;base64,";if(!d||d.length===0)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void b();let O=d;O.startsWith(L)||(O=L+O);const z=a.I.from("mapbox-reserved-lut"),V=new Image;V.src=O,V.onerror=()=>{this._styleColorTheme.lutLoading=!1,M(new Error("Failed to load image data"))},V.onload=()=>{if(this._styleColorTheme.lutLoadingCorrelationID!==p)return void b();this._styleColorTheme.lutLoading=!1;const{width:Y,height:Q,data:ce}=a.o.getImageData(V);if(Q>32)return void M(new Error("The height of the image must be less than or equal to 32 pixels."));if(Y!==Q*Q)return void M(new Error("The width of the image must be equal to the height squared."));this.getImage(z)&&this.removeImage(z),this.addImage(z,{data:new a.q({width:Y,height:Q},ce),pixelRatio:1,sdf:!1,usvg:!1,version:0});const le=this.imageManager.getImage(z,this.scope);le?(this._styleColorTheme.lut={image:le.data,data:d},b()):M(new Error("Missing LUT image."))}})}getLut(d){const p=this._styleColorThemeForScope[d];return p?p.lut:null}setProjection(d){d?this.stylesheet.projection=d:delete this.stylesheet.projection,this.mergeProjection(),this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?(this.getTerrain()||this.stylesheet.terrain)&&!this.disableElevatedTerrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null,0))}_updateMapProjection(){this.isRootStyle()&&(this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.projection))}_loadSprite(d){this._spriteRequest=function(p,b,M){let L,O,z;const V=a.o.devicePixelRatio>1?"@2x":"";let Y=a.m(b.transformRequest(b.normalizeSpriteURL(p,V,".json"),a.R.SpriteJSON),(le,de)=>{Y=null,z||(z=le,L=de,ce())}),Q=a.n(b.transformRequest(b.normalizeSpriteURL(p,V,".png"),a.R.SpriteImage),(le,de)=>{Q=null,z||(z=le,O=de,ce())});function ce(){if(z)M(z);else if(L&&O){const le=a.o.getImageData(O),de={};for(const be in L){const{width:ye,height:Oe,x:Ee,y:qe,sdf:Ze,pixelRatio:Ve,stretchX:gt,stretchY:ct,content:ht}=L[be],ot=new a.q({width:ye,height:Oe});a.q.copy(le,ot,{x:Ee,y:qe},{x:0,y:0},{width:ye,height:Oe},null),de[be]={data:ot,pixelRatio:Ve!==void 0?Ve:1,sdf:Ze!==void 0&&Ze,stretchX:gt,stretchY:ct,content:ht,usvg:!1,version:0}}M(null,de)}}return{cancel(){Y&&(Y.cancel(),Y=null),Q&&(Q.cancel(),Q=null)}}}(d,this.map._requestManager,(p,b)=>{if(this._spriteRequest=null,p)this.fire(new a.y(p));else if(b){const M=new Map;for(const L in b)M.set(a.I.from(L),b[L]);this.addImages(M)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new a.z("data",{dataType:"style"}))})}addIconset(d,p){if(p.type==="sprite")return void this._loadSprite(p.url);const b=this.getOwnSourceCache(p.source);if(!b)return void this.fire(new a.y(new Error(`Source "${p.source}" as specified by iconset "${d}" does not exist and cannot be used as an iconset source`)));const M=b.getSource();if(M.type!=="raster-array")return void this.fire(new a.y(new Error(`Source "${p.source}" as specified by iconset "${d}" is not a "raster-array" source and cannot be used as an iconset source`)));M.partial=!1;const L=new g3(d,this.scope,b);this.imageManager.addImageProvider(L,this.scope)}removeIconset(d){this.imageManager.removeImageProvider(d,this.scope)}_loadIconset(d){if(!a.h(d)&&this.map._spriteFormat!=="icon_set"||this.map._spriteFormat==="raster")return void this._loadSprite(d);const p=this.map._spriteFormat==="auto";var b,M;this._spriteRequest=(M=(L,O)=>{if(this._spriteRequest=null,L)p?this._loadSprite(d):this.fire(new a.y(L));else if(O){const z=new Map;for(const V in O)z.set(a.I.from(V),O[V]);this.addImages(z)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new a.z("data",{dataType:"style"}))},a.bu((b=this.map._requestManager).transformRequest(b.normalizeIconsetURL(d),a.R.Iconset),(L,O)=>{if(L)return void M(L);const z={},V=a.dg(new a.bt(O));for(const Y of V.icons){const Q={version:1,pixelRatio:a.o.devicePixelRatio,content:TI(Y),stretchX:Y.metadata?AI(Y.metadata.stretch_x_areas):void 0,stretchY:Y.metadata?AI(Y.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:Y};z[Y.name]=Q}M(null,z)}))}_validateLayer(d){const p=this.getOwnSource(d.source);if(!p)return;const b=d.sourceLayer;b&&(p.type==="geojson"||p.vectorLayerIds&&p.vectorLayerIds.indexOf(b)===-1)&&this.fire(new a.y(new Error(`Source layer "${b}" does not exist on source "${p.id}" as specified by style layer "${d.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(const d in this._sourceCaches)if(!this._sourceCaches[d].loaded())return!1;if(!this.imageManager.isLoaded()||this.imageManager.hasPatternsInFlight()||!this.modelManager.isLoaded()||this._styleColorTheme.lutLoading)return!1;for(const{style:d}of this.fragments)if(!d.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((d,p)=>{const b=this.fragments[p];return b&&b.style&&(d.data=b.style.serialize()),d})}_serializeSources(){const d={};for(const p in this._sourceCaches){const b=this._sourceCaches[p].getSource();d[b.id]||(d[b.id]=b.serialize())}return d}_serializeLayers(d){const p=[];for(const b of d){const M=this._layers[b];M&&M.type!=="custom"&&p.push(M.serialize())}return p}hasLightTransitions(){return!(!this.light||!this.light.hasTransition())||!(!this.ambientLight||!this.ambientLight.hasTransition())||!(!this.directionalLight||!this.directionalLight.hasTransition())}hasFogTransition(){return!!this.fog&&this.fog.hasTransition()}hasSnowTransition(){return!!this.snow&&this.snow.hasTransition()}hasRainTransition(){return!!this.rain&&this.rain.hasTransition()}hasTransitions(){if(this.hasLightTransitions()||this.hasFogTransition()||this.hasSnowTransition()||this.hasRainTransition())return!0;for(const d in this._sourceCaches)if(this._sourceCaches[d].hasTransition())return!0;for(const d in this._layers)if(this._layers[d].hasTransition())return!0;return!1}_updateDataDrivenEmissiveStrength(){for(const d in this._mergedLayers){const p=this._mergedLayers[d];if(p._transitionablePaint&&p._transitionablePaint._values){const b=p._transitionablePaint._values["line-emissive-strength"];if(b&&b.value&&b.value.isDataDriven())return void(this._hasDataDrivenEmissive=!0)}}this._hasDataDrivenEmissive=!1}hasDataDrivenEmissiveStrength(){return this._hasDataDrivenEmissive}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}_getOrder(d){return d?this.order:this._mergedOrder}isLayerDraped(d){return!!this.terrain&&d.isDraped(this.getLayerSourceCache(d))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(d){const p=this.getOwnLayer(d);if(p)return p;this.fire(new a.y(new Error(`The layer '${d}' does not exist in the map's style.`)))}_checkSource(d){const p=this.getOwnSource(d);if(p)return p;this.fire(new a.y(new Error(`The source '${d}' does not exist in the map's style.`)))}precompilePrograms(d,p){const b=this.map.painter;if(b)for(let M=d.minzoom||0;M<(d.maxzoom||25.5);M++){const L=d.getProgramIds();if(L)for(const O of L){const z=d.getDefaultProgramParams(O,p.zoom,this._styleColorTheme.lut);z&&(b.style=this,this.fog&&(b._fogVisible=!0,z.overrideFog=!0,b.getOrCreateProgram(O,z)),b._fogVisible=!1,z.overrideFog=!1,b.getOrCreateProgram(O,z),(this.stylesheet.terrain||this.stylesheet.projection&&this.stylesheet.projection.name==="globe")&&(z.overrideRtt=!0,b.getOrCreateProgram(O,z)))}}}update(d){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(d),this.directionalLight&&this.directionalLight.recalculate(d);const p=this.calculateLightsBrightness();d.brightness=p||0,p!==this._brightness&&(this._brightness=p,this.dispatcher.broadcast("setBrightness",p)),d.worldview!==this._worldview&&(this._worldview=d.worldview,this.dispatcher.broadcast("setWorldview",this._worldview));const b=this._changes.isDirty();let M=!1;if(this._changes.isDirty()){const z=this._changes.getLayerUpdatesByScope();for(const V in z){const{updatedIds:Y,removedIds:Q}=z[V];(Y||Q)&&(this._updateWorkerLayers(V,Y,Q),M=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(d),this.light&&this.light.updateTransitions(d),this.ambientLight&&this.ambientLight.updateTransitions(d),this.directionalLight&&this.directionalLight.updateTransitions(d),this.fog&&this.fog.updateTransitions(d),this.snow&&this.snow.updateTransitions(d),this.rain&&this.rain.updateTransitions(d),this._changes.reset()}const L={};for(const z in this._mergedSourceCaches){const V=this._mergedSourceCaches[z];L[z]=V.used,V.used=!1,V.tileCoverLift=0}for(const z of this._mergedOrder){const V=this._mergedLayers[z];if(V.visibility!=="none"&&V.recalculate(d,this._availableImages),!V.isHidden(d.zoom)){const Y=this.getLayerSourceCache(V);Y&&(Y.used=!0,Y.tileCoverLift=Math.max(Y.tileCoverLift,V.tileCoverLift()))}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback(()=>{this.precompilePrograms(V,d)}):this.precompilePrograms(V,d))}this._shouldPrecompile&&(this._precompileDone=!0),this.terrain&&M&&this.mergeLayers();const O=this.imageManager.getPendingImageProviders();for(const z of O)z.sourceCache.used=!0;for(const z in L){const V=this._mergedSourceCaches[z];L[z]!==V.used&&V.getSource().fire(new a.z("data",{sourceDataType:"visibility",dataType:"source",sourceId:V.getSource().id}))}this.light&&this.light.recalculate(d),this.terrain&&this.terrain.recalculate(d),this.fog&&this.fog.recalculate(d),this.snow&&this.snow.recalculate(d),this.rain&&this.rain.recalculate(d),this.z=d.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),this.imageManager.clearUpdatedImages(this.scope),b&&this.fire(new a.z("data",{dataType:"style"}))}updateImageProviders(){const d=this.imageManager.getPendingImageProviders();for(const p of d){const b=p.resolvePendingRequests(),M=this.getFragmentStyle(p.scope);M&&M.addImages(b)}}_updateTilesForChangedImages(){const d={};for(const p in this._mergedSourceCaches){const b=this._mergedSourceCaches[p].getSource().scope;d[b]=d[b]||this._changes.getUpdatedImages(b),d[b].length!==0&&this._mergedSourceCaches[p].reloadTilesForDependencies(["icons","patterns"],d[b])}for(const p in d)this._changes.resetUpdatedImages(p)}_updateWorkerLayers(d,p,b){const M=this.getFragmentStyle(d);M&&this.dispatcher.broadcast("updateLayers",{layers:p?M._serializeLayers(p):[],scope:d,removedIds:b||[],options:M.options})}setState(d,p){if(this._checkLoaded(),jm(this,Ni(d)))return!1;(d=a.dp(d)).layers=Sr(d.layers);const b=function(O,z){if(!O)return[{command:lr.setStyle,args:[z]}];let V=[];try{if(!a.by(O.version,z.version))return[{command:lr.setStyle,args:[z]}];if(a.by(O.center,z.center)||V.push({command:lr.setCenter,args:[z.center]}),a.by(O.zoom,z.zoom)||V.push({command:lr.setZoom,args:[z.zoom]}),a.by(O.bearing,z.bearing)||V.push({command:lr.setBearing,args:[z.bearing]}),a.by(O.pitch,z.pitch)||V.push({command:lr.setPitch,args:[z.pitch]}),a.by(O.sprite,z.sprite)||V.push({command:lr.setSprite,args:[z.sprite]}),a.by(O.glyphs,z.glyphs)||V.push({command:lr.setGlyphs,args:[z.glyphs]}),a.by(O.imports,z.imports)||function(de=[],be=[],ye){be=be||[];const Oe=(de=de||[]).map(Lg),Ee=be.map(Lg),qe=de.reduce($1,{}),Ze=be.reduce($1,{}),Ve=Oe.slice();let gt,ct,ht,ot;for(gt=0,ct=0;gt{de.source&&Y[de.source]?V.push({command:lr.removeLayer,args:[de.id]}):ce.push(de)});let le=O.terrain;le&&Y[le.source]&&(V.push({command:lr.setTerrain,args:[void 0]}),le=void 0),V=V.concat(Q),a.by(le,z.terrain)||V.push({command:lr.setTerrain,args:[z.terrain]}),function(de,be,ye){be=be||[];const Oe=(de=de||[]).map(Lg),Ee=be.map(Lg),qe=de.reduce($1,{}),Ze=be.reduce($1,{}),Ve=Oe.slice(),gt=Object.create(null);let ct,ht,ot,st,vt,Pt,Tt;for(ct=0,ht=0;ct!(O.command in II));if(b.length===0)return!1;const M=b.filter(O=>!(O.command in EI));if(M.length>0)throw new Error(`Unimplemented: ${M.map(O=>O.command).join(", ")}.`);const L=[];return b.forEach(O=>{L.push(this[O.command](...O.args))}),p&&Promise.all(L).then(p).catch(p),this.stylesheet=d,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}_updateWorkerImages(){this._availableImages=this.imageManager.listImages(this.scope),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages})}_updateWorkerModels(){this._availableModels=this.modelManager.getModelURIs(this.scope),this.dispatcher.broadcast("setModels",{scope:this.scope,models:this._availableModels})}addImages(d){if(d.size===0)return this;for(const[p,b]of d.entries()){if(this.getImage(p))return this.fire(new a.y(new Error(`An image with the name "${p.name}" already exists.`)));this.imageManager.addImage(p,this.scope,b),this._changes.updateImage(p,this.scope)}return this._updateWorkerImages(),this.fire(new a.z("data",{dataType:"style"})),this}addImage(d,p){return this.getImage(d)?this.fire(new a.y(new Error(`An image with the name "${d.name}" already exists.`))):(this.imageManager.addImage(d,this.scope,p),this._changes.updateImage(d,this.scope),this._updateWorkerImages(),this.fire(new a.z("data",{dataType:"style"})),this)}updateImage(d,p,b=!1){this.imageManager.updateImage(d,this.scope,p),b&&(this._changes.updateImage(d,this.scope),this._updateWorkerImages(),this.fire(new a.z("data",{dataType:"style"})))}getImage(d){return this.imageManager.getImage(d,this.scope)}removeImage(d){return this.getImage(d)?(this.imageManager.removeImage(d,this.scope),this._changes.updateImage(d,this.scope),this._updateWorkerImages(),this.fire(new a.z("data",{dataType:"style"})),this):this.fire(new a.y(new Error("No image with this name exists.")))}listImages(){return this._checkLoaded(),this._availableImages.slice()}getActualScope(){return this._importedAsBasemap?"basemap":this.scope}addModelURLs(d){return this.modelManager.addModelURLs(d,this.getActualScope()),this._updateWorkerModels(),this.fire(new a.z("data",{dataType:"style"})),this}addModel(d,p,b={}){return this._checkLoaded(),this._validate(_e,`models.${d}`,p,null,b)||(this.modelManager.addModel(d,p,this.getActualScope()),this.fire(new a.z("data",{dataType:"style"}))),this}hasModel(d){return this.modelManager.hasModel(d,this.getActualScope())}removeModel(d){return this.hasModel(d)?(this.modelManager.removeModel(d,this.getActualScope(),!1,!0),this.fire(new a.z("data",{dataType:"style"})),this):this.fire(new a.y(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.getActualScope())}addSource(d,p,b={}){if(this._checkLoaded(),this.getOwnSource(d)!==void 0)throw new Error(`There is already a source with ID "${d}".`);if(!p.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(p).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(p.type)>=0&&this._validate(Oo,`sources.${d}`,p,null,b))return;this.map&&this.map._collectResourceTiming&&(p.collectResourceTiming=!0);const M=Do(d,p,this.dispatcher,this);M.scope=this.scope,M.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(M.id),source:M.serialize(),sourceId:M.id}));const L=O=>{const z=(O?"symbol:":"other:")+M.id,V=a.B(z,this.scope),Y=this._sourceCaches[z]=new qc(V,M,O);(O?this._symbolSourceCaches:this._otherSourceCaches)[M.id]=Y,Y.onAdd(this.map)};L(!1),p.type!=="vector"&&p.type!=="geojson"||L(!0),M.onAdd&&M.onAdd(this.map),b.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(d){this._checkLoaded();const p=this.getOwnSource(d);if(!p)throw new Error("There is no source with this ID");for(const M in this._layers)if(this._layers[M].source===d)return this.fire(new a.y(new Error(`Source "${d}" cannot be removed while layer "${M}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===d)return this.fire(new a.y(new Error(`Source "${d}" cannot be removed while terrain is using it.`)));if(this.stylesheet.iconsets){const M=Object.entries(this.stylesheet.iconsets).find(([L,O])=>O.type==="source"&&O.source===d);if(M)return this.fire(new a.y(new Error(`Source "${d}" cannot be removed while iconset "${M[0]}" is using it.`)))}const b=this.getOwnSourceCaches(d);for(const M of b){const L=a.dq(M.id);delete this._sourceCaches[L],this._changes.discardSourceCacheUpdate(M.id),M.fire(new a.z("data",{sourceDataType:"metadata",dataType:"source",sourceId:M.getSource().id})),M.setEventedParent(null),M.clearTiles()}return delete this._otherSourceCaches[d],delete this._symbolSourceCaches[d],this.mergeSources(),p.setEventedParent(null),p.onRemove&&p.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(d,p){this._checkLoaded(),this.getOwnSource(d).setData(p),this._changes.setDirty()}getOwnSource(d){const p=this.getOwnSourceCache(d);return p&&p.getSource()}getOwnSources(){const d=[];for(const p in this._otherSourceCaches){const b=this.getOwnSourceCache(p);b&&d.push(b.getSource())}return d}areTilesLoaded(){const d=this._mergedSourceCaches;for(const p in d){const b=d[p]._tiles;for(const M in b){const L=b[M];if(L.state!=="loaded"&&L.state!=="errored")return!1}}return!0}setLights(d){if(this._checkLoaded(),!d)return delete this.ambientLight,void delete this.directionalLight;const p=this._getTransitionParameters();for(const L of d){if(this._validate(fo,"lights",L))return;switch(L.type){case"ambient":if(this.ambientLight){const O=this.ambientLight;O.set(L),O.updateTransitions(p)}else this.ambientLight=new zs(L,$a||($a=new a.a9({color:new a.aa(a.a6.properties_light_ambient.color),"color-use-theme":new a.aa({type:"string",default:"default","property-type":"data-constant"}),intensity:new a.aa(a.a6.properties_light_ambient.intensity)})),this.scope,this.options);break;case"directional":if(this.directionalLight){const O=this.directionalLight;O.set(L),O.updateTransitions(p)}else this.directionalLight=new zs(L,Aa||(Aa=new a.a9({direction:new a.ap(a.a6.properties_light_directional.direction),color:new a.aa(a.a6.properties_light_directional.color),"color-use-theme":new a.aa({type:"string",default:"default","property-type":"data-constant"}),intensity:new a.aa(a.a6.properties_light_directional.intensity),"cast-shadows":new a.aa(a.a6.properties_light_directional["cast-shadows"]),"shadow-quality":new a.aa(a.a6.properties_light_directional["shadow-quality"]),"shadow-intensity":new a.aa(a.a6.properties_light_directional["shadow-intensity"])})),this.scope,this.options)}}const b=Object.assign(p,{worldview:this.map.getWorldview()}),M=new a.ac(this.z||0,b);this.ambientLight&&this.ambientLight.recalculate(M),this.directionalLight&&this.directionalLight.recalculate(M),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const d=this.directionalLight,p=this.ambientLight;if(!d||!p)return;const b=le=>.2126*(le[0]<=.03928?le[0]/12.92:Math.pow((le[0]+.055)/1.055,2.4))+.7152*(le[1]<=.03928?le[1]/12.92:Math.pow((le[1]+.055)/1.055,2.4))+.0722*(le[2]<=.03928?le[2]/12.92:Math.pow((le[2]+.055)/1.055,2.4)),M=d.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),L=d.properties.get("intensity"),O=d.properties.get("direction"),z=1-a.d4(O.x,O.y,O.z)[2]/90,V=b(M)*L*z,Y=p.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),Q=p.properties.get("intensity"),ce=b(Y)*Q;return Number(((V+ce)/2).toFixed(6))}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const d=[];return this.directionalLight&&d.push(this.directionalLight.get()),this.ambientLight&&d.push(this.ambientLight.get()),d}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(d){if(d==null||d===""&&this.isRootStyle())return this;if(a.dr(d)){const p=a.ds(d),b=this.fragments.find(({id:L})=>L===p);if(!b)return;const M=a.dq(d);return b.style.getFragmentStyle(M)}{const p=this.fragments.find(({id:b})=>b===d);return p?p.style:void 0}}setFeaturesetSelectors(d){if(!d)return;const p={},b=(M,L="")=>`${M}::${L}`;this._featuresetSelectors={};for(const M in d){const L=this._featuresetSelectors[M]=[];for(const O of d[M].selectors){if(O.featureNamespace){const V=this.getOwnLayer(O.layer);if(!V){a.w(`Layer is undefined for selector: ${O.layer}`);continue}const Y=b(V.source,V.sourceLayer);if(Y in p&&p[Y]!==O.featureNamespace){a.w(`"featureNamespace ${O.featureNamespace} of featureset ${M}'s selector is not associated to the same source, skip this selector`);continue}p[Y]=O.featureNamespace}let z;if(O.properties)for(const V in O.properties){const Y=a.U(O.properties[V]);Y.result==="success"&&(z=z||{},z[V]=Y.value)}L.push({layerId:O.layer,namespace:O.featureNamespace,properties:z,uniqueFeatureID:O._uniqueFeatureID})}}}getFeaturesetDescriptors(d){const p=this.getFragmentStyle(d);if(!p||!p.stylesheet.featuresets)return[];const b=[];for(const M in p.stylesheet.featuresets)b.push({featuresetId:M,importId:p.scope?p.scope:void 0});return b}getFeaturesetLayers(d,p){const b=this.getFragmentStyle(p),M=b.stylesheet.featuresets;if(!M||!M[d])return this.fire(new a.y(new Error(`The featureset '${d}' does not exist in the map's style and cannot be queried.`))),[];const L=[];for(const O of M[d].selectors){const z=b.getOwnLayer(O.layer);z&&L.push(z)}return L}getConfigProperty(d,p){const b=this.getFragmentStyle(d);if(!b)return null;const M=a.B(p,b.scope),L=b.options.get(M),O=L?L.value||L.default:null;return O?O.serialize():null}isIndoorEnabled(){return Object.keys(this._mergedIndoor).length>0}getIndoorSourceLayers(d,p){const b=a.B(d,p);return this._mergedIndoor[b]}setIndoorData(d,p){this.map.indoor.setIndoorData(p)}updateIndoorDependentLayers(){this._updateLayers(this._indoorDependentLayers),this.map._styleDirty=!0,this.map.triggerRepaint()}setConfigProperty(d,p,b){const M=this.getFragmentStyle(d);if(!M)return;const L=M.stylesheet.schema;if(!L||!L[p])return;const O=a.U(b);if(O.result!=="success")return void jm(this,O.value);const z=O.value.expression,V=a.B(p,M.scope),Y=M.options.get(V);if(!Y)return;let Q;const{minValue:ce,maxValue:le,stepValue:de,type:be,values:ye}=L[p],Oe=a.U(L[p].default);Oe.result==="success"&&(Q=Oe.value.expression),Q?(this.options.set(V,Object.assign({},Y,{value:z,default:Q,minValue:ce,maxValue:le,stepValue:de,type:be,values:ye})),this.updateConfigDependencies(p)):this.fire(new a.y(new Error(`No schema defined for the config option "${p}" in the "${d}" fragment.`)))}getConfig(d){const p=this.getFragmentStyle(d);if(!p)return null;const b=p.stylesheet.schema;if(!b)return null;const M={};for(const L in b){const O=a.B(L,p.scope),z=p.options.get(O),V=z?z.value||z.default:null;M[L]=V?V.serialize():null}return M}setConfig(d,p){const b=this.getFragmentStyle(d);b&&(b.updateConfig(p,b.stylesheet.schema),this.updateConfigDependencies())}getSchema(d){const p=this.getFragmentStyle(d);return p?p.stylesheet.schema:null}setSchema(d,p){const b=this.getFragmentStyle(d);b&&(b.stylesheet.schema=p,b.updateConfig(b._config,p),this.updateConfigDependencies())}updateConfig(d,p){if(this._config=d,d||p)if(p)for(const b in p){let M,L;const O=a.U(p[b].default);if(O.result==="success"&&(M=O.value.expression),d&&d[b]!==void 0){const le=a.U(d[b]);le.result==="success"&&(L=le.value.expression)}const{minValue:z,maxValue:V,stepValue:Y,type:Q,values:ce}=p[b];if(M){const le=a.B(b,this.scope);this.options.set(le,{default:M,value:L,minValue:z,maxValue:V,stepValue:Y,type:Q,values:ce})}else this.fire(new a.y(new Error(`No schema defined for config option "${b}".`)))}else this.fire(new a.y(new Error("Attempting to set config for a style without schema.")))}_updateLayers(d,p=()=>!0){for(const b of d){const M=this.getLayer(b);M&&p(M)&&(M.possiblyEvaluateVisibility(),this._updateLayer(M),this._changes.setDirty())}}updateConfigDependencies(d){this._updateLayers(this._configDependentLayers,p=>!d||p.expressionDependencies.configDependencies.has(d)),this.ambientLight&&this.ambientLight.updateConfig(this.options),this.directionalLight&&this.directionalLight.updateConfig(this.options),this.fog&&this.fog.updateConfig(this.options),this.snow&&this.snow.updateConfig(this.options),this.rain&&this.rain.updateConfig(this.options),this.forEachFragmentStyle(p=>{const b=p._styleColorTheme.colorThemeOverride?p._styleColorTheme.colorThemeOverride:p._styleColorTheme.colorTheme;if(b){const M=p._evaluateColorThemeData(b);(!p._styleColorTheme.lut&&M!==""||p._styleColorTheme.lut&&M!==p._styleColorTheme.lut.data)&&p.setColorTheme(b)}}),this._changes.setDirty()}addLayer(d,p,b={}){this._checkLoaded();const M=d.id;if(this._layers[M])return void this.fire(new a.y(new Error(`Layer with id "${M}" already exists on this map`)));let L;if(d.type==="custom"){if(jm(this,a.dt(d)))return;L=a.du(d,this.scope,this._styleColorTheme.lut,this.options)}else{if(typeof d.source=="object"&&(this.addSource(M,d.source),d=a.dp(d),d=Object.assign(d,{source:M})),this._validate(Ka,`layers.${M}`,d,{arrayIndex:-1},b))return;L=a.du(d,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(L),L.setEventedParent(this,{layer:{id:M}})}const O=a.B(L.source,L.scope);L.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(O),L.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(O);let z=this._order.length;if(p){const ce=this._order.indexOf(p);if(ce===-1)return void this.fire(new a.y(new Error(`Layer with id "${p}" does not exist on this map.`)));L.slot===this._layers[p].slot?z=ce:a.w(`Layer with id "${p}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(z,0,M),this._layerOrderChanged=!0,this._layers[M]=L;const V=this.getOwnLayerSourceCache(L),Y=!!this.directionalLight&&this.directionalLight.shadowsEnabled();V&&L.canCastShadows()&&Y&&(V.castsShadows=!0);const Q=this._changes.getRemovedLayer(L);if(Q&&L.source&&V&&L.type!=="custom"){this._changes.discardLayerRemoval(L);const ce=a.B(L.source,L.scope);Q.type!==L.type?this._changes.updateSourceCache(ce,"clear"):(this._changes.updateSourceCache(ce,"reload"),V.pause())}this._updateLayer(L),L.onAdd&&L.onAdd(this.map),L.scope=this.scope,this.mergeLayers()}moveLayer(d,p){this._checkLoaded();const b=this._checkLayer(d);if(!b||d===p)return;const M=this._order.indexOf(d);this._order.splice(M,1);let L=this._order.length;if(p){const O=this._order.indexOf(p);if(O===-1)return void this.fire(new a.y(new Error(`Layer with id "${p}" does not exist on this map.`)));b.slot===this._layers[p].slot?L=O:a.w(`Layer with id "${p}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(L,0,d),this._changes.setDirty(),this._layerOrderChanged=!0,this.mergeLayers()}removeLayer(d){this._checkLoaded();const p=this._checkLayer(d);if(!p)return;p.setEventedParent(null);const b=this._order.indexOf(d);this._order.splice(b,1),delete this._layers[d],this._changes.setDirty(),this._layerOrderChanged=!0,this._configDependentLayers.delete(p.fqid),this._indoorDependentLayers.delete(p.fqid),this._changes.removeLayer(p);const M=this.getOwnLayerSourceCache(p);if(M&&M.castsShadows){let L=!1;for(const O in this._layers)if(this._layers[O].source===p.source&&this._layers[O].canCastShadows()){L=!0;break}M.castsShadows=L}p.onRemove&&p.onRemove(this.map),this.mergeLayers()}getOwnLayer(d){return this._layers[d]}hasLayer(d){return d in this._mergedLayers}hasLayerType(d){for(const p in this._layers)if(this._layers[p].type===d)return!0;return!1}setLayerZoomRange(d,p,b){this._checkLoaded();const M=this._checkLayer(d);M&&(M.minzoom===p&&M.maxzoom===b||(p!=null&&(M.minzoom=p),b!=null&&(M.maxzoom=b),this._updateLayer(M)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(d,p){this._checkLoaded();const b=this._checkLayer(d);b&&b.slot!==p&&(b.slot=p,this._updateLayer(b))}setFilter(d,p,b={}){this._checkLoaded();const M=this._checkLayer(d);if(M&&!a.by(M.filter,p))return p==null?(M.filter=void 0,void this._updateLayer(M)):void(this._validate(dr,`layers.${M.id}.filter`,p,{layerType:M.type},b)||(M.filter=a.dp(p),this._updateLayer(M)))}getFilter(d){const p=this._checkLayer(d);if(p)return a.dp(p.filter)}setLayoutProperty(d,p,b,M={}){this._checkLoaded();const L=this._checkLayer(d);if(L&&!a.by(L.getLayoutProperty(p),b)){if(b!=null&&(!M||M.validate!==!1)&&jm(L,xt.call(Ni,{key:`layers.${d}.layout.${p}`,layerType:L.type,objectKey:p,value:b,styleSpec:a.a6,style:{glyphs:!0,sprite:!0}})))return;L.setLayoutProperty(p,b),L.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(L.fqid),L.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(L.fqid),this._updateLayer(L)}}setLayerProperty(d,p,b,M={}){this._checkLoaded();const L=this._checkLayer(d);L&&(p==="appearances"?(L.setAppearances(b),this._changes.setDirty()):L.isPaintProperty(p)?this.setPaintProperty(d,p,b,M):this.setLayoutProperty(d,p,b,M))}getLayoutProperty(d,p){const b=this._checkLayer(d);if(b)return b.getLayoutProperty(p)}setPaintProperty(d,p,b,M={}){this._checkLoaded();const L=this._checkLayer(d);if(!L||a.by(L.getPaintProperty(p),b)||b!=null&&(!M||M.validate!==!1)&&jm(L,Ln.call(Ni,{key:`layers.${d}.paint.${p}`,layerType:L.type,objectKey:p,value:b,styleSpec:a.a6})))return;const O=L.setPaintProperty(p,b);L.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(L.fqid),L.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(L.fqid),O&&this._updateLayer(L),this._changes.updatePaintProperties(L)}getPaintProperty(d,p){const b=this._checkLayer(d);if(b)return b.getPaintProperty(p)}setFeatureState(d,p){if(this._checkLoaded(),"target"in d){if("featuresetId"in d.target){const{featuresetId:V,importId:Y}=d.target,Q=this.getFragmentStyle(Y),ce=Q.getFeaturesetLayers(V);for(const{source:le,sourceLayer:de}of ce)Q.setFeatureState({id:d.id,source:le,sourceLayer:de},p)}else if("layerId"in d.target){const{layerId:V}=d.target,Y=this.getLayer(V);this.setFeatureState({id:d.id,source:Y.source,sourceLayer:Y.sourceLayer},p)}return}const b=d.source,M=d.sourceLayer,L=this._checkSource(b);if(!L)return;const O=L.type;if(O==="geojson"&&M)return void this.fire(new a.y(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(O==="vector"&&!M)return void this.fire(new a.y(new Error("The sourceLayer parameter must be provided for vector source types.")));d.id===void 0&&this.fire(new a.y(new Error("The feature id parameter must be provided.")));const z=this.getOwnSourceCaches(b);for(const V of z)V.setFeatureState(M,d.id,p)}removeFeatureState(d,p){if(this._checkLoaded(),"target"in d){if("featuresetId"in d.target){const{featuresetId:V,importId:Y}=d.target,Q=this.getFragmentStyle(Y),ce=Q.getFeaturesetLayers(V);for(const{source:le,sourceLayer:de}of ce)Q.removeFeatureState({id:d.id,source:le,sourceLayer:de},p)}else if("layerId"in d.target){const{layerId:V}=d.target,Y=this.getLayer(V);this.removeFeatureState({id:d.id,source:Y.source,sourceLayer:Y.sourceLayer},p)}return}const b=d.source,M=this._checkSource(b);if(!M)return;const L=M.type,O=L==="vector"?d.sourceLayer:void 0;if(L==="vector"&&!O)return void this.fire(new a.y(new Error("The sourceLayer parameter must be provided for vector source types.")));if(p&&typeof d.id!="string"&&typeof d.id!="number")return void this.fire(new a.y(new Error("A feature id is required to remove its specific state property.")));const z=this.getOwnSourceCaches(b);for(const V of z)V.removeFeatureState(O,d.id,p)}getFeatureState(d){if(this._checkLoaded(),"target"in d){let L;if("featuresetId"in d.target){const{featuresetId:O,importId:z}=d.target,V=this.getFragmentStyle(z),Y=V.getFeaturesetLayers(O);for(const{source:Q,sourceLayer:ce}of Y){const le=V.getFeatureState({id:d.id,source:Q,sourceLayer:ce});if(le&&!L)L=le;else if(!a.by(L,le))return void this.fire(new a.y(new Error("The same feature id exists in multiple sources in the featureset, but their feature states are not consistent through the sources.")))}}else if("layerId"in d.target){const{layerId:O}=d.target,z=this.getLayer(O);L=this.getFeatureState({id:d.id,source:z.source,sourceLayer:z.sourceLayer})}return L}const p=d.source,b=d.sourceLayer,M=this._checkSource(p);if(M){if(M.type!=="vector"||b)return d.id===void 0&&this.fire(new a.y(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(p)[0].getFeatureState(b,d.id);this.fire(new a.y(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(d){return this.stylesheet.transition=Object.assign({},this.stylesheet.transition,d),this.transition=this.stylesheet.transition,this}getTransition(){return Object.assign({},this.stylesheet.transition)}serialize(){this._checkLoaded();const d=this.getTerrain(),p=d&&this.terrain&&this.terrain.scope===this.scope?d:this.stylesheet.terrain;return a.dv({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,iconsets:this.stylesheet.iconsets,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:p,fog:this.stylesheet.fog,snow:this.stylesheet.snow,rain:this.stylesheet.rain,center:this.stylesheet.center,"color-theme":this.stylesheet["color-theme"],zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:this._serializeSources(),layers:this._serializeLayers(this._order)},b=>b!==void 0)}_updateFilteredLayers(d){for(const p of Object.values(this._mergedLayers))d(p)&&this._updateLayer(p)}_updateLayer(d){this._changes.updateLayer(d);const p=this.getLayerSourceCache(d),b=a.B(d.source,d.scope),M=this._changes.getUpdatedSourceCaches();d.source&&!M[b]&&p&&p.getSource().type!=="raster"&&(this._changes.updateSourceCache(b,"reload"),p.pause()),d.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(d){const p=z=>this._mergedLayers[z].is3D(!!this.terrain),b=this.order,M={},L=[];for(let z=b.length-1;z>=0;z--){const V=b[z];if(p(V)){M[V]=z;for(const Y of d){const Q=Y[V];if(Q)for(const ce of Q)L.push(ce)}}}L.sort((z,V)=>V.intersectionZ-z.intersectionZ);const O=[];for(let z=b.length-1;z>=0;z--){const V=b[z];if(p(V))for(let Y=L.length-1;Y>=0;Y--){const Q=L[Y].feature;if(Q.layer&&M[Q.layer.id]{if(nk.has(Q.type))return;const ce=this.getOwnLayerSourceCache(Q),le=L[ce.id]=L[ce.id]||{sourceCache:ce,layers:{},has3DLayers:!1};Q.is3D(!!this.terrain)&&(le.has3DLayers=!0),le.layers[Q.fqid]=le.layers[Q.fqid]||{styleLayer:Q,targets:[]},le.layers[Q.fqid].targets.push({filter:M})};if(p&&p.layers){if(!Array.isArray(p.layers))return this.fire(new a.y(new Error("parameters.layers must be an Array."))),[];for(const Q of p.layers){const ce=this._layers[Q];if(!ce)return this.fire(new a.y(new Error(`The layer '${Q}' does not exist in the map's style and cannot be queried for features.`))),[];O(ce)}}else for(const Q in this._layers)O(this._layers[Q]);const z=this._queryRenderedFeatures(d,L,b),V=this._flattenAndSortRenderedFeatures(z),Y=[];for(const Q of V)a.dw(Q.layer.id)===this.scope&&Y.push(Q);return Y}queryRenderedFeatureset(d,p,b){let M;p&&!Array.isArray(p)&&p.filter&&(this._validate(dr,"queryRenderedFeatures.filter",p.filter,null,p),M=a.b6(p.filter));const L="mock",O=[];if(p&&p.target)O.push(Object.assign({},p,{targetId:L,filter:M}));else{const Q=this.getFeaturesetDescriptors();for(const ce of Q)O.push({targetId:L,filter:M,target:ce});for(const{style:ce}of this.fragments){const le=ce.getFeaturesetDescriptors();for(const de of le)O.push({targetId:L,filter:M,target:de})}}const z=this.queryRenderedTargets(d,O,b),V=[],Y=new Set;for(const Q of z)for(const ce of Q.variants[L])Du(ce,Q,Y)||V.push(new a.dx(Q,ce));return V}queryRenderedTargets(d,p,b){const M={},L=(z,V,Y,Q)=>{const ce=M[V.id]=M[V.id]||{sourceCache:V,layers:{},has3DLayers:!1};if(ce.layers[z.fqid]=ce.layers[z.fqid]||{styleLayer:z,targets:[]},z.is3D(!!this.terrain)&&(ce.has3DLayers=!0),!Q)return Y.uniqueFeatureID=!1,void ce.layers[z.fqid].targets.push(Y);ce.layers[z.fqid].targets.push(Object.assign({},Y,{namespace:Q.namespace,properties:Q.properties,uniqueFeatureID:Q.uniqueFeatureID}))};for(const z of p)if("featuresetId"in z.target){const{featuresetId:V,importId:Y}=z.target,Q=this.getFragmentStyle(Y);if(!Q||!Q._featuresetSelectors)continue;const ce=Q._featuresetSelectors[V];if(!ce){this.fire(new a.y(new Error(`The featureset '${V}' does not exist in the map's style and cannot be queried for features.`)));continue}for(const le of ce){const de=Q.getOwnLayer(le.layerId);de&&!nk.has(de.type)&&L(de,Q.getOwnLayerSourceCache(de),z,le)}}else if("layerId"in z.target){const{layerId:V}=z.target,Y=this.getLayer(V);if(!Y||nk.has(Y.type))continue;L(Y,this.getLayerSourceCache(Y),z)}const O=this._queryRenderedFeatures(d,M,b);return this._flattenAndSortRenderedFeatures(O)}_queryRenderedFeatures(d,p,b){const M=[],L=!!this.map._showQueryGeometry,O=ca.createFromScreenPoints(d,b);for(const z in p){const V=Yl(O,p[z],this._availableImages,b,L);Object.keys(V).length&&M.push(V)}if(this.placement)for(const z in p){if(!p[z].sourceCache._onlySymbols)continue;const V=tp(O.screenGeometry,p[z],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData,this.map.getWorldview());Object.keys(V).length&&M.push(V)}return M}querySourceFeatures(d,p){const b=p&&p.filter;b&&this._validate(dr,"querySourceFeatures.filter",b,null,p);let M=[];const L=this.getOwnSourceCaches(d);for(const O of L)M=M.concat(xm(O,p));return M}addSourceType(d,p,b){return Vu.getSourceType(d)?b(new Error(`A source type called "${d}" already exists.`)):(Vu.setSourceType(d,p),p.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:d,url:p.workerSourceURL},b):b(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(d,p,b={}){this._checkLoaded();const M=this.light.getLight();let L=!1;for(const z in d)if(!a.by(d[z],M[z])){L=!0;break}if(!L)return;const O=this._getTransitionParameters();this.light.setLight(d,p,b),this.light.updateTransitions(O)}getTerrain(){return this.terrain&&this.terrain.drapeRenderMode===1?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}checkCanvasFingerprintNoise(){this.disableElevatedTerrain===void 0&&(this.disableElevatedTerrain=a.o.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&a.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(d,p=1){if(this._checkLoaded(),!d)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),p===0&&delete this.terrain,d===null?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let b=d;const M=!("source"in d)||d.source==null;if(p===1){if(this.disableElevatedTerrain)return;if("source"in b&&typeof b.source=="object"){const z="terrain-dem-src";this.addSource(z,b.source),b=a.dp(b),b=Object.assign(b,{source:z})}const L=Object.assign({},b),O={};if(this.terrain&&M){L.source=this.terrain.get().source;const z=this.terrain?this.getFragmentStyle(this.terrain.scope):null;z&&(O.style=z.serialize())}if(this._validate(lc,"terrain",L,O))return}if(!this.terrain||this.terrain.scope!==this.scope&&!M||this.terrain&&p!==this.terrain.drapeRenderMode){if(!b)return;this._createTerrain(b,p),this.fire(new a.z("data",{dataType:"style"}))}else{const L=this.terrain,O=L.get();for(const z of Object.keys(a.a6.terrain))!b.hasOwnProperty(z)&&a.a6.terrain[z].default&&(b[z]=a.a6.terrain[z].default);for(const z in d)if(!a.by(d[z],O[z])){L.set(d,this.options),this.stylesheet.terrain=d;const V=this._getTransitionParameters({duration:0});L.updateTransitions(V),this.fire(new a.z("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(d){const p=this.fog=new Gn(d,this.map.transform,this.scope,this.options);this.stylesheet.fog=p.get();const b=this._getTransitionParameters({duration:0});p.updateTransitions(b)}_createSnow(d){const p=this.snow=new lo(d,this.map.transform,this.scope,this.options);this.stylesheet.snow=p.get();const b=this._getTransitionParameters({duration:0});p.updateTransitions(b)}_createRain(d){const p=this.rain=new ya(d,this.map.transform,this.scope,this.options);this.stylesheet.rain=p.get();const b=this._getTransitionParameters({duration:0});p.updateTransitions(b)}_updateMarkersOpacity(){this.map._markers.length!==0&&this.map._requestDomTask(()=>{for(const d of this.map._markers)d._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(d){if(this._checkLoaded(),!d)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const p=this.fog;if(!a.by(p.get(),d)){p.set(d,this.options),this.stylesheet.fog=p.get();const b=this._getTransitionParameters({duration:0});p.updateTransitions(b)}}else this._createFog(d);this._markersNeedUpdate=!0}getSnow(){return this.snow?this.snow.get():null}setSnow(d){if(this._checkLoaded(),!d)return delete this.snow,void delete this.stylesheet.snow;if(this.snow){const p=this.snow;if(!a.by(p.get(),d)){p.set(d,this.options),this.stylesheet.snow=p.get();const b=this._getTransitionParameters({duration:0});p.updateTransitions(b)}}else this._createSnow(d);this._markersNeedUpdate=!0}getRain(){return this.rain?this.rain.get():null}setRain(d){if(this._checkLoaded(),!d)return delete this.rain,void delete this.stylesheet.rain;if(this.rain){const p=this.rain;if(!a.by(p.get(),d)){p.set(d,this.options),this.stylesheet.rain=p.get();const b=this._getTransitionParameters({duration:0});p.updateTransitions(b)}}else this._createRain(d);this._markersNeedUpdate=!0}_reloadColorTheme(){const d=()=>{for(const M in this._layers)this._layers[M].lut=this._styleColorTheme.lut;for(const M in this._sourceCaches)this._sourceCaches[M].clearTiles()},p=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!p)return this._styleColorTheme.lut=null,void d();const b=this._evaluateColorThemeData(p);this._loadColorTheme(b).then(()=>{this.fire(new a.z("colorthemeset")),d()}).catch(M=>{a.w(`Couldn't set color theme: ${M}`)})}setColorTheme(d){this._checkLoaded(),this._styleColorTheme.colorThemeOverride&&a.w("Note: setColorTheme is called on a style with a color-theme override, the passed color-theme won't be visible."),this._styleColorTheme.colorTheme=d,this._reloadColorTheme()}setImportColorTheme(d,p){const b=this.getFragmentStyle(d);b&&(b._styleColorTheme.colorThemeOverride=p,b._reloadColorTheme())}_getTransitionParameters(d){return{now:a.o.now(),transition:Object.assign(this.transition,d)}}updateDrapeFirstLayers(){if(!this.terrain)return;const d=[],p=[];for(const b of this._mergedOrder)this.isLayerDraped(this._mergedLayers[b])?d.push(b):p.push(b);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...d),this._drapedFirstOrder.push(...p)}_createTerrain(d,p){const b=this.terrain=new Ot(d,p,this.scope,this.options,this.map.getWorldview());p===1&&(this.stylesheet.terrain=d),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const M=this._getTransitionParameters({duration:0});b.updateTransitions(M)}_force3DLayerUpdate(){for(const d in this._layers){const p=this._layers[d];p.type==="fill-extrusion"&&this._updateLayer(p)}}_forceSymbolLayerUpdate(){for(const d in this._layers){const p=this._layers[d];p.type==="symbol"&&this._updateLayer(p)}}_validate(d,p,b,M,L={}){if(L&&L.validate===!1)return!1;const O=Object.assign({},this.serialize());return jm(this,d.call(Ni,Object.assign({key:p,style:O,value:b,styleSpec:a.a6},M)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),a.dy.off("pluginStateChange",this._rtlTextPluginCallback);for(const d in this._mergedLayers)this._mergedLayers[d].setEventedParent(null);for(const d in this._mergedSourceCaches)this._mergedSourceCaches[d].clearTiles(),this._mergedSourceCaches[d].setEventedParent(null);this.imageManager.removeScope(this.scope),this.setEventedParent(null),delete this.fog,delete this.snow,delete this.rain,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this.modelManager.setEventedParent(null),this.modelManager.destroy(),this.dispatcher.remove())}clearSource(d){const p=this.getSourceCaches(d);for(const b of p)b.clearTiles()}clearSources(){for(const d in this._mergedSourceCaches)this._mergedSourceCaches[d].clearTiles()}clearLayers(){for(const d in this._mergedLayers){const p=this._mergedLayers[d];p._clear&&p._clear()}}reloadSource(d){const p=this.getSourceCaches(d);for(const b of p)b.resume(),b.reload()}reloadSources(){for(const d of this.getSources())d.reload&&d.reload()}reloadModels(){this.modelManager.reloadModels(""),this.forEachFragmentStyle(d=>{d.modelManager.reloadModels(d.scope)})}updateSources(d){let p;this.directionalLight&&(p=Y1(this.directionalLight));const b=new Set,M=new Set;for(const L in this._mergedLayers){const O=this._mergedLayers[L];O.type==="building"&&b.add(O.source),O.hasElevation()&&!M.has(O.source)&&M.add(O.source)}for(const L in this._mergedSourceCaches){const O=this._mergedSourceCaches[L],z=M.has(O._source.id);b.has(O._source.id)&&(O._source.reparseOverscaled=!1),O.update(d,void 0,void 0,p,z)}}_generateCollisionBoxes(){for(const d in this._sourceCaches){const p=this._sourceCaches[d];p.resume(),p.reload()}}_updatePlacement(d,p,b,M,L,O,z=!1){let V=!1,Y=!1;const Q={},ce={};for(const ye of this._mergedOrder){const Oe=this._mergedLayers[ye];if(Oe.type!=="symbol")continue;const Ee=a.B(Oe.source,Oe.scope);let qe=Q[Ee];if(!qe){const Ve=this.getLayerSourceCache(Oe);if(!Ve)continue;const gt=Ve.getRenderableIds(!0).map(ct=>Ve.getTileByID(ct));ce[Ee]=gt.slice(),qe=Q[Ee]=gt.sort((ct,ht)=>ht.tileID.overscaledZ-ct.tileID.overscaledZ||(ct.tileID.isLessThan(ht.tileID)?-1:1))}const Ze=this.crossTileSymbolIndex.addLayer(Oe,qe,p.center.lng,p.projection);V=V||Ze}this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),z=z||this._layerOrderChanged,this._layerOrderChanged&&this.fire(new a.z("neworder"));const le=!!(this.placement&&!p.equals(this.placement.transform)),de=!!(this.placement&&(this.placement.lastReplacementSourceUpdateTime!==0&&!O||this.placement.lastReplacementSourceUpdateTime!==O.updateTime)),be=(le||de||V||this.placement&&this.placement.isStale())&&M===0;if((z||!this.pauseablePlacement||be||M!==0&&this.pauseablePlacement.isDone()&&!this.placement.stillRecent(a.o.now(),p.zoom))&&(this.pauseablePlacement=new ll(p,this._mergedOrder,z||M===0,b,M,L,this.placement,this.fog&&p.projection.supportsFog?this.fog.state:null,this._buildingIndex),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,Q,ce,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(a.o.now()),Y=!0),V&&this.pauseablePlacement.placement.setStale()),Y||V){this._buildingIndex.onNewFrame(p.zoom);for(let ye=0;yeL===d.id)!==-1)return void this.fire(new a.y(new Error(`Import with id '${d.id}' already exists in the map's style.`)));if(!p)return b.push(d),this._loadImports([d],!0);const M=b.findIndex(({id:L})=>L===p);return M===-1&&this.fire(new a.y(new Error(`Import with id "${p}" does not exist on this map.`))),this.stylesheet.imports=b.slice(0,M).concat(d).concat(b.slice(M)),this._loadImports([d],!0,p)}updateImport(d,p){this._checkLoaded();const b=this.stylesheet.imports||[],M=this.getImportIndex(d);return M===-1?this:typeof p=="string"?(this.setImportUrl(d,p),this):(p.url&&p.url!==b[M].url&&this.setImportUrl(d,p.url),a.by(p.config,b[M].config)||this.setImportConfig(d,p.config,p.data.schema),a.by(p.data,b[M].data)||this.setImportData(d,p.data),this)}moveImport(d,p){this._checkLoaded();let b=this.stylesheet.imports||[];const M=this.getImportIndex(d);if(M===-1)return this;const L=this.getImportIndex(p);if(L===-1)return this;const O=b[M],z=this.fragments[M];return b=b.filter(({id:V})=>V!==d),this.fragments=this.fragments.filter(({id:V})=>V!==d),this.stylesheet.imports=b.slice(0,L).concat(O).concat(b.slice(L)),this.fragments=this.fragments.slice(0,L).concat(z).concat(this.fragments.slice(L)),this.mergeLayers(),this}setImportUrl(d,p){this._checkLoaded();const b=this.stylesheet.imports||[],M=this.getImportIndex(d);if(M===-1)return this;b[M].url=p;const L=this.fragments[M];return L.style=this._createFragmentStyle(b[M]),L.style.on("style.import.load",()=>this.mergeAll()),L.style.loadURL(p),this}setImportData(d,p){this._checkLoaded();const b=this.getImportIndex(d),M=this.stylesheet.imports||[];return b===-1?this:p?(this.fragments[b].style.setState(p),this._reloadImports(),this):(delete M[b].data,this.setImportUrl(d,M[b].url))}setImportConfig(d,p,b){this._checkLoaded();const M=this.getImportIndex(d),L=this.stylesheet.imports||[];if(M===-1)return this;p?L[M].config=p:delete L[M].config;const O=this.fragments[M];b&&O.style.stylesheet&&(O.style.stylesheet.schema=b);const z=O.style.stylesheet&&O.style.stylesheet.schema;return O.config=p,O.style.updateConfig(p,z),this.updateConfigDependencies(),this}removeImport(d){this._checkLoaded();const p=this.stylesheet.imports||[],b=this.getImportIndex(d);b!==-1&&(p.splice(b,1),this.fragments[b].style._remove(),this.fragments.splice(b,1),this._reloadImports())}getImportIndex(d){const p=(this.stylesheet.imports||[]).findIndex(b=>b.id===d);return p===-1&&this.fire(new a.y(new Error(`Import '${d}' does not exist in the map's style and cannot be updated.`))),p}getLayer(d){return this._mergedLayers[d]}getSources(){const d=[];for(const p in this._mergedOtherSourceCaches){const b=this._mergedOtherSourceCaches[p];b&&d.push(b.getSource())}return d}getSource(d,p){const b=this.getSourceCache(d,p);return b&&b.getSource()}getLayerSource(d){const p=this.getLayerSourceCache(d);return p&&p.getSource()}getSourceCache(d,p){const b=a.B(d,p);return this._mergedOtherSourceCaches[b]}getLayerSourceCache(d){const p=a.B(d.source,d.scope);return d.type==="symbol"?this._mergedSymbolSourceCaches[p]:this._mergedOtherSourceCaches[p]}getSourceCaches(d){if(d==null)return Object.values(this._mergedSourceCaches);const p=[];return this._mergedOtherSourceCaches[d]&&p.push(this._mergedOtherSourceCaches[d]),this._mergedSymbolSourceCaches[d]&&p.push(this._mergedSymbolSourceCaches[d]),p}updateSourceCaches(){const d=this._changes.getUpdatedSourceCaches();for(const p in d){const b=d[p];b==="reload"?this.reloadSource(p):b==="clear"&&this.clearSource(p)}}updateLayers(d){const p=this._changes.getUpdatedPaintProperties();for(const b of p){const M=this.getLayer(b);M&&M.updateTransitions(d)}}getGlyphsUrl(){return this.stylesheet.glyphs}setGlyphsUrl(d){this.stylesheet.glyphs=d,this.glyphManager.setURL(d)}getImages(d,p,b){this.imageManager.getImages(p.images,p.scope,b),this._updateTilesForChangedImages();const M=O=>{if(O){const z=p.images.map(V=>a.I.toString(V));O.setDependencies(p.tileID.key,p.type,z)}},L=a.B(p.source,p.scope);M(this._mergedOtherSourceCaches[L]),M(this._mergedSymbolSourceCaches[L]),p.images.some(O=>O.iconsetId)&&this.fire(new a.z("data",{dataType:"style"}))}rasterizeImages(d,p,b){this.imageManager.rasterizeImages(p,b)}getGlyphs(d,p,b){this.glyphManager.getGlyphs(p.stacks,b)}getResource(d,p,b){return a.dz(p,b)}getOwnSourceCache(d){return this._otherSourceCaches[d]}getOwnLayerSourceCache(d){return d.type==="symbol"?this._symbolSourceCaches[d.source]:this._otherSourceCaches[d.source]}getOwnSourceCaches(d){const p=[];return this._otherSourceCaches[d]&&p.push(this._otherSourceCaches[d]),this._symbolSourceCaches[d]&&p.push(this._symbolSourceCaches[d]),p}_isSourceCacheLoaded(d){const p=this.getOwnSourceCaches(d);return p.length===0?(this.fire(new a.y(new Error(`There is no source with ID '${d}'`))),!1):p.every(b=>b.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(d,p){if(!this._clipLayerPresent&&d.type!=="fill-extrusion"&&d.type!=="building")return!1;const b=d.type==="fill-extrusion"&&(d.sourceLayer==="building"||d.sourceLayer==="procedural_buildings"),M=d.type==="building";if(d.is3D(!!this.terrain)){if(b||M||p&&p.type==="batched-model"||d.type==="model")return!0}else if(d.type==="symbol")return!0;return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.fragments.forEach(d=>{d.style._remove()}),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}Vu.getSourceType=function(_){return eu[_]},Vu.setSourceType=function(_,d){eu[_]=d},Vu.registerForPluginStateChange=a.dA;class PI extends a.E{constructor(d){super(),this._style=d,this._buildings={},this._activeFloors=new Set,this._activeFloorsVisible=!0,this._indoorState={selectedFloorId:null,lastActiveFloors:null,activeFloorsVisible:!0},a.aY(["_updateUI"],this)}destroy(){this._buildings={},this._activeFloors=new Set,this._indoorState=null}selectFloor(d){d===this._selectedFloorId&&this._activeFloorsVisible||(this._selectedFloorId=d,this._activeFloorsVisible=!0,this._updateActiveFloors())}setActiveFloorsVisibility(d){this._activeFloorsVisible=d,this._updateActiveFloors(),this._updateIndoorSelector()}setIndoorData(d){for(const[p,b]of Object.entries(d.buildings))if(this._buildings[p])for(const M of b.floorIds)this._buildings[p].floors[M]||(this._buildings[p].floors[M]=b.floors[M]);else this._buildings[p]=b;for(const p of d.activeFloors)this._activeFloors.add(p);this._updateIndoorSelector()}getIndoorTileOptions(d,p){const b=this._style.getIndoorSourceLayers(d,p);return b&&this._indoorState?{sourceLayers:b,indoorState:this._indoorState}:null}_updateUI(d,p,b){const M=function(L,O,z,V){let Y=null,Q=Number.MAX_SAFE_INTEGER;if(V<16)return null;for(const[ce,le]of Object.entries(L)){const de=le.center;if(de){const be=O.distanceTo(a.aT.convert(de));be({id:O,name:b.floors[O].name,zIndex:b.floors[O].zIndex})).sort((O,z)=>z.zIndex-O.zIndex);this.fire(new a.z("selector-update",{selectedFloorId:M,activeFloorsVisible:this._activeFloorsVisible,floors:L}))}_updateActiveFloors(){const d=this._activeFloors;this._activeFloors=new Set,this._indoorState={selectedFloorId:this._selectedFloorId,lastActiveFloors:d,activeFloorsVisible:this._activeFloorsVisible},this._style.updateIndoorDependentLayers()}}var cx=` #define EPSILON 0.0000001 #define PI 3.141592653589793 #ifdef RENDER_CUTOFF float cutoff_opacity(vec4 cutoff_params,float depth) {float near=cutoff_params.x;float far=cutoff_params.y;float cutoffStart=cutoff_params.z;float cutoffEnd=cutoff_params.w;float linearDepth=(depth-near)/(far-near);return clamp((linearDepth-cutoffStart)/(cutoffEnd-cutoffStart),0.0,1.0);} #endif`,dx=` #ifdef DUAL_SOURCE_BLENDING layout(location=0,index=0) out vec4 glFragColor;layout(location=0,index=1) out vec4 glFragColorSrc1; #else layout(location=0) out vec4 glFragColor; #endif #ifdef USE_MRT1 layout(location=1) out vec4 out_Target1; #endif highp float unpack_depth(highp vec4 rgba_depth) {const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;} #ifdef INDICATOR_CUTOUT uniform vec3 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params; #endif vec4 applyCutout(vec4 color,float height) { #ifdef INDICATOR_CUTOUT float verticalFadeRange=u_indicator_cutout_centers.z*0.25;float holeMinOpacity=mix(1.0,u_indicator_cutout_params.x,smoothstep(u_indicator_cutout_centers.z,u_indicator_cutout_centers.z+verticalFadeRange,height));float holeRadius=max(u_indicator_cutout_params.y,0.0);float holeAspectRatio=u_indicator_cutout_params.z;float fadeStart=u_indicator_cutout_params.w;float distA=distance(vec2(gl_FragCoord.x,gl_FragCoord.y*holeAspectRatio),vec2(u_indicator_cutout_centers[0],u_indicator_cutout_centers[1]*holeAspectRatio));return color*min(smoothstep(fadeStart,holeRadius,distA)+holeMinOpacity,1.0); #else return color; #endif } #ifdef DEBUG_WIREFRAME #define HANDLE_WIREFRAME_DEBUG \\ glFragColor=vec4(0.7,0.0,0.0,0.7); \\ gl_FragDepth=gl_FragCoord.z-0.0001; #else #define HANDLE_WIREFRAME_DEBUG #endif #ifdef RENDER_CUTOFF uniform highp vec4 u_cutoff_params;in float v_cutoff_opacity; #endif vec4 textureLodCustom(sampler2D image,highp vec2 pos,highp vec2 lod_coord) {highp vec2 size=vec2(textureSize(image,0));highp vec2 dx=dFdx(lod_coord.xy*size);highp vec2 dy=dFdy(lod_coord.xy*size);highp float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));highp float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}vec4 applyLUT(highp sampler3D lut,vec4 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return vec4(texture(lut,uvw).rgb*col.a,col.a);}vec3 applyLUT(highp sampler3D lut,vec3 col) {return applyLUT(lut,vec4(col,1.0)).rgb;}`,y3=` #define EXTENT 8192.0 #define RAD_TO_DEG 180.0/PI #define DEG_TO_RAD PI/180.0 #define GLOBE_RADIUS EXTENT/PI/2.0 float wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;} #ifdef PROJECTION_GLOBE_VIEW vec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) { #ifndef PROJECTED_POS_ON_VIEWPORT float tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz; #else return vec3(0.0); #endif }vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);} #endif vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4( unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0 );}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const vec2 units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (units_to_pixels*pos+offset)/pattern_size;}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {return get_pattern_pos(pixel_coord_upper,pixel_coord_lower,pattern_size,vec2(tile_units_to_pixels),pos);}float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(PI/4.0+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);} #ifdef RENDER_CUTOFF uniform vec4 u_cutoff_params;out float v_cutoff_opacity; #endif const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt) {float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);} #ifndef HAS_SHADER_STORAGE_BLOCK_material_buffer #define GET_ATTRIBUTE_float(attrib,matInfo,attrib_id) attrib #define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_id) attrib #define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_id) attrib #define DECLARE_MATERIAL_TABLE_INFO #endif`,sk="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",ru=` #define ELEVATION_SCALE 7.0 #define ELEVATION_OFFSET 450.0 #ifdef PROJECTION_GLOBE_VIEW uniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix( mix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;} #else vec3 elevationVector(vec2 pos) { return vec3(0,0,1); } #endif #ifdef TERRAIN uniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float currentElevation(vec2 apos) { #ifdef TERRAIN_DEM_FLOAT_FORMAT vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem,pos).r; #else float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(dd,0)).r;float bl=texture(u_dem,pos+vec2(0,dd)).r;float br=texture(u_dem,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y); #endif }float prevElevation(vec2 apos) { #ifdef TERRAIN_DEM_FLOAT_FORMAT vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem_prev,pos).r; #else float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem_prev,pos).r;float tr=texture(u_dem_prev,pos+vec2(dd,0)).r;float bl=texture(u_dem_prev,pos+vec2(0,dd)).r;float br=texture(u_dem_prev,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y); #endif } #ifdef TERRAIN_VERTEX_MORPHING float elevation(vec2 apos) { #ifdef ZERO_EXAGGERATION return 0.0; #endif float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);} #else float elevation(vec2 apos) { #ifdef ZERO_EXAGGERATION return 0.0; #endif return currentElevation(apos);} #endif vec4 fourSample(vec2 pos,vec2 off) {float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(off.x,0.0)).r;float bl=texture(u_dem,pos+vec2(0.0,off.y)).r;float br=texture(u_dem,pos+off).r;return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);} #else float elevation(vec2 pos) { return 0.0; } #endif #ifdef DEPTH_OCCLUSION uniform highp sampler2D u_depth;uniform highp vec2 u_depth_size_inv;uniform highp vec2 u_depth_range_unpack;uniform highp float u_occluder_half_size;uniform highp float u_occlusion_depth_offset; #ifdef DEPTH_D24 float unpack_depth(float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}vec4 unpack_depth4(vec4 depth) {return depth*u_depth_range_unpack.x+vec4(u_depth_range_unpack.y);} #else highp float unpack_depth_rgba(vec4 rgba_depth) {const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;} #endif bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w; #ifdef CLIP_ZERO_TO_ONE coord.z=-1.0+2.0*coord.z; #endif #ifdef DEPTH_D24 float depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r); #else float depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5)); #endif return coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5; #ifdef DEPTH_D24 highp vec4 depth=vec4( texture(u_depth,uv-df.xz).r,texture(u_depth,uv+df.xz).r,texture(u_depth,uv-df.zy).r,texture(u_depth,uv+df.zy).r );depth=unpack_depth4(depth); #else highp vec4 depth=vec4( unpack_depth_rgba(texture(u_depth,uv-df.xz)),unpack_depth_rgba(texture(u_depth,uv+df.xz)),unpack_depth_rgba(texture(u_depth,uv-df.zy)),unpack_depth_rgba(texture(u_depth,uv+df.zy)) ); #endif return depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5; #ifdef CLIP_ZERO_TO_ONE coord.z=-1.0+2.0*coord.z; #endif int NX=3;int NY=4;highp vec2 df=u_occluder_half_size*u_depth_size_inv;highp vec2 oneStep=2.0*u_occluder_half_size*u_depth_size_inv/vec2(NX-1,NY-1);highp float res=0.0;for (int y=0; y < NY;++y) {for (int x=0; x < NX;++x) { #ifdef DEPTH_D24 highp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r); #else highp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y))); #endif res+=1.0-clamp(300.0*(coord.z+u_occlusion_depth_offset-depth),0.0,1.0);}}res=clamp(2.0*res/float(NX*NY)-0.5,0.0,1.0);return res;}highp float occlusionFade(vec4 frag) {highp vec3 coord=frag.xyz/frag.w; #ifdef CLIP_ZERO_TO_ONE coord.z=-1.0+2.0*coord.z; #endif highp vec4 depth=getCornerDepths(coord.xy);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z+u_occlusion_depth_offset)-depth),0.0,1.0));} #else bool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; } #endif`,ik=`#ifdef FOG uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;out vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);} #endif`,Cr=`#ifdef FOG uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport; #ifdef FLIP_Y uv.y=1.0-uv.y; #endif highp vec3 ray_dir=mix( mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos,float opacity_limit) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,min(opacity,opacity_limit));}vec3 fog_apply(vec3 color,vec3 pos) {return fog_apply(color,pos,1.0);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x > 0.0 || u_fog_vertical_limit.y > 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) {return color;}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);} #endif`,x3=`#ifdef RASTER_ARRAY uniform highp sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);ivec4 _raTexLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}vec2 _raTexLinearMix(highp vec2 fxy,highp vec4 colorMix,highp float colorOffset,highp vec4 t00,highp vec4 t10,highp vec4 t01,highp vec4 t11) {vec2 c00=t00==NODATA ? vec2(0) : vec2(colorOffset+dot(t00,colorMix),1);vec2 c10=t10==NODATA ? vec2(0) : vec2(colorOffset+dot(t10,colorMix),1);vec2 c01=t01==NODATA ? vec2(0) : vec2(colorOffset+dot(t01,colorMix),1);vec2 c11=t11==NODATA ? vec2(0) : vec2(colorOffset+dot(t11,colorMix),1);return mix(mix(c01,c11,fxy.x),mix(c00,c10,fxy.x),fxy.y);}vec2 raTexture2D_image0_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image0,c.yz,0),texelFetch(u_image0,c.xz,0),texelFetch(u_image0,c.yw,0),texelFetch(u_image0,c.xw,0) );}vec2 raTexture2D_image1_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image1,c.yz,0),texelFetch(u_image1,c.xz,0),texelFetch(u_image1,c.yw,0),texelFetch(u_image1,c.xw,0) );}vec2 raTexture2D_image0_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image0,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}vec2 raTexture2D_image1_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image1,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);} #endif`,ak=`#ifdef RASTER_ARRAY uniform sampler2D u_velocity;uniform mediump vec2 u_velocity_res;uniform mediump float u_max_speed;const vec4 NO_DATA=vec4(1);const vec2 INVALID_VELOCITY=vec2(-1);uniform highp vec2 u_uv_offset;uniform highp float u_data_offset;uniform highp vec2 u_data_scale;ivec4 rasterArrayLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}highp vec2 lookup_velocity(highp vec2 uv) {uv=u_uv_offset.x+u_uv_offset.y*uv;highp vec2 fxy;ivec4 c=rasterArrayLinearCoord(uv,u_velocity_res,fxy);highp vec4 tl=texelFetch(u_velocity,c.yz,0);highp vec4 tr=texelFetch(u_velocity,c.xz,0);highp vec4 bl=texelFetch(u_velocity,c.yw,0);highp vec4 br=texelFetch(u_velocity,c.xw,0);if (tl==NO_DATA) {return INVALID_VELOCITY;}if (tr==NO_DATA) {return INVALID_VELOCITY;}if (bl==NO_DATA) {return INVALID_VELOCITY;}if (br==NO_DATA) {return INVALID_VELOCITY;}highp vec4 t=mix(mix(bl,br,fxy.x),mix(tl,tr,fxy.x),fxy.y);highp vec2 velocity=u_data_offset+vec2(dot(t.rg,u_data_scale),dot(t.ba,u_data_scale));velocity.y=-velocity.y;velocity/=max(u_max_speed,length(velocity));return velocity;} #endif uniform highp float u_particle_pos_scale;uniform highp vec2 u_particle_pos_offset;highp vec4 pack_pos_to_rgba(highp vec2 p) {highp vec2 v=(p+u_particle_pos_offset)/u_particle_pos_scale;highp vec4 r=vec4(v.x,fract(v.x*255.0),v.y,fract(v.y*255.0));return vec4(r.x-r.y/255.0,r.y,r.z-r.w/255.0,r.w);}highp vec2 unpack_pos_from_rgba(highp vec4 v) {v=floor(v*255.0+0.5)/255.0;highp vec2 p=vec2(v.x+(v.y/255.0),v.z+(v.w/255.0));return u_particle_pos_scale*p-u_particle_pos_offset;}`,ok=`#ifdef RENDER_SHADOWS uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_normal_offset;vec3 shadow_normal_offset(vec3 normal) {float tileInMeters=u_shadow_normal_offset[0];vec3 n=vec3(-normal.xy,tileInMeters*normal.z);float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return n*dotScale;}vec3 shadow_normal_offset_model(vec3 normal) {vec3 transformed_normal=vec3(-normal.xy,normal.z);float NDotL=dot(normalize(transformed_normal),u_shadow_direction);float dotScale=min(1.0-NDotL,1.0)*0.5+0.5;return normal*dotScale;}float shadow_normal_offset_multiplier0() {return u_shadow_normal_offset[1];}float shadow_normal_offset_multiplier1() {return u_shadow_normal_offset[2];} #endif`,v3=`#ifdef RENDER_SHADOWS precision highp sampler2DShadow;uniform sampler2DShadow u_shadowmap_0;uniform sampler2DShadow u_shadowmap_1;uniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;float shadow_sample(sampler2DShadow shadowmap,highp vec3 pos,highp float bias) { #ifdef CLIP_ZERO_TO_ONE highp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z-bias); #else highp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z*0.5+0.5-bias); #endif return texture(shadowmap,coord);}float shadow_occlusion(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,highp float bias) {light_view_pos0.xyz/=light_view_pos0.w; #ifdef SHADOWS_SINGLE_CASCADE vec2 abs_bounds=abs(light_view_pos0.xy);if (abs_bounds.x >=1.0 || abs_bounds.y >=1.0) {return 0.0;}return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias); #else light_view_pos1.xyz/=light_view_pos1.w;vec4 abs_bounds=abs(vec4(light_view_pos0.xy,light_view_pos1.xy));if (abs_bounds.x < 1.0 && abs_bounds.y < 1.0) {return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias);}if (abs_bounds.z >=1.0 || abs_bounds.w >=1.0) {return 0.0;}float occlusion1=shadow_sample(u_shadowmap_1,light_view_pos1.xyz,bias);return clamp(mix(occlusion1,0.0,smoothstep(u_fade_range.x,u_fade_range.y,view_depth)),0.0,1.0); #endif }highp float calculate_shadow_bias(float NDotL) { #ifdef NORMAL_OFFSET return 0.5*u_shadow_bias.x; #else return 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z)); #endif }float shadowed_light_factor_normal(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_opacity(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,float shadow_opacity) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias)*shadow_opacity;return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_unbiased(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}highp vec2 compute_receiver_plane_depth_bias(highp vec3 pos_dx,highp vec3 pos_dy) {highp vec2 biasUV=vec2( pos_dy.y*pos_dx.z-pos_dx.y*pos_dy.z,pos_dx.x*pos_dy.z-pos_dy.x*pos_dx.z);biasUV*=1.0/((pos_dx.x*pos_dy.y)-(pos_dx.y*pos_dy.x));return biasUV;}float shadowed_light_factor_plane_bias(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {highp vec3 light_view_pos0_xyz=light_view_pos0.xyz/light_view_pos0.w*0.5+0.5;highp vec3 light_view_pos0_ddx=dFdx(light_view_pos0_xyz);highp vec3 light_view_pos0_ddy=dFdy(light_view_pos0_xyz);highp vec2 plane_depth_bias=compute_receiver_plane_depth_bias(light_view_pos0_ddx,light_view_pos0_ddy);highp float bias=dot(vec2(u_shadow_texel_size,u_shadow_texel_size),plane_depth_bias)+0.0001;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadowed_light_factor(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadow_occlusion(float ndotl,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=calculate_shadow_bias(ndotl);return shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);} #endif`;const Q1=/#include\s+"([^"]+)"/g,af=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g,_3=/\b[A-Za-z_][A-Za-z0-9_]*\b/g,Rg=new Set(["ifdef","ifndef","elif","if","defined"]),Fg=new Set;Sm(cx,Fg),Sm(y3,Fg),Sm(dx,Fg);const Nm={"_prelude_fog.vertex.glsl":ik,"_prelude_terrain.vertex.glsl":ru,"_prelude_shadow.vertex.glsl":ok,"_prelude_material_table.vertex.glsl":`#ifdef HAS_SHADER_STORAGE_BLOCK_material_buffer #define MATERIAL_TABLE_DEBUG 0 uniform int u_material_offset;uniform int u_vertex_offset;layout(std140,binding=0)readonly buffer material_buffer{uvec4 material_data[];};struct MaterialInfo{uint dataOffset; #if MATERIAL_TABLE_DEBUG vec4 colorDebug; #endif };uint read_buf_no_offset(uint iDword) {return material_data[iDword/4u][iDword % 4u];}uint read_buf(uint iDword) {iDword+=uint(u_material_offset/4);return read_buf_no_offset(iDword);}float read_buf_float(uint iDword){return uintBitsToFloat(read_buf(iDword));}uint read_buf_uint8(uint iDword,uint iUint8){uint dwordOffset=iDword+(iUint8/4u);uint byteOffset=iUint8 & 3u;uint bitOffset=8u*byteOffset;uint mask=0xffu << bitOffset;uint dwordVal=read_buf(dwordOffset);return (dwordVal & mask) >> bitOffset;}uint read_buf_uint16(uint iDword,uint iUint16){uint dwordOffset=iDword+(iUint16 >> 1u);uint bitOffset=(iUint16 & 1u)*16u;uint mask=0xffffu << bitOffset;uint dwordVal=read_buf(dwordOffset);return (dwordVal & mask) >> bitOffset;}uint nrDwordsForVertexIdEntries(uint nrMaterialLookupEntries) {return nrMaterialLookupEntries;}uint nrDwordsForMaterialIdEntries(uint nrMaterialLookupEntries) {return (nrMaterialLookupEntries*2u+3u)/4u;}uint findRangeBinarySearch(uint vertexId,uint numRanges,uint dwordOffset) {uint left=0u;uint right=numRanges-1u;for (uint i=0u; i < 16u; i++) { if (left > right) {break;}uint mid=(left+right)/2u;uint start=read_buf(dwordOffset+mid);uint nextStart=(mid+1u < numRanges) ? read_buf(dwordOffset+mid+1u) : 0xffffffffu;if (vertexId >=start && vertexId < nextStart) {return mid;} else if (vertexId < start) {if (mid==0u) {break;}right=mid-1u;} else {left=mid+1u;}}return 0u; }uint readVertexId(uint dwordOffset,uint iMaterialLookupEntry) {return read_buf(dwordOffset+iMaterialLookupEntry);}uint findRange(uint vertexId,uint numRanges,uint dwordOffset) {uint iRange;if(numRanges <=64u){uint vertexBegin;for(iRange=0u; iRange < numRanges;++iRange) {vertexBegin=readVertexId(dwordOffset,iRange);if(vertexBegin > vertexId) {break;}}iRange=iRange==0u? 0u : iRange-1u;} else { iRange=findRangeBinarySearch(vertexId,numRanges,dwordOffset);}return iRange;}MaterialInfo read_material_info(uint vertex_id) {MaterialInfo info; #if MATERIAL_TABLE_DEBUG const vec4 red=vec4(1.0,0.0,0.0,1.0);const vec4 orange=vec4(1.0,0.5,0.0,1.0);const vec4 yellow=vec4(1.0,1.0,0.0,1.0);const vec4 green=vec4(0.0,1.0,0.0,1.0);const vec4 indigo=vec4(0.294,0.0,0.510,1.0);const vec4 blue=vec4(0.0,0.0,1.0,1.0);const vec4 purple=vec4(0.5,0.0,0.5,1.0);const vec4 pink=vec4(1.0,0.0,1.0,1.0);info.colorDebug=green; #endif uint offset=0u; #if MATERIAL_TABLE_DEBUG bool keepFinding=true;uint magic=read_buf(offset);if(magic !=0xCAFEBABEu) {info.colorDebug=red;keepFinding=false;return info;} #endif offset++; #if MATERIAL_TABLE_DEBUG uint nrMaterials=read_buf(offset);uint nrVertices=read_buf(offset+1u);if(keepFinding && vertex_id >=nrVertices) {info.colorDebug=red;keepFinding=false;} #endif offset+=2u;uint nrMaterialLookupEntries=read_buf(offset++);uint perMaterialEntrySizeDwords=read_buf(offset++); #if MATERIAL_TABLE_DEBUG if(keepFinding && perMaterialEntrySizeDwords !=1u) {info.colorDebug=red;keepFinding=false;} #endif uint iMaterialLookup=findRange(vertex_id,nrMaterialLookupEntries,offset); #if MATERIAL_TABLE_DEBUG if(keepFinding) {uint vertexBeginCheck=readVertexId(offset,iMaterialLookup);if(vertexBeginCheck > vertex_id) {info.colorDebug=red;keepFinding=false;}if(iMaterialLookup < nrMaterialLookupEntries-1u) {uint vertexEndCheck=readVertexId(offset,iMaterialLookup+1u);if(vertexEndCheck <=vertex_id) {info.colorDebug=red;keepFinding=false;}}} #endif offset+=nrDwordsForVertexIdEntries(nrMaterialLookupEntries);uint materialId=iMaterialLookup; #if MATERIAL_TABLE_DEBUG if(keepFinding) {if(materialId >=nrMaterialLookupEntries) {info.colorDebug=red;}} #endif info.dataOffset=offset+materialId*perMaterialEntrySizeDwords;return info;}uint get_data_location(const MaterialInfo matInfo,uint attribOffsetBytes) {uint attribFieldOffsetDwords=attribOffsetBytes/4u;return matInfo.dataOffset+attribFieldOffsetDwords;}vec4 read_material_vec4(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return vec4(read_buf_float(loc),read_buf_float(loc+1u),read_buf_float(loc+2u),read_buf_float(loc+3u));}vec2 read_material_vec2(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return vec2(read_buf_float(loc),read_buf_float(loc+1u));}float read_material_float(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return read_buf_float(loc);} #define GET_ATTRIBUTE_float(attrib,matInfo,attrib_offset) read_material_float(matInfo,attrib_offset) #define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_offset) read_material_vec4(matInfo,attrib_offset) #define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_offset) read_material_vec2(matInfo,attrib_offset) #define DECLARE_MATERIAL_TABLE_INFO MaterialInfo materialInfo=read_material_info(uint(gl_VertexID)); #define DECLARE_MATERIAL_TABLE_INFO_DEBUG(dbgColor) MaterialInfo materialInfo=read_material_info(uint(gl_VertexID)); dbgColor=materialInfo.colorDebug; #endif`,"_prelude_fog.fragment.glsl":Cr,"_prelude_shadow.fragment.glsl":v3,"_prelude_lighting.glsl":` #ifdef LIGHTING_3D_MODE uniform mediump vec3 u_lighting_ambient_color;uniform mediump vec3 u_lighting_directional_dir;uniform mediump vec3 u_lighting_directional_color;uniform mediump vec3 u_ground_radiance;float calculate_ambient_directional_factor(vec3 normal) {float NdotL=dot(normal,u_lighting_directional_dir);const float factor_reduction_max=0.3;float dir_luminance=dot(u_lighting_directional_color,vec3(0.2126,0.7152,0.0722));float directional_factor_min=1.0-factor_reduction_max*min(dir_luminance,1.0);float ambient_directional_factor=mix(directional_factor_min,1.0,min((NdotL+1.0),1.0));const float vertical_factor_min=0.92;float vertical_factor=mix(vertical_factor_min,1.0,normal.z*0.5+0.5);return vertical_factor*ambient_directional_factor;}vec3 linearProduct(vec3 srgbIn,vec3 k) {return srgbIn*pow(k,vec3(1./2.2));}vec3 apply_lighting(vec3 color,vec3 normal,float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return linearProduct(color,ambient_contrib+directional_contrib);}vec4 apply_lighting(vec4 color,vec3 normal,float dir_factor) {return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting(vec3 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return apply_lighting(color.rgb,normal,dir_factor);}vec4 apply_lighting(vec4 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting_ground(vec3 color) {return color*u_ground_radiance;}vec4 apply_lighting_ground(vec4 color) {return vec4(apply_lighting_ground(color.rgb),color.a);}float calculate_NdotL(vec3 normal) {const float ext=0.70710678118;return (clamp(dot(normal,u_lighting_directional_dir),-ext,1.0)+ext)/(1.0+ext);}vec4 apply_lighting_with_emission_ground(vec4 color,float emissive_strength) {return mix(apply_lighting_ground(color),color,emissive_strength);}vec3 compute_flood_lighting(vec3 flood_light_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=flood_light_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);float occlusion_ramp=smoothstep(0.0,0.2,1.0-occlusion);return mix(fully_occluded_color,flood_light_color,occlusion_ramp);}vec3 compute_emissive_draped(vec3 unlit_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=unlit_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);return mix(fully_occluded_color,unlit_color,1.0-occlusion);} #endif`,"_prelude_raster_array.glsl":x3,"_prelude_raster_particle.glsl":ak},lk={};Vs("",ru),Vs(Cr,ik),Vs(v3,ok),Vs(x3,""),Vs(ak,"");const LI=Vs(dx,y3),ck=cx,Fie=[` #if defined(GL_EXT_blend_func_extended) && defined(DUAL_SOURCE_BLENDING) #extension GL_EXT_blend_func_extended : require #endif`,"precision mediump float;",ck,LI.fragmentSource].join(` `),OI=["precision highp float;",ck,LI.vertexSource].join(` `);var b3={background:Vs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" uniform vec4 u_color;uniform float u_opacity;uniform mediump float u_emissive_strength; #ifdef LIGHTING_3D_MODE in vec4 v_color; #endif void main() {vec4 out_color; #ifdef LIGHTING_3D_MODE out_color=v_color; #else out_color=u_color; #endif #ifdef FOG out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); #endif glFragColor=out_color*u_opacity; #ifdef USE_MRT1 out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_lighting.glsl" in vec2 a_pos;uniform mat4 u_matrix;uniform mediump float u_emissive_strength; #ifdef LIGHTING_3D_MODE uniform mediump vec4 u_color;out vec4 v_color; #endif void main() {gl_Position=u_matrix*vec4(a_pos,0,1); #ifdef LIGHTING_3D_MODE v_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength); #endif #ifdef FOG v_fog_pos=fog_position(a_pos); #endif }`),backgroundPattern:Vs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" uniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform float u_emissive_strength;uniform sampler2D u_image;in highp vec2 v_pos;void main() {highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=textureLodCustom(u_image,pos,v_pos); #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); #endif #ifdef FOG out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); #endif glFragColor=out_color*u_opacity; #ifdef USE_MRT1 out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" uniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec2 u_pattern_units_to_pixels;in vec2 a_pos;out highp vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_pattern_units_to_pixels,a_pos); #ifdef FOG v_fog_pos=fog_position(a_pos); #endif }`),building:Vs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_shadow.fragment.glsl" #include "_prelude_lighting.glsl" const float window_depth=0.5;const float ao_radius=0.2;in vec4 v_color;in highp vec3 v_normal;in highp vec3 v_pos; #ifdef BUILDING_FAUX_FACADE in lowp float v_faux_facade;in highp float v_faux_facade_ed;in highp vec2 v_faux_facade_window;in highp vec2 v_faux_facade_floor;in highp vec2 v_faux_facade_range;in highp float v_aspect;in highp vec3 v_tbn_0;in highp vec3 v_tbn_1;in highp vec3 v_tbn_2;in highp vec4 v_faux_color_emissive;uniform float u_faux_facade_ao_intensity; #endif #ifdef RENDER_SHADOWS in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1; #endif #ifdef FLOOD_LIGHT in highp float v_flood_radius;in float v_has_flood_light; #endif uniform lowp float u_opacity;uniform vec3 u_camera_pos;uniform highp float u_tile_to_meter;uniform float u_facade_emissive_chance;uniform vec3 u_flood_light_color;uniform float u_flood_light_intensity;vec3 linearTosRGB(in vec3 color) {return pow(color,vec3(1./2.2));} #ifdef BUILDING_FAUX_FACADE float hash12(in vec2 p) {vec3 p3 =fract(vec3(p.xyx)*0.1031);p3+=dot(p3,p3.yzx+33.33);return fract((p3.x+p3.y)*p3.z);}float min3(in vec3 v) {return min(min(v.x,v.y),v.z);}vec2 get_uv_mask_id(in vec2 q,out float mask,out vec2 id) {vec2 p=q;mask=step(v_faux_facade_range.x,p.y)*step(p.y,v_faux_facade_range.y);p.y=p.y-v_faux_facade_range.x;vec2 uv=modf(p/v_faux_facade_floor,id);vec4 d=(v_faux_facade_floor.xyxy+vec4(-v_faux_facade_window,v_faux_facade_window))*0.5;vec4 edge=d/v_faux_facade_floor.xyxy;vec2 m=step(edge.xy,uv)*step(uv,edge.zw);mask*=m.x*m.y;uv-=vec2(0.5);uv*=vec2(0.5)/(vec2(0.5)-edge.xy);uv+=vec2(0.5);return uv;}float ray_unit_box(in vec3 ray_o,in vec3 ray_d,in vec3 bmin,in vec3 bmax) {vec3 planes=mix(bmin,bmax,step(0.0,ray_d));vec3 t=(planes-ray_o)/ray_d;return min3(t);}float get_emissive(in vec2 id) {if (u_facade_emissive_chance > 0.0) {return (step(hash12(id),u_facade_emissive_chance)+0.05)*v_faux_color_emissive.a;}return 0.0;}vec3 get_shade_info(in vec3 v,in vec3 v_normalized,in vec3 color,in vec2 id,in mat3 tbn,inout vec3 out_normal,inout float out_emissive) {vec3 out_color=color;vec3 abs_v=abs(v_normalized);bool x_major=abs_v.x >=abs_v.y && abs_v.x >=abs_v.z;bool y_major=abs_v.y >=abs_v.x && abs_v.y >=abs_v.z;bool z_major=abs_v.z >=abs_v.x && abs_v.z >=abs_v.y; #if 0 if (x_major) {out_color=v.x > 0.0 ? vec3(1.0,0.0,0.0) : vec3(0.0,1.0,1.0);} else if (y_major) {out_color=v.y > 0.0 ? vec3(0.0,1.0,0.0) : vec3(1.0,0.0,1.0);} else if (z_major) {out_color=v.z > 0.0 ? vec3(0.0,0.0,1.0) : vec3(1.0,1.0,0.0);}out_emissive=1.0; #else if (x_major) {out_normal=sign(v.x)*tbn[0];} else if (y_major) {out_normal=vec3(0.0,0.0,-sign(v.y));} else if (z_major) {out_color=v_faux_color_emissive.rgb;out_emissive=v.z <=0.0 ? get_emissive(id) : out_emissive;}float ao=1.0;if (u_faux_facade_ao_intensity > 0.0) {vec4 ao_range=v_faux_facade_window.xxyy*0.5-vec4(0,ao_radius,0,ao_radius);vec2 ao_range_z=vec2(window_depth*0.5)-vec2(0.0,ao_radius);if (x_major || y_major) {ao*=smoothstep(-ao_range_z.x,-ao_range_z.y,v.z);} else if (z_major) {ao*=smoothstep(-ao_range.x,-ao_range.y,v.x)*(1.0-smoothstep(ao_range.y,ao_range.x,v.x));ao*=smoothstep(-ao_range.z,-ao_range.w,v.y)*(1.0-smoothstep(ao_range.w,ao_range.z,v.y));}ao=mix(1.0,min(1.0,ao+0.25),u_faux_facade_ao_intensity);}out_color*=ao; #endif return out_color;} #endif vec3 apply_lighting_linear(in vec3 color,in vec3 normal,in float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return color*(ambient_contrib+directional_contrib);}void main() {vec3 normal=normalize(v_normal);vec3 base_color=v_color.rgb;float emissive=v_color.a; #ifdef BUILDING_FAUX_FACADE if (v_faux_facade > 0.0) {mat3 tbn=mat3(v_tbn_0,v_tbn_1,v_tbn_2);vec3 v=vec3(v_pos.xy,v_pos.z/u_tile_to_meter)-u_camera_pos;vec3 view_tangent=transpose(tbn)*v;vec2 q=vec2(v_faux_facade_ed,v_pos.z);float mask=0.0;vec2 id=vec2(0.0);vec2 uv=get_uv_mask_id(q,mask,id);uv*=v_faux_facade_window;vec3 bmin=vec3(0.0,0.0,-window_depth);vec3 bmax=bmin+vec3(v_faux_facade_window,window_depth);vec3 ray_o=vec3(uv,0.0);vec3 ray_d=normalize(view_tangent);float t_min=ray_unit_box(ray_o,ray_d,bmin,bmax);vec3 hit=ray_o+t_min*ray_d;vec3 r=vec3(v_faux_facade_window,-window_depth);hit-=r*0.5;vec3 normalized=hit/r;vec3 out_normal=normal;float out_emissive=emissive;vec3 room_color=get_shade_info(hit,normalized,base_color,id,tbn,out_normal,out_emissive);base_color=mix(base_color,room_color,mask);normal=mix(normal,out_normal,mask);emissive=mix(emissive,out_emissive,mask);} #endif vec4 color=vec4(base_color,1.0);vec3 xy_flipped_normal=vec3(-normal.xy,normal.z);float shadowed_lighting_factor=0.0; #ifdef RENDER_SHADOWS #ifdef RENDER_CUTOFF shadowed_lighting_factor=shadowed_light_factor_normal_opacity(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;} #else shadowed_lighting_factor=shadowed_light_factor_normal(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w); #endif #else shadowed_lighting_factor=dot(xy_flipped_normal,u_lighting_directional_dir); #endif color.rgb=apply_lighting_linear(color.rgb,xy_flipped_normal,shadowed_lighting_factor);color.rgb=linearTosRGB(color.rgb); #ifdef FLOOD_LIGHT float flood_radiance=(1.0-min(v_pos.z/v_flood_radius,1.0))*u_flood_light_intensity*v_has_flood_light;color.rgb=mix(color.rgb,u_flood_light_color,flood_radiance); #endif color.rgb=mix(color.rgb,linearTosRGB(base_color.rgb),emissive); #ifdef FOG color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,v_pos.z)); #endif color*=u_opacity; #ifdef INDICATOR_CUTOUT color=applyCutout(color,v_pos.z); #endif #ifdef FEATURE_CUTOUT color=apply_feature_cutout(color,gl_FragCoord); #endif glFragColor=color; #ifdef DEBUG_SHOW_NORMALS color.rgb=xy_flipped_normal*0.5+vec3(0.5,0.5,0.5);color.a=1.0;glFragColor=color; #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_shadow.vertex.glsl" in vec3 a_pos_3f;in vec3 a_normal_3;in vec3 a_centroid_3;in float a_flood_light_wall_radius_1i16;in vec4 a_faux_facade_data;in vec2 a_faux_facade_vertical_range;uniform mat4 u_matrix;uniform mat4 u_normal_matrix;uniform highp float u_tile_to_meter;out vec4 v_color;out vec3 v_normal;out highp vec3 v_pos; #ifdef BUILDING_FAUX_FACADE out lowp float v_faux_facade;out highp float v_faux_facade_ed;out highp vec2 v_faux_facade_window;out highp vec2 v_faux_facade_floor;out highp vec2 v_faux_facade_range;out highp float v_aspect;out highp vec3 v_tbn_0;out highp vec3 v_tbn_1;out highp vec3 v_tbn_2;out highp vec4 v_faux_color_emissive; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1; #endif #ifdef FLOOD_LIGHT out highp float v_flood_radius;out float v_has_flood_light; #endif const float MAX_UINT_16=65535.0;const float MAX_INT_16=32767.0;const float MAX_UINT_8=255.0;const float TWO_POW_8=256.0;const float FLOOD_LIGHT_MAX_RADIUS_METER=2048.0;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));} #ifdef BUILDING_FAUX_FACADE mat3 get_tbn(in vec3 normal) {const vec3 bitangent=vec3(0.0,0.0,1.0);vec3 tangent=normalize(vec3(normal.y,-normal.x,0.0));return mat3(tangent,bitangent,normal);} #endif #pragma mapbox: define-attribute-vertex-shader-only highp vec2 part_color_emissive #pragma mapbox: define-attribute-vertex-shader-only highp vec2 faux_facade_color_emissive void main() { #pragma mapbox: initialize-attribute-custom highp vec2 part_color_emissive #pragma mapbox: initialize-attribute-custom highp vec2 faux_facade_color_emissive #ifdef FLOOD_LIGHT v_flood_radius=(a_flood_light_wall_radius_1i16/MAX_INT_16*FLOOD_LIGHT_MAX_RADIUS_METER);v_has_flood_light=step(0.0,v_flood_radius); #endif vec4 color_emissive=decode_color(part_color_emissive);v_color=vec4(sRGBToLinear(color_emissive.rgb),color_emissive.a);vec3 a_normal_3f=a_normal_3/MAX_INT_16;v_normal=vec3(u_normal_matrix*vec4(a_normal_3f,0.0));float hidden=0.0;float depth_offset=0.0; #ifdef BUILDING_FAUX_FACADE v_faux_facade=a_faux_facade_data.x;if (v_faux_facade > 0.0) {v_faux_facade_ed=a_faux_facade_data.x *u_tile_to_meter;float window_x_perc=floor(a_faux_facade_data.y/TWO_POW_8);float window_y_perc=a_faux_facade_data.y-TWO_POW_8*window_x_perc;vec2 window_perc=vec2(window_x_perc,window_y_perc)/MAX_UINT_8;v_faux_facade_floor=(a_faux_facade_data.zw/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_faux_facade_window=window_perc*v_faux_facade_floor;v_faux_facade_range=(a_faux_facade_vertical_range/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_aspect=v_faux_facade_window.x/v_faux_facade_window.y;mat3 tbn=get_tbn(normalize(v_normal));v_tbn_0=tbn[0];v_tbn_1=tbn[1];v_tbn_2=tbn[2];v_faux_color_emissive=decode_color(faux_facade_color_emissive);v_faux_color_emissive.rgb=sRGBToLinear(v_faux_color_emissive.rgb);float height=a_centroid_3.z;depth_offset=min(1000.0,height)*0.0000002;} #endif v_pos=a_pos_3f; #ifdef RENDER_CUTOFF vec4 ground=u_matrix*vec4(a_centroid_3,1.0);v_cutoff_opacity=cutoff_opacity(u_cutoff_params,ground.z);hidden=float(v_cutoff_opacity==0.0);v_pos.z*=v_cutoff_opacity; #endif #ifdef RENDER_SHADOWS vec3 shadow_pos=v_pos; #ifdef NORMAL_OFFSET vec3 offset=shadow_normal_offset_model(v_normal);shadow_pos+=offset*shadow_normal_offset_multiplier0(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shadow_pos,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(shadow_pos,1.0); #endif #ifdef FOG v_fog_pos=fog_position(v_pos); #endif gl_Position=mix(u_matrix*vec4(v_pos,1),AWAY,hidden);gl_Position.z-=depth_offset*gl_Position.w;}`),buildingBloom:Vs(`in vec4 v_color_emissive; #pragma mapbox: define-attribute highp vec4 bloom_attenuation #pragma mapbox: initialize-attribute highp vec4 bloom_attenuation float saturate(float val) {return clamp(val,0.0,1.0);}void main() {float emission=v_color_emissive.a;float opacity=1.0; #ifdef HAS_ATTRIBUTE_a_bloom_attenuation float distance=length(vec2(1.3*max(0.0,abs(bloom_attenuation.x)-bloom_attenuation.z),bloom_attenuation.y));distance+= mix(0.5,0.0,clamp(emission-1.0,0.0,1.0));opacity*=saturate(1.0-distance*distance); #endif #ifdef RENDER_CUTOFF opacity*=v_cutoff_opacity; #endif glFragColor=vec4(v_color_emissive.rgb,1.0)*opacity;}`,`in vec3 a_pos_3f; #pragma mapbox: define-attribute-vertex-shader-only highp vec2 part_color_emissive #pragma mapbox: define-attribute highp vec4 bloom_attenuation out vec4 v_color_emissive;uniform mat4 u_matrix;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() { #pragma mapbox: initialize-attribute-custom highp vec2 part_color_emissive #pragma mapbox: initialize-attribute highp vec4 bloom_attenuation #ifdef HAS_ATTRIBUTE_a_part_color_emissive vec4 color_emissive=decode_color(part_color_emissive);float part_emissive=color_emissive.a*5.0;v_color_emissive=vec4(sRGBToLinear(color_emissive.rgb),part_emissive); #else v_color_emissive=vec4(1.0); #endif gl_Position=u_matrix*vec4(a_pos_3f,1.0); #ifdef RENDER_CUTOFF v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); #endif }`),buildingDepth:Vs(`in highp float v_depth;void main() { #ifndef DEPTH_TEXTURE glFragColor=pack_depth(v_depth); #endif }`,"in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;void main() {gl_Position=u_matrix*vec4(a_pos_3f,1.0);v_depth=gl_Position.z/gl_Position.w;}"),circle:Vs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" in vec3 v_data;in float v_visibility; #pragma mapbox: define highp vec4 color #pragma mapbox: define mediump float radius #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity #pragma mapbox: define highp vec4 stroke_color #pragma mapbox: define mediump float stroke_width #pragma mapbox: define lowp float stroke_opacity uniform float u_emissive_strength;void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize mediump float radius #pragma mapbox: initialize lowp float blur #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize highp vec4 stroke_color #pragma mapbox: initialize mediump float stroke_width #pragma mapbox: initialize lowp float stroke_opacity vec2 extrude=v_data.xy;float blur_positive=blur < 0.0 ? 0.0 : 1.0;lowp float antialiasblur=v_data.z;float extrude_length=length(extrude)+antialiasblur*(1.0-blur_positive);float antialiased_blur=-max(abs(blur),antialiasblur);float antialiase_blur_opacity=smoothstep(0.0,antialiasblur,extrude_length-1.0);float opacity_t=blur_positive==1.0 ? smoothstep(0.0,-antialiased_blur,1.0-extrude_length) : smoothstep(antialiased_blur,0.0,extrude_length-1.0)-antialiase_blur_opacity;float color_t=stroke_width < 0.01 ? 0.0 : smoothstep( antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width) );vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t); #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); #endif #ifdef FOG out_color=fog_apply_premultiplied(out_color,v_fog_pos); #endif glFragColor=out_color*(v_visibility*opacity_t); #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif }`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_terrain.vertex.glsl" #define NUM_VISIBILITY_RINGS 2 #define INV_SQRT2 0.70710678 #define ELEVATION_BIAS 0.0001 #define NUM_SAMPLES_PER_RING 16 uniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in vec2 a_pos; #ifdef PROJECTION_GLOBE_VIEW in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir; #endif #ifdef ELEVATED_ROADS in float a_circle_z_offset; #endif out vec3 v_data;out float v_visibility; #pragma mapbox: define highp vec4 color #pragma mapbox: define mediump float radius #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity #pragma mapbox: define highp vec4 stroke_color #pragma mapbox: define mediump float stroke_width #pragma mapbox: define lowp float stroke_opacity vec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) { #if defined(TERRAIN) return elevation(pos)+ELEVATION_BIAS; #else return 0.0; #endif }vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale); #ifdef PITCH_WITH_MAP #ifdef PROJECTION_GLOBE_VIEW return u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) ); #else return u_matrix*( world_center+vec4(sample_offset,0,0) ); #endif #else return projected_center+vec4(sample_offset,0,0); #endif }float get_sample_step() { #ifdef PITCH_WITH_MAP return 2.0*PI/float(NUM_SAMPLES_PER_RING); #else return PI/float(NUM_SAMPLES_PER_RING); #endif }void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize mediump float radius #pragma mapbox: initialize lowp float blur #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize highp vec4 stroke_color #pragma mapbox: initialize mediump float stroke_width #pragma mapbox: initialize lowp float stroke_opacity vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);vec4 world_center;mat3 surface_vectors; #ifdef PROJECTION_GLOBE_VIEW vec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1); #else surface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1); #endif #ifdef ELEVATED_ROADS world_center.z+=a_circle_z_offset+ELEVATION_BIAS; #endif vec4 projected_center=u_matrix*world_center;float view_scale=0.0; #ifdef PITCH_WITH_MAP #ifdef SCALE_WITH_MAP view_scale=1.0; #else view_scale=projected_center.w/u_camera_to_center_distance; #endif #else #ifdef SCALE_WITH_MAP view_scale=u_camera_to_center_distance; #else view_scale=projected_center.w; #endif #endif gl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0; #ifdef TERRAIN float step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center; #ifdef PITCH_WITH_MAP float cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center; #else occlusion_world_center=world_center;occlusion_projected_center=projected_center; #endif for(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING); #else visibility=1.0; #endif #ifdef PROJECTION_GLOBE_VIEW visibility=1.0; #endif v_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur); #ifdef FOG v_fog_pos=fog_position(world_center.xyz); #endif }`),clippingMask:Vs("void main() {glFragColor=vec4(1.0);}","in vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:Vs(`#include "_prelude_fog.fragment.glsl" uniform highp float u_intensity;in vec2 v_extrude; #pragma mapbox: define highp float weight #define GAUSS_COEF 0.3989422804014327 void main() { #pragma mapbox: initialize highp float weight float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);glFragColor=vec4(val,1.0,1.0,1.0); #ifdef FOG if (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);} #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl" #include "_prelude_fog.vertex.glsl" uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos; #ifdef PROJECTION_GLOBE_VIEW in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir; #endif out vec2 v_extrude; #pragma mapbox: define highp float weight #pragma mapbox: define mediump float radius const highp float ZERO=1.0/255.0/16.0; #define GAUSS_COEF 0.3989422804014327 void main() { #pragma mapbox: initialize highp float weight #pragma mapbox: initialize mediump float radius vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(a_pos*0.5);vec3 pos; #ifdef PROJECTION_GLOBE_VIEW vec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); #else pos=vec3(tilePos+extrude,elevation(tilePos)); #endif gl_Position=u_matrix*vec4(pos,1); #ifdef FOG v_fog_pos=fog_position(pos); #endif }`),heatmapTexture:Vs(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));glFragColor=color*u_opacity; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(0.0); #endif HANDLE_WIREFRAME_DEBUG;}`,"in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:Vs("in float v_placed;in float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);glFragColor =mix(red,blue,step(0.5,v_placed))*0.5;glFragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}",`#include "_prelude_terrain.vertex.glsl" in vec3 a_pos;in vec2 a_anchor_pos;in vec2 a_extrude;in vec2 a_placed;in vec2 a_shift;in vec2 a_elevation_from_sea;in float a_size_scale;in vec2 a_padding;in float a_auto_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance; #ifdef PROJECTION_GLOBE_VIEW uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform float u_zoom_transition; #endif out float v_placed;out float v_notUsed;void main() {float feature_elevation=a_elevation_from_sea.x+a_auto_z_offset;float terrain_elevation=(a_elevation_from_sea.y==1.0 ? 0.0 : elevation(a_anchor_pos));vec3 proj_pos=a_pos+elevationVector(a_anchor_pos)*(feature_elevation+terrain_elevation); #ifdef PROJECTION_GLOBE_VIEW #ifndef PROJECTED_POS_ON_VIEWPORT vec3 globe_pos=proj_pos;vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,a_anchor_pos,u_tile_id,u_merc_center);proj_pos=mix_globe_mercator(globe_pos,mercator_pos,u_zoom_transition); #endif #endif vec4 projectedPoint=u_matrix*vec4(proj_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp( 0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}`),collisionCircle:Vs("in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);glFragColor=color*alpha*opacity_t;}",`in vec2 a_pos_2f;in float a_radius;in vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2( mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp( 0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}`),debug:Vs("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);glFragColor=mix(u_color,overlay_color,overlay_color.a);}",`#include "_prelude_terrain.vertex.glsl" in vec2 a_pos; #ifdef PROJECTION_GLOBE_VIEW in vec3 a_pos_3; #endif out vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0; #ifdef PROJECTION_GLOBE_VIEW gl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1); #else gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1); #endif }`),elevatedStructuresDepth:Vs(`void main() { #ifndef DEPTH_TEXTURE glFragColor=vec4(0.); #endif }`,"in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform float u_depth_bias;void main() {gl_Position=u_matrix*vec4(a_pos,a_height,1);gl_Position.z=gl_Position.z+u_depth_bias;}"),elevatedStructuresDepthReconstruct:Vs(`#ifdef DEPTH_RECONSTRUCTION in float v_height; #endif void main() { #ifdef DEPTH_RECONSTRUCTION if (v_height >=0.0) discard; #else #ifdef FEATURE_CUTOUT apply_feature_cutout(vec4(0.0,0.0,0.0,1.0),gl_FragCoord); #endif #endif glFragColor=vec4(1.0,0.0,0.0,1.0);}`,`in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform vec3 u_camera_pos;uniform highp float u_depth_bias;uniform lowp float u_height_scale;uniform lowp float u_reset_depth; #ifdef DEPTH_RECONSTRUCTION out float v_height; #endif void main() {vec3 vpos=vec3(a_pos,a_height*u_height_scale); #ifdef DEPTH_RECONSTRUCTION if (u_camera_pos.z > vpos.z) {vpos-=(u_camera_pos-vpos)*(vpos.z/(u_camera_pos.z-vpos.z));}v_height=a_height; #endif gl_Position=u_matrix*vec4(vpos,1);gl_Position.z=u_reset_depth==1.0 ? gl_Position.w : gl_Position.z+u_depth_bias;}`),elevatedStructures:Vs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" #include "_prelude_shadow.fragment.glsl" in vec3 v_normal;in float v_height; #ifdef RENDER_SHADOWS in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth; #endif vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}vec3 compute_view_dependent_emissive_color(float ndotl,float emissive_strength,vec3 color) {color=sRGBToLinear(color);color=color*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);color=linearTosRGB(color.rgb);return color;}uniform float u_emissive_strength; #pragma mapbox: define highp vec4 structure_color void main() { #pragma mapbox: initialize highp vec4 structure_color vec3 color=structure_color.xyz; #ifdef LIGHTING_3D_MODE vec3 normal=normalize(v_normal);vec3 transformed_normal=vec3(-normal.xy,normal.z);float ndotl=calculate_NdotL(transformed_normal);float emissive_strength=u_emissive_strength;emissive_strength=0.0;vec3 emissive_color=compute_view_dependent_emissive_color(ndotl,emissive_strength,color.xyz); #ifdef RENDER_SHADOWS float shadowed_lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth);color.rgb=apply_lighting(color.rgb,transformed_normal,shadowed_lighting_factor); #else color=apply_lighting(color,transformed_normal); #endif color=mix(color,emissive_color,emissive_strength);if (v_height < 0.0) {float penetration=max(v_height+7.5,0.0);float occlusion=1.0-1.0/PI*acos(1.0-penetration/4.0);color=color*(1.0-pow(occlusion,2.0)*0.3);} #endif #ifdef FOG color=fog_apply(color,v_fog_pos); #endif vec4 out_color=vec4(color,1.0); #ifdef INDICATOR_CUTOUT out_color=applyCutout(out_color,v_height); #endif #ifdef FEATURE_CUTOUT out_color=apply_feature_cutout(out_color,gl_FragCoord); #endif glFragColor=out_color;HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_shadow.vertex.glsl" in vec2 a_pos;in float a_height;in vec3 a_pos_normal_3;uniform mat4 u_matrix;out vec3 v_normal;out float v_height; #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth; #endif #pragma mapbox: define highp vec4 structure_color void main() { #pragma mapbox: initialize highp vec4 structure_color v_normal=a_pos_normal_3/16384.0;v_height=a_height;vec3 pos=vec3(a_pos,a_height);gl_Position=u_matrix*vec4(pos,1); #ifdef RENDER_SHADOWS vec3 shd_pos0=pos;vec3 shd_pos1=pos; #ifdef NORMAL_OFFSET vec3 offset=shadow_normal_offset(vec3(-v_normal.xy,v_normal.z));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; #endif #ifdef FOG v_fog_pos=fog_position(a_pos); #endif }`),fill:Vs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" #include "_prelude_shadow.fragment.glsl" #pragma mapbox: define highp vec4 color #pragma mapbox: define lowp float opacity uniform float u_emissive_strength; #ifdef RENDER_SHADOWS uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; #endif #ifdef ELEVATED_ROADS in highp float v_road_z_offset; #endif #ifdef INDICATOR_CUTOUT in highp float v_z_offset; #endif void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize lowp float opacity vec4 out_color=color; #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); #ifdef RENDER_SHADOWS float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); #endif #endif #ifdef FOG out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); #endif out_color*=opacity; #ifdef INDICATOR_CUTOUT if (v_z_offset >=0.0) {out_color=applyCutout(out_color,v_z_offset);} #endif #ifdef FEATURE_CUTOUT out_color=apply_feature_cutout(out_color,gl_FragCoord); #endif glFragColor=out_color; #ifdef USE_MRT1 out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_shadow.vertex.glsl" in vec2 a_pos; #ifdef ELEVATED_ROADS in float a_road_z_offset;out highp float v_road_z_offset; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; #endif #ifdef INDICATOR_CUTOUT out highp float v_z_offset; #endif uniform mat4 u_matrix; #pragma mapbox: define highp vec4 color #pragma mapbox: define lowp float opacity #pragma mapbox: define highp float z_offset void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize highp float z_offset #ifdef ELEVATED_ROADS z_offset+=a_road_z_offset;v_road_z_offset=z_offset; #endif float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden); #ifdef RENDER_SHADOWS vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); #ifdef NORMAL_OFFSET vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; #endif #ifdef FOG v_fog_pos=fog_position(a_pos); #endif #ifdef INDICATOR_CUTOUT v_z_offset=z_offset; #endif }`),fillOutline:Vs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" #include "_prelude_shadow.fragment.glsl" in highp vec2 v_pos;uniform float u_emissive_strength; #ifdef RENDER_SHADOWS uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; #endif #pragma mapbox: define highp vec4 outline_color #pragma mapbox: define lowp float opacity void main() { #pragma mapbox: initialize highp vec4 outline_color #pragma mapbox: initialize lowp float opacity float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color; #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); #ifdef RENDER_SHADOWS float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); #endif #endif #ifdef FOG out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); #endif #ifdef FEATURE_CUTOUT out_color=apply_feature_cutout(out_color,gl_FragCoord); #endif glFragColor=out_color*(alpha*opacity); #ifdef USE_MRT1 out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_shadow.vertex.glsl" in vec2 a_pos; #ifdef ELEVATED_ROADS in float a_road_z_offset; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; #endif uniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos; #pragma mapbox: define highp vec4 outline_color #pragma mapbox: define lowp float opacity #pragma mapbox: define highp float z_offset void main() { #pragma mapbox: initialize highp vec4 outline_color #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize highp float z_offset #ifdef ELEVATED_ROADS z_offset+=a_road_z_offset; #endif float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden); #ifdef FLIP_Y v_pos=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world; #else v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; #endif #ifdef RENDER_SHADOWS vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); #ifdef NORMAL_OFFSET vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; #endif #ifdef FOG v_fog_pos=fog_position(a_pos); #endif }`),fillOutlinePattern:Vs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" #include "_prelude_shadow.fragment.glsl" uniform vec2 u_texsize;uniform sampler2D u_image; #ifdef FILL_PATTERN_TRANSITION uniform float u_pattern_transition; #endif uniform float u_emissive_strength; #ifdef APPLY_LUT_ON_GPU uniform highp sampler3D u_lutTexture; #endif #ifdef RENDER_SHADOWS uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; #endif in highp vec2 v_pos;in highp vec2 v_pos_world; #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp vec4 pattern #ifdef FILL_PATTERN_TRANSITION #pragma mapbox: define mediump vec4 pattern_b #endif void main() { #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump vec4 pattern #ifdef FILL_PATTERN_TRANSITION #pragma mapbox: initialize mediump vec4 pattern_b #endif vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=textureLodCustom(u_image,pos,lod_pos); #ifdef APPLY_LUT_ON_GPU out_color=applyLUT(u_lutTexture,out_color); #endif #ifdef FILL_PATTERN_TRANSITION vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition; #endif #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); #ifdef RENDER_SHADOWS float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); #endif #endif #ifdef FEATURE_CUTOUT out_color=apply_feature_cutout(out_color,gl_FragCoord); #endif #ifdef FOG out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); #endif glFragColor=out_color*(alpha*opacity); #ifdef USE_MRT1 out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_shadow.vertex.glsl" uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos; #ifdef ELEVATED_ROADS in float a_road_z_offset; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; #endif out highp vec2 v_pos;out highp vec2 v_pos_world; #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp vec4 pattern #ifdef FILL_PATTERN_TRANSITION #pragma mapbox: define mediump vec4 pattern_b #endif #pragma mapbox: define lowp float pixel_ratio #pragma mapbox: define highp float z_offset void main() { #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump vec4 pattern #ifdef FILL_PATTERN_TRANSITION #pragma mapbox: initialize mediump vec4 pattern_b #endif #pragma mapbox: initialize lowp float pixel_ratio #pragma mapbox: initialize highp float z_offset vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw; #ifdef ELEVATED_ROADS z_offset+=a_road_z_offset; #endif float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos); #ifdef FLIP_Y v_pos_world=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world; #else v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; #endif #ifdef RENDER_SHADOWS vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); #ifdef NORMAL_OFFSET vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; #endif #ifdef FOG v_fog_pos=fog_position(a_pos); #endif }`),fillPattern:Vs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" #include "_prelude_shadow.fragment.glsl" uniform vec2 u_texsize;uniform sampler2D u_image; #ifdef FILL_PATTERN_TRANSITION uniform float u_pattern_transition; #endif in highp vec2 v_pos;uniform float u_emissive_strength; #ifdef RENDER_SHADOWS uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; #endif #ifdef ELEVATED_ROADS in highp float v_road_z_offset; #endif #ifdef APPLY_LUT_ON_GPU uniform highp sampler3D u_lutTexture; #endif #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp vec4 pattern #ifdef FILL_PATTERN_TRANSITION #pragma mapbox: define mediump vec4 pattern_b #endif void main() { #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump vec4 pattern #ifdef FILL_PATTERN_TRANSITION #pragma mapbox: initialize mediump vec4 pattern_b #endif vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos); #ifdef APPLY_LUT_ON_GPU out_color=applyLUT(u_lutTexture,out_color); #endif #ifdef FILL_PATTERN_TRANSITION vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition; #endif #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); #ifdef RENDER_SHADOWS float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); #ifdef ELEVATED_ROADS out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); #else out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); #endif #endif #endif #ifdef FEATURE_CUTOUT out_color=apply_feature_cutout(out_color,gl_FragCoord); #endif #ifdef FOG out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); #endif glFragColor=out_color*opacity; #ifdef USE_MRT1 out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_shadow.vertex.glsl" uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos; #ifdef ELEVATED_ROADS in float a_road_z_offset;out highp float v_road_z_offset; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; #endif out highp vec2 v_pos; #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp vec4 pattern #ifdef FILL_PATTERN_TRANSITION #pragma mapbox: define mediump vec4 pattern_b #endif #pragma mapbox: define lowp float pixel_ratio #pragma mapbox: define highp float z_offset void main() { #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump vec4 pattern #pragma mapbox: initialize lowp float pixel_ratio #pragma mapbox: initialize highp float z_offset #ifdef FILL_PATTERN_TRANSITION #pragma mapbox: initialize mediump vec4 pattern_b #endif vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio; #ifdef ELEVATED_ROADS z_offset+=a_road_z_offset;v_road_z_offset=z_offset; #endif float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos); #ifdef RENDER_SHADOWS vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); #ifdef NORMAL_OFFSET vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; #endif #ifdef FOG v_fog_pos=fog_position(a_pos); #endif }`),fillExtrusion:Vs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_shadow.fragment.glsl" #include "_prelude_lighting.glsl" in vec4 v_color;in vec4 v_flat; #ifdef RENDER_SHADOWS in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1; #endif uniform lowp float u_opacity; #ifdef FAUX_AO uniform lowp vec2 u_ao;in vec2 v_ao; #endif #if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) in vec4 v_roof_color; #endif #if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) in highp vec3 v_normal; #endif uniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor; #if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT) in float v_flood_radius;in float v_has_floodlight; #endif in float v_height; #pragma mapbox: define highp float emissive_strength void main() { #pragma mapbox: initialize highp float emissive_strength #if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) vec3 normal=normalize(v_normal); #endif float z;vec4 color=v_color; #ifdef ZERO_ROOF_RADIUS z=float(normal.z > 0.00001); #ifdef LIGHTING_3D_MODE normal=mix(normal,vec3(0.0,0.0,1.0),z); #else color=mix(v_color,v_roof_color,z); #endif #endif float h=max(0.0,v_height);float ao_shade=1.0; #ifdef FAUX_AO float intensity=u_ao[0];float h_floors=h/(u_ao[1]*u_vertical_scale);float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);ao_shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x; #ifdef ZERO_ROOF_RADIUS concave*=(1.0-z); #endif float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);ao_shade*=mix(1.0,x_shade*x_shade*x_shade,concave); #ifdef LIGHTING_3D_MODE #ifdef FLOOD_LIGHT color.rgb*=mix(ao_shade,1.0,v_has_floodlight); #else color.rgb*=ao_shade; #endif #else color.rgb*=ao_shade; #endif #endif #ifdef LIGHTING_3D_MODE float flood_radiance=0.0; #ifdef FLOOD_LIGHT flood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight; #endif #ifdef RENDER_SHADOWS #ifdef FLOOD_LIGHT float ndotl_unclamped=dot(normal,u_shadow_direction);float ndotl=max(0.0,ndotl_unclamped);float occlusion=ndotl_unclamped < 0.0 ? 1.0 : shadow_occlusion(ndotl,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 litColor=apply_lighting(color.rgb,normal,(1.0-u_shadow_intensity*occlusion)*ndotl);vec3 floodLitColor=compute_flood_lighting(u_flood_light_color*u_opacity,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=mix(litColor,floodLitColor,flood_radiance); #else float shadowed_lighting_factor; #ifdef RENDER_CUTOFF shadowed_lighting_factor=shadowed_light_factor_normal_opacity(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;} #else shadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w); #endif color.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor); #endif #else color.rgb=apply_lighting(color.rgb,normal); #ifdef FLOOD_LIGHT color.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance); #endif #endif color.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity; #endif #ifdef FOG color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h)); #endif #ifdef INDICATOR_CUTOUT color=applyCutout(color,h); #endif #ifdef FEATURE_CUTOUT color=apply_feature_cutout(color,gl_FragCoord); #endif glFragColor=color; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_terrain.vertex.glsl" #include "_prelude_shadow.vertex.glsl" #include "_prelude_lighting.glsl" #include "_prelude_material_table.vertex.glsl" uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;uniform float u_width_scale;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos; #ifdef RENDER_WALL_MODE in vec3 a_join_normal_inside; #endif #ifdef PROJECTION_GLOBE_VIEW in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift; #endif #ifdef TERRAIN uniform int u_height_type;uniform int u_base_type; #endif uniform highp float u_vertical_scale;out vec4 v_color;out vec4 v_flat; #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1; #endif #if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) out vec4 v_roof_color; #endif #if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) out highp vec3 v_normal; #endif #ifdef FAUX_AO uniform lowp vec2 u_ao;out vec2 v_ao; #endif #if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT) out float v_flood_radius;out float v_has_floodlight; #endif out float v_height;vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));} #pragma mapbox: define highp float base #pragma mapbox: define highp float height #pragma mapbox: define highp vec4 color #pragma mapbox: define highp float flood_light_wall_radius #pragma mapbox: define highp float line_width #pragma mapbox: define highp float emissive_strength void main() {DECLARE_MATERIAL_TABLE_INFO #pragma mapbox: initialize highp float base #pragma mapbox: initialize highp float height #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize highp float flood_light_wall_radius #pragma mapbox: initialize highp float line_width #pragma mapbox: initialize highp float emissive_strength base*=u_vertical_scale;height*=u_vertical_scale;vec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0)); #if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) v_normal=normal; #endif base=max(0.0,base);float attr_height=height;height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0); #if defined(HAS_CENTROID) || defined(TERRAIN) centroid_pos=a_centroid_pos; #endif float ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos; #ifdef TERRAIN bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h); #else h=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h); #endif #ifdef PROJECTION_GLOBE_VIEW float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); #endif float cutoff=1.0;vec3 scaled_pos=pos; #ifdef RENDER_CUTOFF vec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_pos.x==0.0 ? pos.xyz : (centroid_random/8.0);vec4 ground=u_matrix*vec4(ground_pos.xy,ele,1.0); #ifdef CLIP_ZERO_TO_ONE cutoff=cutoff_opacity(u_cutoff_params,ground.z*2.0-ground.w); #else cutoff=cutoff_opacity(u_cutoff_params,ground.z); #endif if (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 g=floor(ground_pos);vec3 mod_=centroid_random-g*8.0;float seed=min(1.0,0.1*(min(3.5,max(mod_.x+mod_.y,0.2*attr_height))*0.35+mod_.z));if (cutoff < 0.8-seed) {cutoff=0.0;}}float cutoff_scale=cutoff;v_cutoff_opacity=cutoff;scaled_pos.z=mix(c_ele,h,cutoff_scale); #endif float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0) || (color.a==0.0)); #ifdef RENDER_WALL_MODE vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);scaled_pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;scaled_pos.xy-=a_join_normal_inside.z*wall_offset*0.5; #endif gl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h; #ifdef RENDER_SHADOWS vec3 shd_pos0=pos;vec3 shd_pos1=pos; #ifdef NORMAL_OFFSET vec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1); #endif float NdotL=0.0;float colorvalue=0.0; #ifndef LIGHTING_3D_MODE colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);if (normal.y !=0.0) {float r=0.84;r=mix(0.7,0.98,1.0-u_lightintensity);NdotL*=( (1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));} #endif #ifdef FAUX_AO float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height; #ifdef TERRAIN top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height); #endif v_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]); #ifdef PROJECTION_GLOBE_VIEW top_height+=u_height_lift; #endif gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w; #endif #ifdef LIGHTING_3D_MODE #ifdef FLOOD_LIGHT float is_wall=1.0-float(t > 0.0 && top_up_ny.y > 0.0);v_has_floodlight=float(flood_light_wall_radius > 0.0 && is_wall > 0.0);v_flood_radius=flood_light_wall_radius*u_vertical_scale; #endif v_color=vec4(color.rgb,1.0);float ndotl=calculate_NdotL(normal);v_flat.rgb=sRGBToLinear(color.rgb);v_flat.rgb=v_flat.rgb*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);v_flat=vec4(linearTosRGB(v_flat.rgb),1.0); #else v_color=vec4(0.0,0.0,0.0,1.0);v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity; #endif #if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) float roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color=vec4(0.0,0.0,0.0,1.0);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_roof_color*=u_opacity; #endif #ifdef FOG v_fog_pos=fog_position(pos); #endif }`),fillExtrusionDepth:Vs(`in highp float v_depth;void main() { #ifndef DEPTH_TEXTURE glFragColor=pack_depth(v_depth); #endif }`,`#include "_prelude_terrain.vertex.glsl" #include "_prelude_material_table.vertex.glsl" uniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_width_scale;uniform float u_vertical_scale; #ifdef TERRAIN uniform int u_height_type;uniform int u_base_type; #endif in vec4 a_pos_normal_ed;in vec2 a_centroid_pos; #ifdef RENDER_WALL_MODE in vec3 a_join_normal_inside; #endif #pragma mapbox: define highp float base #pragma mapbox: define highp float height #pragma mapbox: define highp float line_width #pragma mapbox: define highp vec4 color out highp float v_depth;void main() {DECLARE_MATERIAL_TABLE_INFO #pragma mapbox: initialize highp float base #pragma mapbox: initialize highp float height #pragma mapbox: initialize highp float line_width #pragma mapbox: initialize highp vec4 color base*=u_vertical_scale;height*=u_vertical_scale;vec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0); #if defined(HAS_CENTROID) || defined(TERRAIN) centroid_pos=a_centroid_pos; #endif vec3 pos; #ifdef TERRAIN bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;float ele=elevation(pos_nx.xy);float c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);float h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h); #else pos=vec3(pos_nx.xy,t > 0.0 ? height : base); #endif #ifdef RENDER_WALL_MODE vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;pos.xy-=a_join_normal_inside.z*wall_offset*0.5; #endif float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);v_depth=gl_Position.z/gl_Position.w;}`),fillExtrusionPattern:Vs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" uniform vec2 u_texsize;uniform sampler2D u_image; #ifdef FILL_EXTRUSION_PATTERN_TRANSITION uniform float u_pattern_transition; #endif #ifdef FAUX_AO uniform lowp vec2 u_ao;in vec3 v_ao; #endif #ifdef LIGHTING_3D_MODE in vec3 v_normal; #endif #ifdef APPLY_LUT_ON_GPU uniform highp sampler3D u_lutTexture; #endif in highp vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity; #pragma mapbox: define highp float base #pragma mapbox: define highp float height #pragma mapbox: define mediump vec4 pattern #ifdef FILL_EXTRUSION_PATTERN_TRANSITION #pragma mapbox: define mediump vec4 pattern_b #endif #pragma mapbox: define highp float pixel_ratio void main() { #pragma mapbox: initialize highp float base #pragma mapbox: initialize highp float height #pragma mapbox: initialize mediump vec4 pattern #ifdef FILL_EXTRUSION_PATTERN_TRANSITION #pragma mapbox: initialize mediump vec4 pattern_b #endif #pragma mapbox: initialize highp float pixel_ratio vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos); #ifdef APPLY_LUT_ON_GPU out_color=applyLUT(u_lutTexture,out_color); #endif #ifdef FILL_EXTRUSION_PATTERN_TRANSITION vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition; #endif #ifdef LIGHTING_3D_MODE out_color=apply_lighting(out_color,normalize(v_normal))*u_opacity; #else out_color=out_color*v_lighting; #endif #ifdef FAUX_AO float intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade; #endif #ifdef FOG out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); #endif #ifdef INDICATOR_CUTOUT out_color=applyCutout(out_color,height); #endif glFragColor=out_color; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_terrain.vertex.glsl" #include "_prelude_lighting.glsl" #include "_prelude_material_table.vertex.glsl" uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_width_scale;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos; #ifdef RENDER_WALL_MODE in vec3 a_join_normal_inside; #endif #ifdef PROJECTION_GLOBE_VIEW in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift; #endif #ifdef TERRAIN uniform int u_height_type;uniform int u_base_type; #endif out highp vec2 v_pos;out vec4 v_lighting; #ifdef FAUX_AO uniform lowp vec2 u_ao;out vec3 v_ao; #endif #ifdef LIGHTING_3D_MODE out vec3 v_normal; #endif #pragma mapbox: define highp float base #pragma mapbox: define highp float height #pragma mapbox: define highp vec4 color #pragma mapbox: define mediump vec4 pattern #ifdef FILL_EXTRUSION_PATTERN_TRANSITION #pragma mapbox: define mediump vec4 pattern_b #endif #pragma mapbox: define highp float pixel_ratio #pragma mapbox: define highp float line_width void main() {DECLARE_MATERIAL_TABLE_INFO #pragma mapbox: initialize highp float base #pragma mapbox: initialize highp float height #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize mediump vec4 pattern #ifdef FILL_EXTRUSION_PATTERN_TRANSITION #pragma mapbox: initialize mediump vec4 pattern_b #endif #pragma mapbox: initialize highp float pixel_ratio #pragma mapbox: initialize highp float line_width vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0); #if defined(HAS_CENTROID) || defined(TERRAIN) centroid_pos=a_centroid_pos; #endif float ele=0.0;float h=z;vec3 p;float c_ele; #ifdef TERRAIN bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;p=vec3(pos_nx.xy,h); #else p=vec3(pos_nx.xy,z); #endif #ifdef PROJECTION_GLOBE_VIEW float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); #endif #ifdef RENDER_WALL_MODE vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);p.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;p.xy-=a_join_normal_inside.z*wall_offset*0.5; #endif float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0 ? pos_nx.xy : vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0; #ifdef LIGHTING_3D_MODE NdotL=calculate_NdotL(normal); #else NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL); #endif if (normal.y !=0.0) {float r=0.84; #ifndef LIGHTING_3D_MODE r=mix(0.7,0.98,1.0-u_lightintensity); #endif NdotL*=( (1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));} #ifdef FAUX_AO float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height; #ifdef TERRAIN top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height); #endif v_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]); #ifdef PROJECTION_GLOBE_VIEW top_height+=u_height_lift; #endif gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w; #endif #ifdef LIGHTING_3D_MODE v_normal=normal; #else v_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity; #endif #ifdef FOG v_fog_pos=fog_position(p); #endif }`),groundShadow:Vs(`#include "_prelude_shadow.fragment.glsl" precision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1; #ifdef FOG in float v_fog_opacity; #endif void main() {float light=shadowed_light_factor_plane_bias(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 shadow=mix(u_ground_shadow_factor,vec3(1.0),light); #ifdef RENDER_CUTOFF shadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w)); #endif #ifdef FOG shadow=mix(shadow,vec3(1.0),v_fog_opacity); #endif #ifdef INDICATOR_CUTOUT shadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0),0.0).r); #endif glFragColor=vec4(shadow,1.0);}`,`#include "_prelude_fog.vertex.glsl" uniform mat4 u_matrix;uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;in vec2 a_pos;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1; #ifdef FOG out float v_fog_opacity; #endif void main() {gl_Position=u_matrix*vec4(a_pos,0.0,1.0);v_pos_light_view_0=u_light_matrix_0*vec4(a_pos,0.0,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(a_pos,0.0,1.0); #ifdef FOG v_fog_pos=fog_position(a_pos);v_fog_opacity=fog(v_fog_pos); #endif }`),fillExtrusionGroundEffect:Vs(`uniform highp float u_ao_pass;uniform highp float u_opacity;uniform highp float u_flood_light_intensity;uniform highp vec3 u_flood_light_color;uniform highp float u_attenuation;uniform sampler2D u_fb;uniform float u_fb_size; #ifdef SDF_SUBPASS in highp vec2 v_pos;in highp vec4 v_line_segment;in highp float v_flood_light_radius_tile;in highp vec2 v_ao;float line_df(highp vec2 a,highp vec2 b,highp vec2 p) {highp vec2 ba=b-a;highp vec2 pa=p-a;highp float r=clamp(dot(pa,ba)/dot(ba,ba),0.0,1.0);return length(pa-r*ba);} #ifdef FOG in highp float v_fog; #endif #endif void main() { #ifdef CLEAR_SUBPASS vec4 color=vec4(1.0); #ifdef CLEAR_FROM_TEXTURE color=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size)); #endif glFragColor=color; #else #ifdef SDF_SUBPASS highp float d=line_df(v_line_segment.xy,v_line_segment.zw,v_pos);highp float effect_radius=mix(v_flood_light_radius_tile,v_ao.y,u_ao_pass);d/=effect_radius;d=min(d,1.0);d=1.0-pow(1.0-d,u_attenuation);highp float effect_intensity=mix(u_flood_light_intensity,v_ao.x,u_ao_pass);highp float fog=1.0; #ifdef FOG fog=v_fog; #endif #ifdef RENDER_CUTOFF fog*=v_cutoff_opacity; #endif glFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog)); #else #ifdef USE_MRT1 out_Target1=vec4(1.0-texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size)).a,0.0,0.0,0.0); #else vec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass); #ifdef OVERDRAW_INSPECTOR color=vec4(1.0); #endif glFragColor=color; #endif #endif HANDLE_WIREFRAME_DEBUG; #endif }`,`#include "_prelude_fog.vertex.glsl" in highp vec4 a_pos_end;in highp float a_angular_offset_factor;in highp float a_hidden_by_landmark; #ifdef SDF_SUBPASS out highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao; #ifdef FOG out highp float v_fog; #endif #endif uniform highp float u_flood_light_intensity;uniform highp mat4 u_matrix;uniform highp float u_ao_pass;uniform highp float u_meter_to_tile;uniform highp float u_edge_radius;uniform highp float u_dynamic_offset;uniform highp vec2 u_ao; #pragma mapbox: define highp float flood_light_ground_radius const float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() { #pragma mapbox: initialize highp float flood_light_ground_radius vec2 p=a_pos_end.xy;vec2 q=floor(a_pos_end.zw*0.5);vec2 start_bottom=a_pos_end.zw-q*2.0;float fl_ground_radius=flood_light_ground_radius;fl_ground_radius=abs(flood_light_ground_radius);float direction=flood_light_ground_radius < 0.0 ?-1.0 : 1.0;float flood_radius_tile=fl_ground_radius*u_meter_to_tile;vec2 v=normalize(q-p);float ao_radius=u_ao.y/3.5;float effect_radius=mix(flood_radius_tile,ao_radius,u_ao_pass)+u_edge_radius;float angular_offset_factor=a_angular_offset_factor/NORM*TANGENT_CUTOFF;float angular_offset=direction*angular_offset_factor*effect_radius;float top=1.0-start_bottom.y;float side=(0.5-start_bottom.x)*2.0;vec2 extrusion_parallel=v*side*mix(u_dynamic_offset,angular_offset,top);vec2 perp=vec2(v.y,-v.x);vec2 extrusion_perp=direction*perp*effect_radius*top;vec3 pos=vec3(mix(q,p,start_bottom.x),0.0);pos.xy+=extrusion_parallel+extrusion_perp; #ifdef SDF_SUBPASS v_pos=pos.xy;v_line_segment=vec4(p,q)+perp.xyxy*u_edge_radius;v_flood_light_radius_tile=flood_radius_tile;v_ao=vec2(u_ao.x,ao_radius); #ifdef FOG v_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos); #endif #endif float hidden_by_landmark=0.0; #ifdef HAS_CENTROID hidden_by_landmark=a_hidden_by_landmark; #endif float isFloodlit=float(fl_ground_radius > 0.0 && u_flood_light_intensity > 0.0);float hidden=mix(1.0-isFloodlit,isFloodlit,u_ao_pass);hidden+=hidden_by_landmark;gl_Position=mix(u_matrix*vec4(pos,1.0),AWAY,float(hidden > 0.0)); #ifdef RENDER_CUTOFF v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); #endif }`),hillshadePrepare:Vs(`precision highp float;uniform highp sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;float getElevation(vec2 coord) {return texture(u_image,coord).r/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2( (c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c) )/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4( deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:Vs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;uniform float u_emissive_strength;void main() {vec4 pixel=texture(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);glFragColor=accent_color*(1.0-shade_color.a)+shade_color; #ifdef LIGHTING_3D_MODE glFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength); #endif #ifdef FOG glFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos)); #endif #ifdef USE_MRT1 out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" uniform mat4 u_matrix;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0; #ifdef FOG v_fog_pos=fog_position(a_pos); #endif }`),line:Vs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" #include "_prelude_shadow.fragment.glsl" uniform lowp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_floor_width_scale;uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec3 v_uv; #ifdef ELEVATED_ROADS in highp float v_road_z_offset; #endif #ifdef RENDER_LINE_DASH uniform sampler2D u_dash_image;in vec2 v_tex; #endif #ifdef RENDER_LINE_GRADIENT uniform sampler2D u_gradient_image; #endif #ifdef INDICATOR_CUTOUT in highp float v_z_offset; #endif #ifdef RENDER_SHADOWS uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; #endif float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;} #pragma mapbox: define highp vec4 color #pragma mapbox: define lowp float floorwidth #pragma mapbox: define lowp vec4 dash #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity #pragma mapbox: define mediump float side_z_offset #pragma mapbox: define lowp float border_width #pragma mapbox: define lowp vec4 border_color #pragma mapbox: define lowp float emissive_strength float linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize lowp float floorwidth #pragma mapbox: initialize lowp vec4 dash #pragma mapbox: initialize lowp float blur #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump float side_z_offset #pragma mapbox: initialize lowp float border_width #pragma mapbox: initialize lowp vec4 border_color #pragma mapbox: initialize lowp float emissive_strength float dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);alpha=side_z_offset > 0.0 ? 1.0-alpha : alpha; #ifdef RENDER_LINE_DASH float sdfdist=texture(u_dash_image,v_tex).r;float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;float scaled_floorwidth=(floorwidth*u_floor_width_scale);alpha*=linearstep(0.5-sdfgamma/scaled_floorwidth,0.5+sdfgamma/scaled_floorwidth,sdfdist); #endif highp vec4 out_color; #ifdef RENDER_LINE_GRADIENT out_color=texture(u_gradient_image,v_uv.xy); #ifdef MULTIPLY_LINE_GRADIENT_COLOR out_color*=color; #endif #else out_color=color; #endif float trim_alpha=1.0; #ifdef RENDER_LINE_TRIM_OFFSET highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);out_color=mix(out_color,u_trim_color,transition_factor);trim_alpha=1.0-transition_factor;} #endif if (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}} #ifdef RENDER_LINE_BORDER float edgeBlur=((border_width*u_width_scale)+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);if (border_color.a==0.0) {float Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}} else {out_color=mix(border_color*trim_alpha,out_color,smoothAlpha);}} #endif #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(out_color,emissive_strength); #ifdef RENDER_SHADOWS float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); #ifdef ELEVATED_ROADS out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); #else out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); #endif #endif #endif #ifdef FOG out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); #endif out_color*=(alpha*opacity); #ifdef INDICATOR_CUTOUT out_color=applyCutout(out_color,v_z_offset); #endif #ifdef FEATURE_CUTOUT out_color=apply_feature_cutout(out_color,gl_FragCoord); #endif glFragColor=out_color; #ifdef DUAL_SOURCE_BLENDING glFragColorSrc1=vec4(vec3(0.0),emissive_strength); #else #ifdef USE_MRT1 out_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_shadow.vertex.glsl" #include "_prelude_terrain.vertex.glsl" #define EXTRUDE_SCALE 0.015873016 in vec2 a_pos_normal;in vec4 a_data; #if defined(ELEVATED) || defined(ELEVATED_ROADS) || defined(VARIABLE_LINE_WIDTH) in vec3 a_z_offset_width; #endif #if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) in highp vec3 a_packed; #endif #ifdef RENDER_LINE_DASH in float a_linesofar; #endif uniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;uniform float u_width_scale;uniform highp float u_floor_width_scale; #ifdef ELEVATED uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) { #ifdef ELEVATION_REFERENCE_SEA return 0.0; #else return elevation(apos); #endif } #endif out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec3 v_uv; #ifdef ELEVATED_ROADS out highp float v_road_z_offset; #endif #ifdef RENDER_LINE_DASH uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex; #endif #ifdef RENDER_LINE_GRADIENT uniform float u_image_height; #endif #ifdef INDICATOR_CUTOUT out highp float v_z_offset; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; #endif #pragma mapbox: define highp vec4 color #pragma mapbox: define lowp float floorwidth #pragma mapbox: define lowp vec4 dash #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity #pragma mapbox: define mediump float gapwidth #pragma mapbox: define lowp float offset #pragma mapbox: define mediump float width #pragma mapbox: define mediump float side_z_offset #pragma mapbox: define lowp float border_width #pragma mapbox: define lowp vec4 border_color #pragma mapbox: define lowp float emissive_strength void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize lowp float floorwidth #pragma mapbox: initialize lowp vec4 dash #pragma mapbox: initialize lowp float blur #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump float gapwidth #pragma mapbox: initialize lowp float offset #pragma mapbox: initialize mediump float width #pragma mapbox: initialize mediump float side_z_offset #pragma mapbox: initialize lowp float border_width #pragma mapbox: initialize lowp vec4 border_color #pragma mapbox: initialize lowp float emissive_strength float a_z_offset; #if defined(ELEVATED) || defined(ELEVATED_ROADS) a_z_offset=a_z_offset_width.x; #endif float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth; #ifdef VARIABLE_LINE_WIDTH bool left=normal.y==1.0;halfwidth=(u_width_scale*(left ? a_z_offset_width.y : a_z_offset_width.z))/2.0;a_z_offset+=left ? side_z_offset : 0.0;v_normal=side_z_offset > 0.0 && left ? vec2(0.0) : v_normal; #else halfwidth=(u_width_scale*width)/2.0; #endif offset=-1.0*offset*u_width_scale;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy; #ifdef ELEVATED_ROADS v_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude; #else #ifdef ELEVATED vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0; #ifdef CROSS_SLOPE_VERTICAL float top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0); #else #ifdef CROSS_SLOPE_HORIZONTAL float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset; #else float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset; #endif #endif gl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden); #else gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden); #endif #endif #ifdef ELEVATED_ROADS #ifdef RENDER_SHADOWS vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos; #ifdef NORMAL_OFFSET vec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; #endif #endif #ifndef RENDER_TO_TEXTURE float epsilon=0.0001;float extrude_length_without_perspective=max(length(dist),epsilon);float extrude_length_with_perspective=max(length(projected_extrude_xy/gl_Position.w*u_units_to_pixels),epsilon);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur)); #else v_gamma_scale=1.0; #endif #if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) highp float a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float line_progress=a_packed[2]; #ifdef RENDER_LINE_GRADIENT highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec3(a_uv_x,a_split_index*texel_height-half_texel_height,line_progress); #else v_uv=vec3(a_uv_x,0.0,line_progress); #endif #endif #ifdef RENDER_LINE_DASH float scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/(floorwidth*u_floor_width_scale),(-normal.y*height+dash.x+0.5)/u_texsize.y); #endif v_width2=vec2(outset,inset); #ifdef FOG v_fog_pos=fog_position(pos); #endif #ifdef INDICATOR_CUTOUT v_z_offset=a_z_offset; #endif }`),linePattern:Vs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" #include "_prelude_shadow.fragment.glsl" uniform highp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_alpha_discard_threshold;uniform highp vec2 u_texsize;uniform highp float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;uniform sampler2D u_image; #ifdef APPLY_LUT_ON_GPU uniform highp sampler3D u_lutTexture; #endif #ifdef LINE_PATTERN_TRANSITION uniform float u_pattern_transition; #endif in vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width; #ifdef RENDER_LINE_TRIM_OFFSET in highp vec3 v_uv; #endif #ifdef ELEVATED_ROADS in highp float v_road_z_offset; #endif #ifdef LINE_JOIN_NONE in vec2 v_pattern_data; #endif #ifdef INDICATOR_CUTOUT in highp float v_z_offset; #endif #ifdef RENDER_SHADOWS uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; #endif #pragma mapbox: define mediump vec4 pattern #ifdef LINE_PATTERN_TRANSITION #pragma mapbox: define mediump vec4 pattern_b #endif #pragma mapbox: define mediump float pixel_ratio #pragma mapbox: define mediump float blur #pragma mapbox: define mediump float opacity #pragma mapbox: define lowp float emissive_strength void main() { #pragma mapbox: initialize mediump vec4 pattern #ifdef LINE_PATTERN_TRANSITION #pragma mapbox: initialize mediump vec4 pattern_b #endif #pragma mapbox: initialize mediump float pixel_ratio #pragma mapbox: initialize mediump float blur #pragma mapbox: initialize mediump float opacity #pragma mapbox: initialize lowp float emissive_strength vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;highp float pattern_size=display_size.x/u_tile_units_to_pixels;float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);highp float pattern_x=v_linesofar/pattern_size*aspect;highp float x=mod(pattern_x,1.0);highp float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;highp vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));highp vec2 lod_pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(pattern_x,y));vec4 color=textureLodCustom(u_image,pos,lod_pos); #ifdef APPLY_LUT_ON_GPU color=applyLUT(u_lutTexture,color); #endif #ifdef LINE_PATTERN_TRANSITION vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl*texel_size-texel_size,pattern_b_br*texel_size+texel_size,vec2(x,y));vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);color=color*(1.0-u_pattern_transition)+color_b*u_pattern_transition; #endif #ifdef RENDER_LINE_TRIM_OFFSET highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);color=mix(color,color.a*u_trim_color,transition_factor);} #endif #ifdef LINE_JOIN_NONE highp float pattern_len=pattern_size/aspect;highp float segment_phase=pattern_len-mod(v_linesofar-v_pattern_data.x+pattern_len,pattern_len);highp float visible_start=segment_phase-step(pattern_len*0.5,segment_phase)*pattern_len;highp float visible_end=floor((v_pattern_data.y-segment_phase)/pattern_len)*pattern_len+segment_phase;visible_end+=step(pattern_len*0.5,v_pattern_data.y-visible_end)*pattern_len;if (v_pattern_data.x < visible_start || v_pattern_data.x >=visible_end) {color=vec4(0.0);} #endif #ifdef LIGHTING_3D_MODE color=apply_lighting_with_emission_ground(color,emissive_strength); #ifdef RENDER_SHADOWS float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); #ifdef ELEVATED_ROADS color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); #else color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); #endif #endif #endif #ifdef FOG color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); #endif color*=(alpha*opacity);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}} #ifdef INDICATOR_CUTOUT color=applyCutout(color,v_z_offset); #endif glFragColor=color; #ifdef DUAL_SOURCE_BLENDING glFragColorSrc1=vec4(vec3(0.0),emissive_strength); #else #ifdef USE_MRT1 out_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_shadow.vertex.glsl" #include "_prelude_terrain.vertex.glsl" #define scale 0.015873016 in vec2 a_pos_normal;in vec4 a_data; #if defined(ELEVATED) || defined(ELEVATED_ROADS) in vec3 a_z_offset_width; #endif #ifdef RENDER_LINE_TRIM_OFFSET in highp vec3 a_packed; #endif in highp float a_linesofar; #ifdef LINE_JOIN_NONE in highp vec3 a_pattern_data;out vec2 v_pattern_data; #endif #ifdef INDICATOR_CUTOUT out highp float v_z_offset; #endif uniform mat4 u_matrix;uniform float u_tile_units_to_pixels;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform float u_device_pixel_ratio;uniform float u_width_scale;uniform float u_floor_width_scale; #ifdef ELEVATED uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) { #ifdef ELEVATION_REFERENCE_SEA return 0.0; #else return elevation(apos); #endif } #endif out vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width; #ifdef RENDER_LINE_TRIM_OFFSET out highp vec3 v_uv; #endif #ifdef ELEVATED_ROADS out highp float v_road_z_offset; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; #endif #pragma mapbox: define mediump float blur #pragma mapbox: define mediump float opacity #pragma mapbox: define mediump float offset #pragma mapbox: define mediump float gapwidth #pragma mapbox: define mediump float width #pragma mapbox: define mediump float floorwidth #pragma mapbox: define mediump vec4 pattern #ifdef LINE_PATTERN_TRANSITION #pragma mapbox: define mediump vec4 pattern_b #endif #pragma mapbox: define mediump float pixel_ratio #pragma mapbox: define lowp float emissive_strength void main() { #pragma mapbox: initialize mediump float blur #pragma mapbox: initialize mediump float opacity #pragma mapbox: initialize mediump float offset #pragma mapbox: initialize mediump float gapwidth #pragma mapbox: initialize mediump float width #pragma mapbox: initialize mediump float floorwidth #pragma mapbox: initialize mediump vec4 pattern #ifdef LINE_PATTERN_TRANSITION #pragma mapbox: initialize mediump vec4 pattern_b #endif #pragma mapbox: initialize mediump float pixel_ratio #pragma mapbox: initialize lowp float emissive_strength float a_z_offset; #if defined(ELEVATED) || defined(ELEVATED_ROADS) a_z_offset=a_z_offset_width.x; #endif float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=(u_width_scale*width)/2.0;offset=-1.0*offset*u_width_scale;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);vec2 dist=outset*a_extrude*scale;float u=0.5*a_direction;float t=1.0-abs(u);vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy; #ifdef ELEVATED_ROADS v_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude; #else #ifdef ELEVATED vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0; #ifdef CROSS_SLOPE_VERTICAL float top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0); #else #ifdef CROSS_SLOPE_HORIZONTAL float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset; #else float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset; #endif #endif gl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden); #else gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden); #endif #endif #ifdef ELEVATED_ROADS #ifdef RENDER_SHADOWS vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos; #ifdef NORMAL_OFFSET vec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; #endif #endif #ifndef RENDER_TO_TEXTURE float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude_xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur)); #else v_gamma_scale=1.0; #endif #ifdef RENDER_LINE_TRIM_OFFSET highp float a_uv_x=a_packed[0];highp float line_progress=a_packed[2];v_uv=vec3(a_uv_x,0.0,line_progress); #endif v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=(floorwidth*u_floor_width_scale); #ifdef LINE_JOIN_NONE v_width=(floorwidth*u_floor_width_scale)+ANTIALIASING;mediump float pixels_to_tile_units=1.0/u_tile_units_to_pixels;mediump float pixel_ratio_inverse=1.0/pixel_ratio;mediump float aspect=v_width/((pattern.w-pattern.y)*pixel_ratio_inverse);highp float subt_multiple=(pattern.z-pattern.x)*pixel_ratio_inverse*pixels_to_tile_units*aspect*32.0;highp float subt=floor(a_pattern_data.z/subt_multiple)*subt_multiple;float offset_sign=(fract(a_pattern_data.x)-0.5)*4.0;float line_progress_offset=offset_sign*v_width*0.5*pixels_to_tile_units;v_linesofar=(a_pattern_data.z-subt)+a_linesofar+line_progress_offset;v_pattern_data=vec2(a_pattern_data.x+line_progress_offset,a_pattern_data.y); #endif #ifdef FOG v_fog_pos=fog_position(pos); #endif #ifdef INDICATOR_CUTOUT v_z_offset=a_z_offset; #endif }`),raster:Vs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" #include "_prelude_raster_array.glsl" uniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;uniform highp float u_zoom_transition;in vec2 v_pos0;in vec2 v_pos1;in float v_depth; #ifdef PROJECTION_GLOBE_VIEW in float v_split_fade; #endif uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;uniform float u_emissive_strength; #ifndef RASTER_ARRAY uniform highp sampler2D u_image0;uniform sampler2D u_image1; #endif #ifdef RASTER_COLOR uniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res; #endif void main() {vec4 color0,color1,color;vec2 value; #ifdef RASTER_COLOR #ifdef RASTER_ARRAY #ifdef RASTER_ARRAY_LINEAR value=mix( raTexture2D_image0_linear(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_linear(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t ); #else value=mix( raTexture2D_image0_nearest(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_nearest(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t ); #endif if (value.y > 0.0) value.x/=value.y; #else color=mix(texture(u_image0,v_pos0),texture(u_image1,v_pos1),u_fade_t);value=vec2(u_colorization_offset+dot(color.rgb,u_colorization_mix.rgb),color.a); #endif color=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y; #else color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t); #endif color.a*=u_opacity; #ifdef GLOBE_POLES color.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition); #endif vec3 rgb=color.rgb;rgb=vec3( dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);vec3 out_color=mix(u_high_vec,u_low_vec,rgb); #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb; #endif #ifdef FOG highp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit)); #endif glFragColor=vec4(out_color*color.a,color.a); #ifdef PROJECTION_GLOBE_VIEW glFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade)); #endif #ifdef RENDER_CUTOFF glFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth); #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif #ifdef USE_MRT1 out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" uniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;uniform vec2 u_texture_offset;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center; #define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8 #ifdef GLOBE_POLES in vec3 a_globe_pos;in vec2 a_uv; #else in vec2 a_pos;in vec2 a_texture_pos; #endif out vec2 v_pos0;out vec2 v_pos1;out float v_depth; #ifdef PROJECTION_GLOBE_VIEW out float v_split_fade; #endif void main() {vec2 uv; #ifdef GLOBE_POLES vec3 globe_pos=a_globe_pos;globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos ,1.0);uv=a_uv; #ifdef FOG v_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz); #endif #else float w=1.0+dot(a_texture_pos,u_perspective_transform);uv=a_texture_pos/8192.0; #ifdef PROJECTION_GLOBE_VIEW vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]); v_split_fade=0.0;if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;float opposite_merc_center=mod(u_merc_center.x+0.5,1.0);float dist_from_poles=(abs(mercatorY-0.5)*2.0);float range=0.1;v_split_fade=abs(opposite_merc_center-mercatorX);v_split_fade=clamp(1.0-v_split_fade,0.0,1.0);v_split_fade=max(smoothstep(1.0-range,1.0,dist_from_poles),max(smoothstep(1.0-range,1.0,v_split_fade),smoothstep(1.0-range,1.0,1.0-v_split_fade)));}float tiles=u_grid_matrix[0][2];if (tiles > 0.0) {float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvY=mercatorY*tiles-idy;float uvX=mercatorX*tiles-idx;uv=vec2(uvX,uvY);}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos; #ifdef FOG v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); #endif #else gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w); #ifdef FOG v_fog_pos=fog_position(a_pos); #endif #endif #endif v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;v_pos0=u_texture_offset.x+u_texture_offset.y*v_pos0;v_pos1=u_texture_offset.x+u_texture_offset.y*v_pos1; #ifdef RENDER_CUTOFF v_depth=gl_Position.z; #endif }`),rasterParticle:Vs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" uniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;in vec2 v_pos0;in vec2 v_pos1;uniform sampler2D u_image0;uniform sampler2D u_image1;void main() {vec4 color0,color1,color;color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 out_color=color.rgb; #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),1.0).rgb; #endif #ifdef FOG highp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit)); #endif glFragColor=vec4(out_color*color.a,color.a); #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" uniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center; #define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8 in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv; #ifdef PROJECTION_GLOBE_VIEW vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvX=mercatorX*tiles-idx;float uvY=mercatorY*tiles-idy;uv=vec2(uvX,uvY);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos; #ifdef FOG v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); #endif #else uv=a_texture_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w); #ifdef FOG v_fog_pos=fog_position(a_pos); #endif #endif v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),rasterParticleDraw:Vs("uniform sampler2D u_color_ramp;in float v_particle_speed;void main() {glFragColor=texture(u_color_ramp,vec2(v_particle_speed,0.5));}",`#include "_prelude_raster_particle.glsl" in float a_index;uniform sampler2D u_particle_texture;uniform float u_particle_texture_side_len;uniform vec2 u_tile_offset;out float v_particle_speed;void main() {ivec2 pixel_coord=ivec2( mod(a_index,u_particle_texture_side_len),a_index/u_particle_texture_side_len);vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);vec2 pos=unpack_pos_from_rgba(pixel)+u_tile_offset;vec2 tex_coord=fract(pos);vec2 velocity=lookup_velocity(tex_coord);if (velocity==INVALID_VELOCITY) {gl_Position=AWAY;v_particle_speed=0.0;} else {gl_Position=vec4(2.0*pos-1.0,0,1);v_particle_speed=length(velocity);}gl_PointSize=1.0;}`),rasterParticleTexture:Vs("uniform sampler2D u_texture;uniform float u_opacity;in vec2 v_tex_pos;void main() {vec4 color=texture(u_texture,v_tex_pos);glFragColor=vec4(floor(255.0*color*u_opacity)/255.0);}","in vec2 a_pos;out vec2 v_tex_pos;void main() {vec2 uv=0.5*a_pos+vec2(0.5);v_tex_pos=uv;gl_Position=vec4(a_pos,0.0,1.0);}"),rasterParticleUpdate:Vs(`#include "_prelude_raster_particle.glsl" uniform sampler2D u_particle_texture;uniform mediump float u_particle_texture_side_len;uniform mediump float u_speed_factor;uniform highp float u_reset_rate;uniform highp float u_rand_seed;in highp vec2 v_tex_coord;vec2 linearstep(vec2 edge0,vec2 edge1,vec2 x) {return clamp((x-edge0)/(edge1-edge0),vec2(0),vec2(1));}const highp vec3 rand_constants=vec3(12.9898,78.233,4375.85453);highp float rand(const highp vec2 co) {highp float t=dot(rand_constants.xy,co);return fract(sin(t)*(rand_constants.z+t));}void main() {ivec2 pixel_coord=ivec2(v_tex_coord*u_particle_texture_side_len);highp vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);highp vec2 pos=unpack_pos_from_rgba(pixel);highp vec2 velocity=lookup_velocity(clamp(pos,0.0,1.0));highp vec2 dp=velocity==INVALID_VELOCITY ? vec2(0) : velocity*u_speed_factor;pos=pos+dp;highp vec2 seed=(pos+v_tex_coord)*u_rand_seed;highp vec2 random_pos=vec2(rand(seed+1.3),rand(seed+2.1));highp vec2 persist_rate=pow( linearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4) );highp vec2 per_frame_persist=pow(persist_rate,abs(dp)/u_particle_pos_offset);highp float drop_rate=1.0-per_frame_persist.x*per_frame_persist.y;drop_rate=any(greaterThanEqual(abs(pos-0.5),vec2(0.5+u_particle_pos_offset))) ? 1.0 : drop_rate;highp float drop=step(1.0-drop_rate-u_reset_rate,rand(seed));highp vec2 next_pos=mix(pos,random_pos,drop);glFragColor=pack_pos_to_rgba(next_pos);}`,"in vec2 a_pos;out vec2 v_tex_coord;void main() {v_tex_coord=0.5*(a_pos+vec2(1.0));gl_Position=vec4(a_pos,0.0,1.0);}"),symbol:Vs(`#include "_prelude_lighting.glsl" #include "_prelude_shadow.fragment.glsl" #define SDF_PX 8.0 #define SDF 1.0 #define ICON 0.0 uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_halo;uniform lowp float u_scale_factor; #ifdef ICON_TRANSITION uniform float u_icon_transition; #endif #ifdef COLOR_ADJUSTMENT uniform mat4 u_color_adj_mat; #endif #ifdef INDICATOR_CUTOUT in highp float v_z_offset; #else #ifdef RENDER_SHADOWS in highp float v_z_offset; #endif #endif in vec2 v_tex_a; #ifdef ICON_TRANSITION in vec2 v_tex_b; #endif in float v_draw_halo;in vec3 v_gamma_scale_size_fade_opacity; #ifdef RENDER_TEXT_AND_SYMBOL in float is_sdf;in vec2 v_tex_a_icon; #endif #ifdef RENDER_SHADOWS uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; #endif #ifdef APPLY_LUT_ON_GPU uniform highp sampler3D u_lutTexture; #endif #pragma mapbox: define highp vec4 fill_color #pragma mapbox: define highp vec4 halo_color #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp float halo_width #pragma mapbox: define lowp float halo_blur #pragma mapbox: define lowp float emissive_strength void main() { #pragma mapbox: initialize highp vec4 fill_color #pragma mapbox: initialize highp vec4 halo_color #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize lowp float halo_width #pragma mapbox: initialize lowp float halo_blur #pragma mapbox: initialize lowp float emissive_strength vec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2]; #ifdef RENDER_TEXT_AND_SYMBOL if (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity;glFragColor=texture(u_texture_icon,tex_icon)*alpha; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif return;} #endif #ifdef RENDER_SDF float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_gamma_scale_size_fade_opacity.x;float size=v_gamma_scale_size_fade_opacity.y;float fontScale=u_is_text ? size/24.0 : size;out_color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {out_color=halo_color;gamma=(halo_blur*u_scale_factor*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width*u_scale_factor/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,v_tex_a).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);out_color*=alpha; #else #ifdef ICON_TRANSITION vec4 a=texture(u_texture,v_tex_a)*(1.0-u_icon_transition);vec4 b=texture(u_texture,v_tex_b)*u_icon_transition;out_color=(a+b); #else out_color=texture(u_texture,v_tex_a); #endif #ifdef APPLY_LUT_ON_GPU out_color=applyLUT(u_lutTexture,out_color); #endif #ifdef COLOR_ADJUSTMENT out_color=u_color_adj_mat*out_color; #endif #endif out_color*=opacity*fade_opacity; #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(out_color,emissive_strength); #ifdef RENDER_SHADOWS float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); #ifdef TERRAIN out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); #else out_color.rgb*=mix(v_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); #endif #endif #endif #ifdef INDICATOR_CUTOUT out_color=applyCutout(out_color,v_z_offset); #endif #ifdef FEATURE_CUTOUT out_color=apply_feature_cutout(out_color,gl_FragCoord); #endif glFragColor=out_color; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl" #include "_prelude_shadow.vertex.glsl" #define APPEARANCE_ICON 1.0 in vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity; #ifdef Z_OFFSET in float a_auto_z_offset; #endif #ifdef PROJECTION_GLOBE_VIEW in vec3 a_globe_anchor;in vec3 a_globe_normal; #endif #ifdef ICON_TRANSITION in vec2 a_texb; #endif #ifdef OCCLUSION_QUERIES in float a_occlusion_query_opacity; #endif #ifdef ELEVATED_ROADS in vec3 a_x_axis;in vec3 a_y_axis;uniform float u_normal_scale; #endif #ifdef INDICATOR_CUTOUT out highp float v_z_offset; #else #ifdef RENDER_SHADOWS out highp float v_z_offset; #endif #endif uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_elevation_from_sea;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform vec2 u_texsize_icon;uniform bool u_is_halo; #ifdef PROJECTION_GLOBE_VIEW uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix; #endif out vec2 v_tex_a; #ifdef ICON_TRANSITION out vec2 v_tex_b; #endif out float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity; #ifdef RENDER_TEXT_AND_SYMBOL out float is_sdf;out vec2 v_tex_a_icon; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; #endif #pragma mapbox: define highp vec4 fill_color #pragma mapbox: define highp vec4 halo_color #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp float halo_width #pragma mapbox: define lowp float halo_blur #pragma mapbox: define lowp float emissive_strength #pragma mapbox: define lowp float occlusion_opacity #pragma mapbox: define lowp float z_offset void main() { #pragma mapbox: initialize highp vec4 fill_color #pragma mapbox: initialize highp vec4 halo_color #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize lowp float halo_width #pragma mapbox: initialize lowp float halo_blur #pragma mapbox: initialize lowp float emissive_strength #pragma mapbox: initialize lowp float occlusion_opacity #pragma mapbox: initialize lowp float z_offset vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);float a_size_max= floor(a_size[1]*0.5);float a_apperance_icon=a_size[1]-2.0*a_size_max;vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (a_apperance_icon==APPEARANCE_ICON) {size=a_size_max/128.0;} else if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size_max,u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=u_elevation_from_sea ? z_offset : z_offset+elevation(tile_anchor); #ifdef Z_OFFSET e+=a_auto_z_offset; #endif vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe; #ifdef PROJECTION_GLOBE_VIEW mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos_globe=a_globe_anchor+h;world_pos=mix_globe_mercator(world_pos_globe,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0; #else world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0; #endif vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ? camera_to_anchor_distance/u_camera_to_center_distance : u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp( 0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;vec2 a; #ifdef PROJECTION_GLOBE_VIEW vec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);vec4 projected_point_globe=u_matrix*vec4(world_pos_globe,1);a=projected_point_globe.xy/projected_point_globe.w; #else offsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w; #endif vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos; #ifdef PROJECTION_GLOBE_VIEW #ifdef PROJECTED_POS_ON_VIEWPORT projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xyz+h,1.0); #else vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz,mercator_pos,u_zoom_transition)+h;projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0); #endif #else projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0); #endif highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0); #ifdef TERRAIN #ifdef PITCH_WITH_MAP_TERRAIN vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy); #endif #endif #ifdef Z_OFFSET z+=u_pitch_with_map ? a_auto_z_offset+z_offset : 0.0; #else z+=u_pitch_with_map ? z_offset : 0.0; #endif float occlusion_fade=globe_occlusion_fade;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float out_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change)); #ifdef DEPTH_OCCLUSION float depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier; #endif #ifdef OCCLUSION_QUERIES float occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier; #endif #ifdef Z_TEST_OCCLUSION out_fade_opacity*=occlusion_opacity; #endif float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);vec3 pos; #ifdef PROJECTION_GLOBE_VIEW vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y; #else #ifdef ELEVATED_ROADS vec3 xAxis=vec3(a_x_axis.xy,a_x_axis.z*u_normal_scale);vec3 yAxis=vec3(a_y_axis.xy,a_y_axis.z*u_normal_scale);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y; #else pos=vec3(projected_pos.xy/projected_pos.w+offset,z); #endif #endif gl_Position=mix(u_coord_matrix*vec4(pos,1.0),AWAY,hidden);float gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_gamma_scale_size_fade_opacity=vec3(gamma_scale,size,out_fade_opacity);v_tex_a=a_tex/u_texsize; #ifdef RENDER_TEXT_AND_SYMBOL is_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon; #endif #ifdef ICON_TRANSITION v_tex_b=a_texb/u_texsize; #endif #ifdef RENDER_SHADOWS vec4 shd_pos=u_inv_matrix*vec4(pos,1.0);vec3 shd_pos0=shd_pos.xyz;vec3 shd_pos1=shd_pos.xyz; #ifdef NORMAL_OFFSET vec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; #endif #ifdef INDICATOR_CUTOUT v_z_offset=e; #else #ifdef RENDER_SHADOWS v_z_offset=e; #endif #endif }`),terrainRaster:Vs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_shadow.fragment.glsl" #include "_prelude_lighting.glsl" uniform sampler2D u_image0; #ifdef LIGHTING_3D_ALPHA_EMISSIVENESS uniform sampler2D u_image1;uniform float u_emissive_texture_available; #endif in vec2 v_pos0; #ifdef FOG in float v_fog_opacity; #endif #ifdef RENDER_SHADOWS in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1; #endif uniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color; #ifdef LIGHTING_3D_MODE const vec3 normal=vec3(0.0,0.0,1.0); #ifdef RENDER_SHADOWS float cutoffOpacity=1.0; #ifdef RENDER_CUTOFF cutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w); #endif #ifdef LIGHTING_3D_ALPHA_EMISSIVENESS float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : image_color.a;vec3 unlit_base=image_color.rgb*(1.0-emissive_strength);vec3 emissive_base=image_color.rgb*emissive_strength;float ndotl=u_shadow_direction.z;float occlusion=ndotl < 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,0.0);ndotl=max(0.0,ndotl);vec3 lit=apply_lighting(unlit_base,normal,mix(1.0,(1.0-(u_shadow_intensity*occlusion))*ndotl,cutoffOpacity));vec3 emissive=compute_emissive_draped(emissive_base,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=lit+emissive;color.a=1.0; #else float lighting_factor=shadowed_light_factor_normal_unbiased(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);color=apply_lighting(image_color,normal,mix(1.0,lighting_factor,cutoffOpacity)); #endif #else float lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor); #ifdef LIGHTING_3D_ALPHA_EMISSIVENESS float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : image_color.a;color.rgb=mix(color.rgb,image_color.rgb,emissive_strength);color.a=1.0; #endif #endif #else color=image_color; #endif #ifdef FOG #ifdef ZERO_EXAGGERATION color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); #else color=fog_dither(fog_apply_from_vert(color,v_fog_opacity)); #endif #endif glFragColor=color; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_terrain.vertex.glsl" uniform mat4 u_matrix;uniform float u_skirt_height;in vec2 a_pos;out vec2 v_pos0; #ifdef FOG out float v_fog_opacity; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1; #endif void main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;v_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0); #ifdef FOG #ifdef ZERO_EXAGGERATION v_fog_pos=fog_position(decodedPos); #else v_fog_opacity=fog(fog_position(vec3(decodedPos,elevation))); #endif #endif #ifdef RENDER_SHADOWS vec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.); #endif }`),terrainDepth:Vs("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",`#include "_prelude_terrain.vertex.glsl" uniform mat4 u_matrix;in vec2 a_pos;out float v_depth;void main() {float elevation=elevation(a_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}`),skybox:Vs(`#include "_prelude_fog.fragment.glsl" in lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep( cos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=texture(u_cubemap,uv).rgb; #ifdef FOG sky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color); #endif sky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity); #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif }`,sk),skyboxGradient:Vs(`#include "_prelude_fog.fragment.glsl" in highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture(u_color_ramp,vec2(progress,0.5)); #ifdef FOG color.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a; #endif color*=u_opacity;glFragColor=color; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif }`,sk),skyboxCapture:Vs(` in highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;precision highp float; #define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6) #define BETA_M vec3(21e-6,21e-6,21e-6) #define MIE_G 0.76 #define DENSITY_HEIGHT_SCALE_R 8000.0 #define DENSITY_HEIGHT_SCALE_M 1200.0 #define PLANET_RADIUS 6360e3 #define ATMOSPHERE_RADIUS 6420e3 #define SAMPLE_STEPS 10 #define DENSITY_STEPS 4 float ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;glFragColor=vec4(color,1.0);}`,"in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globeRaster:Vs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" uniform sampler2D u_image0; #ifdef LIGHTING_3D_ALPHA_EMISSIVENESS uniform sampler2D u_image1;uniform float u_emissive_texture_available; #endif uniform float u_far_z_cutoff;in vec2 v_pos0; #ifndef FOG uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport; #endif void main() {vec4 color; #ifdef CUSTOM_ANTIALIASING highp vec2 uv=gl_FragCoord.xy/u_viewport; #ifdef FLIP_Y uv.y=1.0-uv.y; #endif highp vec3 ray_dir=mix( mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;highp float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);highp float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture(u_image0,v_pos0); #ifdef LIGHTING_3D_MODE #ifdef LIGHTING_3D_ALPHA_EMISSIVENESS float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : raster.a;raster=apply_lighting_with_emission_ground(raster,emissive_strength);color=vec4(clamp(raster.rgb,vec3(0),vec3(1))*antialias,antialias); #else raster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias); #endif #else color=vec4(raster.rgb*antialias,raster.a*antialias); #endif #else color=texture(u_image0,v_pos0); #ifdef LIGHTING_3D_MODE #ifdef LIGHTING_3D_ALPHA_EMISSIVENESS float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : color.a;color=apply_lighting_with_emission_ground(color,emissive_strength);color.a=1.0; #else color=apply_lighting_ground(color); #endif #endif #endif #ifdef FOG color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); #endif color*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_terrain.vertex.glsl" uniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height; #ifdef GLOBE_POLES in vec3 a_globe_pos;in vec2 a_uv; #else in vec2 a_pos; #endif out vec2 v_pos0;void main() { #ifdef GLOBE_POLES vec3 globe_pos=a_globe_pos;vec2 uv=a_uv; #else float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY); #endif v_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale; #ifdef GLOBE_POLES vec3 up_vector=globe_derived_up_vector; #else vec3 up_vector=elevationVector(tile_pos); #endif float height=elevation(tile_pos);globe_pos+=up_vector*height; #ifndef GLOBE_POLES globe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z; #endif #ifdef GLOBE_POLES vec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0); #else vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0); #endif gl_Position=u_proj_matrix*interpolated_pos; #ifdef FOG v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); #endif }`),globeAtmosphere:Vs(`#include "_prelude_fog.fragment.glsl" uniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_atmosphere_fog_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir; #ifdef PROJECTION_GLOBE_VIEW globe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) { #ifdef ALPHA_PASS glFragColor=vec4(0,0,0,0);return; #else #ifdef NATIVE glFragColor=vec4(1,1,1,1); #else glFragColor=vec4(0,0,0,1); #endif return; #endif } #endif highp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ? 0.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle; #ifdef PROJECTION_GLOBE_VIEW highp vec3 closest_point=globe_pos_dot_dir*dir;highp float closest_point_to_center=length(closest_point-u_globe_pos);highp float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ? PI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t); #else horizon_angle=horizon_angle_mercator; #endif horizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_atmosphere_fog_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_atmosphere_fog_color.rgb;vec3 color_stop_1=u_high_color.rgb;vec3 color_stop_2=u_space_color.rgb; #ifdef ALPHA_PASS float a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);glFragColor=vec4(1.0,1.0,1.0,a); #else vec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c=c2;glFragColor=vec4(c*t,t); #endif }`,`in vec3 a_pos;in vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;out highp vec3 v_ray_dir;out highp vec3 v_horizon_dir;void main() {v_ray_dir=mix( mix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix( mix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}`),model:Vs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_shadow.fragment.glsl" #include "_prelude_lighting.glsl" uniform float u_opacity;uniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;uniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix; #ifdef RENDER_SHADOWS in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows; #endif #ifdef OCCLUSION_TEXTURE_TRANSFORM uniform vec4 u_occlusionTextureTransform; #endif #pragma mapbox: define-attribute highp vec3 normal_3f #pragma mapbox: define-attribute highp vec3 color_3f #pragma mapbox: define-attribute highp vec4 color_4f #pragma mapbox: define-attribute highp vec2 uv_2f #pragma mapbox: initialize-attribute highp vec3 normal_3f #pragma mapbox: initialize-attribute highp vec3 color_3f #pragma mapbox: initialize-attribute highp vec4 color_4f #pragma mapbox: initialize-attribute highp vec2 uv_2f #ifdef HAS_ATTRIBUTE_a_pbr in lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params; #endif #ifdef HAS_TEXTURE_u_baseColorTexture uniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff; #endif #ifdef HAS_TEXTURE_u_metallicRoughnessTexture uniform sampler2D u_metallicRoughnessTexture; #endif #ifdef HAS_TEXTURE_u_occlusionTexture uniform sampler2D u_occlusionTexture;uniform float u_aoIntensity; #endif #ifdef HAS_TEXTURE_u_normalTexture uniform sampler2D u_normalTexture; #endif #ifdef HAS_TEXTURE_u_emissionTexture uniform sampler2D u_emissionTexture; #endif #ifdef APPLY_LUT_ON_GPU uniform highp sampler3D u_lutTexture; #endif #ifdef TERRAIN_FRAGMENT_OCCLUSION in highp float v_depth;uniform highp sampler2D u_depthTexture;uniform highp vec2 u_inv_depth_size;uniform highp vec2 u_depth_range_unpack; #ifdef DEPTH_D24 highp float unpack_depth(highp float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;} #else highp float unpack_depth_rgba(highp vec4 rgba_depth) {const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;} #endif bool isOccluded() {highp vec2 coord=gl_FragCoord.xy*u_inv_depth_size; #ifdef FLIP_Y coord.y=1.0-coord.y; #endif #ifdef DEPTH_D24 highp float depth=unpack_depth(texture(u_depthTexture,coord).r); #else highp float depth=unpack_depth_rgba(texture(u_depthTexture,coord)); #endif return v_depth > depth+0.0005;} #endif #define saturate(_x) clamp(_x,0.,1.) vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}float calculate_NdotL(vec3 normal,vec3 lightDir) {const float ext=0.70710678118;return (clamp(dot(normal,lightDir),-ext,1.0)+ext)/(1.0+ext);}vec3 getDiffuseShadedColor(vec3 albedo,vec3 normal,vec3 lightDir,vec3 lightColor) { #ifdef LIGHTING_3D_MODE vec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor; #ifdef RENDER_SHADOWS lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows); #else lighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir)); #endif return apply_lighting(albedo,transformed_normal,lighting_factor); #else vec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-lightColor),vec3(1.0));return c3; #endif }vec4 getBaseColor() {vec4 albedo=u_baseColorFactor; #ifdef HAS_ATTRIBUTE_a_color_3f albedo*=vec4(color_3f,1.0); #endif #ifdef HAS_ATTRIBUTE_a_pbr #else #ifdef HAS_ATTRIBUTE_a_color_4f albedo*=color_4f; #endif #endif #if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f) vec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}} #ifdef UNPREMULT_TEXTURE_IN_SHADER if(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=1.0; #endif if(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;} #endif vec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a); #ifdef APPLY_LUT_ON_GPU color=applyLUT(u_lutTexture,color); #endif return color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) { #ifdef HAS_TEXTURE_u_normalTexture highp vec3 dp1=vec3(dFdx(p.x),dFdx(p.y),dFdx(p.z));highp vec3 dp2=vec3(dFdy(p.x),dFdy(p.y),dFdy(p.z));highp vec2 duv1=vec2(dFdx(uv.x),dFdx(uv.y));highp vec2 duv2=vec2(dFdy(uv.x),dFdy(uv.y));highp vec3 dp2perp=cross( dp2,N );highp vec3 dp1perp=cross( N,dp1 );highp vec3 T=dp2perp*duv1.x+dp1perp*duv2.x;highp vec3 B=dp2perp*duv1.y+dp1perp*duv2.y; #ifdef FLIP_Y T=-T;B=-B; #endif highp float lengthT=dot(T,T);highp float lengthB=dot(B,B);highp float maxLength=max(lengthT,lengthB);highp float invmax=inversesqrt( maxLength );highp mat3 res=mat3( T*invmax,B*invmax,N );return res; #else return mat3(1.0); #endif }highp vec3 getNormal(){highp vec3 n; #ifdef HAS_ATTRIBUTE_a_normal_3f n=normalize(normal_3f); #else highp vec3 fdx=vec3(dFdx(v_position_height.x),dFdx(v_position_height.y),dFdx(v_position_height.z));highp vec3 fdy=vec3(dFdy(v_position_height.x),dFdy(v_position_height.y),dFdy(v_position_height.z)); #ifdef FLIP_Y n=normalize(cross(fdx,fdy)); #else n=normalize(cross(fdx,fdy))*-1.0; #endif #endif #if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) vec3 nMap=texture( u_normalTexture,uv_2f).xyz;nMap=normalize(2.0*nMap-vec3(1.0));highp vec3 v=normalize(-v_position_height.xyz);highp mat3 TBN=cotangentFrame(n,v,uv_2f);n=normalize(TBN*nMap); #endif return n;}struct Material {float perceptualRoughness;float alphaRoughness;float metallic;vec3 f90;vec4 baseColor;vec3 diffuseColor;vec3 specularColor;highp vec3 normal;};Material getPBRMaterial() {Material mat;mat.baseColor=getBaseColor();mat.perceptualRoughness=u_roughnessFactor;mat.metallic=u_metallicFactor; #ifdef HAS_ATTRIBUTE_a_pbr mat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w; #endif #if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) vec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b; #endif const float c_minRoughness=0.04;mat.perceptualRoughness=clamp(mat.perceptualRoughness,c_minRoughness,1.0);mat.metallic=saturate(mat.metallic);mat.alphaRoughness=mat.perceptualRoughness*mat.perceptualRoughness;const vec3 f0=vec3(0.04);mat.diffuseColor=mat.baseColor.rgb*(vec3(1.0)-f0);mat.diffuseColor*=1.0-mat.metallic;mat.specularColor=mix(f0,mat.baseColor.rgb,mat.metallic);highp float reflectance=max(max(mat.specularColor.r,mat.specularColor.g),mat.specularColor.b);highp float reflectance90=saturate(reflectance*25.0);mat.f90=vec3(reflectance90);mat.normal=getNormal();return mat;}float V_GGX(float NdotL,float NdotV,float roughness) {float a2=roughness*roughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-a2)+a2);float GGXL=NdotV*sqrt(NdotL*NdotL*(1.0-a2)+a2);return 0.5/(GGXV+GGXL);}float V_GGXFast(float NdotL,float NdotV,float roughness) {float a=roughness;float GGXV=NdotL*(NdotV*(1.0-a)+a);float GGXL=NdotV*(NdotL*(1.0-a)+a);return 0.5/(GGXV+GGXL);}vec3 F_Schlick(vec3 specularColor,vec3 f90,float VdotH) {return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH) {float x=1.0-VdotH;float x4=x*x*x*x;return specularColor+(1.0-specularColor)*x4*x;}float D_GGX(highp float NdotH,float alphaRoughness) {highp float a4=alphaRoughness*alphaRoughness;highp float f=(NdotH*a4-NdotH)*NdotH+1.0;return a4/(PI*f*f);}vec3 diffuseBurley(Material mat,float LdotH,float NdotL,float NdotV) {float f90=2.0*LdotH*LdotH*mat.alphaRoughness-0.5;return (mat.diffuseColor/PI)*(1.0+f90*pow((1.0-NdotL),5.0))*(1.0+f90*pow((1.0-NdotV),5.0));}vec3 diffuseLambertian(Material mat) { #ifdef LIGHTING_3D_MODE return mat.diffuseColor; #else return mat.diffuseColor/PI; #endif }vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV) {vec4 c0=vec4(-1,-0.0275,-0.572,0.022);vec4 c1=vec4(1,0.0425,1.04,-0.04);highp vec4 r=roughness*c0+c1;highp float a004=min(r.x*r.x,exp2(-9.28*NdotV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}vec3 computeIndirectLightContribution(Material mat,float NdotV,vec3 normal) {vec3 env_light=vec3(0.65,0.65,0.65); #ifdef LIGHTING_3D_MODE float ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor; #endif vec3 envBRDF=EnvBRDFApprox(mat.specularColor,mat.perceptualRoughness,NdotV);vec3 indirectSpecular= envBRDF*env_light;vec3 indirectDiffuse=mat.diffuseColor*env_light;return indirectSpecular+indirectDiffuse;}vec3 computeLightContribution(Material mat,vec3 lightPosition,vec3 lightColor) {highp vec3 n=mat.normal;highp vec3 v=normalize(-v_position_height.xyz);highp vec3 l=normalize(lightPosition);highp vec3 h=normalize(v+l);float NdotV=clamp(abs(dot(n,v)),0.001,1.0);float NdotL=saturate(dot(n,l));highp float NdotH=saturate(dot(n,h));float VdotH=saturate(dot(v,h));vec3 f=F_SchlickFast(mat.specularColor,VdotH);float g=V_GGXFast(NdotL,NdotV,mat.alphaRoughness);float d=D_GGX(NdotH,mat.alphaRoughness);vec3 diffuseTerm=(1.0-f)*diffuseLambertian(mat);vec3 specularTerm=f*g*d;vec3 transformed_normal=vec3(-n.xy,n.z);float lighting_factor; #ifdef RENDER_SHADOWS lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows); #else lighting_factor=NdotL; #endif vec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*lightColor;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0; #if !defined(LIGHTING_3D_MODE) const vec3 luminosityFactor=vec3(0.2126,0.7152,0.0722);float luminance=dot(diffuseTerm,luminosityFactor);intensityFactor=mix((1.0-u_lightintensity),max((1.0-luminance+u_lightintensity),1.0),NdotL); #endif color*=intensityFactor;return color;}void main() { #ifdef TERRAIN_FRAGMENT_OCCLUSION if (isOccluded()) {discard;} #endif vec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor; #ifdef LIGHTING_3D_MODE lightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color; #endif vec4 finalColor; #ifdef DIFFUSE_SHADED vec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor); #ifdef HAS_TEXTURE_u_occlusionTexture float ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao; #endif finalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity; #else Material mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0; #if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) #ifdef OCCLUSION_TEXTURE_TRANSFORM vec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy; #else vec2 uv=uv_2f; #endif ao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao; #endif vec4 emissive=u_emissiveFactor; #if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) emissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb); #endif #ifdef APPLY_LUT_ON_GPU float emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength; #endif color+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity; #ifdef HAS_ATTRIBUTE_a_pbr float resEmission=v_roughness_metallic_emissive_alpha.z;resEmission*=v_height_based_emission_params.z+v_height_based_emission_params.w*pow(clamp(v_height_based_emission_params.x,0.0,1.0),v_height_based_emission_params.y);vec3 color_mix=v_color_mix.rgb; #ifdef APPLY_LUT_ON_GPU color_mix=applyLUT(u_lutTexture,color_mix); #endif color=mix(color,color_mix,min(1.0,resEmission)); #ifdef HAS_ATTRIBUTE_a_color_4f float distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.y));distance+= mix(0.5,0.0,clamp(resEmission-1.0,0.0,1.0));opacity*=v_roughness_metallic_emissive_alpha.w*saturate(1.0-distance*distance); #endif #endif vec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity); #endif #ifdef FOG finalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w)); #endif #ifdef RENDER_CUTOFF finalColor*=v_cutoff_opacity; #endif #ifdef INDICATOR_CUTOUT finalColor=applyCutout(finalColor,v_position_height.w); #endif #ifdef FEATURE_CUTOUT finalColor=apply_feature_cutout(finalColor,gl_FragCoord); #endif glFragColor=finalColor; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_shadow.vertex.glsl" in vec3 a_pos_3f; #pragma mapbox: define-attribute highp vec3 normal_3f #pragma mapbox: define-attribute highp vec2 uv_2f #pragma mapbox: define-attribute highp vec3 color_3f #pragma mapbox: define-attribute highp vec4 color_4f #pragma mapbox: define-attribute-vertex-shader-only highp vec4 pbr #pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength uniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix; #ifdef INSTANCED_ARRAYS in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3; #else uniform highp mat4 u_normal_matrix; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth_shadows; #endif out vec4 v_position_height;out lowp vec4 v_color_mix; #ifdef TERRAIN_FRAGMENT_OCCLUSION out highp float v_depth; #endif #ifdef HAS_ATTRIBUTE_a_pbr out lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params; #endif vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() { #pragma mapbox: initialize-attribute highp vec3 normal_3f #pragma mapbox: initialize-attribute highp vec2 uv_2f #pragma mapbox: initialize-attribute highp vec3 color_3f #pragma mapbox: initialize-attribute highp vec4 color_4f #pragma mapbox: initialize-attribute-custom highp vec4 pbr #pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength highp mat4 normal_matrix; #ifdef INSTANCED_ARRAYS normal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3); #else normal_matrix=u_normal_matrix; #endif vec3 local_pos;mat3 rs; #ifdef MODEL_POSITION_ON_GPU vec3 pos_color=normal_matrix[0].xyz;vec4 translate=normal_matrix[1];vec3 pos_a=floor(pos_color);vec3 rgb=1.05*(pos_color-pos_a);float hidden=float(pos_a.x > EXTENT);float color_mix=pos_a.z/100.0;v_color_mix=vec4(sRGBToLinear(rgb),color_mix);float meter_to_tile=normal_matrix[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);rs[0].x=normal_matrix[1].w;rs[0].yz=normal_matrix[2].xy;rs[1].xy=normal_matrix[2].zw;rs[1].z=normal_matrix[3].x;rs[2].xyz=normal_matrix[3].yzw;vec4 pos_node=u_lighting_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;local_pos=pos.xyz;gl_Position=mix(u_matrix*pos,AWAY,hidden);pos.z*=meter_to_tile;v_position_height.xyz=pos.xyz-u_camera_pos; #else local_pos=a_pos_3f;gl_Position=u_matrix*vec4(a_pos_3f,1);v_position_height.xyz=vec3(u_lighting_matrix*vec4(a_pos_3f,1));v_color_mix=vec4(sRGBToLinear(u_color_mix.rgb),u_color_mix.a); #endif v_position_height.w=a_pos_3f.z; #ifdef HAS_ATTRIBUTE_a_pbr vec4 albedo_c=decode_color(pbr.xy);vec2 e_r_m=unpack_float(pbr.z);vec2 r_m= unpack_float(e_r_m.y*16.0);r_m.r=r_m.r*16.0;v_color_mix=vec4(albedo_c.rgb,1.0);v_roughness_metallic_emissive_alpha=vec4(vec3(r_m,e_r_m.x)/255.0,albedo_c.a);v_roughness_metallic_emissive_alpha.z*=2.0;float heightBasedRelativeIntepolation=a_pos_3f.z*heightBasedEmissiveStrength.x+heightBasedEmissiveStrength.y;v_height_based_emission_params.x=heightBasedRelativeIntepolation;v_height_based_emission_params.y=heightBasedEmissiveStrength.z;vec2 emissionMultiplierValues=unpack_float(pbr.w)/256.0;v_height_based_emission_params.z=emissionMultiplierValues.x;v_height_based_emission_params.w=emissionMultiplierValues.y-emissionMultiplierValues.x; #endif #ifdef FOG v_fog_pos=fog_position(local_pos); #endif #ifdef RENDER_CUTOFF v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); #endif #ifdef TERRAIN_FRAGMENT_OCCLUSION v_depth=gl_Position.z/gl_Position.w; #ifdef CLIP_ZERO_TO_ONE v_depth=-1.0+2.0*v_depth; #endif #endif #ifdef HAS_ATTRIBUTE_a_normal_3f #ifdef MODEL_POSITION_ON_GPU float x_squared_scale=dot(rs[0],rs[0]);float y_squared_scale=dot(rs[1],rs[1]);float z_squared_scale=dot(rs[2],rs[2]);vec3 squared_scale=vec3(x_squared_scale,y_squared_scale,z_squared_scale);normal_3f=rs*((u_lighting_matrix*vec4(normal_3f,0.0)).xyz/squared_scale);normal_3f=normalize(normal_3f); #else normal_3f=vec3(normal_matrix*vec4(normal_3f,0)); #endif #endif #ifdef HAS_ATTRIBUTE_a_pbr #ifdef HAS_ATTRIBUTE_a_color_4f v_roughness_metallic_emissive_alpha.w=clamp(color_4f.a*v_roughness_metallic_emissive_alpha.w*(v_roughness_metallic_emissive_alpha.z-1.0),0.0,1.0); #endif #endif #ifdef RENDER_SHADOWS vec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0); #ifdef NORMAL_OFFSET #ifdef HAS_ATTRIBUTE_a_normal_3f #ifdef MODEL_POSITION_ON_GPU vec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0(); #else vec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0(); #endif #endif #endif v_pos_light_view_0=u_light_matrix_0*shadow_pos;v_pos_light_view_1=u_light_matrix_1*shadow_pos;v_depth_shadows=gl_Position.w; #endif }`),modelDepth:Vs(`in highp float v_depth;void main() { #ifndef DEPTH_TEXTURE glFragColor=pack_depth(v_depth); #endif }`,`in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth; #ifdef MODEL_POSITION_ON_GPU #ifdef INSTANCED_ARRAYS in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3; #else uniform highp mat4 u_instance; #endif uniform highp mat4 u_node_matrix; #endif void main() { #ifdef MODEL_POSITION_ON_GPU highp mat4 instance; #ifdef INSTANCED_ARRAYS instance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3); #else instance=u_instance; #endif vec3 pos_color=instance[0].xyz;vec4 translate=instance[1];vec3 pos_a=floor(pos_color);float hidden=float(pos_a.x > EXTENT);float meter_to_tile=instance[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);mat3 rs;rs[0].x=instance[1].w;rs[0].yz=instance[2].xy;rs[1].xy=instance[2].zw;rs[1].z=instance[3].x;rs[2].xyz=instance[3].yzw;vec4 pos_node=u_node_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;gl_Position=mix(u_matrix*pos,AWAY,hidden); #else gl_Position=u_matrix*vec4(a_pos_3f,1); #endif v_depth=gl_Position.z/gl_Position.w;}`),stars:Vs(`in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv) {float beginFade=0.6;float lengthFromCenter=length(v_uv);return 1.0-clamp((lengthFromCenter-beginFade)/(1.0-beginFade),0.0,1.0);}void main() {float alpha=shapeCircle(v_uv);vec3 color=vec3(1.0,1.0,1.0);alpha*=v_intensity;glFragColor=vec4(color*alpha,alpha);HANDLE_WIREFRAME_DEBUG;}`,` in vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_fade_opacity;uniform mat4 u_matrix;uniform vec3 u_up;uniform vec3 u_right;uniform float u_intensity_multiplier;out highp vec2 v_uv;out mediump float v_intensity;void main() {v_uv=a_uv;v_intensity=a_fade_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}`),snowParticle:Vs("in highp vec2 uv;in highp float alphaMultiplier;uniform vec4 u_particleColor;uniform vec2 u_simpleShapeParameters;void main() {float t=clamp((length(uv)-u_simpleShapeParameters.x)/(1.0-u_simpleShapeParameters.x),0.0,1.0);float alpha=1.0-pow(t,pow(10.0,u_simpleShapeParameters.y));alpha*=alphaMultiplier;alpha*=u_particleColor.a;vec3 color=u_particleColor.rgb*alpha;glFragColor=vec4(color,alpha) ;HANDLE_WIREFRAME_DEBUG;}",` in highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_snowParticleData;in highp vec4 a_snowParticleDataHorizontalOscillation;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform vec2 u_screenSize;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; uniform float u_velocity;uniform vec3 u_direction;uniform float u_horizontalOscillationRadius; uniform float u_horizontalOscillationRate; uniform float u_billboardSize;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;out highp vec2 uv;out highp float alphaMultiplier;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos.xyz*=halfBoxSize;pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_snowParticleData.z;float coneAngleHeadingRad=a_snowParticleData.w*radians(360.0);vec3 localZ=normalize(u_direction);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 direction;direction.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.z=cos(coneAnglePichRad);direction=normalize(direction);vec3 simPosLocal=vec3(0,0,0);float velocityScale=(1.0+3.0*a_snowParticleData.y)*u_velocity;simPosLocal+=direction*velocityScale*u_time;float horizontalOscillationRadius=u_horizontalOscillationRadius*a_snowParticleDataHorizontalOscillation.x;float horizontalOscillationAngle=u_horizontalOscillationRate*u_time*(-1.0+2.0*a_snowParticleDataHorizontalOscillation.y);simPosLocal.xy+=horizontalOscillationRadius*vec2(cos(horizontalOscillationAngle),sin(horizontalOscillationAngle));vec3 simPos=localX*simPosLocal.x+ localY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);float clipZ=-u_cam_pos.z+pos.z;vec4 posView=u_modelview*vec4(pos,1.0);float size=u_billboardSize;alphaMultiplier=1.0;vec4 posScreen=u_projection*posView;posScreen/=posScreen.w;posScreen.xy=vec2(0.5)+posScreen.xy*0.5;posScreen.xy*=u_screenSize;vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=u_screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-posScreen.xy)/(0.5*u_screenSize));screenDist+=a_snowParticleData.x*u_thinningParticleOffset;float scaleFactorMode=0.0;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);if (a_snowParticleData.x < u_thinningAffectedRatio) {scaleFactorMode=1.0-thinningFadeRatio;alphaMultiplier=thinningFadeRatio;}}vec4 posScreen1=u_projection*vec4(posView.x-size,posView.yzw);posScreen1/=posScreen1.w;vec4 posScreen2=u_projection*vec4(posView.x+size,posView.yzw);posScreen2/=posScreen2.w;posScreen1.xy=vec2(0.5)+posScreen1.xy*0.5;posScreen1.xy*=u_screenSize;posScreen2.xy=vec2(0.5)+posScreen2.xy*0.5;posScreen2.xy*=u_screenSize;float screenLength=length(posScreen1.xy-posScreen2.xy);float screenEpsilon=3.0;float scaleFactor=1.0;if (screenLength < screenEpsilon) {scaleFactor=screenEpsilon/max(screenLength,0.01);scaleFactor=mix(scaleFactor,1.0,scaleFactorMode);}float screenEpsilon2=15.0;if (screenLength > screenEpsilon2) {scaleFactor=screenEpsilon2/max(screenLength,0.01);}size*=scaleFactor;vec2 right=size*vec2(1,0);vec2 up=size*vec2(0,1);posView.xy+=right*a_uv.x;posView.xy+=up*a_uv.y;uv=a_uv;gl_Position=u_projection*posView;}`),rainParticle:Vs("in highp vec2 uv;in highp float particleRandomValue;uniform sampler2D u_texScreen;uniform float u_distortionStrength;uniform vec4 u_color;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;uniform float u_shapeDirectionalPower;uniform float u_mode;void main() {vec2 st=uv*0.5+vec2(0.5);vec2 uvm=uv;uvm.y=-1.0+2.0*pow(st.y,u_shapeDirectionalPower);float shape=clamp(1.0-length(uvm),0.0,1.0);float alpha=abs(shape)*u_color.a;vec2 screenSize=vec2(textureSize(u_texScreen,0));vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-gl_FragCoord.xy)/(0.5*screenSize));screenDist+=(0.5+0.5*particleRandomValue)*u_thinningParticleOffset;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;float thinningAlpha=1.0;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);thinningAlpha*=thinningFadeRatio;}vec2 offsetXY=normalize(uvm)*abs(shape);vec2 stScreen=(gl_FragCoord.xy+offsetXY*u_distortionStrength*thinningAlpha)/screenSize;vec3 colorScreen=texture(u_texScreen,stScreen).rgb;alpha*=thinningAlpha;glFragColor=mix(vec4(colorScreen,1.0),vec4(u_color.rgb*alpha,alpha),u_mode);HANDLE_WIREFRAME_DEBUG;}",` in highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_rainParticleData;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; uniform float u_velocity; uniform vec2 u_rainDropletSize;uniform vec3 u_rainDirection;out highp vec2 uv;out highp float particleRandomValue;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos*=halfBoxSize; pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_rainParticleData.z;float coneAngleHeadingRad=a_rainParticleData.w*radians(360.0);vec3 localZ=normalize(u_rainDirection);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 directionLocal;directionLocal.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.z=cos(coneAnglePichRad);directionLocal=normalize(directionLocal);vec3 directionWorld=localX*directionLocal.x+localY*directionLocal.y+localZ*directionLocal.z;float velocityScale=(1.0+3.0*a_rainParticleData.y)*u_velocity;vec3 simPosLocal=vec3(0,0,0);simPosLocal+=directionLocal*velocityScale*u_time;vec3 simPos=localX*simPosLocal.x+ localY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);vec4 posView=u_modelview*vec4(pos,1.0);vec3 directionView=normalize((u_modelview*vec4(directionWorld,0.0)).xyz);vec3 side=cross(directionView,normalize(posView.xyz));posView.xyz+=side*a_uv.x*u_rainDropletSize.x;posView.xyz+=directionView*a_uv.y*u_rainDropletSize.y;uv=a_uv;particleRandomValue=a_rainParticleData.x;gl_Position=u_projection*posView;}`),vignette:Vs("uniform vec3 u_vignetteShape;uniform vec4 u_vignetteColor;in vec2 st;void main() {float screenDist=length(st);float alpha=clamp((screenDist-u_vignetteShape.x)/u_vignetteShape.y,0.0,1.0);alpha=pow(alpha,u_vignetteShape.z)*u_vignetteColor.a;vec3 color=u_vignetteColor.rgb;glFragColor=vec4(color*alpha,alpha) ;}","in vec2 a_pos_2f;out vec2 st;void main() {st=a_pos_2f;gl_Position=vec4(a_pos_2f,0,1);}"),occlusion:Vs("uniform vec4 u_color;void main() {glFragColor=u_color;}",`#include "_prelude_terrain.vertex.glsl" in highp vec2 a_offset_xy;uniform highp vec3 u_anchorPos;uniform mat4 u_matrix;uniform vec2 u_screenSizePx;uniform vec2 u_occluderSizePx;void main() {vec3 world_pos=u_anchorPos; #ifdef TERRAIN float e=elevation(world_pos.xy);world_pos.z+=e; #endif vec4 projected_point=u_matrix*vec4(world_pos,1.0);projected_point.xy+=projected_point.w*a_offset_xy*0.5*u_occluderSizePx/u_screenSizePx;gl_Position=projected_point;}`)};function Sm(_,d){const p=_.split(` `);for(let b of p){if(b=b.trimStart(),b[0]!=="#"||!b.includes("if")||b.startsWith("#endif"))continue;const M=b.match(_3);if(M)for(const L of M)Rg.has(L)||d.add(L)}}function Vs(_,d){const p=new Set,b=[],M=[];_=_.replace(Q1,(O,z)=>(M.push(z),"")),d=d.replace(Q1,(O,z)=>(b.push(z),""));let L=new Set(Fg);Sm(_,L),Sm(d,L);for(const O of[...b,...M])lk[O]||(lk[O]=new Set,Sm(Nm[O],lk[O])),L=new Set([...L,...lk[O]]);return{fragmentSource:_=_.replace(af,(O,z,V,Y,Q)=>(p.add(Q),z==="define"?` #ifndef HAS_UNIFORM_u_${Q} in ${V} ${Y} ${Q}; #else uniform ${V} ${Y} u_${Q}; #endif `:z==="initialize"?` #ifdef HAS_UNIFORM_u_${Q} ${V} ${Y} ${Q} = u_${Q}; #endif `:z==="define-attribute"?` #ifdef HAS_ATTRIBUTE_a_${Q} in ${V} ${Y} ${Q}; #endif `:z==="initialize-attribute"?"":void 0)),vertexSource:d=d.replace(af,(O,z,V,Y,Q)=>{const ce=`MATERIAL_ATTRIBUTE_OFFSET_${Q}`,le=Y==="float"?"vec2":Y,de=`GET_ATTRIBUTE_${le}(a_${Q}, materialInfo, ${ce})`,be=Q.match(/color/)?"color":le;return z==="define-attribute-vertex-shader-only"?` #ifdef HAS_ATTRIBUTE_a_${Q} in ${V} ${Y} a_${Q}; #endif `:p.has(Q)?z==="define"?` #ifndef HAS_UNIFORM_u_${Q} uniform lowp float u_${Q}_t; #if !defined(${ce}) in ${V} ${le} a_${Q}; #endif out ${V} ${Y} ${Q}; #else uniform ${V} ${Y} u_${Q}; #endif `:z==="initialize"?be==="vec4"?` #ifndef HAS_UNIFORM_u_${Q} ${Q} = a_${Q}; #else ${V} ${Y} ${Q} = u_${Q}; #endif `:` #if !defined(HAS_UNIFORM_u_${Q}) #ifdef ${ce} ${Q} = unpack_mix_${be}(${de}, u_${Q}_t); #else ${Q} = unpack_mix_${be}(a_${Q}, u_${Q}_t); #endif #else ${V} ${Y} ${Q} = u_${Q}; #endif `:z==="define-attribute"?` #ifdef HAS_ATTRIBUTE_a_${Q} in ${V} ${Y} a_${Q}; out ${V} ${Y} ${Q}; #endif `:z==="initialize-attribute"?` #ifdef HAS_ATTRIBUTE_a_${Q} ${Q} = a_${Q}; #endif `:void 0:z==="define"?` #ifndef HAS_UNIFORM_u_${Q} uniform lowp float u_${Q}_t; #if !defined(${ce}) in ${V} ${le} a_${Q}; #endif #else uniform ${V} ${Y} u_${Q}; #endif `:z==="define-instanced"?be==="mat4"?` #ifdef INSTANCED_ARRAYS in vec4 a_${Q}0; in vec4 a_${Q}1; in vec4 a_${Q}2; in vec4 a_${Q}3; #else uniform ${V} ${Y} u_${Q}; #endif `:` #ifdef INSTANCED_ARRAYS in ${V} ${le} a_${Q}; #else uniform ${V} ${Y} u_${Q}; #endif `:z==="initialize-attribute-custom"?` #ifdef HAS_ATTRIBUTE_a_${Q} ${V} ${Y} ${Q} = a_${Q}; #endif `:be==="vec4"?` #ifndef HAS_UNIFORM_u_${Q} #ifdef ${ce} ${V} ${Y} ${Q} = ${de}; #else ${V} ${Y} ${Q} = a_${Q}; #endif #else ${V} ${Y} ${Q} = u_${Q}; #endif `:` #ifndef HAS_UNIFORM_u_${Q} #ifdef ${ce} ${V} ${Y} ${Q} = unpack_mix_${be}(${de}, u_${Q}_t); #else ${V} ${Y} ${Q} = unpack_mix_${be}(a_${Q}, u_${Q}_t); #endif #else ${V} ${Y} ${Q} = u_${Q}; #endif `}),usedDefines:L,vertexIncludes:b,fragmentIncludes:M}}class zie{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(d,p,b,M,L,O,z,V){this.context=d;let Y=this.boundPaintVertexBuffers.length!==M.length;for(let ce=0;!Y&&ce{const gt=Ze.paint.get("hillshade-shadow-color"),ct=Ze.paint.get("hillshade-shadow-color-use-theme").constantOr("default")==="none",ht=Ze.paint.get("hillshade-highlight-color"),ot=Ze.paint.get("hillshade-highlight-color-use-theme").constantOr("default")==="none",st=Ze.paint.get("hillshade-accent-color"),vt=Ze.paint.get("hillshade-accent-color-use-theme").constantOr("default")==="none",Pt=Ze.paint.get("hillshade-emissive-strength");let Tt=a.an(Ze.paint.get("hillshade-illumination-direction"));if(Ze.paint.get("hillshade-illumination-anchor")==="viewport")Tt-=Ee.transform.angle;else if(Ee.style&&Ee.style.enable3dLights()&&Ee.style.directionalLight){const Vt=Ee.style.directionalLight.properties.get("direction"),nr=a.d4(Vt.x,Vt.y,Vt.z);Tt=a.an(nr[1])}const qt=!Ee.options.moving;return{u_matrix:Ve||Ee.transform.calculateProjMatrix(qe.tileID.toUnwrapped(),qt),u_image:0,u_latrange:Bie(0,qe.tileID),u_light:[Ze.paint.get("hillshade-exaggeration"),Tt],u_shadow:gt.toPremultipliedRenderColor(ct?null:Ze.lut),u_highlight:ht.toPremultipliedRenderColor(ot?null:Ze.lut),u_emissive_strength:Pt,u_accent:st.toPremultipliedRenderColor(vt?null:Ze.lut)}})(_,p,b,_.terrain?d.projMatrix:null);_.uploadCommonUniforms(z,le,d.toUnwrapped());const{tileBoundsBuffer:be,tileBoundsIndexBuffer:ye,tileBoundsSegments:Oe}=_.getTileBoundsBuffers(p);le.draw(_,V.TRIANGLES,M,L,O,Rn.disabled,de,b.id,be,ye,Oe)}function w3(_,d,p){if(!d.needsDEMTextureUpload)return;const b=_.context,M=b.gl;b.pixelStoreUnpackPremultiplyAlpha.set(!1),d.demTexture=d.demTexture||_.getTileTexture(p.stride);const L=p.getPixels();d.demTexture?d.demTexture.update(L,{premultiply:!1}):d.demTexture=new a.T(b,L,M.R32F,{premultiply:!1}),d.needsDEMTextureUpload=!1}function Uie(_,d,p){const b=_.context,M=b.gl;if(!d.dem)return;const L=d.dem;if(b.activeTexture.set(M.TEXTURE1),w3(_,d,L),!d.demTexture)return;d.demTexture.bind(M.NEAREST,M.CLAMP_TO_EDGE);const O=L.dim;b.activeTexture.set(M.TEXTURE0);let z=d.hillshadeFBO;if(!z){const le=new a.T(b,{width:O,height:O,data:null},M.RGBA8);le.bind(M.LINEAR,M.CLAMP_TO_EDGE),z=d.hillshadeFBO=b.createFramebuffer(O,O,1,"renderbuffer"),z.colorAttachment0.set(le.texture)}b.bindFramebuffer.set(z.framebuffer),b.viewport.set([0,0,O,O]);const{tileBoundsBuffer:V,tileBoundsIndexBuffer:Y,tileBoundsSegments:Q}=_.getMercatorTileBoundsBuffers(),ce=[];_.linearFloatFilteringSupported()&&ce.push("TERRAIN_DEM_FLOAT_FORMAT"),_.terrain&&_.terrain.renderingToTexture&&_.emissiveMode==="mrt-fallback"&&ce.push("USE_MRT1"),_.getOrCreateProgram("hillshadePrepare",{defines:ce}).draw(_,M.TRIANGLES,cn.disabled,Fn.disabled,Jn.unblended,Rn.disabled,((le,de)=>{const be=de.stride,ye=a.bC();return a.ce(ye,0,a.al,-a.al,0,0,1),a.br(ye,ye,[0,-a.al,0]),{u_matrix:ye,u_image:1,u_dimension:[be,be],u_zoom:le.overscaledZ}})(d.tileID,L),p.id,V,Y,Q),d.needsHillshadePrepare=!1}class xa{constructor(d){this.gl=d.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(d){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class qie extends xa{getDefault(){return a.ao.transparent.toNonPremultipliedRenderColor(null)}set(d){const p=this.current;(d.r!==p.r||d.g!==p.g||d.b!==p.b||d.a!==p.a||this.dirty)&&(this.gl.clearColor(d.r,d.g,d.b,d.a),this.current=d,this.dirty=!1)}}class DI extends xa{getDefault(){return 1}set(d){(d!==this.current||this.dirty)&&(this.gl.clearDepth(d),this.current=d,this.dirty=!1)}}class j3 extends xa{getDefault(){return 0}set(d){(d!==this.current||this.dirty)&&(this.gl.clearStencil(d),this.current=d,this.dirty=!1)}}class dk extends xa{getDefault(){return[!0,!0,!0,!0]}set(d){const p=this.current;(d[0]!==p[0]||d[1]!==p[1]||d[2]!==p[2]||d[3]!==p[3]||this.dirty)&&(this.gl.colorMask(d[0],d[1],d[2],d[3]),this.current=d,this.dirty=!1)}}class k3 extends xa{getDefault(){return!0}set(d){(d!==this.current||this.dirty)&&(this.gl.depthMask(d),this.current=d,this.dirty=!1)}}class zg extends xa{getDefault(){return 255}set(d){(d!==this.current||this.dirty)&&(this.gl.stencilMask(d),this.current=d,this.dirty=!1)}}class ux extends xa{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(d){const p=this.current;(d.func!==p.func||d.ref!==p.ref||d.mask!==p.mask||this.dirty)&&(this.gl.stencilFunc(d.func,d.ref,d.mask),this.current=d,this.dirty=!1)}}class J1 extends xa{getDefault(){const d=this.gl;return[d.KEEP,d.KEEP,d.KEEP]}set(d){const p=this.current;(d[0]!==p[0]||d[1]!==p[1]||d[2]!==p[2]||this.dirty)&&(this.gl.stencilOp(d[0],d[1],d[2]),this.current=d,this.dirty=!1)}}class hx extends xa{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const p=this.gl;d?p.enable(p.STENCIL_TEST):p.disable(p.STENCIL_TEST),this.current=d,this.dirty=!1}}class RI extends xa{getDefault(){return[0,1]}set(d){const p=this.current;(d[0]!==p[0]||d[1]!==p[1]||this.dirty)&&(this.gl.depthRange(d[0],d[1]),this.current=d,this.dirty=!1)}}class N3 extends xa{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const p=this.gl;d?p.enable(p.DEPTH_TEST):p.disable(p.DEPTH_TEST),this.current=d,this.dirty=!1}}class FI extends xa{getDefault(){return this.gl.LESS}set(d){(d!==this.current||this.dirty)&&(this.gl.depthFunc(d),this.current=d,this.dirty=!1)}}class fx extends xa{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const p=this.gl;d?p.enable(p.BLEND):p.disable(p.BLEND),this.current=d,this.dirty=!1}}class uk extends xa{getDefault(){const d=this.gl;return[d.ONE,d.ZERO,d.ONE,d.ZERO]}set(d){const p=this.current;(d[0]!==p[0]||d[1]!==p[1]||d[2]!==p[2]||d[3]!==p[3]||this.dirty)&&(this.gl.blendFuncSeparate(d[0],d[1],d[2],d[3]),this.current=d,this.dirty=!1)}}class hk extends xa{getDefault(){return a.ao.transparent.toNonPremultipliedRenderColor(null)}set(d){const p=this.current;(d.r!==p.r||d.g!==p.g||d.b!==p.b||d.a!==p.a||this.dirty)&&(this.gl.blendColor(d.r,d.g,d.b,d.a),this.current=d,this.dirty=!1)}}class S3 extends xa{getDefault(){return this.gl.FUNC_ADD}set(d){(d!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(d,d),this.current=d,this.dirty=!1)}}class fk extends xa{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const p=this.gl;d?p.enable(p.CULL_FACE):p.disable(p.CULL_FACE),this.current=d,this.dirty=!1}}class ev extends xa{getDefault(){return this.gl.BACK}set(d){(d!==this.current||this.dirty)&&(this.gl.cullFace(d),this.current=d,this.dirty=!1)}}class zI extends xa{getDefault(){return this.gl.CCW}set(d){(d!==this.current||this.dirty)&&(this.gl.frontFace(d),this.current=d,this.dirty=!1)}}let BI=class extends xa{getDefault(){return null}set(_){(_!==this.current||this.dirty)&&(this.gl.useProgram(_),this.current=_,this.dirty=!1)}};class $I extends xa{getDefault(){return this.gl.TEXTURE0}set(d){(d!==this.current||this.dirty)&&(this.gl.activeTexture(d),this.current=d,this.dirty=!1)}}class px extends xa{getDefault(){const d=this.gl;return[0,0,d.drawingBufferWidth,d.drawingBufferHeight]}set(d){const p=this.current;(d[0]!==p[0]||d[1]!==p[1]||d[2]!==p[2]||d[3]!==p[3]||this.dirty)&&(this.gl.viewport(d[0],d[1],d[2],d[3]),this.current=d,this.dirty=!1)}}class UI extends xa{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const p=this.gl;p.bindFramebuffer(p.FRAMEBUFFER,d),this.current=d,this.dirty=!1}}class Vie extends xa{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const p=this.gl;p.bindRenderbuffer(p.RENDERBUFFER,d),this.current=d,this.dirty=!1}}class Hie extends xa{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const p=this.gl;p.bindTexture(p.TEXTURE_2D,d),this.current=d,this.dirty=!1}}class Wie extends xa{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const p=this.gl;p.bindBuffer(p.ARRAY_BUFFER,d),this.current=d,this.dirty=!1}}class C3 extends xa{getDefault(){return null}set(d){const p=this.gl;p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,d),this.current=d,this.dirty=!1}}class M3 extends xa{getDefault(){return null}set(d){this.gl&&(d!==this.current||this.dirty)&&(this.gl.bindVertexArray(d),this.current=d,this.dirty=!1)}}class T3 extends xa{getDefault(){return 4}set(d){if(d===this.current&&!this.dirty)return;const p=this.gl;p.pixelStorei(p.UNPACK_ALIGNMENT,d),this.current=d,this.dirty=!1}}class A3 extends xa{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const p=this.gl;p.pixelStorei(p.UNPACK_PREMULTIPLY_ALPHA_WEBGL,d),this.current=d,this.dirty=!1}}class qI extends xa{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const p=this.gl;p.pixelStorei(p.UNPACK_FLIP_Y_WEBGL,d),this.current=d,this.dirty=!1}}class pk extends xa{constructor(d,p){super(d),this.context=d,this.parent=p}getDefault(){return null}}class mk extends pk{constructor(d,p,b=0){super(d,p),this.attachmentPoint=d.gl.COLOR_ATTACHMENT0+b}setDirty(){this.dirty=!0}set(d){if(d===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const p=this.gl;p.framebufferTexture2D(p.FRAMEBUFFER,this.attachmentPoint,p.TEXTURE_2D,d,0),this.current=d,this.dirty=!1}}class mx extends pk{attachment(){return this.gl.DEPTH_ATTACHMENT}set(d){if(d===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const p=this.gl;p.framebufferRenderbuffer(p.FRAMEBUFFER,this.attachment(),p.RENDERBUFFER,d),this.current=d,this.dirty=!1}}class tv extends pk{attachment(){return this.gl.DEPTH_ATTACHMENT}set(d){if(d===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const p=this.gl;p.framebufferTexture2D(p.FRAMEBUFFER,this.attachment(),p.TEXTURE_2D,d,0),this.current=d,this.dirty=!1}}class VI extends mx{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}const nu=(_,d,p,b)=>({u_matrix:_,u_image0:0,u_image1:1,u_skirt_height:d,u_ground_shadow_factor:p,u_emissive_texture_available:b}),gk=(_,d,p,b,M,L,O,z,V,Y,Q,ce,le,de,be,ye,Oe)=>({u_proj_matrix:Float32Array.from(_),u_globe_matrix:d,u_normalize_matrix:Float32Array.from(b),u_merc_matrix:p,u_zoom_transition:M,u_merc_center:L,u_image0:0,u_image1:1,u_frustum_tl:O,u_frustum_tr:z,u_frustum_br:V,u_frustum_bl:Y,u_globe_pos:Q,u_globe_radius:ce,u_viewport:le,u_grid_matrix:Oe?Float32Array.from(Oe):new Float32Array(9),u_skirt_height:de,u_far_z_cutoff:be,u_emissive_texture_available:ye});function rv(_,d){return _!=null&&d!=null&&!(!_.hasData()||!d.hasData())&&_.demTexture!=null&&d.demTexture!=null&&_.tileID.key!==d.tileID.key}const cp=new class{constructor(){this.operations={}}newMorphing(_,d,p,b,M){if(_ in this.operations){const L=this.operations[_];L.to.tileID.key!==p.tileID.key&&(L.queued=p)}else this.operations[_]={startTime:b,phase:0,duration:M,from:d,to:p,queued:null}}getMorphValuesForProxy(_){if(!(_ in this.operations))return null;const d=this.operations[_];return{from:d.from,to:d.to,phase:d.phase}}update(_){for(const d in this.operations){const p=this.operations[d];for(p.phase=(_-p.startTime)/p.duration;p.phase>=1||!this._validOp(p);)if(!this._nextOp(p,_)){delete this.operations[d];break}}}_nextOp(_,d){return!!_.queued&&(_.from=_.to,_.to=_.queued,_.queued=null,_.phase=0,_.startTime=d,!0)}_validOp(_){return _.from.hasData()&&_.to.hasData()}},yk={0:null,1:"TERRAIN_VERTEX_MORPHING"};function xk(_,d,p){if(d===0)return 0;const b=d<1&&p===514?.25/d:1;return 6*Math.pow(1.5,22-_)*Math.max(d,1)*b}function E3(_,d){const p=1<<_.z;return!d&&(_.x===0||_.x===p-1)||_.y===0||_.y===p-1}function gx(_,d){if(!_.style||!_.style.enable3dLights())return;const p=_.context,b=p.gl;p.activeTexture.set(b.TEXTURE1),d?d.bind(b.LINEAR,b.CLAMP_TO_EDGE):_.emptyTexture.bind(b.LINEAR,b.CLAMP_TO_EDGE)}const nv=_=>({u_matrix:_});function sv(_,d,p,b,M){if(M>0){const L=a.o.now(),O=(L-_.timeAdded)/M,z=d?(L-d.timeAdded)/M:-1,V=p.getSource(),Y=b.coveringZoomLevel({tileSize:V.tileSize,roundZoom:V.roundZoom}),Q=!d||Math.abs(d.tileID.overscaledZ-Y)>Math.abs(_.tileID.overscaledZ-Y),ce=Q&&_.refreshedUponExpiration?1:a.aA(Q?O:1-z,0,1);return d?{opacity:1,mix:1-ce,isFading:O<1}:{opacity:ce,mix:0,isFading:O<1}}return{opacity:1,mix:0,isFading:!1}}class vk extends qc{constructor(d){const p=Do("mock-dem",{type:"raster-dem",maxzoom:d.transform.maxZoom},d.style.dispatcher,d.style);super("mock-dem",p,!1),p.setEventedParent(this),this._sourceLoaded=!0}_loadTile(d,p){d.state="loaded",p(null)}}class I3 extends qc{constructor(d){const p=Do("proxy",{type:"geojson",maxzoom:d.transform.maxZoom},d.style.dispatcher,d.style);super("proxy",p,!1),p.setEventedParent(this),this.map=this.getSource().map=d,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(d,p,b){if(d.freezeTileCoverage)return;this.transform=d;const M=d.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((L,O)=>{if(L[O.key]="",!this._tiles[O.key]){const z=new np(O,this._source.tileSize*O.overscaleFactor(),d.tileZoom,void 0,void 0,this._source.worldview);z.state="loaded",this._tiles[O.key]=z}return L},{});for(const L in this._tiles)L in M||(this.freeFBO(L),this._tiles[L].unloadVectorData(),delete this._tiles[L])}freeFBO(d){const p=this.proxyCachedFBO[d];if(p!==void 0){const b=Object.values(p);this.renderCachePool.push(...b),delete this.proxyCachedFBO[d]}}deallocRenderCache(){this.renderCache.forEach(d=>d.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class P3 extends a.aQ{constructor(d,p,b){super(d.overscaledZ,d.wrap,d.canonical.z,d.canonical.x,d.canonical.y),this.proxyTileKey=p,this.projMatrix=b}}class L3 extends a.bV{constructor(d,p){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},this.painter=d,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[b,M,L]=function(V){const Y=new a.bd,Q=new a.b0,ce=131;Y.reserve(17161),Q.reserve(33800);const le=a.al/128,de=a.al+le/2,be=de+le;for(let Oe=-le;Oede||Oe<0||Oe>de?24575:0,Ze=a.aA(Math.round(Ee),0,a.al),Ve=a.aA(Math.round(Oe),0,a.al);Y.emplaceBack(Ze+qe,Ve)}const ye=(Oe,Ee)=>{const qe=Ee*ce+Oe;Q.emplaceBack(qe+1,qe,qe+ce),Q.emplaceBack(qe+ce,qe+ce+1,qe+1)};for(let Oe=1;Oe<129;Oe++)for(let Ee=1;Ee<129;Ee++)ye(Ee,Oe);return[0,129].forEach(Oe=>{for(let Ee=0;Ee<130;Ee++)ye(Ee,Oe),ye(Oe,Ee)}),[Y,Q,32768]}(),O=d.context;this.gridBuffer=O.createVertexBuffer(b,a.bf.members),this.gridIndexBuffer=O.createIndexBuffer(M),this.gridSegments=a.bg.simpleSegment(0,0,b.length,M.length),this.gridNoSkirtSegments=a.bg.simpleSegment(0,0,b.length,L),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new I3(p.map),this.orthoMatrix=a.bC(),a.ce(this.orthoMatrix,this.painter.transform.projection.name==="globe"?.015:0,a.al,0,a.al,0,1);const z=O.gl;this._overlapStencilMode=new Fn({func:z.GEQUAL,mask:255},0,255,z.KEEP,z.KEEP,z.REPLACE),this._previousZoom=d.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=p,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new vk(p.map),this._pendingGroundEffectLayers=[],this._emissiveTexture=!1}set style(d){d.on("data",this._onStyleDataEvent.bind(this)),this._style=d,this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(d,p,b){if(d&&d.terrain){this._style!==d&&(this.style=d,this._evaluationZoom=void 0);const M=d.terrain.properties,L=d.terrain.drapeRenderMode===0,O=d.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=a.o.now();const z=d.terrain&&d.terrain.scope,V=M.get("source"),Y=L?this._mockSourceCache:d.getSourceCache(V,z);if(!Y)return void a.w(`Couldn't find terrain source "${V}".`);if(this.sourceCache=Y,this._attenuationRange=d.terrain.getAttenuationRange(),this._exaggeration=O?this.calculateExaggeration(p):M.get("exaggeration"),!p.projection.requiresDraping&&O&&this._exaggeration===0)return void this._disable();this.enabled=!0;const Q=()=>{this.sourceCache.used&&a.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source. This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const ce=this.getScaledDemTileSize();this.sourceCache.update(p,ce,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,Q(),this._initializing=!0),Q(),p.updateElevation(!0,b),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(p),this._emptyDEMTextureDirty=!0,this._previousZoom=p.zoom}else this._disable()}calculateExaggeration(d){if(this._attenuationRange&&d.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(d.zoom);const p=this._previousCameraAltitude,b=d.getFreeCameraOptions().position.z/d.pixelsPerMeter*d.worldSize;this._previousCameraAltitude=b;const M=p!=null?b-p:Number.MAX_VALUE;if(Math.abs(M)<2)return this._exaggeration;const L=d.zoom,O=this._style.terrain;if(!this._previousUpdateTimestamp)return O.getExaggeration(L);let z=L-this._previousZoom;const V=this._previousUpdateTimestamp;let Y=L;this._evaluationZoom!=null&&(Y=this._evaluationZoom,Math.abs(L-Y)>.5&&(z=.5*(L-Y+z)),z*M<0&&(Y+=z)),this._evaluationZoom=Y;const Q=O.getExaggeration(Y),ce=Q===O.getExaggeration(Math.max(0,Y-.1));if(ce&&Math.abs(Q-this._exaggeration)<.01)return Q;let le=Math.min(.1,.00375*(this._updateTimestamp-V));return(ce||Q<.1||Math.abs(z)<1e-4)&&(le=Math.min(.2,4*le)),a.ak(this._exaggeration,Q,le)}resetTileLookupCache(d){this._findCoveringTileCache[d]={}}attenuationRange(){return this._attenuationRange}getDemUpscale(){return this.proxySourceCache.getSource().tileSize/128}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(d){d.dataType==="source"&&d.coord?this._clearRenderCacheForTile(d.sourceCacheId,d.coord):d.dataType==="style"&&(this.invalidateRenderCache=!0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this._previousCameraAltitude=void 0)}_disable(){if(this.enabled&&(this.enabled=!1,this._emptyDEMTextureDirty=!0,this._sharedDepthStencil=void 0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const d in this._style._mergedSourceCaches)this._style._mergedSourceCaches[d].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach(d=>d.fb.destroy()),this.pool=[],this.framebufferCopyTexture&&this.framebufferCopyTexture.destroy()}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this.enabled?this._exaggeration:0}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const d=2*this.proxySourceCache.getSource().tileSize;return[d,d]}set useVertexMorphing(d){this._useVertexMorphing=d}updateTileBinding(d){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const p=this.proxySourceCache,b=this.painter.transform;this._initializing&&(this._initializing=b._centerAltitude===0&&this.getAtPointOrZero(a.ae.fromLngLat(b.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const M=this.proxyCoords=p.getIds().map(V=>{const Y=p.getTileByID(V).tileID;return Y.projMatrix=b.calculateProjMatrix(Y.toUnwrapped()),Y});(function(V,Y){const Q=Y.transform.pointCoordinate(Y.transform.getCameraPoint()),ce=new a.P(Q.x,Q.y);V.sort((le,de)=>{if(de.overscaledZ-le.overscaledZ)return de.overscaledZ-le.overscaledZ;const be=new a.P(le.canonical.x+(1<{this.proxyToSource[V.key]={}}),this.terrainTileForTile={};const O=this._style._mergedSourceCaches;for(const V in O){const Y=O[V];if(!Y.used||(Y!==this.sourceCache&&this.resetTileLookupCache(Y.id),this._setupProxiedCoordsForOrtho(Y,d[V],L),Y.usedForTerrain))continue;const Q=d[V];Y.getSource().reparseOverscaled&&this._assignTerrainTiles(Q)}this.proxiedCoords[p.id]=M.map(V=>new P3(V,V.key,this.orthoMatrix)),this._assignTerrainTiles(M),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(L),this.renderingToTexture=!1;const z={};this._visibleDemTiles=[];for(const V of this.proxyCoords){const Y=this.terrainTileForTile[V.key];if(!Y)continue;const Q=Y.tileID.key;Q in z||(this._visibleDemTiles.push(Y),z[Q]=Q)}}_assignTerrainTiles(d){this._initializing||d.forEach(p=>{if(this.terrainTileForTile[p.key])return;const b=this._findTileCoveringTileID(p,this.sourceCache);b&&(this.terrainTileForTile[p.key]=b)})}_prepareDEMTextures(){const d=this.painter.context,p=d.gl;for(const b in this.terrainTileForTile){const M=this.terrainTileForTile[b],L=M.dem;!L||M.demTexture&&!M.needsDEMTextureUpload||(d.activeTexture.set(p.TEXTURE1),w3(this.painter,M,L))}}_prepareDemTileUniforms(d,p,b,M){if(!p||p.demTexture==null)return!1;const L=d.tileID.canonical,O=Math.pow(2,p.tileID.canonical.z-L.z),z=M||"";return b[`u_dem_tl${z}`]=[L.x*O%1,L.y*O%1],b[`u_dem_scale${z}`]=O,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let d=0;const p=this._visibleDemTiles.reduce((b,M)=>{if(!M.dem)return b;const L=M.dem.tree.minimums[0];return L>0&&d++,b+L},0);return d?p/d:0}_updateEmptyDEMTexture(){const d=this.painter.context,p=d.gl;d.activeTexture.set(p.TEXTURE2);const b=this._getLoadedAreaMinimum(),M=new a.dL({width:1,height:1},new Float32Array([b]));this._emptyDEMTextureDirty=!1;let L=this._emptyDEMTexture;return L?L.update(M,{premultiply:!1}):L=this._emptyDEMTexture=new a.T(d,M,p.R32F,{premultiply:!1}),L}setupElevationDraw(d,p,b){const M=this.painter.context,L=M.gl,O={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0};O.u_exaggeration=this.exaggeration();let z=null,V=null,Y=1;if(b&&b.morphing&&this._useVertexMorphing){const de=b.morphing.srcDemTile,be=b.morphing.dstDemTile;Y=b.morphing.phase,de&&be&&(this._prepareDemTileUniforms(d,de,O,"_prev")&&(V=de),this._prepareDemTileUniforms(d,be,O)&&(z=be))}const Q=de=>de&&de.demTexture&&this.painter.linearFloatFilteringSupported()?L.LINEAR:L.NEAREST;let ce=null;var le;if(this.enabled?V&&z?(ce=z.demTexture,M.activeTexture.set(L.TEXTURE4),V.demTexture.bind(Q(V),L.CLAMP_TO_EDGE),O.u_dem_lerp=Y):(z=this.terrainTileForTile[d.tileID.key],ce=this._prepareDemTileUniforms(d,z,O)?z.demTexture:this.emptyDEMTexture):ce=this.emptyDEMTexture,M.activeTexture.set(L.TEXTURE2),ce&&(O.u_dem_size=(le=ce).size[0]===1?1:le.size[0]-2,ce.bind(Q(z),L.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(b&&b.useDepthForOcclusion,p,O),b&&b.useMeterToDem&&z){const de=(1<{if(Ee===Vt)return;const nr=[yk[Vt],"PROJECTION_GLOBE_VIEW"];Ze&&nr.push("CUSTOM_ANTIALIASING");const vr=Y.isTileAffectedByFog(qt);Oe=Y.getOrCreateProgram("globeRaster",{defines:nr,overrideFog:vr}),Ee=Vt},gt=Y.colorModeForRenderPass(),ct=new cn(ye.LEQUAL,cn.ReadWrite,Y.depthRangeFor3D);cp.update(de);const ht=a.dF(qe),ot=[a.aF(qe.center.lng),a.aJ(qe.center.lat)],st=Y.globeSharedBuffers,vt=[qe.width*a.o.devicePixelRatio,qe.height*a.o.devicePixelRatio],Pt=Float32Array.from(qe.globeMatrix),Tt={useDenormalizedUpVectorScale:!0};{const qt=Y.transform,Vt=xk(qt.zoom,Q.exaggeration(),Q.sourceCache._source.tileSize);Ee=-1;const nr=ye.TRIANGLES;for(const vr of le){const Ft=ce.getTile(vr),St=Fn.disabled,Kt=Q.prevTerrainTileForTile[vr.key],Ut=Q.terrainTileForTile[vr.key];rv(Kt,Ut)&&cp.newMorphing(vr.key,Kt,Ut,de,250),gx(Y,Ft.emissiveTexture),be.activeTexture.set(ye.TEXTURE0),Ft.texture&&Ft.texture.bind(ye.LINEAR,ye.CLAMP_TO_EDGE);const ur=cp.getMorphValuesForProxy(vr.key),Ar=ur?1:0;ur&&Object.assign(Tt,{morphing:{srcDemTile:ur.from,dstDemTile:ur.to,phase:a.dD(ur.phase)}});const Ur=a.dG(vr.canonical),Nr=a.dH(Ur.getCenter().lat),_r=a.dI(vr.canonical,Ur,Nr,qt.worldSize/qt._pixelsPerMercatorPixel),nn=a.bk(a.dJ(vr.canonical)),Jr=Y.emissiveMode==="mrt-fallback"?1:0,Dr=gk(qt.expandedFarZProjMatrix,Pt,ht,nn,a.aj(qt.zoom),ot,qt.frustumCorners.TL,qt.frustumCorners.TR,qt.frustumCorners.BR,qt.frustumCorners.BL,qt.globeCenterInViewSpace,qt.globeRadius,vt,Vt,qt._farZ,Jr,_r);if(Ve(vr,Ar),Oe&&(Q.setupElevationDraw(Ft,Oe,Tt),Y.uploadCommonUniforms(be,Oe,vr.toUnwrapped()),st)){const[qr,wn,Hn]=st.getGridBuffers(Nr,Vt!==0);Oe.draw(Y,nr,ct,St,gt,Rn.backCCW,Dr,"globe_raster",qr,wn,Hn)}}}if(st&&(Y.renderDefaultNorthPole||Y.renderDefaultSouthPole)){const qt=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];Ze&&qt.push("CUSTOM_ANTIALIASING"),Oe=Y.getOrCreateProgram("globeRaster",{defines:qt});for(const Vt of le){const{x:nr,y:vr,z:Ft}=Vt.canonical,St=vr===0,Kt=vr===(1<qr.draw(Y,ye.TRIANGLES,ct,Fn.disabled,gt,Rn.disabled,gk(qe.expandedFarZProjMatrix,_r,_r,nn,0,ot,qe.frustumCorners.TL,qe.frustumCorners.TR,qe.frustumCorners.BR,qe.frustumCorners.BL,qe.globeCenterInViewSpace,qe.globeRadius,vt,0,qe._farZ,Jr),"globe_pole_raster",wn,Ar,Ur);Q.setupElevationDraw(Nr,Oe,Tt),Y.uploadCommonUniforms(be,Oe,Vt.toUnwrapped()),St&&Y.renderDefaultNorthPole&&Dr(Oe,Ut),Kt&&Y.renderDefaultSouthPole&&(_r=a.cS(a.bC(),_r,[1,-1,1]),Dr(Oe,ur))}}}})(M,L,O,z,V);else{const Y=M.context,Q=Y.gl;let ce,le;const de=M.shadowRenderer,be=bm(M,M.longestCutoffRange),ye=gt=>{if(le===gt)return;const ct=[];ct.push(yk[gt]),be.shouldRenderCutoff&&ct.push("RENDER_CUTOFF"),de&&(ct.push("RENDER_SHADOWS","DEPTH_TEXTURE"),de.useNormalOffset&&ct.push("NORMAL_OFFSET")),ce=M.getOrCreateProgram("terrainRaster",{defines:ct}),le=gt},Oe=M.colorModeForRenderPass(),Ee=new cn(Q.LEQUAL,cn.ReadWrite,M.depthRangeFor3D);cp.update(V);const qe=M.transform,Ze=xk(qe.zoom,L.exaggeration(),L.sourceCache._source.tileSize);let Ve=[0,0,0];if(de){const gt=M.style.directionalLight,ct=M.style.ambientLight;gt&&ct&&(Ve=lp(M.style,gt,ct))}{le=-1;const gt=Q.TRIANGLES,[ct,ht]=[L.gridIndexBuffer,L.gridSegments];for(const ot of z){const st=O.getTile(ot),vt=Fn.disabled,Pt=L.prevTerrainTileForTile[ot.key],Tt=L.terrainTileForTile[ot.key];rv(Pt,Tt)&&cp.newMorphing(ot.key,Pt,Tt,V,250),gx(M,st.emissiveTexture),Y.activeTexture.set(Q.TEXTURE0),st.texture&&st.texture.bind(Q.LINEAR,Q.CLAMP_TO_EDGE);const qt=cp.getMorphValuesForProxy(ot.key),Vt=qt?1:0;let nr;qt&&(nr={morphing:{srcDemTile:qt.from,dstDemTile:qt.to,phase:a.dD(qt.phase)}});const vr=M.emissiveMode==="mrt-fallback"?1:0,Ft=nu(ot.projMatrix,E3(ot.canonical,qe.renderWorldCopies)?Ze/10:Ze,Ve,vr);if(ye(Vt),!ce)continue;L.setupElevationDraw(st,ce,nr);const St=ot.toUnwrapped();de&&de.setupShadows(St,ce),M.uploadCommonUniforms(Y,ce,St,null,be),ce.draw(M,gt,Ee,vt,Oe,Rn.backCCW,Ft,"terrain_raster",L.gridBuffer,ct,ht)}}}}(p,this,this.proxySourceCache,d,this._updateTimestamp),this.renderingToTexture=!0,p.gpuTimingDeferredRenderEnd(),d.splice(0,d.length))}renderBatch(d){if(this._drapedRenderBatches.length===0)return d+1;this.renderingToTexture=!0;const p=this.painter,b=this.painter.context,M=this.proxySourceCache,L=this.proxiedCoords[M.id],O=this._drapedRenderBatches.shift(),z=p.style.order,V=[];this._updateFBOs(p.emissiveMode==="mrt-fallback");let Y=0;for(const Q of L){const ce=M.getTileByID(Q.proxyTileKey),le=M.proxyCachedFBO[Q.key]?M.proxyCachedFBO[Q.key][d]:void 0,de=le!==void 0?M.renderCache[le]:this.pool[Y++],be=le!==void 0;if(ce.texture=de.tex,ce.emissiveTexture=de.emissiveTex,be&&!de.dirty){V.push(ce.tileID);continue}b.bindFramebuffer.set(de.fb.framebuffer);const ye=b.gl;let Oe;ye.drawBuffers(p.emissiveMode==="mrt-fallback"?[ye.COLOR_ATTACHMENT0,ye.COLOR_ATTACHMENT1]:[ye.COLOR_ATTACHMENT0]),this.renderedToTile=!1,de.dirty&&(b.clear({color:a.ao.transparent,stencil:0}),de.dirty=!1);for(let Ee=O.start;Ee<=O.end;++Ee){const qe=p.style._mergedLayers[z[Ee]];if(qe.isHidden(p.transform.zoom))continue;const Ze=p.style.getLayerSourceCache(qe),Ve=Ze?this.proxyToSource[Q.key][Ze.id]:[Q];if(!Ve)continue;const gt=Ve;b.viewport.set([0,0,de.fb.width,de.fb.height]),Oe!==(Ze?Ze.id:null)&&(this._setupStencil(de,Ve,qe,Ze),Oe=Ze?Ze.id:null),p.renderLayer(p,Ze,qe,gt)}if(ye.drawBuffers([ye.COLOR_ATTACHMENT0]),this._drapedRenderBatches.length===0)for(const Ee of this._pendingGroundEffectLayers){const qe=p.style._mergedLayers[z[Ee]];if(qe.isHidden(p.transform.zoom))continue;const Ze=p.style.getLayerSourceCache(qe),Ve=Ze?this.proxyToSource[Q.key][Ze.id]:[Q];if(!Ve)continue;const gt=Ve;b.viewport.set([0,0,de.fb.width,de.fb.height]),Oe!==(Ze?Ze.id:null)&&(this._setupStencil(de,Ve,qe,Ze),Oe=Ze?Ze.id:null),p.renderLayer(p,Ze,qe,gt)}this.renderedToTile?(de.dirty=!0,V.push(ce.tileID)):be||--Y,Y===5&&(Y=0,this.renderToBackBuffer(V))}return this.renderToBackBuffer(V),this.renderingToTexture=!1,b.bindFramebuffer.set(null),b.viewport.set([0,0,p.width,p.height]),O.end+1}postRender(){}isLayerOrderingCorrect(d){const p=d.order.length;let b=-1,M=p;for(let L=0;Lb}getMinElevationBelowMSL(){let d=0;return this._visibleDemTiles.filter(p=>p.dem).forEach(p=>{d=Math.min(d,p.dem.tree.minimums[0])}),d===0?d:(d-30)*this._exaggeration}raycast(d,p,b){if(!this._visibleDemTiles)return null;const M=this._visibleDemTiles.filter(L=>L.dem).map(L=>{const O=L.tileID,z=1<(L.t!==null?L.t:Number.MAX_VALUE)-(O.t!==null?O.t:Number.MAX_VALUE));for(const L of M){if(L.t==null)return null;const O=L.tile.dem.tree.raycast(L.minx,L.miny,L.maxx,L.maxy,d,p,b);if(O!=null)return O}return null}_createFBO(){const d=this.painter.context,p=d.gl,b=this.drapeBufferSize;d.activeTexture.set(p.TEXTURE0);const M=new a.T(d,{width:b[0],height:b[1],data:null},p.RGBA8);M.bind(p.LINEAR,p.CLAMP_TO_EDGE);const L=d.createFramebuffer(b[0],b[1],1,null);let O;return L.colorAttachment0.set(M.texture),this._emissiveTexture&&(O=new a.T(d,{width:b[0],height:b[1],data:null},p.R8),O.bind(p.LINEAR,p.CLAMP_TO_EDGE),L.createColorAttachment(d,1),L.colorAttachment1.set(O.texture)),L.depthAttachment=new VI(d,L.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=d.createRenderbuffer(d.gl.DEPTH_STENCIL,b[0],b[1]),this._stencilRef=0,L.depthAttachment.set(this._sharedDepthStencil),d.clear({stencil:0})):L.depthAttachment.set(this._sharedDepthStencil),d.extTextureFilterAnisotropic&&p.texParameterf(p.TEXTURE_2D,d.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,d.extTextureFilterAnisotropicMax),{fb:L,tex:M,emissiveTex:O,dirty:!1}}_updateFBOs(d){if(this._emissiveTexture!==d){for(const p of this.pool)this._updateFBO(p,d);for(const p of this.proxySourceCache.renderCache)this._updateFBO(p,d);this._emissiveTexture=d}}_updateFBO(d,p){const b=d.fb,M=this.painter.context,L=M.gl,O=this.drapeBufferSize;if(p){const z=new a.T(M,{width:O[0],height:O[1],data:null},L.R8);z.bind(L.LINEAR,L.CLAMP_TO_EDGE),d.emissiveTex=z,b.createColorAttachment(M,1),b.colorAttachment1.set(z.texture)}else d.emissiveTex=void 0,b.removeColorAttachment(M,1);d.dirty=!0}_initFBOPool(){for(;this.pool.length{const p=this._style._mergedLayers[d],b=p.isHidden(this.painter.transform.zoom);return p.type==="hillshade"||p.type==="custom"?!b&&p.shouldRedrape():!b&&p.hasTransition()})}_clearLineLayersFromRenderCache(){let d=!1;for(const b of this._style.getSources())if(b instanceof ep){d=!0;break}if(!d)return;const p={};for(let b=0;bV>z.end)||a.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=b}_setupRenderCache(d){const p=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,p.renderCache.length>p.renderCachePool.length){const O=Object.values(p.proxyCachedFBO);p.proxyCachedFBO={};for(let z=0;z=0;O--){const z=b[O];if(p.getTileByID(z.key),p.proxyCachedFBO[z.key]!==void 0){const V=d[z.key],Y=this.proxyToSource[z.key];let Q=0;for(const ce in Y){const le=Y[ce],de=V[ce];if(!de||de.length!==le.length||le.some((be,ye)=>be!==de[ye]||M[ce]&&M[ce].hasOwnProperty(be.key))){Q=-1;break}++Q}for(const ce in p.proxyCachedFBO[z.key])p.renderCache[p.proxyCachedFBO[z.key][ce]].dirty=Q<0||Q!==Object.values(V).length}}const L=[...this._drapedRenderBatches];L.sort((O,z)=>z.end-z.start-(O.end-O.start));for(const O of L)for(const z of b){if(p.proxyCachedFBO[z.key])continue;let V=p.renderCachePool.pop();V===void 0&&p.renderCache.length<50&&(V=p.renderCache.length,p.renderCache.push(this._createFBO())),V!==void 0&&(p.proxyCachedFBO[z.key]={},p.proxyCachedFBO[z.key][O.start]=V,p.renderCache[V].dirty=!0)}this._tilesDirty={}}_setupStencil(d,p,b,M){if(!M||!this._sourceTilesOverlap[M.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const L=this.painter.context,O=L.gl;if(p.length<=1)return void(this._overlapStencilType=!1);let z;if(b.isTileClipped())z=p.length,this._overlapStencilMode.test={func:O.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(p[0].overscaledZ>p[p.length-1].overscaledZ))return void(this._overlapStencilType=!1);z=1,this._overlapStencilMode.test={func:O.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+z>255&&(L.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=z,this._overlapStencilMode.ref=this._stencilRef,b.isTileClipped()&&this._renderTileClippingMasks(p,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return this._overlapStencilType==="Clip"||this._overlapStencilType==="Mask"}stencilModeForRTTOverlap(d){return this.renderingToTexture&&this._overlapStencilType?(this._overlapStencilType==="Clip"&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[d.key]),this._overlapStencilMode):Fn.disabled}_renderTileClippingMasks(d,p){const b=this.painter,M=this.painter.context,L=M.gl;b._tileClippingMaskIDs={},M.setColorMode(Jn.disabled),M.setDepthMode(cn.disabled);const O=b.getOrCreateProgram("clippingMask");for(const z of d){const V=b._tileClippingMaskIDs[z.key]=--p;O.draw(b,L.TRIANGLES,cn.disabled,new Fn({func:L.ALWAYS,mask:0},V,255,L.KEEP,L.KEEP,L.REPLACE),Jn.disabled,Rn.disabled,nv(z.projMatrix),"$clipping",b.tileExtentBuffer,b.quadTriangleIndexBuffer,b.tileExtentSegments)}}pointCoordinate(d){const p=this.painter.transform;if(d.x<0||d.x>p.width||d.y<0||d.y>p.height)return null;const b=[d.x,d.y,1,1];a.aC(b,b,p.pixelMatrixInverse),a.cK(b,b,1/b[3]),b[0]/=p.worldSize,b[1]/=p.worldSize;const M=p._camera.position,L=a.cf(1,p.center.lat),O=[M[0],M[1],M[2]/L,0],z=a.da([],b.slice(0,3),O);a.aw(z,z);const V=this.raycast(O,z,this._exaggeration);return V!==null&&V?(a.bH(O,O,z,V),O[3]=O[2],O[2]*=L,O):null}_setupProxiedCoordsForOrtho(d,p,b){if(d.getSource()instanceof a.aU)return this._setupProxiedCoordsForImageSource(d,p,b);this._findCoveringTileCache[d.id]=this._findCoveringTileCache[d.id]||{};const M=this.proxiedCoords[d.id]=[],L=this.proxyCoords;for(let V=0;VQ.overscaledZ-Y.overscaledZ)}_setupProxiedCoordsForImageSource(d,p,b){if(!d.getSource().loaded())return;const M=this.proxiedCoords[d.id]=[],L=this.proxyCoords,O=d.getSource(),z=O.tileID;if(!z)return;const V=new a.P(z.x,z.y)._div(1<(ce.min.x=Math.min(ce.min.x,le.x-V.x),ce.min.y=Math.min(ce.min.y,le.y-V.y),ce.max.x=Math.max(ce.max.x,le.x-V.x),ce.max.y=Math.max(ce.max.y,le.y-V.y),ce),{min:new a.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new a.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),Q=(ce,le)=>{const de=ce.wrap+ce.canonical.x/(1<Oe+Y.max.x||be+yeEe+Y.max.y};for(let ce=0;ceO.key===p.tileID.key);if(L)return L}if(p.tileID.key!==d.key){const L=d.canonical.z-p.tileID.canonical.z;let O,z,V;M=a.bC();const Y=p.tileID.wrap-d.wrap<0?(O=a.al>>L,z=O*((p.tileID.canonical.x<=ce){const le=d.canonical.z-ce;p.getSource().reparseOverscaled?(z=Math.max(d.canonical.z+2,p.transform.tileZoom),O=new a.aQ(z,d.wrap,ce,d.canonical.x>>le,d.canonical.y>>le)):le!==0&&(z=ce,O=new a.aQ(z,d.wrap,ce,d.canonical.x>>le,d.canonical.y>>le))}O.key!==d.key&&(Y.push(O.key),b=p.getTile(O))}const Q=ce=>{Y.forEach(le=>{M[le]=ce}),Y.length=0};for(z-=1;z>=V&&(!b||!b.hasData());z--){b&&Q(b.tileID.key);const ce=O.calculateScaledKey(z);if(b=p.getTileByID(ce),b&&b.hasData())break;const le=M[ce];if(le===null)break;le===void 0?Y.push(ce):b=p.getTileByID(le)}return Q(b?b.tileID.key:null),b&&b.hasData()?b:null}findDEMTileFor(d){return this.enabled?this._findTileCoveringTileID(d,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(d,p){let b=this._tilesDirty[d];b||(b=this._tilesDirty[d]={}),b[p.key]=!0}}function yx(_,d,p){const b=function(z,V,Y){const Q=a.bJ(V,z),ce=a.bJ(Y,[.2126,.7152,.0722]),le=(be,ye,Oe)=>(1-Oe)*be+Oe*ye,de=le(1-.3*Math.min(ce,1),1,Math.min(Q+1,1));return le(.92,1,Math.asin(a.aA(V[2],-1,1))/Math.PI+.5)*de}(_,[0,0,1],d),M=[0,0,0];a.c5(M,p.slice(0,3),b);const L=[0,0,0];a.c5(L,d.slice(0,3),_[2]);const O=[0,0,0];return a.d8(O,M,L),a.db(O)}const Gie=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],Kie=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","building","buildingBloom","elevatedStructures","model","symbol"];class HI{static cacheKey(d,p,b,M){const L=[p];M&&L.push(M.cacheKey);for(const O of b)d.usedDefines.has(O)&&L.push(O);return L.join("/")}constructor(d,p,b,M,L,O){const z=d.gl;this.program=z.createProgram(),this.configuration=M,this.name=p,this.fixedDefines=[...O];const V=`#version 300 es ${(M?M.defines():[]).concat(O.map(ye=>`#define ${ye}`)).join(` `)}`,Y=[V,Fie];for(const ye of b.fragmentIncludes)Y.push(Nm[ye]);Y.push(b.fragmentSource);const Q=Y.join(` `),ce=[V,OI];for(const ye of b.vertexIncludes)ce.push(Nm[ye]);this.forceManualRenderingForInstanceIDShaders=d.forceManualRenderingForInstanceIDShaders&&b.vertexSource.includes("gl_InstanceID"),this.forceManualRenderingForInstanceIDShaders&&ce.push("uniform int u_instanceID;"),ce.push(b.vertexSource);let le=ce.join(` `);this.forceManualRenderingForInstanceIDShaders&&(le=le.replaceAll("gl_InstanceID","u_instanceID"));const de=z.createShader(z.FRAGMENT_SHADER);if(z.isContextLost())return void(this.failedToCreate=!0);z.shaderSource(de,Q),z.compileShader(de),z.attachShader(this.program,de);const be=z.createShader(z.VERTEX_SHADER);z.isContextLost()?this.failedToCreate=!0:(z.shaderSource(be,le),z.compileShader(be),z.attachShader(this.program,be),this.attributes={},z.linkProgram(this.program),z.deleteShader(be),z.deleteShader(de),this.fixedUniforms=L(d),this.fixedUniformsEntries=Object.entries(this.fixedUniforms),this.binderUniforms=M?M.getUniforms(d):[],this.forceManualRenderingForInstanceIDShaders&&(this.instancingUniforms=(ye=>({u_instanceID:new a.ch(ye)}))(d)),(O.includes("TERRAIN")||p.includes("symbol")||p.includes("circle"))&&(this.terrainUniforms=(ye=>({u_dem:new a.ch(ye),u_dem_prev:new a.ch(ye),u_dem_tl:new a.ck(ye),u_dem_scale:new a.cj(ye),u_dem_tl_prev:new a.ck(ye),u_dem_scale_prev:new a.cj(ye),u_dem_size:new a.cj(ye),u_dem_lerp:new a.cj(ye),u_exaggeration:new a.cj(ye),u_depth:new a.ch(ye),u_depth_size_inv:new a.ck(ye),u_depth_range_unpack:new a.ck(ye),u_occluder_half_size:new a.cj(ye),u_occlusion_depth_offset:new a.cj(ye),u_meter_to_dem:new a.cj(ye),u_label_plane_matrix_inv:new a.cl(ye)}))(d)),O.includes("GLOBE")&&(this.globeUniforms=(ye=>({u_tile_tl_up:new a.ci(ye),u_tile_tr_up:new a.ci(ye),u_tile_br_up:new a.ci(ye),u_tile_bl_up:new a.ci(ye),u_tile_up_scale:new a.cj(ye)}))(d)),O.includes("FOG")&&(this.fogUniforms=(ye=>({u_fog_matrix:new a.cl(ye),u_fog_range:new a.ck(ye),u_fog_color:new a.d3(ye),u_fog_horizon_blend:new a.cj(ye),u_fog_vertical_limit:new a.ck(ye),u_fog_temporal_offset:new a.cj(ye),u_frustum_tl:new a.ci(ye),u_frustum_tr:new a.ci(ye),u_frustum_br:new a.ci(ye),u_frustum_bl:new a.ci(ye),u_globe_pos:new a.ci(ye),u_globe_radius:new a.cj(ye),u_globe_transition:new a.cj(ye),u_is_globe:new a.ch(ye),u_viewport:new a.ck(ye)}))(d)),O.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(ye=>({u_cutoff_params:new a.d3(ye)}))(d)),O.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(ye=>({u_lighting_ambient_color:new a.ci(ye),u_lighting_directional_dir:new a.ci(ye),u_lighting_directional_color:new a.ci(ye),u_ground_radiance:new a.ci(ye)}))(d)),O.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(ye=>({u_light_matrix_0:new a.cl(ye),u_light_matrix_1:new a.cl(ye),u_fade_range:new a.ck(ye),u_shadow_normal_offset:new a.ci(ye),u_shadow_intensity:new a.cj(ye),u_shadow_texel_size:new a.cj(ye),u_shadow_map_resolution:new a.cj(ye),u_shadow_direction:new a.ci(ye),u_shadow_bias:new a.ci(ye),u_shadowmap_0:new a.ch(ye),u_shadowmap_1:new a.ch(ye)}))(d)))}getAttributeLocation(d,p){let b=this.attributes[p];return b===void 0&&(b=this.attributes[p]=d.getAttribLocation(this.program,p)),b}setTerrainUniformValues(d,p){if(!this.terrainUniforms)return;const b=this.terrainUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const M in p)b[M]&&b[M].set(this.program,M,p[M])}}setGlobeUniformValues(d,p){if(!this.globeUniforms)return;const b=this.globeUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const M in p)b[M]&&b[M].set(this.program,M,p[M])}}setFogUniformValues(d,p){if(!this.fogUniforms)return;const b=this.fogUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const M in p)b[M].set(this.program,M,p[M])}}setCutoffUniformValues(d,p){if(!this.cutoffUniforms)return;const b=this.cutoffUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const M in p)b[M].set(this.program,M,p[M])}}setLightsUniformValues(d,p){if(!this.lightsUniforms)return;const b=this.lightsUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const M in p)b[M].set(this.program,M,p[M])}}setShadowUniformValues(d,p){if(this.failedToCreate||!this.shadowUniforms)return;const b=this.shadowUniforms;d.program.set(this.program);for(const M in p)b[M].set(this.program,M,p[M])}_drawDebugWireframe(d,p,b,M,L,O,z,V,Y,Q){const ce=d.options.wireframe;if(ce.terrain===!1&&ce.layers2D===!1&&ce.layers3D===!1)return;const le=d.context;if(!(!(!ce.terrain||this.name!=="terrainRaster"&&this.name!=="globeRaster")||!(!ce.layers2D||d._terrain&&d._terrain.renderingToTexture||!Gie.includes(this.name))||!(!ce.layers3D||!Kie.includes(this.name))))return;const de=le.gl,be=d.wireframeDebugCache.getLinesFromTrianglesBuffer(d.frameCounter,L,le);if(!be)return;const ye=[...this.fixedDefines,"DEBUG_WIREFRAME"],Oe=d.getOrCreateProgram(this.name,{config:this.configuration,defines:ye});le.program.set(Oe.program);const Ee=(Ve,gt,ct)=>{if(gt[Ve]&&ct[Ve])for(const ht in gt[Ve])ct[Ve][ht]&&ct[Ve][ht].set(ct.program,ht,gt[Ve][ht].current)};Y&&Y.setUniforms(Oe.program,le,Oe.binderUniforms,z,{zoom:V}),Ee("fixedUniforms",this,Oe),Ee("terrainUniforms",this,Oe),Ee("globeUniforms",this,Oe),Ee("fogUniforms",this,Oe),Ee("lightsUniforms",this,Oe),Ee("shadowUniforms",this,Oe),be.bind(),le.setColorMode(new Jn([de.ONE,de.ONE_MINUS_SRC_ALPHA,de.ZERO,de.ONE],a.ao.transparent,[!0,!0,!0,!1])),le.setDepthMode(new cn(p.func===de.LESS?de.LEQUAL:p.func,cn.ReadOnly,p.range)),le.setStencilMode(Fn.disabled);const qe=3*O.primitiveLength*2,Ze=3*O.primitiveOffset*2*2;if(this.forceManualRenderingForInstanceIDShaders){const Ve=Q||1;for(let gt=0;gt1?de.drawElementsInstanced(de.LINES,qe,de.UNSIGNED_SHORT,Ze,Q):de.drawElements(de.LINES,qe,de.UNSIGNED_SHORT,Ze);L.bind(),le.program.set(this.program),le.setDepthMode(p),le.setStencilMode(b),le.setColorMode(M)}checkUniforms(d,p,b){if(this.fixedDefines.includes(p)){for(const M of Object.keys(b))if(!b[M].initialized)throw new Error(`Program '${this.name}', from draw '${d}': uniform ${M} not set but required by ${p} being defined`)}}draw(d,p,b,M,L,O,z,V,Y,Q,ce,le,de,be,ye,Oe){const Ee=d.context,qe=Ee.gl;if(this.failedToCreate)return;Ee.program.set(this.program),Ee.setDepthMode(b),Ee.setStencilMode(M),Ee.setColorMode(L),Ee.setCullFace(O);for(const[ot,st]of this.fixedUniformsEntries)st.set(this.program,ot,z[ot]);be&&be.setUniforms(this.program,Ee,this.binderUniforms,le,{zoom:de});const Ze={[qe.POINTS]:1,[qe.LINES]:2,[qe.TRIANGLES]:3,[qe.LINE_STRIP]:1}[p];this.checkUniforms(V,"RENDER_SHADOWS",this.shadowUniforms);const Ve=ye||[],gt=be?be.getPaintVertexBuffers():[],ct=p===qe.TRIANGLES&&Q,ht=Oe&&Oe>0?1:void 0;for(const ot of ce.get()){const st=ot.vaos||(ot.vaos={});if((st[V]||(st[V]=new zie)).bind(Ee,this,Y,gt,Q,ot.vertexOffset,Ve,ht),this.forceManualRenderingForInstanceIDShaders){const vt=Oe||1;for(let Pt=0;Pt1?qe.drawElementsInstanced(p,ot.primitiveLength*Ze,qe.UNSIGNED_SHORT,ot.primitiveOffset*Ze*2,Oe):Q?qe.drawElements(p,ot.primitiveLength*Ze,qe.UNSIGNED_SHORT,ot.primitiveOffset*Ze*2):qe.drawArrays(p,ot.vertexOffset,ot.vertexLength);ct&&this._drawDebugWireframe(d,b,M,L,Q,ot,le,de,be,Oe)}}}function WI(_,d,p=0){const b=Math.pow(2,d.tileID.overscaledZ),M=d.tileSize*Math.pow(2,_.transform.tileZoom)/b,L=M*(d.tileID.canonical.x+d.tileID.wrap*b),O=M*d.tileID.canonical.y;return{u_image:0,u_texsize:d.imageAtlasTexture?d.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/a.ay(d,1,_.transform.tileZoom),u_pixel_coord_upper:[L>>16,O>>16],u_pixel_coord_lower:[65535&L,65535&O],u_pattern_transition:p}}const _k={terrain:0,flat:1},Zie=a.bC(),bk=(_,d,p,b,M,L,O,z,V,Y,Q,ce,le,de,be,ye,Oe,Ee)=>{const qe=d.style.light,Ze=qe.properties.get("position"),Ve=[Ze.x,Ze.y,Ze.z],gt=a.dO();qe.properties.get("anchor")==="viewport"&&(a.dP(gt,-d.transform.angle),a.dQ(Ve,Ve,gt));const ct=qe.properties.get("color").toPremultipliedRenderColor(null),ht=d.transform,ot={u_matrix:_,u_lightpos:Ve,u_lightintensity:qe.properties.get("intensity"),u_lightcolor:[ct.r,ct.g,ct.b],u_vertical_gradient:+p,u_opacity:b,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Zie,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:_k[Y],u_base_type:_k[Q],u_ao:M,u_edge_radius:L,u_width_scale:O,u_flood_light_color:be,u_vertical_scale:ye,u_flood_light_intensity:Oe,u_ground_shadow_factor:Ee};return ht.projection.name==="globe"&&(ot.u_tile_id=[z.canonical.x,z.canonical.y,1<({u_matrix:_,u_edge_radius:d,u_width_scale:p,u_vertical_scale:b,u_height_type:_k[M],u_base_type:_k[L]}),GI=(_,d,p,b,M,L,O,z,V,Y,Q,ce,le,de,be,ye,Oe,Ee)=>{const qe=bk(_,d,p,b,M,L,O,z,Y,Q,ce,le,de,be,ye,Oe,1,[0,0,0]),Ze={u_height_factor:-Math.pow(2,z.overscaledZ)/V.tileSize/8};return Object.assign(qe,WI(d,V,Ee),Ze)},xx=(_,d,p,b,M,L,O,z,V,Y,Q)=>({u_matrix:d,u_opacity:p,u_ao_pass:b?1:0,u_meter_to_tile:M,u_ao:L,u_flood_light_intensity:O,u_flood_light_color:z,u_attenuation:V,u_edge_radius:Y,u_fb:0,u_fb_size:Q,u_dynamic_offset:1}),D3=(_,d,p)=>({u_matrix:_,u_emissive_strength:d,u_ground_shadow_factor:p}),R3=(_,d,p,b,M,L=0)=>Object.assign(D3(_,d,M),WI(p,b,L)),KI=(_,d,p,b)=>({u_matrix:_,u_world:p,u_emissive_strength:d,u_ground_shadow_factor:b}),F3=(_,d,p,b,M,L,O=0)=>Object.assign(R3(_,d,p,b,L,O),{u_world:M}),Cm=(_,d)=>({u_matrix:_,u_ground_shadow_factor:d}),Bg=(_,d,p,b,M)=>({u_matrix:_,u_camera_pos:[d[0],d[1],d[2]],u_depth_bias:p,u_height_scale:b,u_reset_depth:M}),wk=(_,d,p,b,M,L,O,z,V)=>({u_matrix:_,u_normal_matrix:d,u_opacity:p,u_faux_facade_ao_intensity:b,u_camera_pos:M,u_tile_to_meter:L,u_facade_emissive_chance:O,u_flood_light_color:z,u_flood_light_intensity:V}),ZI=_=>({u_matrix:_}),Mm=_=>({u_matrix:_}),z3=(_,d,p,b,M,L,O,z)=>{const V=a.al/L.tileSize;return{u_matrix:_,u_inv_rot_matrix:d,u_camera_to_center_distance:p.getCameraToCenterDistance(z),u_extrude_scale:[p.pixelsToGLUnits[0]/V,p.pixelsToGLUnits[1]/V],u_zoom_transition:b,u_tile_id:O,u_merc_center:M}},iv=(_,d,p=1)=>({u_matrix:_,u_color:d,u_overlay:0,u_overlay_scale:p}),YI=a.bC(),XI=(_,d,p,b,M,L,O)=>{const z=_.transform,V=z.projection.name==="globe",Y=V?a.dR(z.zoom,d.canonical)*z._pixelsPerMercatorPixel:a.ay(p,1,L),Q={u_matrix:d.projMatrix,u_extrude_scale:Y,u_intensity:O,u_inv_rot_matrix:YI,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(V){Q.u_inv_rot_matrix=b,Q.u_merc_center=M,Q.u_tile_id=[d.canonical.x,d.canonical.y,1<({u_matrix:_,u_normalize_matrix:d,u_globe_matrix:p,u_merc_matrix:b,u_grid_matrix:M,u_tl_parent:L,u_scale_parent:Y,u_fade_t:Q.mix,u_opacity:Q.opacity*ce.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:ce.paint.get("raster-brightness-min"),u_brightness_high:ce.paint.get("raster-brightness-max"),u_saturation_factor:a.dT(ce.paint.get("raster-saturation")),u_contrast_factor:a.dS(ce.paint.get("raster-contrast")),u_spin_weights:JI(ce.paint.get("raster-hue-rotate")),u_perspective_transform:le,u_raster_elevation:de,u_zoom_transition:O,u_merc_center:z,u_cutoff_params:V,u_colorization_mix:jk(a.dU,ye,Ee),u_colorization_offset:kk(a.dU,Oe,Ee),u_color_ramp:be,u_texture_offset:[Ze/(qe+2*Ze),qe/(qe+2*Ze)],u_texture_res:[qe+2*Ze,qe+2*Ze],u_emissive_strength:Ve});function JI(_){_*=Math.PI/180;const d=Math.sin(_),p=Math.cos(_);return[(2*p+1)/3,(-Math.sqrt(3)*d-p+1)/3,(Math.sqrt(3)*d-p+1)/3]}const of=.05,Yie=(_,d,p,b,M,L,O,z,V,Y,Q,ce)=>({u_matrix:_,u_normalize_matrix:d,u_globe_matrix:p,u_merc_matrix:b,u_grid_matrix:M,u_tl_parent:L,u_scale_parent:Y,u_fade_t:Q.mix,u_opacity:Q.opacity,u_image0:0,u_image1:1,u_raster_elevation:ce,u_zoom_transition:O,u_merc_center:z,u_cutoff_params:V}),Xie=(_,d,p,b,M,L,O,z,V,Y)=>({u_particle_texture:_,u_particle_texture_side_len:d,u_tile_offset:p,u_velocity:b,u_color_ramp:L,u_velocity_res:M,u_max_speed:O,u_uv_offset:z,u_data_scale:[255*V[0],255*V[1]],u_data_offset:Y,u_particle_pos_scale:1.1,u_particle_pos_offset:[of,of]}),eP=(_,d,p,b,M,L,O,z,V,Y)=>({u_particle_texture:_,u_particle_texture_side_len:d,u_velocity:p,u_velocity_res:b,u_max_speed:M,u_speed_factor:L,u_reset_rate:O,u_rand_seed:Math.random(),u_uv_offset:z,u_data_scale:[255*V[0],255*V[1]],u_data_offset:Y,u_particle_pos_scale:1.1,u_particle_pos_offset:[of,of]}),tP=a.bC(),Nk=(_,d,p,b,M,L,O,z,V,Y,Q,ce,le,de,be,ye,Oe,Ee,qe,Ze,Ve,gt,ct,ht)=>{const ot=M.transform,st={u_is_size_zoom_constant:+(_==="constant"||_==="source"),u_is_size_feature_constant:+(_==="constant"||_==="camera"),u_size_t:d?d.uSizeT:0,u_size:d?d.uSize:0,u_camera_to_center_distance:ot.getCameraToCenterDistance(qe),u_rotate_symbol:+p,u_aspect_ratio:ot.width/ot.height,u_fade_change:M.options.fadeDuration?M.symbolFadeChange:1,u_matrix:L,u_label_plane_matrix:O,u_coord_matrix:z,u_is_text:+Y,u_elevation_from_sea:V?1:0,u_pitch_with_map:+b,u_texsize:Q,u_texsize_icon:ce,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:tP,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:tP,u_up_vector:[0,-1,0],u_color_adj_mat:gt,u_icon_transition:ct||0,u_gamma_scale:b?M.transform.getCameraToCenterDistance(qe)*Math.cos(M.terrain?0:M.transform._pitch):1,u_device_pixel_ratio:a.o.devicePixelRatio,u_is_halo:1,u_scale_factor:ht||1,u_ground_shadow_factor:Ze,u_inv_matrix:a.bl(a.bC(),O),u_normal_scale:Ve,u_lutTexture:bl.LUT};return qe.name==="globe"&&(st.u_tile_id=[de.canonical.x,de.canonical.y,1<({u_matrix:_,u_emissive_strength:d,u_opacity:p,u_color:b}),Tm=(_,d,p,b,M,L,O,z,V)=>Object.assign(function(Y,Q,ce,le,de,be){const{width:ye,height:Oe}=le.imageManager.getPixelSize(Q),Ee=Math.pow(2,be.tileID.overscaledZ),qe=be.tileSize*Math.pow(2,le.transform.tileZoom)/Ee,Ze=qe*(be.tileID.canonical.x+be.tileID.wrap*Ee),Ve=qe*be.tileID.canonical.y;return{u_image:0,u_pattern_tl:ce.tl,u_pattern_br:ce.br,u_texsize:[ye,Oe],u_pattern_size:ce.displaySize,u_pattern_units_to_pixels:de?[le.transform.width,-1*le.transform.height]:[1/a.ay(be,1,le.transform.tileZoom),1/a.ay(be,1,le.transform.tileZoom)],u_pixel_coord_upper:[Ze>>16,Ve>>16],u_pixel_coord_lower:[65535&Ze,65535&Ve]}}(0,L,O,b,z,V),{u_matrix:_,u_emissive_strength:d,u_opacity:p}),vx=new Float32Array(a.bA([])),$g=(_,d,p,b,M,L,O,z,V,Y,Q,ce,le,de=[0,0,0],be,ye,Oe)=>{const Ee=M.style.light,qe=Ee.properties.get("position"),Ze=[-qe.x,-qe.y,qe.z],Ve=a.dO();Ee.properties.get("anchor")==="viewport"&&(a.dP(Ve,-M.transform.angle),a.dQ(Ze,Ze,Ve));const gt=Q.alphaMode==="MASK",ct=Ee.properties.get("color").toNonPremultipliedRenderColor(null),ht=le.paint.get("model-ambient-occlusion-intensity"),ot=le.paint.get("model-color").constantOr(a.ao.white).toNonPremultipliedRenderColor(null);return ot.a=le.paint.get("model-color-mix-intensity").constantOr(0),Oe&&(ot.r=Oe[0],ot.g=Oe[1],ot.b=Oe[2],ot.a=Oe[3]),ye&&(ot.r=ye.color.r,ot.g=ye.color.g,ot.b=ye.color.b,ot.a=ye.colorMix,ce=ye.emissionStrength,L*=ye.opacity),{u_matrix:_,u_lighting_matrix:d,u_normal_matrix:p,u_node_matrix:b||vx,u_lightpos:Ze,u_lightintensity:Ee.properties.get("intensity"),u_lightcolor:[ct.r,ct.g,ct.b],u_camera_pos:de,u_opacity:L,u_baseTextureIsAlpha:0,u_alphaMask:+gt,u_alphaCutoff:Q.alphaCutoff,u_baseColorFactor:O.toNonPremultipliedRenderColor(null).toArray01(),u_emissiveFactor:z.toNonPremultipliedRenderColor(null).toArray01(),u_metallicFactor:V,u_roughnessFactor:Y,u_baseColorTexture:bl.BaseColor,u_metallicRoughnessTexture:bl.MetallicRoughness,u_normalTexture:bl.Normal,u_occlusionTexture:bl.Occlusion,u_emissionTexture:bl.Emission,u_lutTexture:bl.LUT,u_color_mix:ot.toArray01(),u_aoIntensity:ht,u_emissive_strength:ce,u_occlusionTextureTransform:be||[0,0,0,0]}},B3=(_,d=vx,p=vx)=>({u_matrix:_,u_instance:d,u_node_matrix:p}),Sk={fillExtrusion:_=>({u_matrix:new a.cl(_),u_lightpos:new a.ci(_),u_lightintensity:new a.cj(_),u_lightcolor:new a.ci(_),u_vertical_gradient:new a.cj(_),u_opacity:new a.cj(_),u_edge_radius:new a.cj(_),u_width_scale:new a.cj(_),u_ao:new a.ck(_),u_height_type:new a.ch(_),u_base_type:new a.ch(_),u_tile_id:new a.ci(_),u_zoom_transition:new a.cj(_),u_inv_rot_matrix:new a.cl(_),u_merc_center:new a.ck(_),u_up_dir:new a.ci(_),u_height_lift:new a.cj(_),u_flood_light_color:new a.ci(_),u_vertical_scale:new a.cj(_),u_flood_light_intensity:new a.cj(_),u_ground_shadow_factor:new a.ci(_)}),fillExtrusionDepth:_=>({u_matrix:new a.cl(_),u_edge_radius:new a.cj(_),u_width_scale:new a.cj(_),u_vertical_scale:new a.cj(_),u_height_type:new a.ch(_),u_base_type:new a.ch(_)}),fillExtrusionPattern:_=>({u_matrix:new a.cl(_),u_lightpos:new a.ci(_),u_lightintensity:new a.cj(_),u_lightcolor:new a.ci(_),u_vertical_gradient:new a.cj(_),u_height_factor:new a.cj(_),u_edge_radius:new a.cj(_),u_width_scale:new a.cj(_),u_ao:new a.ck(_),u_height_type:new a.ch(_),u_base_type:new a.ch(_),u_tile_id:new a.ci(_),u_zoom_transition:new a.cj(_),u_inv_rot_matrix:new a.cl(_),u_merc_center:new a.ck(_),u_up_dir:new a.ci(_),u_height_lift:new a.cj(_),u_image:new a.ch(_),u_texsize:new a.ck(_),u_pixel_coord_upper:new a.ck(_),u_pixel_coord_lower:new a.ck(_),u_tile_units_to_pixels:new a.cj(_),u_opacity:new a.cj(_),u_pattern_transition:new a.cj(_)}),fillExtrusionGroundEffect:_=>({u_matrix:new a.cl(_),u_opacity:new a.cj(_),u_ao_pass:new a.cj(_),u_meter_to_tile:new a.cj(_),u_ao:new a.ck(_),u_flood_light_intensity:new a.cj(_),u_flood_light_color:new a.ci(_),u_attenuation:new a.cj(_),u_edge_radius:new a.cj(_),u_fb:new a.ch(_),u_fb_size:new a.cj(_),u_dynamic_offset:new a.cj(_)}),fill:_=>({u_matrix:new a.cl(_),u_emissive_strength:new a.cj(_),u_ground_shadow_factor:new a.ci(_)}),fillPattern:_=>({u_matrix:new a.cl(_),u_emissive_strength:new a.cj(_),u_image:new a.ch(_),u_texsize:new a.ck(_),u_pixel_coord_upper:new a.ck(_),u_pixel_coord_lower:new a.ck(_),u_tile_units_to_pixels:new a.cj(_),u_ground_shadow_factor:new a.ci(_),u_pattern_transition:new a.cj(_)}),fillOutline:_=>({u_matrix:new a.cl(_),u_emissive_strength:new a.cj(_),u_world:new a.ck(_),u_ground_shadow_factor:new a.ci(_)}),fillOutlinePattern:_=>({u_matrix:new a.cl(_),u_emissive_strength:new a.cj(_),u_world:new a.ck(_),u_image:new a.ch(_),u_texsize:new a.ck(_),u_pixel_coord_upper:new a.ck(_),u_pixel_coord_lower:new a.ck(_),u_tile_units_to_pixels:new a.cj(_),u_ground_shadow_factor:new a.ci(_),u_pattern_transition:new a.cj(_)}),building:_=>({u_matrix:new a.cl(_),u_normal_matrix:new a.cl(_),u_opacity:new a.cj(_),u_faux_facade_ao_intensity:new a.cj(_),u_camera_pos:new a.ci(_),u_tile_to_meter:new a.cj(_),u_facade_emissive_chance:new a.cj(_),u_flood_light_color:new a.ci(_),u_flood_light_intensity:new a.cj(_)}),buildingBloom:_=>({u_matrix:new a.cl(_)}),buildingDepth:_=>({u_matrix:new a.cl(_)}),elevatedStructuresDepth:_=>({u_matrix:new a.cl(_),u_depth_bias:new a.cj(_)}),elevatedStructures:_=>({u_matrix:new a.cl(_),u_ground_shadow_factor:new a.ci(_)}),elevatedStructuresDepthReconstruct:_=>({u_matrix:new a.cl(_),u_camera_pos:new a.ci(_),u_depth_bias:new a.cj(_),u_height_scale:new a.cj(_),u_reset_depth:new a.cj(_)}),circle:a.dY,collisionBox:_=>({u_matrix:new a.cl(_),u_inv_rot_matrix:new a.cl(_),u_camera_to_center_distance:new a.cj(_),u_extrude_scale:new a.ck(_),u_zoom_transition:new a.cj(_),u_merc_center:new a.ck(_),u_tile_id:new a.ci(_)}),collisionCircle:_=>({u_matrix:new a.cl(_),u_inv_matrix:new a.cl(_),u_camera_to_center_distance:new a.cj(_),u_viewport_size:new a.ck(_)}),debug:_=>({u_color:new a.dB(_),u_matrix:new a.cl(_),u_overlay:new a.ch(_),u_overlay_scale:new a.cj(_)}),clippingMask:_=>({u_matrix:new a.cl(_)}),heatmap:_=>({u_extrude_scale:new a.cj(_),u_intensity:new a.cj(_),u_matrix:new a.cl(_),u_inv_rot_matrix:new a.cl(_),u_merc_center:new a.ck(_),u_tile_id:new a.ci(_),u_zoom_transition:new a.cj(_),u_up_dir:new a.ci(_)}),heatmapTexture:_=>({u_image:new a.ch(_),u_color_ramp:new a.ch(_),u_opacity:new a.cj(_)}),hillshade:_=>({u_matrix:new a.cl(_),u_image:new a.ch(_),u_latrange:new a.ck(_),u_light:new a.ck(_),u_shadow:new a.dB(_),u_highlight:new a.dB(_),u_emissive_strength:new a.cj(_),u_accent:new a.dB(_)}),hillshadePrepare:_=>({u_matrix:new a.cl(_),u_image:new a.ch(_),u_dimension:new a.ck(_),u_zoom:new a.cj(_)}),line:a.dX,linePattern:a.dW,raster:_=>({u_matrix:new a.cl(_),u_normalize_matrix:new a.cl(_),u_globe_matrix:new a.cl(_),u_merc_matrix:new a.cl(_),u_grid_matrix:new a.dC(_),u_tl_parent:new a.ck(_),u_scale_parent:new a.cj(_),u_fade_t:new a.cj(_),u_opacity:new a.cj(_),u_image0:new a.ch(_),u_image1:new a.ch(_),u_brightness_low:new a.cj(_),u_brightness_high:new a.cj(_),u_saturation_factor:new a.cj(_),u_contrast_factor:new a.cj(_),u_spin_weights:new a.ci(_),u_perspective_transform:new a.ck(_),u_raster_elevation:new a.cj(_),u_zoom_transition:new a.cj(_),u_merc_center:new a.ck(_),u_cutoff_params:new a.d3(_),u_colorization_mix:new a.d3(_),u_colorization_offset:new a.cj(_),u_color_ramp:new a.ch(_),u_texture_offset:new a.ck(_),u_texture_res:new a.ck(_),u_emissive_strength:new a.cj(_)}),rasterParticle:_=>({u_matrix:new a.cl(_),u_normalize_matrix:new a.cl(_),u_globe_matrix:new a.cl(_),u_merc_matrix:new a.cl(_),u_grid_matrix:new a.dC(_),u_tl_parent:new a.ck(_),u_scale_parent:new a.cj(_),u_fade_t:new a.cj(_),u_opacity:new a.cj(_),u_image0:new a.ch(_),u_image1:new a.ch(_),u_raster_elevation:new a.cj(_),u_zoom_transition:new a.cj(_),u_merc_center:new a.ck(_),u_cutoff_params:new a.d3(_)}),rasterParticleTexture:_=>({u_texture:new a.ch(_),u_opacity:new a.cj(_)}),rasterParticleDraw:_=>({u_particle_texture:new a.ch(_),u_particle_texture_side_len:new a.cj(_),u_tile_offset:new a.ck(_),u_velocity:new a.ch(_),u_color_ramp:new a.ch(_),u_velocity_res:new a.ck(_),u_max_speed:new a.cj(_),u_uv_offset:new a.ck(_),u_data_scale:new a.ck(_),u_data_offset:new a.cj(_),u_particle_pos_scale:new a.cj(_),u_particle_pos_offset:new a.ck(_)}),rasterParticleUpdate:_=>({u_particle_texture:new a.ch(_),u_particle_texture_side_len:new a.cj(_),u_velocity:new a.ch(_),u_velocity_res:new a.ck(_),u_max_speed:new a.cj(_),u_speed_factor:new a.cj(_),u_reset_rate:new a.cj(_),u_rand_seed:new a.cj(_),u_uv_offset:new a.ck(_),u_data_scale:new a.ck(_),u_data_offset:new a.cj(_),u_particle_pos_scale:new a.cj(_),u_particle_pos_offset:new a.ck(_)}),symbol:_=>({u_is_size_zoom_constant:new a.ch(_),u_is_size_feature_constant:new a.ch(_),u_size_t:new a.cj(_),u_size:new a.cj(_),u_camera_to_center_distance:new a.cj(_),u_rotate_symbol:new a.ch(_),u_aspect_ratio:new a.cj(_),u_fade_change:new a.cj(_),u_matrix:new a.cl(_),u_label_plane_matrix:new a.cl(_),u_coord_matrix:new a.cl(_),u_is_text:new a.ch(_),u_elevation_from_sea:new a.ch(_),u_pitch_with_map:new a.ch(_),u_texsize:new a.ck(_),u_texsize_icon:new a.ck(_),u_texture:new a.ch(_),u_texture_icon:new a.ch(_),u_gamma_scale:new a.cj(_),u_device_pixel_ratio:new a.cj(_),u_tile_id:new a.ci(_),u_zoom_transition:new a.cj(_),u_inv_rot_matrix:new a.cl(_),u_merc_center:new a.ck(_),u_camera_forward:new a.ci(_),u_tile_matrix:new a.cl(_),u_up_vector:new a.ci(_),u_ecef_origin:new a.ci(_),u_is_halo:new a.ch(_),u_icon_transition:new a.cj(_),u_color_adj_mat:new a.cl(_),u_scale_factor:new a.cj(_),u_ground_shadow_factor:new a.ci(_),u_inv_matrix:new a.cl(_),u_normal_scale:new a.cj(_),u_lutTexture:new a.ch(_)}),background:_=>({u_matrix:new a.cl(_),u_emissive_strength:new a.cj(_),u_opacity:new a.cj(_),u_color:new a.dB(_)}),backgroundPattern:_=>({u_matrix:new a.cl(_),u_emissive_strength:new a.cj(_),u_opacity:new a.cj(_),u_image:new a.ch(_),u_pattern_tl:new a.ck(_),u_pattern_br:new a.ck(_),u_texsize:new a.ck(_),u_pattern_size:new a.ck(_),u_pixel_coord_upper:new a.ck(_),u_pixel_coord_lower:new a.ck(_),u_pattern_units_to_pixels:new a.ck(_)}),terrainRaster:_=>({u_matrix:new a.cl(_),u_image0:new a.ch(_),u_image1:new a.ch(_),u_skirt_height:new a.cj(_),u_ground_shadow_factor:new a.ci(_),u_emissive_texture_available:new a.cj(_)}),skybox:_=>({u_matrix:new a.cl(_),u_sun_direction:new a.ci(_),u_cubemap:new a.ch(_),u_opacity:new a.cj(_),u_temporal_offset:new a.cj(_)}),skyboxGradient:_=>({u_matrix:new a.cl(_),u_color_ramp:new a.ch(_),u_center_direction:new a.ci(_),u_radius:new a.cj(_),u_opacity:new a.cj(_),u_temporal_offset:new a.cj(_)}),skyboxCapture:_=>({u_matrix_3f:new a.dC(_),u_sun_direction:new a.ci(_),u_sun_intensity:new a.cj(_),u_color_tint_r:new a.d3(_),u_color_tint_m:new a.d3(_),u_luminance:new a.cj(_)}),globeRaster:_=>({u_proj_matrix:new a.cl(_),u_globe_matrix:new a.cl(_),u_normalize_matrix:new a.cl(_),u_merc_matrix:new a.cl(_),u_zoom_transition:new a.cj(_),u_merc_center:new a.ck(_),u_image0:new a.ch(_),u_image1:new a.ch(_),u_grid_matrix:new a.dC(_),u_skirt_height:new a.cj(_),u_far_z_cutoff:new a.cj(_),u_frustum_tl:new a.ci(_),u_frustum_tr:new a.ci(_),u_frustum_br:new a.ci(_),u_frustum_bl:new a.ci(_),u_globe_pos:new a.ci(_),u_globe_radius:new a.cj(_),u_viewport:new a.ck(_),u_emissive_texture_available:new a.cj(_)}),globeAtmosphere:_=>({u_frustum_tl:new a.ci(_),u_frustum_tr:new a.ci(_),u_frustum_br:new a.ci(_),u_frustum_bl:new a.ci(_),u_horizon:new a.cj(_),u_transition:new a.cj(_),u_fadeout_range:new a.cj(_),u_atmosphere_fog_color:new a.d3(_),u_high_color:new a.d3(_),u_space_color:new a.d3(_),u_temporal_offset:new a.cj(_),u_horizon_angle:new a.cj(_)}),model:_=>({u_matrix:new a.cl(_),u_lighting_matrix:new a.cl(_),u_normal_matrix:new a.cl(_),u_node_matrix:new a.cl(_),u_lightpos:new a.ci(_),u_lightintensity:new a.cj(_),u_lightcolor:new a.ci(_),u_camera_pos:new a.ci(_),u_opacity:new a.cj(_),u_baseColorFactor:new a.d3(_),u_emissiveFactor:new a.d3(_),u_metallicFactor:new a.cj(_),u_roughnessFactor:new a.cj(_),u_baseTextureIsAlpha:new a.ch(_),u_alphaMask:new a.ch(_),u_alphaCutoff:new a.cj(_),u_baseColorTexture:new a.ch(_),u_metallicRoughnessTexture:new a.ch(_),u_normalTexture:new a.ch(_),u_occlusionTexture:new a.ch(_),u_emissionTexture:new a.ch(_),u_lutTexture:new a.ch(_),u_color_mix:new a.d3(_),u_aoIntensity:new a.cj(_),u_emissive_strength:new a.cj(_),u_occlusionTextureTransform:new a.d3(_)}),modelDepth:_=>({u_matrix:new a.cl(_),u_instance:new a.cl(_),u_node_matrix:new a.cl(_)}),groundShadow:_=>({u_matrix:new a.cl(_),u_ground_shadow_factor:new a.ci(_)}),stars:_=>({u_matrix:new a.cl(_),u_up:new a.ci(_),u_right:new a.ci(_),u_intensity_multiplier:new a.cj(_)}),snowParticle:_=>({u_modelview:new a.cl(_),u_projection:new a.cl(_),u_time:new a.cj(_),u_cam_pos:new a.ci(_),u_velocityConeAperture:new a.cj(_),u_velocity:new a.cj(_),u_horizontalOscillationRadius:new a.cj(_),u_horizontalOscillationRate:new a.cj(_),u_boxSize:new a.cj(_),u_billboardSize:new a.cj(_),u_simpleShapeParameters:new a.ck(_),u_screenSize:new a.ck(_),u_thinningCenterPos:new a.ck(_),u_thinningShape:new a.ci(_),u_thinningAffectedRatio:new a.cj(_),u_thinningParticleOffset:new a.cj(_),u_particleColor:new a.d3(_),u_direction:new a.ci(_)}),rainParticle:_=>({u_modelview:new a.cl(_),u_projection:new a.cl(_),u_time:new a.cj(_),u_cam_pos:new a.ci(_),u_texScreen:new a.ch(_),u_velocityConeAperture:new a.cj(_),u_velocity:new a.cj(_),u_boxSize:new a.cj(_),u_rainDropletSize:new a.ck(_),u_distortionStrength:new a.cj(_),u_rainDirection:new a.ci(_),u_color:new a.d3(_),u_screenSize:new a.ck(_),u_thinningCenterPos:new a.ck(_),u_thinningShape:new a.ci(_),u_thinningAffectedRatio:new a.cj(_),u_thinningParticleOffset:new a.cj(_),u_shapeDirectionalPower:new a.cj(_),u_shapeNormalPower:new a.cj(_),u_mode:new a.cj(_)}),vignette:_=>({u_vignetteShape:new a.ci(_),u_vignetteColor:new a.d3(_)}),occlusion:_=>({u_matrix:new a.cl(_),u_anchorPos:new a.ci(_),u_screenSizePx:new a.ck(_),u_occluderSizePx:new a.ck(_),u_color:new a.d3(_)})};class bh{constructor(d,p,b,M){this.id=bh.uniqueIdxCounter,bh.uniqueIdxCounter++,this.context=d;const L=d.gl;this.buffer=L.createBuffer(),this.dynamicDraw=!!b,this.context.unbindVAO(),d.bindElementBuffer.set(this.buffer),L.bufferData(L.ELEMENT_ARRAY_BUFFER,p.arrayBuffer,this.dynamicDraw?L.DYNAMIC_DRAW:L.STATIC_DRAW),this.dynamicDraw||M||p.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(d){this.id=bh.uniqueIdxCounter,bh.uniqueIdxCounter++;const p=this.context.gl;this.context.unbindVAO(),this.bind(),p.bufferSubData(p.ELEMENT_ARRAY_BUFFER,0,d.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}bh.uniqueIdxCounter=0;const $3={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class rP{constructor(d,p,b,M,L,O){this.length=p.length,this.attributes=b,this.itemSize=p.bytesPerElement,this.dynamicDraw=M,this.instanceCount=O,this.context=d;const z=d.gl;this.buffer=z.createBuffer(),d.bindVertexBuffer.set(this.buffer),z.bufferData(z.ARRAY_BUFFER,p.arrayBuffer,this.dynamicDraw?z.DYNAMIC_DRAW:z.STATIC_DRAW),this.dynamicDraw||L||p.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(d){const p=this.context.gl;this.bind(),p.bufferSubData(p.ARRAY_BUFFER,0,d.arrayBuffer)}enableAttributes(d,p){for(let b=0;b0&&d.vertexAttribDivisor(L,b)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class nP{constructor(d,p,b,M,L){this.context=d,this.width=p,this.height=b;const O=this.framebuffer=d.gl.createFramebuffer();M>0&&(this.colorAttachment0=new mk(d,O,0)),M>1&&(this.colorAttachment1=new mk(d,O,1)),L&&(this.depthAttachmentType=L,this.depthAttachment=L==="renderbuffer"?new mx(d,O):new tv(d,O))}createColorAttachment(d,p){p===0?this.colorAttachment0=new mk(d,this.framebuffer,0):p===1&&(this.colorAttachment1=new mk(d,this.framebuffer,1))}removeColorAttachment(d,p){const b=this.context.gl;let M;p===0?(M=this.colorAttachment0.get(),this.colorAttachment0=void 0):p===1&&(M=this.colorAttachment1.get(),this.colorAttachment1=void 0),M&&b.deleteTexture(M)}destroy(){const d=this.context.gl;if(this.colorAttachment0){const p=this.colorAttachment0.get();p&&d.deleteTexture(p)}if(this.colorAttachment1){const p=this.colorAttachment1.get();p&&d.deleteTexture(p)}if(this.depthAttachment&&this.depthAttachmentType)if(this.depthAttachmentType==="renderbuffer"){const p=this.depthAttachment.get();p&&d.deleteRenderbuffer(p)}else{const p=this.depthAttachment.get();p&&d.deleteTexture(p)}d.deleteFramebuffer(this.framebuffer)}}class _x{constructor(d,p){this.gl=d,this.clearColor=new qie(this),this.clearDepth=new DI(this),this.clearStencil=new j3(this),this.colorMask=new dk(this),this.depthMask=new k3(this),this.stencilMask=new zg(this),this.stencilFunc=new ux(this),this.stencilOp=new J1(this),this.stencilTest=new hx(this),this.depthRange=new RI(this),this.depthTest=new N3(this),this.depthFunc=new FI(this),this.blend=new fx(this),this.blendFunc=new uk(this),this.blendColor=new hk(this),this.blendEquation=new S3(this),this.cullFace=new fk(this),this.cullFaceSide=new ev(this),this.frontFace=new zI(this),this.program=new BI(this),this.activeTexture=new $I(this),this.viewport=new px(this),this.bindFramebuffer=new UI(this),this.bindRenderbuffer=new Vie(this),this.bindTexture=new Hie(this),this.bindVertexBuffer=new Wie(this),this.bindElementBuffer=new C3(this),this.bindVertexArrayOES=new M3(this),this.pixelStoreUnpack=new T3(this),this.pixelStoreUnpackPremultiplyAlpha=new A3(this),this.pixelStoreUnpackFlipY=new qI(this),this.options=p?Object.assign({},p):{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=d.getExtension("EXT_texture_filter_anisotropic")||d.getExtension("MOZ_EXT_texture_filter_anisotropic")||d.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=d.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=d.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=d.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=d.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.forceManualRenderingForInstanceIDShaders=p&&!!p.forceManualRenderingForInstanceIDShaders||this.renderer&&this.renderer.indexOf("PowerVR")!==-1,this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=d.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=d.getExtension("EXT_color_buffer_half_float"),this.extTimerQuery=d.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=d.getParameter(d.MAX_TEXTURE_SIZE),this.extBlendFuncExtended=d.getExtension("WEBGL_blend_func_extended")}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(d,p,b){return new bh(this,d,p,b)}createVertexBuffer(d,p,b,M,L){return new rP(this,d,p,b,M,L)}createRenderbuffer(d,p,b){const M=this.gl,L=M.createRenderbuffer();return this.bindRenderbuffer.set(L),M.renderbufferStorage(M.RENDERBUFFER,d,p,b),this.bindRenderbuffer.set(null),L}createFramebuffer(d,p,b,M){return new nP(this,d,p,b,M)}clear({color:d,depth:p,stencil:b,colorMask:M}){const L=this.gl;let O=0;d&&(O|=L.COLOR_BUFFER_BIT,this.clearColor.set(d.toNonPremultipliedRenderColor(null)),this.colorMask.set(M||[!0,!0,!0,!0])),p!==void 0&&(O|=L.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(p),this.depthMask.set(!0)),b!==void 0&&(O|=L.STENCIL_BUFFER_BIT,this.clearStencil.set(b),this.stencilMask.set(255)),L.clear(O)}setCullFace(d){d.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(d.mode),this.frontFace.set(d.frontFace))}setDepthMode(d){d.func!==this.gl.ALWAYS||d.mask?(this.depthTest.set(!0),this.depthFunc.set(d.func),this.depthMask.set(d.mask),this.depthRange.set(d.range)):this.depthTest.set(!1)}setStencilMode(d){d.test.func!==this.gl.ALWAYS||d.mask?(this.stencilTest.set(!0),this.stencilMask.set(d.mask),this.stencilOp.set([d.fail,d.depthFail,d.pass]),this.stencilFunc.set({func:d.test.func,ref:d.ref,mask:d.test.mask})):this.stencilTest.set(!1)}setColorMode(d){a.by(d.blendFunction,Jn.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(d.blendFunction),this.blendColor.set(d.blendColor),d.blendEquation?this.blendEquation.set(d.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(d.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}let Ug;function Yr(_,d,p,b,M,L,O){const z=_.context,V=z.gl,Y=_.transform,Q=[a.aF(Y.center.lng),a.aJ(Y.center.lat)],ce=p.layout.get("symbol-placement"),le=p.layout.get("text-variable-anchor"),de=p.layout.get("icon-rotation-alignment")==="map",be=p.layout.get("text-rotation-alignment")==="map",ye=ce!=="point",Oe=[];let Ee=0,qe=0;for(let st=0;st0){const Dr=a.bC(),qr=Nr;a.cP(Dr,Tt.placementInvProjMatrix,Y.glCoordMatrix),a.cP(Dr,Dr,Tt.placementViewportMatrix),Oe.push({circleArray:nn,circleOffset:qe,transform:qr,invTransform:Dr,projection:Tt.getProjection()}),Ee+=nn.length/4,qe=Ee}if(!_r)continue;_.terrain&&_.terrain.setupElevationDraw(Pt,Ur);const Jr=ur?[vt.canonical.x,vt.canonical.y,1<=0&&(de[Ze.associatedIconIndex]={x:Tt,y:qt,z:Vt,angle:Kt})}else xh(ct,ce)}if(Y){le.clear();const qe=_.icon.placedSymbolArray;for(let Ze=0;Ze{let Hs=[0,0,0];if(hi){const rs=_.style.directionalLight,na=_.style.ambientLight;rs&&na&&(Hs=lp(_.style,rs,na))}return Hs},Js=hi=>{st.depthOcclusionForSymbolsAndCircles&&(p.hasOcclusionOpacityProperties||_.terrain)&&(hi.push("DEPTH_D24"),hi.push("DEPTH_OCCLUSION"))},Un=hi=>{p.lut&&!ct&&(p.lut.texture||(p.lut.texture=new a.d$(_.context,p.lut.image,[p.lut.image.height,p.lut.image.height,p.lut.image.height],ht.gl.RGBA8)),ht.activeTexture.set(ht.gl.TEXTURE0+bl.LUT),p.lut.texture&&p.lut.texture.bind(ht.gl.LINEAR,ht.gl.CLAMP_TO_EDGE),hi.push("APPLY_LUT_ON_GPU"))},ui=()=>{const hi=vt&&p.layout.get("symbol-placement")!=="point",Hs=[];Js(Hs),Un(Hs);const rs=hi||Hn,na=_r.elevationType==="road",Za=_.shadowRenderer,ka=na&&Tt&&!!Za&&Za.enabled,zi=on(ka),Zc=na&&Tt&&!_.terrain?Ft:vr,Xl=p.paint.get("icon-image-cross-fade");_.terrainRenderModeElevated()&&Tt&&Hs.push("PITCH_WITH_MAP_TERRAIN"),nn&&(Hs.push("PROJECTION_GLOBE_VIEW"),rs&&Hs.push("PROJECTED_POS_ON_VIEWPORT")),Xl>0&&_r.hasAnySecondaryIcon&&Hs.push("ICON_TRANSITION"),!_r.icon.zOffsetVertexBuffer||na&&_.terrain||Hs.push("Z_OFFSET"),Ee===0&&qe===0&&Ze===0&&Ve===1||Hs.push("COLOR_ADJUSTMENT"),_r.sdfIcons&&Hs.push("RENDER_SDF"),ka&&Hs.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),na&&Tt&&!_.terrain&&_r.icon.orientationVertexBuffer&&Hs.push("ELEVATED_ROADS");const zo=_r.icon.programConfigurations.get(p.id),uc=_.getOrCreateProgram("symbol",{config:zo,defines:Hs}),hc=Nr.imageAtlasTexture?Nr.imageAtlasTexture.size:[0,0],Il=_r.iconSizeData,au=a.bK(Il,st.zoom),Ku=Tt||!st.isOrthographic,yd=Cc(Dr,Nr.tileID.canonical,Tt,vt,st,_r.getProjection(),qr),Fa=q1(Dr,Nr.tileID.canonical,Tt,vt,st,_r.getProjection(),qr),ro=_.translatePosMatrix(Fa,Nr,z,Y,!0),Bi=_.translatePosMatrix(Dr,Nr,z,Y),mo=rs?ov:yd,Ia=vt&&!Tt&&!hi;let Na=Ar;!Ut&&!st.mercatorFromTransition||vt||(Na=dp(st));const Zu=nn?Na:Ar,_v=p.getColorAdjustmentMatrix(Ee,qe,Ze,Ve),kh=Nk(Il.kind,au,Ia,Tt,_,Bi,mo,ro,gt,!1,hc,[0,0],0,Ur,Jr,St,As,Zu,_r.getProjection(),zi,ai,_v,Xl,null),bv=Nr.imageAtlasTexture?Nr.imageAtlasTexture:null,Tx=p.layout.get("icon-size").constantOr(0)!==1||_r.iconsNeedLinear,hf=_r.sdfIcons||_.options.rotating||_.options.zooming||Tx||Ku?ot.LINEAR:ot.NEAREST,vp=_r.sdfIcons&&p.paint.get("icon-halo-width").constantOr(1)!==0,Ax=_.terrain&&Tt&&hi?a.bl(a.bC(),yd):ov;if(hi&&_r.icon){const Om=a.bV.getAtTileOffsetFunc(Ur,st.center.lat,st.worldSize,_r.getProjection()),_p=Kj(Dr,Nr.tileID.canonical,Tt,vt,st,_r.getProjection(),qr),Nh=p.layout.get("icon-size-scale-range"),bp=a.aA(_.scaleFactor,Nh[0],Nh[1]);CI(_r,Dr,_,!1,_p,Fa,Tt,ye,Om,Ur,bp)}return{program:uc,buffers:_r.icon,uniformValues:kh,atlasTexture:bv,atlasTextureIcon:null,atlasInterpolation:hf,atlasInterpolationIcon:null,isSDF:_r.sdfIcons,hasHalo:vp,depthMode:Zc,tile:Nr,renderWithShadows:ka,labelPlaneMatrixInv:Ax}},Ci=()=>{const hi=Pt&&p.layout.get("symbol-placement")!=="point",Hs=[],rs=hi||Kt||Hn,na=_r.elevationType==="road",Za=_.shadowRenderer,ka=na&&qt&&!!Za&&Za.enabled,zi=on(ka),Zc=na&&qt&&!_.terrain?Ft:vr;_.terrainRenderModeElevated()&&qt&&Hs.push("PITCH_WITH_MAP_TERRAIN"),nn&&(Hs.push("PROJECTION_GLOBE_VIEW"),rs&&Hs.push("PROJECTED_POS_ON_VIEWPORT")),!_r.text.zOffsetVertexBuffer||na&&_.terrain||Hs.push("Z_OFFSET"),_r.iconsInText&&Hs.push("RENDER_TEXT_AND_SYMBOL"),Hs.push("RENDER_SDF"),ka&&Hs.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),na&&qt&&!_.terrain&&_r.text.orientationVertexBuffer&&Hs.push("ELEVATED_ROADS"),Js(Hs);const Xl=_r.text.programConfigurations.get(p.id),zo=_.getOrCreateProgram("symbol",{config:Xl,defines:Hs});let uc,hc=[0,0],Il=null;const au=_r.textSizeData;_r.iconsInText&&(hc=Nr.imageAtlasTexture?Nr.imageAtlasTexture.size:[0,0],Il=Nr.imageAtlasTexture?Nr.imageAtlasTexture:null,uc=qt||!st.isOrthographic||_.options.rotating||_.options.zooming||au.kind==="composite"||au.kind==="camera"?ot.LINEAR:ot.NEAREST);const Ku=Nr.glyphAtlasTexture?Nr.glyphAtlasTexture.size:[0,0],yd=p.layout.get("text-size-scale-range"),Fa=a.aA(_.scaleFactor,yd[0],yd[1]),ro=a.bK(au,st.zoom,Fa),Bi=Cc(Dr,Nr.tileID.canonical,qt,Pt,st,_r.getProjection(),qr),mo=q1(Dr,Nr.tileID.canonical,qt,Pt,st,_r.getProjection(),qr),Ia=_.translatePosMatrix(mo,Nr,V,Q,!0),Na=_.translatePosMatrix(Dr,Nr,V,Q),Zu=rs?ov:Bi,_v=Pt&&!qt&&!hi;let kh=Ar;!Ut&&!st.mercatorFromTransition||Pt||(kh=dp(st));const bv=Nk(au.kind,ro,_v,qt,_,Na,Zu,Ia,gt,!0,Ku,hc,0,Ur,Jr,St,As,nn?kh:Ar,_r.getProjection(),zi,ai,null,null,Fa),Tx=Nr.glyphAtlasTexture?Nr.glyphAtlasTexture:null,hf=ot.LINEAR,vp=p.paint.get("text-halo-width").constantOr(1)!==0,Ax=_.terrain&&qt&&hi?a.bl(a.bC(),Bi):ov;if(hi&&_r.text){const Om=a.bV.getAtTileOffsetFunc(Ur,st.center.lat,st.worldSize,_r.getProjection()),_p=Kj(Dr,Nr.tileID.canonical,qt,Pt,st,_r.getProjection(),qr);CI(_r,Dr,_,!0,_p,mo,qt,Oe,Om,Ur,Fa)}return{program:zo,buffers:_r.text,uniformValues:bv,atlasTexture:Tx,atlasTextureIcon:Il,atlasInterpolation:hf,atlasInterpolationIcon:uc,isSDF:!0,hasHalo:vp,depthMode:Zc,tile:Nr,renderWithShadows:ka,labelPlaneMatrixInv:Ax}},vi=_r.icon.segments.get().length,Ys=_r.text.segments.get().length,ts=vi&&!O.onlyText?ui():null,ci=Ys&&!O.onlyIcons?Ci():null,Ea=p.paint.get("icon-opacity").constantOr(1),ua=p.paint.get("text-opacity").constantOr(1);if(Vt&&_r.canOverlap){nr=!0;const hi=Ea&&!O.onlyText?_r.icon.segments.get():[],Hs=ua&&!O.onlyIcons?_r.text.segments.get():[];for(const rs of hi)ur.push({segments:new a.bg([rs]),sortKey:rs.sortKey,state:ts});for(const rs of Hs)ur.push({segments:new a.bg([rs]),sortKey:rs.sortKey,state:ci})}else O.onlyText||ur.push({segments:Ea?_r.icon.segments:new a.bg([]),sortKey:0,state:ts}),O.onlyIcons||ur.push({segments:ua?_r.text.segments:new a.bg([]),sortKey:0,state:ci})}nr&&ur.sort((Ur,Nr)=>Ur.sortKey-Nr.sortKey);for(const Ur of ur){const Nr=Ur.state;if(Nr)if(_.terrain?_.terrain.setupElevationDraw(Nr.tile,Nr.program,{useDepthForOcclusion:st.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:Nr.labelPlaneMatrixInv}):_.setupDepthForOcclusion(st.depthOcclusionForSymbolsAndCircles,Nr.program),ht.activeTexture.set(ot.TEXTURE0),Nr.atlasTexture&&Nr.atlasTexture.bind(Nr.atlasInterpolation,ot.CLAMP_TO_EDGE,!0),Nr.atlasTextureIcon&&(ht.activeTexture.set(ot.TEXTURE1),Nr.atlasTextureIcon&&Nr.atlasTextureIcon.bind(Nr.atlasInterpolationIcon,ot.CLAMP_TO_EDGE,!0)),Nr.renderWithShadows&&_.shadowRenderer.setupShadows(Nr.tile.tileID.toUnwrapped(),Nr.program,"vector-tile"),_.uploadCommonLightUniforms(_.context,Nr.program),Nr.hasHalo){const _r=Nr.uniformValues;_r.u_is_halo=1,U3(Nr.buffers,Ur.segments,p,_,Nr.program,Nr.depthMode,M,L,_r,2),_r.u_is_halo=0}else{if(Nr.isSDF){const _r=Nr.uniformValues;Nr.hasHalo&&(_r.u_is_halo=1,U3(Nr.buffers,Ur.segments,p,_,Nr.program,Nr.depthMode,M,L,_r,1)),_r.u_is_halo=0}U3(Nr.buffers,Ur.segments,p,_,Nr.program,Nr.depthMode,M,L,Nr.uniformValues,1)}}}function U3(_,d,p,b,M,L,O,z,V,Y){const Q=[_.dynamicLayoutVertexBuffer,_.opacityVertexBuffer,_.iconTransitioningVertexBuffer,_.globeExtVertexBuffer,_.zOffsetVertexBuffer,_.orientationVertexBuffer];M.draw(b,b.context.gl.TRIANGLES,L,O,z,Rn.disabled,V,p.id,_.layoutVertexBuffer,_.indexBuffer,d,p.paint,b.transform.zoom,_.programConfigurations.get(p.id),Q,Y)}function sP(_,d){const p=1<<_.canonical.z,b=(d.x*p-_.canonical.x-_.wrap*p)*a.al,M=(d.y*p-_.canonical.y)*a.al,L=a.e8(d.z,d.y);return a.d5(b,M,L)}function Ck(_,d,p,b,M){if(!p.layout||p.layout.get("fill-elevation-reference")==="none"||p.paint.get("fill-opacity").constantOr(1)===0)return;const L=_.context.gl,O=new cn(_.context.gl.LEQUAL,cn.ReadWrite,_.depthRangeFor3D),z=new cn(_.context.gl.GREATER,cn.ReadWrite,_.depthRangeFor3D),V=function(de){let be=.01;return de.isOrthographic&&(be=a.ak(1e-4,be,a.d0(de.pitch>=_h?1:de.pitch/_h))),2*be}(_.transform),Y=_.transform.getFreeCameraOptions().position,Q="elevatedStructuresDepthReconstruct",ce=_.getOrCreateProgram(Q,{defines:["DEPTH_RECONSTRUCTION"]}),le=_.getOrCreateProgram(Q);for(const de of b){const be=d.getTile(de),ye=be.getBucket(p);if(!ye)continue;const Oe=ye.elevatedStructures;if(!Oe)continue;const Ee=ye.elevationBufferData.heightRange,qe=sP(de.toUnwrapped(),Y),Ze=_.translatePosMatrix(de.projMatrix,be,p.paint.get("fill-translate"),p.paint.get("fill-translate-anchor"));let Ve,gt,ct,ht;if(M==="initialize"){if(!Ee||Ee.min>=1||Oe.depthSegments.segments[0].primitiveLength===0)continue;Ve=Bg(Ze,qe,V,1,0),gt=O,ct=Oe.depthSegments,ht=ce}else if(M==="reset"){if(!Ee||Ee.min>=0||Oe.maskSegments.segments[0].primitiveLength===0)continue;Ve=Bg(Ze,qe,0,0,1),gt=z,ct=Oe.maskSegments,ht=ce}else if(M==="geometry"){if(Oe.depthSegments.segments[0].primitiveLength===0)continue;Ve=Bg(Ze,qe,V,1,0),gt=O,ct=Oe.depthSegments,ht=le}ht.draw(_,L.TRIANGLES,gt,Fn.disabled,Jn.disabled,Rn.disabled,Ve,p.id,Oe.vertexBuffer,Oe.indexBuffer,ct,p.paint,_.transform.zoom)}}function Mk(_,d,p,b){const{painter:M,sourceCache:L,layer:O,coords:z,colorMode:V,elevationType:Y,terrainEnabled:Q,pass:ce}=_,le=M.context.gl,de=O.paint.get("fill-pattern"),be=O.paint.get("fill-pattern-cross-fade"),ye=de.constantOr(null);let Oe=Y;Y!=="road"||d&&!Q||(Oe="none");const Ee=Oe==="road",qe=_.painter.shadowRenderer,Ze=Ee&&!!qe&&qe.enabled,Ve=new cn(M.context.gl.LEQUAL,cn.ReadOnly,M.depthRangeFor3D);let gt=[0,0,0];if(Ze){const st=M.style.directionalLight,vt=M.style.ambientLight;st&&vt&&(gt=lp(M.style,st,vt))}const ct=de&&de.constantOr(1),ht=M.terrain&&M.terrain.renderingToTexture,ot=(st,vt)=>{let Pt,Tt,qt,Vt,nr;vt?(Pt=ct&&!O.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",qt=le.LINES):(Pt=ct?"fillPattern":"fill",qt=le.TRIANGLES);for(const vr of z){const Ft=L.getTile(vr);if(ct&&!Ft.patternsLoaded())continue;const St=Ft.getBucket(O);if(!St)continue;const Kt=d?St.elevationBufferData:St.bufferData;if(Kt.isEmpty())continue;M.prepareDrawTile();const Ut=Kt.programConfigurations.get(O.id),ur=M.isTileAffectedByFog(vr),Ar=[],Ur=[];Ee&&(Ar.push("ELEVATED_ROADS"),Ur.push(Kt.elevatedLayoutVertexBuffer)),Ze&&Ar.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),ht&&p&&Ar.push("USE_MRT1"),ct&&(M.context.activeTexture.set(le.TEXTURE0),Ft.imageAtlasTexture&&Ft.imageAtlasTexture.bind(le.LINEAR,le.CLAMP_TO_EDGE),Ut.updatePaintBuffers());let Nr=!1;if(ye&&Ft.imageAtlas){const qr=Ft.imageAtlas,wn=a.e3.from(ye),Hn=wn.getPrimary().scaleSelf(a.o.devicePixelRatio).toString(),As=wn.getSecondary(),ai=qr.patternPositions.get(Hn),on=As?qr.patternPositions.get(As.scaleSelf(a.o.devicePixelRatio).toString()):null;Nr=!!ai&&!!on,ai&&Ut.setConstantPatternPositions(ai,on)}be>0&&(Nr||Ut.getPatternTransitionVertexBuffer("fill-pattern"))&&Ar.push("FILL_PATTERN_TRANSITION");const _r=M.getOrCreateProgram(Pt,{config:Ut,overrideFog:ur,defines:Ar}),nn=M.translatePosMatrix(vr.projMatrix,Ft,O.paint.get("fill-translate"),O.paint.get("fill-translate-anchor"));Ze&&qe.setupShadows(Ft.tileID.toUnwrapped(),_r,"vector-tile");const Jr=O.paint.get("fill-emissive-strength");if(vt){Vt=Kt.lineIndexBuffer,nr=Kt.lineSegments;const qr=M.terrain&&M.terrain.renderingToTexture?M.terrain.drapeBufferSize:[le.drawingBufferWidth,le.drawingBufferHeight];Tt=Pt==="fillOutlinePattern"&&ct?F3(nn,Jr,M,Ft,qr,gt,be):KI(nn,Jr,qr,gt)}else Vt=Kt.indexBuffer,nr=Kt.triangleSegments,Tt=ct?R3(nn,Jr,M,Ft,gt,be):D3(nn,Jr,gt);M.uploadCommonUniforms(M.context,_r,vr.toUnwrapped());let Dr=st;(Y==="road"&&!Q||Y==="offset")&&(Dr=Ve),_r.draw(M,qt,Dr,b||M.stencilModeForClipping(vr),V,Rn.disabled,Tt,O.id,Kt.layoutVertexBuffer,Vt,nr,O.paint,M.transform.zoom,Ut,Ur)}};M.renderPass===ce&&ot(M.depthModeForSublayer(1,M.renderPass==="opaque"?cn.ReadWrite:cn.ReadOnly),!1),Oe==="none"&&M.renderPass==="translucent"&&O.paint.get("fill-antialias")&&ot(M.depthModeForSublayer(O.getPaintProperty("fill-outline-color")?2:0,cn.ReadOnly),!0)}function Tk(_,d,p,b,M,L,O,z){p.resetLayerRenderingStats(_);const V=_.context,Y=V.gl,Q=_.transform,ce=p.paint.get("fill-extrusion-pattern"),le=p.paint.get("fill-extrusion-pattern-cross-fade"),de=ce.constantOr(null),be=ce.constantOr(1),ye=p.paint.get("fill-extrusion-opacity"),Oe=_.style.enable3dLights(),Ee=p.paint.get(Oe&&!be?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),qe=[p.paint.get("fill-extrusion-ambient-occlusion-intensity"),Ee],Ze=p.layout.get("fill-extrusion-edge-radius"),Ve=Ze>0&&!p.paint.get("fill-extrusion-rounded-roof"),gt=Ve?0:Ze,ct=Q.projection.name==="globe"?a.eb():0,ht=Q.projection.name==="globe",ot=ht?a.aj(Q.zoom):0,st=[a.aF(Q.center.lng),a.aJ(Q.center.lat)],vt=p.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",Pt=p.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(vt?null:p.lut).toArray01().slice(0,3),Tt=p.paint.get("fill-extrusion-flood-light-intensity"),qt=p.paint.get("fill-extrusion-vertical-scale"),Vt=p.paint.get("fill-extrusion-line-width").constantOr(1)!==0,nr=p.paint.get("fill-extrusion-height-alignment"),vr=p.paint.get("fill-extrusion-base-alignment"),Ft=bm(_,p.paint.get("fill-extrusion-cutoff-fade-range")),St=[];let Kt;ht&&St.push("PROJECTION_GLOBE_VIEW"),qe[0]>0&&St.push("FAUX_AO"),Ve&&St.push("ZERO_ROOF_RADIUS"),z&&St.push("HAS_CENTROID"),Tt>0&&St.push("FLOOD_LIGHT"),Ft.shouldRenderCutoff&&St.push("RENDER_CUTOFF"),Vt&&St.push("RENDER_WALL_MODE");const Ut=_.renderPass==="shadow",ur=_.shadowRenderer,Ar=Ut&&!!ur,Ur=Ut?Rn.disabled:Rn.backCCW;_.shadowRenderer&&(_.shadowRenderer.useNormalOffset=!0);let Nr=[0,0,0];if(ur){const Jr=_.style.directionalLight,Dr=_.style.ambientLight;Jr&&Dr&&(Nr=lp(_.style,Jr,Dr)),Ut||(St.push("RENDER_SHADOWS","DEPTH_TEXTURE"),ur.useNormalOffset&&St.push("NORMAL_OFFSET")),Kt=St.concat(["SHADOWS_SINGLE_CASCADE"])}const _r=Ar?"fillExtrusionDepth":be?"fillExtrusionPattern":"fillExtrusion",nn=p.getLayerRenderingStats();for(const Jr of b){const Dr=d.getTile(Jr),qr=Dr.getBucket(p);if(!qr||qr.projection.name!==Q.projection.name)continue;let wn=!1;ur&&(wn=ur.getMaxCascadeForTile(Jr.toUnwrapped())===0);const Hn=_.isTileAffectedByFog(Jr),As=qr.programConfigurations.get(p.id);let ai=!1;if(de&&Dr.imageAtlas){const Ys=Dr.imageAtlas,ts=a.e3.from(de),ci=ts.getPrimary().scaleSelf(a.o.devicePixelRatio).toString(),Ea=ts.getSecondary(),ua=Ys.patternPositions.get(ci),hi=Ea?Ys.patternPositions.get(Ea.scaleSelf(a.o.devicePixelRatio).toString()):null;ai=!!ua&&!!hi,ua&&As.setConstantPatternPositions(ua,hi)}le>0&&(ai||As.getPatternTransitionVertexBuffer("fill-extrusion-pattern"))&&St.push("FILL_EXTRUSION_PATTERN_TRANSITION");const on=_.getOrCreateProgram(_r,{config:As,defines:wn?Kt:St,overrideFog:Hn});if(_.terrain&&_.terrain.setupElevationDraw(Dr,on,{useMeterToDem:!0}),!qr.centroidVertexBuffer){const Ys=on.getAttributeLocation(Y,"a_centroid_pos");Ys!==-1&&Y.vertexAttrib2f(Ys,0,0)}!Ut&&ur&&ur.setupShadows(Dr.tileID.toUnwrapped(),on,"vector-tile"),be&&(_.context.activeTexture.set(Y.TEXTURE0),Dr.imageAtlasTexture&&Dr.imageAtlasTexture.bind(Y.LINEAR,Y.CLAMP_TO_EDGE),As.updatePaintBuffers());const Js=p.paint.get("fill-extrusion-vertical-gradient"),Un=1/qr.tileToMeter;let ui;if(Ut&&ur){if(hp(Dr.tileID,qr.maxHeight,_))continue;const Ys=ur.calculateShadowPassMatrixFromTile(Dr.tileID.toUnwrapped());ui=O3(Ys,gt,Un,qt,nr,vr)}else{const Ys=_.translatePosMatrix(Jr.expandedProjMatrix,Dr,p.paint.get("fill-extrusion-translate"),p.paint.get("fill-extrusion-translate-anchor")),ts=Q.projection.createInversionMatrix(Q,Jr.canonical);ui=be?GI(Ys,_,Js,ye,qe,gt,Un,Jr,Dr,ct,nr,vr,ot,st,ts,Pt,qt,le):bk(Ys,_,Js,ye,qe,gt,Un,Jr,ct,nr,vr,ot,st,ts,Pt,qt,Tt,Nr)}_.uploadCommonUniforms(V,on,Jr.toUnwrapped(),null,Ft);let Ci=qr.segments;if(Q.projection.name==="mercator"&&!Ut&&(Ci=qr.getVisibleSegments(Dr.tileID,_.terrain,_.transform.getFrustum(0)),!Ci.get().length))continue;if(nn)if(Ut)for(const Ys of Ci.get())nn.numRenderedVerticesInShadowPass+=Ys.primitiveLength;else for(const Ys of Ci.get())nn.numRenderedVerticesInTransparentPass+=Ys.primitiveLength;const vi=[];(_.terrain||z)&&vi.push(qr.centroidVertexBuffer),ht&&vi.push(qr.layoutVertexExtBuffer),Vt&&vi.push(qr.wallVertexBuffer),on.draw(_,V.gl.TRIANGLES,M,L,O,Ur,ui,p.id,qr.layoutVertexBuffer,qr.indexBuffer,Ci,p.paint,_.transform.zoom,As,vi)}_.shadowRenderer&&(_.shadowRenderer.useNormalOffset=!1)}class q3{constructor(){this.translate=[0,0],this.translateAnchor="map",this.edgeRadius=0,this.cutoffFadeRange=0}}function up(_,d,p,b,M,L,O,z,V,Y,Q,ce,le,de,be,ye,Oe,Ee,qe,Ze){const Ve=d.context,gt=Ve.gl,ct=d.transform,ht=d.transform.zoom,ot=[],st=_.translate,vt=_.translateAnchor,Pt=_.edgeRadius,Tt=bm(d,_.cutoffFadeRange);Q==="clear"?(ot.push("CLEAR_SUBPASS"),Ze&&(ot.push("CLEAR_FROM_TEXTURE"),Ve.activeTexture.set(gt.TEXTURE0),Ze.bind(gt.LINEAR,gt.CLAMP_TO_EDGE))):Q==="sdf"?ot.push("SDF_SUBPASS"):Q==="emissive"&&(ot.push("USE_MRT1"),Ve.activeTexture.set(gt.TEXTURE0),Ze.bind(gt.LINEAR,gt.CLAMP_TO_EDGE)),Ee&&ot.push("HAS_CENTROID"),Tt.shouldRenderCutoff&&ot.push("RENDER_CUTOFF");const qt=(Vt,nr,vr,Ft,St)=>{let Kt=ot;nr.groundRadiusBuffer!=null&&(Kt=ot.concat("HAS_ATTRIBUTE_a_flood_light_ground_radius"));const Ut=nr.programConfigurations.get(b.id),ur=d.isTileAffectedByFog(Vt),Ar=d.getOrCreateProgram("fillExtrusionGroundEffect",{config:Ut,defines:Kt,overrideFog:ur}),Ur=xx(d,Ft,ce,Y,St,[le,de*St],be,ye,Oe,ht>=17?0:Pt*St,Ze?Ze.size[0]:0),Nr=[];Ee&&Nr.push(nr.hiddenByLandmarkVertexBuffer),nr.groundRadiusBuffer!=null&&Nr.push(nr.groundRadiusBuffer),d.uploadCommonUniforms(Ve,Ar,Vt.toUnwrapped(),null,Tt),Ar.draw(d,Ve.gl.TRIANGLES,L,O,z,V,Ur,b.id,nr.vertexBuffer,nr.indexBuffer,vr,b.paint,ht,Ut,Nr)};for(const Vt of M){const nr=p.getTile(Vt),vr=nr.getBucket(b);if(!vr||vr.projection.name!==ct.projection.name||!vr.groundEffect||vr.groundEffect&&!vr.groundEffect.hasData())continue;const Ft=vr.groundEffect,St=1/vr.tileToMeter;{const Kt=d.translatePosMatrix(Vt.projMatrix,nr,st,vt),Ut=Ft.getDefaultSegment();qt(Vt,Ft,Ut,Kt,St)}if(qe)for(let Kt=0;Kt<4;Kt++){const Ut=a.e9[Kt](Vt),ur=p.getTile(Ut);if(!ur)continue;const Ar=ur.getBucket(b);if(!Ar||Ar.projection.name!==ct.projection.name||!Ar.groundEffect||Ar.groundEffect&&!Ar.groundEffect.hasData())continue;const Ur=Ar.groundEffect;let Nr,_r;Kt===0?(Nr=[-a.al,0,0],_r=1):Kt===1?(Nr=[a.al,0,0],_r=0):Kt===2?(Nr=[0,-a.al,0],_r=3):(Nr=[0,a.al,0],_r=2);const nn=Ur.regionSegments[_r];if(!nn)continue;const Jr=new Float32Array(16);a.br(Jr,Vt.projMatrix,Nr),qt(Vt,Ur,nn,d.translatePosMatrix(Jr,nr,st,vt),St)}}}function Qie(_,d,p,b,M,L,O){b.centroidVertexArray.length===0&&b.createCentroidsBuffer();const z=L?L.findDEMTileFor(p):null;if(!(z&&z.dem||O))return;L&&z&&z.dem&&b.selfDEMTileTimestamp!==z.dem._timestamp&&(b.borderDoneWithNeighborZ=[-1,-1,-1,-1],b.selfDEMTileTimestamp=z.dem._timestamp);const V=Ee=>new a.P(Math.ceil((Ee+a.ed)*a.ee),0),Y=Ee=>{const qe=d.getSource().minzoom,Ze=gt=>{const ct=d.getTileByID(gt);if(ct&&ct.hasData())return ct.getBucket(M)},Ve=[0,-1,1];for(const gt of Ve){if(Ee.overscaledZ+gt(Q[0]=Math.min(Ee.min.y,qe.min.y),Q[1]=Math.max(Ee.max.y,qe.max.y),Q[2]=a.al-qe.min.x>Ee.max.x?qe.min.x-a.al:Ee.max.x,Q),le=(Ee,qe)=>(Q[0]=Math.min(Ee.min.x,qe.min.x),Q[1]=Math.max(Ee.max.x,qe.max.x),Q[2]=a.al-qe.min.y>Ee.max.y?qe.min.y-a.al:Ee.max.y,Q),de=[(Ee,qe)=>ce(Ee,qe),(Ee,qe)=>ce(qe,Ee),(Ee,qe)=>le(Ee,qe),(Ee,qe)=>le(qe,Ee)],be=(Ee,qe,Ze,Ve,gt,ct,ht)=>{if(!L)return 0;const ot=[[ct?Ze:Ee,ct?Ee:Ze,0],[ct?Ze:qe,ct?qe:Ze,0]],st=ht<0?a.al+ht:ht,vt=[ct?st:(Ee+qe)/2,ct?(Ee+qe)/2:st,0];return Ze===0&&ht<0||Ze!==0&&ht>0?L.getForTilePoints(gt,[vt],!0,Ve):ot.push(vt),L.getForTilePoints(p,ot,!0,z),Math.max(ot[0][2],ot[1][2],vt[2])/L.exaggeration()};for(let Ee=0;Ee<4;Ee++){const qe=b.borderFeatureIndices[Ee];if(qe.length===0)continue;const Ze=a.e9[Ee](p),Ve=Y(Ze);if(!(Ve&&Ve instanceof a.ea))continue;const gt=L?L.findDEMTileFor(Ze):null;if(!(gt&>.dem||O)||(L&>&>.dem&&b.borderDEMTileTimestamp[Ee]!==gt.dem._timestamp&&(b.borderDoneWithNeighborZ[Ee]=-1,b.borderDEMTileTimestamp[Ee]=gt.dem._timestamp),b.borderDoneWithNeighborZ[Ee]===Ve.canonical.z))continue;Ve.centroidVertexArray.length===0&&Ve.createCentroidsBuffer();const ct=(Ee<2?1:5)-Ee,ht=Ve.borderDoneWithNeighborZ[ct]!==b.canonical.z,ot=Ve.borderFeatureIndices[ct];let st=0;if(b.canonical.z!==Ve.canonical.z){for(const vt of qe)b.showCentroid(b.featuresOnBorder[vt]);if(ht)for(const vt of ot)Ve.showCentroid(Ve.featuresOnBorder[vt]);b.borderDoneWithNeighborZ[Ee]=Ve.canonical.z,Ve.borderDoneWithNeighborZ[ct]=b.canonical.z}for(const vt of qe){const Pt=b.featuresOnBorder[vt],Tt=b.centroidData[Pt.centroidDataIndex],qt=Pt.borders[Ee];let Vt;for(;stqt[0]+3||nr[0]>qt[0]-3)break;Ve.showCentroid(Vt),st++}if(Vt&&stqt[1]-3)&&(vr++,++st!==ot.length);)Vt=Ve.featuresOnBorder[ot[st]];Vt=Ve.featuresOnBorder[ot[nr]];let Ft=!1;if(vr>=1){const Ut=Vt.borders[ct];Math.abs(qt[0]-Ut[0])<3&&Math.abs(qt[1]-Ut[1])<3&&(vr=1,Ft=!0,st=nr+1)}else if(vr===0){b.showCentroid(Pt);continue}const St=Ve.centroidData[Vt.centroidDataIndex];O&&Ft&&(((ye=Tt).flags|(Oe=St).flags)&a.ec?(ye.flags|=a.ec,Oe.flags|=a.ec):(ye.flags&=~a.ec,Oe.flags&=~a.ec));const Kt=Pt.intersectsCount()>1||Vt.intersectsCount()>1;if(vr>1)st=nr,Tt.centroidXY=St.centroidXY=new a.P(0,0);else if(gt&>.dem&&!Kt){const Ut=de[Ee](Tt,St),ur=Ee%2?a.al-1:0,Ar=be(Ut[0],Math.min(a.al-1,Ut[1]),ur,gt,Ze,Ee<2,Ut[2]);Tt.centroidXY=St.centroidXY=V(Ar)}else Kt?Tt.centroidXY=St.centroidXY=new a.P(0,0):(Tt.centroidXY=b.encodeBorderCentroid(Pt),St.centroidXY=Ve.encodeBorderCentroid(Vt));b.writeCentroidToBuffer(Tt),Ve.writeCentroidToBuffer(St)}else b.showCentroid(Pt)}b.borderDoneWithNeighborZ[Ee]=Ve.canonical.z,Ve.borderDoneWithNeighborZ[ct]=b.canonical.z}var ye,Oe;(b.needsCentroidUpdate||!b.centroidVertexBuffer&&b.centroidVertexArray.length!==0)&&b.uploadCentroid(_)}const Ld=[1,0,0],V3=[0,1,0],Gc=[0,0,1];function hp(_,d,p){const b=p.transform,M=p.shadowRenderer;if(!M)return!0;const L=_.toUnwrapped(),O=b.tileSize*M._cascades[p.currentShadowCascade].scale;let z=d;if(b.elevation){const ye=b.elevation.getMinMaxForTile(_);ye&&(z+=ye.max)}const V=[...M.shadowDirection];V[2]=-V[2];const Y=M.computeSimplifiedTileShadowVolume(L,z,O,V);if(!Y)return!1;const Q=[Ld,V3,Gc,V,[V[0],0,V[2]],[0,V[1],V[2]]],ce=b.projection.name==="globe",le=b.scaleZoom(O),de=a.cB.fromInvProjectionMatrix(b.invProjMatrix,b.worldSize,le,!ce),be=M.getCurrentCascadeFrustum();return de.intersectsPrecise(Y.vertices,Y.planes,Q)===0||be.intersectsPrecise(Y.vertices,Y.planes,Q)===0}function cv(_){const{painter:d,source:p,layer:b,coords:M}=_;let L=_.defines;const O=d.context,z=d.renderPass==="shadow",V=d.renderPass==="light-beam",Y=d.shadowRenderer,Q=a.ef(d.transform.center.lat,d.transform.zoom),ce=bm(d,b.paint.get("building-cutoff-fade-range"));ce.shouldRenderCutoff&&(L=L.concat("RENDER_CUTOFF")),_.floodLightIntensity>0&&(L=L.concat("FLOOD_LIGHT"));for(const le of M){const de=p.getTile(le),be=de.getBucket(b);if(!be)continue;Y&&Y.getMaxCascadeForTile(le.toUnwrapped())===0&&(L=L.concat("SHADOWS_SINGLE_CASCADE"));const ye=be.programConfigurations.get(b.id);let Oe,Ee,qe,Ze=d.translatePosMatrix(le.expandedProjMatrix,de,[0,0],"map");if(Ze=a.cS(a.bC(),Ze,[1,1,_.verticalScale]),z&&Y){if(hp(de.tileID,be.maxHeight*Q,d))continue;let gt=Y.calculateShadowPassMatrixFromTile(de.tileID.toUnwrapped());gt=a.cS(a.bC(),gt,[1,1,_.verticalScale]),qe=Mm(gt),Oe=Ee=d.getOrCreateProgram("buildingDepth",{config:ye,defines:L,overrideFog:!1})}else if(V)Oe=Ee=d.getOrCreateProgram("buildingBloom",{config:ye,defines:L,overrideFog:!1}),qe=ZI(Ze);else{const gt=d.transform.calculatePosMatrix(le.toUnwrapped(),d.transform.worldSize);a.cS(gt,gt,[1,1,_.verticalScale]);const ct=a.bC();a.cS(ct,gt,[1,-1,1/Q]),a.bl(ct,ct),a.eg(ct,ct);const ht=d.transform.getFreeCameraOptions().position,ot=1<{if(V){const ht=gt.entranceBloom;ct.draw(d,O.gl.TRIANGLES,_.depthMode,Fn.disabled,_.blendMode,Rn.disabled,qe,b.id,ht.layoutVertexBuffer,ht.indexBuffer,ht.segmentsBucket,b.paint,d.transform.zoom,ye,[ht.layoutAttenuationBuffer,ht.layoutColorBuffer])}else{const ht=gt.segmentsBucket;let ot=[gt.layoutNormalBuffer,gt.layoutCentroidBuffer,gt.layoutColorBuffer,gt.layoutFloodLightDataBuffer];gt.layoutFacadePaintBuffer&&(ot=ot.concat([gt.layoutFacadeDataBuffer,gt.layoutFacadeVerticalRangeBuffer,gt.layoutFacadePaintBuffer])),ct.draw(d,O.gl.TRIANGLES,_.depthMode,Fn.disabled,_.blendMode,z?Rn.disabled:Rn.backCW,qe,b.id,gt.layoutVertexBuffer,gt.indexBuffer,ht,b.paint,d.transform.zoom,ye,ot)}};d.uploadCommonUniforms(O,Ee,le.toUnwrapped(),null,ce),be.buildingWithoutFacade&&Ve(be.buildingWithoutFacade,Ee),be.buildingWithFacade&&(Oe!==Ee&&d.uploadCommonUniforms(O,Oe,le.toUnwrapped(),null,ce),Ve(be.buildingWithFacade,Oe))}}function Ak(_,d,p,b,M,L,O,z,V,Y,Q,ce,le){const de=_.context.gl,be=_.depthModeForSublayer(1,cn.ReadOnly,de.LEQUAL,!0),ye=.1*(1-(Oe=Q))+3*Oe;var Oe;const Ee=_._showOverdrawInspector,qe=ce,Ze=new q3;Ee||up(Ze,_,d,p,b,be,new Fn({func:de.ALWAYS,mask:255},255,255,de.KEEP,de.KEEP,de.REPLACE),new Jn([de.ONE,de.ONE,de.ONE,de.ONE],a.ao.transparent,[!1,!1,!1,!0],de.MIN),Rn.disabled,M,"sdf",L,O,z,V,Y,ye,qe,!1);{const Ve=Ee?Fn.disabled:new Fn({func:de.EQUAL,mask:255},255,255,de.KEEP,de.DECR,de.DECR),gt=Ee?_.colorModeForRenderPass():new Jn([de.ONE_MINUS_DST_ALPHA,de.DST_ALPHA,de.ONE,de.ONE],a.ao.transparent,[!0,!0,!0,!0]);up(Ze,_,d,p,b,be,Ve,gt,Rn.disabled,M,"color",L,O,z,V,Y,ye,qe,!1)}}function Ek(_){return[_[0]*a.eh,_[1]*a.eh,_[2]*a.eh,0]}function dv(_,d,p,b,M,L,O,z,V){const Y=b.getSource(),Q=p.globeSharedBuffers;if(!Q)return;let ce,le,de;if(d&&(ce=b.getTile(d)),Y instanceof a.aU?(le=Y.texture,de=a.dK(0,0,p.transform)):ce&&d&&(le=ce.texture,de=a.dK(d.canonical.z,d.canonical.x,p.transform)),!le||!de)return;_||(de=a.cS(a.bC(),de,[1,-1,1]));const be=p.context,ye=be.gl,Oe=M.paint.get("raster-resampling")==="nearest"?ye.NEAREST:ye.LINEAR,Ee=p.colorModeForDrapableLayerRenderPass(L),qe=O.defines;qe.push("GLOBE_POLES");const Ze=new cn(ye.LEQUAL,cn.ReadWrite,p.depthRangeFor3D),Ve=Float32Array.from(p.transform.expandedFarZProjMatrix),gt=Float32Array.from(a.bk(a.dJ(new a.cD(0,0,0))));p.terrain&&p.terrain.prepareDrawTile(),be.activeTexture.set(ye.TEXTURE0),le.bind(Oe,ye.CLAMP_TO_EDGE),be.activeTexture.set(ye.TEXTURE1),le.bind(Oe,ye.CLAMP_TO_EDGE),"useMipmap"in le&&be.extTextureFilterAnisotropic&&p.transform.pitch>20&&ye.texParameterf(ye.TEXTURE_2D,be.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,be.extTextureFilterAnisotropicMax);const[ct,ht,ot,st]=d?Q.getPoleBuffers(d.canonical.z,!1):Q.getPoleBuffers(0,!0),vt=M.paint.get("raster-elevation");let Pt;_?(Pt=ct,p.renderDefaultNorthPole=vt!==0):(Pt=ht,p.renderDefaultSouthPole=vt!==0);const Tt=Ek(O.mix),qt=((nr,vr,Ft,St,Kt,Ut,ur,Ar,Ur,Nr,_r,nn,Jr)=>QI(nr,vr,Ft,new Float32Array(16),new Float32Array(9),[0,0],St,[0,0],[0,0,0,0],1,{opacity:1,mix:0},Ut,[0,0],Ar,2,Nr,_r,nn,1,0,Jr))(Ve,gt,de,a.aj(p.transform.zoom),0,M,0,vt,0,Tt,O.offset,O.range,L),Vt=p.getOrCreateProgram("raster",{defines:qe});p.uploadCommonUniforms(be,Vt,null),Vt.draw(p,ye.TRIANGLES,Ze,V,Ee,z,qt,M.id,Pt,ot,st)}function iP(_){const d=_._nearZ,p=_.projection.farthestPixelDistance(_),b=p-d,M=.2*_.height,L=d+M;return[d,p,(L-M-d)/b,(L-d)/b]}function fp(_,d,p,b){if(_)return d instanceof Qo&&_ instanceof sp?d.getTextureDescriptor(_,p,!0):{texture:_.texture,mix:Ek(b.mix),offset:b.offset,buffer:0,tileSize:1}}var Qi=a.ei([{name:"a_index",type:"Int16",components:1}]);class Ik{constructor(d,p,b,M){const L={width:b[0],height:b[1],data:null},O=d.gl;this.targetColorTexture=new a.T(d,L,O.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new a.T(d,L,O.RGBA8,{useMipmap:!1}),this.context=d,this.updateParticleTexture(p,M),this.lastInvalidatedAt=0}updateParticleTexture(d,p){if(this.particleTextureDimension===p.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());const b=this.context.gl,M=p.width*p.height;this.particleTexture0=new a.T(this.context,p,b.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new a.T(this.context,p,b.RGBA8,{premultiply:!1,useMipmap:!1});const L=new a.ej;L.reserve(M);for(let O=0;O0){const Tt=a.bj(p.canonical,V),qt=a.el(Tt);le=a.aB(new Float32Array(16),V.globeMatrix,qt),a.aB(le,V.projMatrix,le)}const de=a.bC();de[12]+=2*M/(a.o.devicePixelRatio*V.width),de[13]+=2*L/(a.o.devicePixelRatio*V.height),a.aB(le,de,le);const be=_.getOrCreateProgram("debug",{defines:ce}),ye=d.getTileByID(p.key);_.terrain&&_.terrain.setupElevationDraw(ye,be);const Oe=cn.disabled,Ee=Fn.disabled,qe=_.colorModeForRenderPass(),Ze="$debug";z.activeTexture.set(Y.TEXTURE0),_.emptyTexture.bind(Y.LINEAR,Y.CLAMP_TO_EDGE),Q?ye._makeGlobeTileDebugBuffers(_.context,V):ye._makeDebugTileBoundsBuffers(_.context,V.projection);const Ve=ye._tileDebugBuffer||_.debugBuffer,gt=ye._tileDebugIndexBuffer||_.debugIndexBuffer,ct=ye._tileDebugSegments||_.debugSegments;if(be.draw(_,Y.LINE_STRIP,Oe,Ee,qe,Rn.disabled,iv(le,b.toPremultipliedRenderColor(null)),Ze,Ve,gt,ct,null,null,null,[ye._globeTileDebugBorderBuffer]),O){const Tt=ye.latestRawTileData,qt=Math.floor((Tt&&Tt.byteLength||0)/1024);let Vt=p.canonical.toString();p.overscaledZ!==p.canonical.z&&(Vt+=` => ${p.overscaledZ}`),Vt+=` ${ye.state}`,Vt+=` ${qt}kb`,function(nr,vr){nr.initDebugOverlayCanvas();const Ft=nr.debugOverlayCanvas,St=nr.context.gl,Kt=nr.debugOverlayCanvas.getContext("2d");Kt.clearRect(0,0,Ft.width,Ft.height),Kt.shadowColor="white",Kt.shadowBlur=2,Kt.lineWidth=1.5,Kt.strokeStyle="white",Kt.textBaseline="top",Kt.font="bold 36px Open Sans, sans-serif",Kt.fillText(vr,5,5),Kt.strokeText(vr,5,5),nr.debugOverlayTexture.update(Ft),nr.debugOverlayTexture.bind(St.LINEAR,St.CLAMP_TO_EDGE)}(_,Vt)}const ht=d.getTile(p).tileSize,ot=512/Math.min(ht,512)*(p.overscaledZ/V.zoom)*.5,st=ye._tileDebugTextBuffer||_.debugBuffer,vt=ye._tileDebugTextIndexBuffer||_.quadTriangleIndexBuffer,Pt=ye._tileDebugTextSegments||_.debugSegments;be.draw(_,Y.TRIANGLES,Oe,Ee,Jn.alphaBlended,Rn.disabled,iv(le,a.ao.transparent.toPremultipliedRenderColor(null),ot),Ze,st,vt,Pt,null,null,null,[ye._globeTileDebugTextBuffer])}function Hg(_,d,p,b){Dt(_,0,d+p/2,_.transform.width,p,b)}function Ra(_,d,p,b){Dt(_,d-p/2,0,p,_.transform.height,b)}function Dt(_,d,p,b,M,L){const O=_.context,z=O.gl;z.enable(z.SCISSOR_TEST),z.scissor(d*a.o.devicePixelRatio,p*a.o.devicePixelRatio,b*a.o.devicePixelRatio,M*a.o.devicePixelRatio),O.clear({color:L}),z.disable(z.SCISSOR_TEST)}const dP=a.ei([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:Pk}=dP;function lf(_,d,p,b){_.emplaceBack(d,p,b)}class Lk{constructor(d){this.vertexArray=new a.em,this.indices=new a.b0,lf(this.vertexArray,-1,-1,1),lf(this.vertexArray,1,-1,1),lf(this.vertexArray,-1,1,1),lf(this.vertexArray,1,1,1),lf(this.vertexArray,-1,-1,-1),lf(this.vertexArray,1,-1,-1),lf(this.vertexArray,-1,1,-1),lf(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=d.createVertexBuffer(this.vertexArray,Pk),this.indexBuffer=d.createIndexBuffer(this.indices),this.segment=a.bg.simpleSegment(0,0,36,12)}}function Wg(_,d,p,b,M,L){const O=_.context.gl,z=d.paint.get("sky-atmosphere-color"),V=d.paint.get("sky-atmosphere-halo-color"),Y=d.paint.get("sky-atmosphere-sun-intensity"),Q=((ce,le,de,be,ye)=>({u_matrix_3f:ce,u_sun_direction:le,u_sun_intensity:de,u_color_tint_r:[be.r,be.g,be.b,be.a],u_color_tint_m:[ye.r,ye.g,ye.b,ye.a],u_luminance:5e-5}))(a.eo(a.dO(),b),M,Y,z.toPremultipliedRenderColor(null),V.toPremultipliedRenderColor(null));O.framebufferTexture2D(O.FRAMEBUFFER,O.COLOR_ATTACHMENT0,O.TEXTURE_CUBE_MAP_POSITIVE_X+L,d.skyboxTexture,0),p.draw(_,O.TRIANGLES,cn.disabled,Fn.disabled,Jn.unblended,Rn.frontCW,Q,"skyboxCapture",d.skyboxGeometry.vertexBuffer,d.skyboxGeometry.indexBuffer,d.skyboxGeometry.segment)}const uP=a.ei([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class bx{constructor(d){const p=new a.ep;p.emplaceBack(-1,1,1,0,0),p.emplaceBack(1,1,1,1,0),p.emplaceBack(1,-1,1,1,1),p.emplaceBack(-1,-1,1,0,1);const b=new a.b0;b.emplaceBack(0,1,2),b.emplaceBack(2,3,0),this.vertexBuffer=d.createVertexBuffer(p,uP.members),this.indexBuffer=d.createIndexBuffer(b),this.segments=a.bg.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const Jie=a.ei([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_size_scale",components:1},{type:"Float32",name:"a_fade_opacity",components:1}]);class eae{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class hP{constructor(d){this.colorModeAlphaBlendedWriteRGB=new Jn([1,nf,1,nf],a.ao.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new Jn([1,0,1,0],a.ao.transparent,[!1,!1,!1,!0]),this.params=new eae,this.updateNeeded=!0}update(d){const p=d.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new bx(p);const b=this.params.sizeRange,M=this.params.intensityRange,L=function(Q){const ce=a.eq(30),le=[];for(let de=0;de{const ot=L.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];ht&&ot.push("ALPHA_PASS");const st=d.getOrCreateProgram("globeAtmosphere",{defines:ot}),vt=((Tt,qt,Vt,nr,vr,Ft,St,Kt,Ut,ur,Ar,Ur)=>({u_frustum_tl:Tt,u_frustum_tr:qt,u_frustum_br:Vt,u_frustum_bl:nr,u_horizon:vr,u_transition:Ft,u_fadeout_range:St,u_atmosphere_fog_color:Kt.toArray01(),u_high_color:Ut.toArray01(),u_space_color:ur.toArray01(),u_temporal_offset:Ar,u_horizon_angle:Ur}))(L.frustumCorners.TL,L.frustumCorners.TR,L.frustumCorners.BR,L.frustumCorners.BL,L.frustumCorners.horizon,z,Oe,Q,le,be,qe,gt);d.uploadCommonUniforms(b,st);const Pt=this.atmosphereBuffer;Pt&&st.draw(d,M.TRIANGLES,O,Fn.disabled,ht?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,Rn.backCW,vt,ht?"atmosphere_glow_alpha":"atmosphere_glow",Pt.vertexBuffer,Pt.indexBuffer,Pt.segments)};ct(!1),ct(!0)}drawStars(d,p){const b=a.aA(p.properties.get("star-intensity"),0,1);if(b===0)return;const M=d.context,L=M.gl,O=d.transform,z=d.getOrCreateProgram("stars"),V=a.c7([]);a.c9(V,V,-O._pitch),a.c8(V,V,-O.angle),a.c9(V,V,a.an(O._center.lat)),a.et(V,V,-a.an(O._center.lng));const Y=a.cc(new Float32Array(16),V),Q=a.aB([],O.starsProjMatrix,Y),ce=a.eo([],Y),le=a.eu([],ce),de=[0,1,0];a.dQ(de,de,le),a.c5(de,de,this.params.sizeMultiplier);const be=[1,0,0];a.dQ(be,be,le),a.c5(be,be,this.params.sizeMultiplier);const ye=(Oe=de,Ee=be,qe=b,{u_matrix:Float32Array.from(Q),u_up:Oe,u_right:Ee,u_intensity_multiplier:qe});var Oe,Ee,qe;d.uploadCommonUniforms(M,z),this.starsVx&&this.starsIdx&&z.draw(d,L.TRIANGLES,cn.disabled,Fn.disabled,this.colorModeAlphaBlendedWriteRGB,Rn.disabled,ye,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}class Ok{constructor(){this.visibleTiles=[]}updateBorders(d,p){const b=[],M=[],L=d._getRenderableCoordinates(!1,!0);for(const V of L){const Y=d.getTile(V);if(!Y.hasData())continue;const Q=Y.getBucket(p);Q&&(Q.isEmpty()||(b.push(V.key),M.push({bucket:Q,tileID:V.canonical})))}let O=b.length!==this.visibleTiles.length;if(!O){b.sort();for(let V=0;VV.tileID.z-Y.tileID.z||V.tileID.x-Y.tileID.x||V.tileID.y-Y.tileID.y);for(const V of M){const Y=new Array,Q=new Array,ce=V.bucket;for(const le of ce.featuresOnBorder)z.has(le.featureId)?Q.push(le.footprintIndex):(z.add(le.featureId),Y.push(le.footprintIndex));ce.updateFootprintHiddenFlags(Y,a.ev,!1),ce.updateFootprintHiddenFlags(Q,a.ev,!0)}}}function Dk(_,d){const p=[..._],b=d.cameraWorldSizeForFog/d.worldSize,M=a.bA([]);return a.cS(M,M,[b,b,1]),a.aB(p,M,p),a.aB(p,d.worldToFogMatrix,p),p}function Rk(_,d,p,b,M){const L=p.material,O=b.context,{baseColorTexture:z,metallicRoughnessTexture:V}=L.pbrMetallicRoughness,{normalTexture:Y,occlusionTexture:Q,emissionTexture:ce}=L;function le(be,ye,Oe){if(be&&(_.push(ye),O.activeTexture.set(O.gl.TEXTURE0+Oe),be.gfxTexture)){const{minFilter:Ee,magFilter:qe,wrapS:Ze,wrapT:Ve}=be.sampler;be.gfxTexture.bindExtraParam(Ee,qe,Ze,Ve)}}le(z,"HAS_TEXTURE_u_baseColorTexture",bl.BaseColor),le(V,"HAS_TEXTURE_u_metallicRoughnessTexture",bl.MetallicRoughness),le(Y,"HAS_TEXTURE_u_normalTexture",bl.Normal),le(Q,"HAS_TEXTURE_u_occlusionTexture",bl.Occlusion),le(ce,"HAS_TEXTURE_u_emissionTexture",bl.Emission),M&&(M.texture||(M.texture=new a.d$(b.context,M.image,[M.image.height,M.image.height,M.image.height],O.gl.RGBA8)),O.activeTexture.set(O.gl.TEXTURE0+bl.LUT),M.texture&&M.texture.bind(O.gl.LINEAR,O.gl.CLAMP_TO_EDGE),_.push("APPLY_LUT_ON_GPU")),p.texcoordBuffer&&(_.push("HAS_ATTRIBUTE_a_uv_2f"),d.push(p.texcoordBuffer)),p.colorBuffer&&(_.push(p.colorBuffer.itemSize===12?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),d.push(p.colorBuffer)),p.normalBuffer&&(_.push("HAS_ATTRIBUTE_a_normal_3f"),d.push(p.normalBuffer)),p.pbrBuffer&&(_.push("HAS_ATTRIBUTE_a_pbr"),_.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),d.push(p.pbrBuffer)),L.alphaMode!=="OPAQUE"&&L.alphaMode!=="MASK"||_.push("UNPREMULT_TEXTURE_IN_SHADER"),L.defined||_.push("DIFFUSE_SHADED");const de=b.shadowRenderer;de&&(_.push("RENDER_SHADOWS","DEPTH_TEXTURE"),de.useNormalOffset&&_.push("NORMAL_OFFSET"))}function Fk(_,d,p,b,M,L){const O=_.modelOpacity,z=d.context,V=new cn(d.context.gl.LEQUAL,_.isLightMesh?cn.ReadOnly:cn.ReadWrite,d.depthRangeFor3D),Y=d.transform,Q=_.mesh,ce=Q.material,le=ce.pbrMetallicRoughness,de=d.style.fog;let be;be=d.transform.projection.zAxisUnit==="pixels"?[..._.nodeModelMatrix]:a.aB([],b.zScaleMatrix,_.nodeModelMatrix),a.aB(be,b.negCameraPosMatrix,be);const ye=a.bl([],be);a.eg(ye,ye);const Oe=p.paint.get("model-color-use-theme").constantOr("default")==="none",Ee=p.paint.get("model-emissive-strength").constantOr(0),qe=$g(new Float32Array(_.worldViewProjection),new Float32Array(be),new Float32Array(ye),null,d,O,le.baseColorFactor,ce.emissiveFactor,le.metallicFactor,le.roughnessFactor,ce,Ee,p,void 0,void 0,_.materialOverride,_.modelColor),Ze={defines:[]},Ve=[],gt=d.shadowRenderer;gt&&(gt.useNormalOffset=!1),Rk(Ze.defines,Ve,Q,d,Oe?null:p.lut);let ct=null;if(de){const st=Dk(_.nodeModelMatrix,d.transform);if(ct=new Float32Array(st),Y.projection.name!=="globe"){const vt=Q.aabb.min,Pt=Q.aabb.max,[Tt,qt]=de.getOpacityForBounds(st,vt[0],vt[1],Pt[0],Pt[1]);Ze.overrideFog=Tt>=ir||qt>=ir}}const ht=bm(d,p.paint.get("model-cutoff-fade-range"));ht.shouldRenderCutoff&&Ze.defines.push("RENDER_CUTOFF");const ot=d.getOrCreateProgram("model",Ze);d.uploadCommonUniforms(z,ot,null,ct,ht),d.renderPass!=="shadow"&>&>.setupShadowsFromMatrix(_.nodeModelMatrix,ot),ot.draw(d,z.gl.TRIANGLES,V,M,L,Q.material.doubleSided?Rn.disabled:Rn.backCCW,qe,p.id,Q.vertexBuffer,Q.indexBuffer,Q.segments,p.paint,d.transform.zoom,void 0,Ve)}function uv(_,d){return _.style._importedAsBasemap?"basemap":d.scope}function Gg(_,d,p,b,M,L,O,z,V,Y){const Q=_.transform,ce=!!d.isGeometryBloom&&d.isGeometryBloom;if(ce&&_.renderPass==="shadow")return;const le=Q.projection.name==="globe"?a.eD(p,Q):[...p];a.aB(le,le,d.globalMatrix);const de=a.aB([],b,le);if(d.meshes)for(const be of d.meshes){const ye=z.get(be.material.name);if(ye&&ye.opacity<=0)continue;if(be.material.alphaMode!=="BLEND"){O.push({mesh:be,depth:0,modelIndex:M,worldViewProjection:de,nodeModelMatrix:le,isLightMesh:ce,materialOverride:ye,modelOpacity:V,modelColor:Y});continue}const Oe=a.af([],be.centroid,de);!Q.isOrthographic&&Oe[2]<=0||L.push({mesh:be,depth:Oe[2],modelIndex:M,worldViewProjection:de,nodeModelMatrix:le,isLightMesh:ce,materialOverride:ye,modelOpacity:V,modelColor:Y})}if(d.children)for(const be of d.children)Gg(_,be,p,b,M,L,O,z,V,Y)}function wh(_,d,p,b){const M=p.shadowRenderer;if(!M)return;const L=M.getShadowPassDepthMode(),O=M.getShadowPassColorMode(),z=M.calculateShadowPassMatrixFromMatrix(d),V=B3(z);p.getOrCreateProgram("modelDepth",{defines:p._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(p,p.context.gl.TRIANGLES,L,Fn.disabled,O,Rn.disabled,V,b.id,_.vertexBuffer,_.indexBuffer,_.segments,b.paint,p.transform.zoom,void 0,void 0)}function fP(_,d,p,b,M,L){for(const O of M){const z=Object.assign({},b);z.part=O;const V={type:"Unknown",id:d,properties:z},Y={orientation:_.paint.get("model-rotation").evaluate(V,p)};L.set(O,Y)}}function pP(_,d,p,b,M,L){for(const O of M){const z=Object.assign({},b);z.part=O;const V={type:"Unknown",id:d,properties:z},Y={color:_.paint.get("model-color").evaluate(V,p),colorMix:_.paint.get("model-color-mix-intensity").evaluate(V,p),opacity:_.paint.get("model-opacity").evaluate(V,p),emissionStrength:_.paint.get("model-emissive-strength").evaluate(V,p)};L.set(O,Y)}}function mP(_,d,p,b,M){let L=!1;for(const z of b)z.modelOpacity!==1&&(Fk(z,_,d,M[z.modelIndex],Fn.disabled,Jn.disabled),L=!0);for(const z of b)Fk(z,_,d,M[z.modelIndex],z.modelOpacity!==1?_.stencilModeFor3D():Fn.disabled,_.colorModeForRenderPass());L&&_.resetStencilClippingMasks();const O=Jn.additive;for(const z of p)Fk(z,_,d,M[z.modelIndex],Fn.disabled,z.isLightMesh?O:_.colorModeForRenderPass())}function gP(_,d,p){const b=d.updateZoomBasedPaintProperties(),M=function(L,O,z){let V,Y,Q,ce=L.terrain?L.terrain.exaggeration():0;if(L.terrain&&ce>0){const le=L.terrain,de=le.findDEMTileFor(z);de&&de.dem?V=a.eF.create(le,z,de):ce=0}if(ce===0&&(O.terrainElevationMin=0,O.terrainElevationMax=0),ce===O.validForExaggeration&&(ce===0||V&&V._demTile&&V._demTile.tileID===O.validForDEMTile.id&&V._dem._timestamp===O.validForDEMTile.timestamp))return!1;for(const le in O.instancesPerModel){const de=O.instancesPerModel[le];for(let be=0;beY&&(Y=de.max)}const Q=a.aA(b.x,L,O)-b.x,ce=a.aA(b.y,z,V)-b.y,le=a.cf(Y,d.center.lat)-b.z;return d._zoomFromMercatorZ(Math.sqrt(Q*Q+ce*ce+le*le))}function yP(_,d,p,b,M,L,O){const z=_.context,V=_.renderPass==="shadow",Y=_.shadowRenderer,Q=V&&Y?Y.getShadowPassDepthMode():new cn(z.gl.LEQUAL,cn.ReadWrite,_.depthRangeFor3D),ce=_.isTileAffectedByFog(L),le=_.transform.projection.name==="globe";if(p.meshes)for(const de of p.meshes){const be=le?[]:["MODEL_POSITION_ON_GPU"],ye=[];let Oe,Ee,qe;const Ze=!le&&b.instancedDataArray.length>20;Ze&&be.push("INSTANCED_ARRAYS");const Ve=bm(_,d.paint.get("model-cutoff-fade-range"));if(Ve.shouldRenderCutoff&&be.push("RENDER_CUTOFF"),V&&Y)Oe=_.getOrCreateProgram("modelDepth",{defines:be}),Ee=B3(O.shadowTileMatrix,O.shadowTileMatrix,Float32Array.from(p.globalMatrix)),qe=Y.getShadowPassColorMode();else{Rk(be,ye,de,_,d.paint.get("model-color-use-theme").constantOr("default")==="none"?null:d.lut),Oe=_.getOrCreateProgram("model",{defines:be,overrideFog:ce});const ct=de.material,ht=ct.pbrMetallicRoughness,ot=d.paint.get("model-opacity").constantOr(1),st=d.paint.get("model-emissive-strength").constantOr(0);Ee=$g(L.expandedProjMatrix,Float32Array.from(p.globalMatrix),new Float32Array(16),null,_,ot,ht.baseColorFactor,ct.emissiveFactor,ht.metallicFactor,ht.roughnessFactor,ct,st,d,M),Y&&(O.shadowUniformsInitialized?Oe.setShadowUniformValues(z,Y.getShadowUniformValues()):(Y.setupShadows(L.toUnwrapped(),Oe,"model-tile"),O.shadowUniformsInitialized=!0)),qe=Ve.shouldRenderCutoff||ot<1||ct.alphaMode!=="OPAQUE"?Jn.alphaBlended:Jn.unblended}_.uploadCommonUniforms(z,Oe,L.toUnwrapped(),null,Ve);const gt=de.material.doubleSided?Rn.disabled:Rn.backCCW;if(Ze)ye.push(b.instancedDataBuffer),Oe.draw(_,z.gl.TRIANGLES,Q,Fn.disabled,qe,gt,Ee,d.id,de.vertexBuffer,de.indexBuffer,de.segments,d.paint,_.transform.zoom,void 0,ye,b.instancedDataArray.length);else{const ct=V?"u_instance":"u_normal_matrix";for(let ht=0;htV[1]?O:V,L[0]=p.max[0],O=a.aC(a.eG(),L,M),z=O[1]V[1]?O:V,L[1]=p.min[1],O=a.aC(a.eG(),L,M),z=O[1]V[1]?O:V;const Y=a.aA(b[0],0,1),Q=100*d.pixelsPerMeter*a.aA(b[1],0,1),ce=a.aA(b[2],0,1),le=a.eH(a.eG(),z,V,Y),de=Math.tan(.5*d.fovX),be=-le[2]*de;if(Q===0)return le[1]<-Math.abs(be)?ce:1;const ye=(-Math.abs(be)-le[1])/Q,Oe=(qe,Ze,Ve)=>(1-Ve)*qe+Ve*Ze,Ee=a.aA(Oe(1,ce,ye),ce,1);return Oe(1,Ee,a.aA((d.pitch-20)/20,0,1))}class xP{}class Em{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(d,p,b){{const ce=this._storage.get(p.id);if(ce)return ce.lastUsedFrameIdx=d,ce.buf}const M=b.gl,L=M.getBufferParameter(M.ELEMENT_ARRAY_BUFFER,M.BUFFER_SIZE),O=new ArrayBuffer(L),z=new Int16Array(O);M.getBufferSubData(M.ELEMENT_ARRAY_BUFFER,0,new Int16Array(O));const V=new a.eJ;for(let ce=0;ce30&&(b.buf.destroy(),this._storage.delete(p))}destroy(){for(const[d,p]of this._storage)p.buf.destroy(),this._storage.delete(d)}}class wx{constructor(){this.occluderSize=30,this.depthOffset=-1e-4}}const jx=a.ei([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_rainParticleData",components:4}]);class pp{constructor(d){this.revealStart=11,this.revealRange=2}}const W3=a.ei([{type:"Float32",name:"a_pos_2f",components:2}]);class G3{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(d,p){const b=d.getOrCreateProgram("vignette");if(!this.vignetteVx||!this.vignetteIdx){const O=new a.eK,z=new a.b0;O.emplaceBack(-1,-1),O.emplaceBack(1,-1),O.emplaceBack(1,1),O.emplaceBack(-1,1),z.emplaceBack(0,1,2),z.emplaceBack(0,2,3),this.vignetteVx=d.context.createVertexBuffer(O,W3.members),this.vignetteIdx=d.context.createIndexBuffer(z)}const M=a.bg.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){d.uploadCommonUniforms(d.context,b);const O={u_vignetteShape:(L={vignetteShape:[p.start,p.range,Math.pow(10,p.fadePower)],vignetteColor:[p.color.r,p.color.g,p.color.b,p.color.a*p.strength]}).vignetteShape,u_vignetteColor:L.vignetteColor};b.draw(d,d.context.gl.TRIANGLES,cn.disabled,Fn.disabled,Jn.alphaBlended,Rn.disabled,O,"vignette",this.vignetteVx,this.vignetteIdx,M)}var L}}class K3{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(d,p){const b=d.getFreeCameraOptions().position,M=b.toAltitude(),L=b.toLngLat(),O=a.an(L.lng),z=a.an(L.lat),V=d.pixelsPerMeter/p,Y=O*a.eM,Q=a.eM*Math.log(Math.tan(Math.PI/4+z/2));if(this._offsetXPrev===void 0)this._offsetXPrev=0,this._offsetYPrev=0,this._elevationPrev=0,this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0;else{const ce=-this._offsetYPrev+Q,le=-this._elevationPrev+M;this._accumulatedOffsetX+=(-this._offsetXPrev+Y)*V,this._accumulatedOffsetY+=ce*V,this._accumulatedElevation+=le*V,this._offsetXPrev=Y,this._offsetYPrev=Q,this._elevationPrev=M}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function zk(_,d){return[-(_[0]-Math.floor(_[0]/d)*d),-(_[1]-Math.floor(_[1]/d)*d),-(_[2]-Math.floor(_[2]/d)*d)]}function su(_){const d=a.eq(1323123451230),p=[];for(let b=0;b<_;++b){const M=2*d()-1,L=2*d()-1,O=2*d()-1;p.push(a.d5(M,L,O))}return p}function md(_,d,p,b,M){const L=a.aA((M-p)/(b-p),0,1);return(1-L)*_+L*d}class Kg{constructor(d){this._movement=new K3,this._accumulatedTimeFromStart=0,this._prevTime=Date.now()/1e3,this._vignette=new G3,this._ppmScaleFactor=d}destroy(){this.particlesVx&&this.particlesVx.destroy(),this.particlesIdx&&this.particlesIdx.destroy(),this._vignette&&this._vignette.destroy()}updateOnRender(d,p){const b=d.transform;this._movement.update(b,this._ppmScaleFactor);const M=b.starsProjMatrix,L=a.c7([]);a.c9(L,L,a.an(90)-b._pitch),a.c8(L,L,-b.angle);const O=a.cc(new Float32Array(16),L),z=a.eL(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1),V=a.eg([],z),Y=a.aB([],V,O),Q=Date.now()/1e3;return this._accumulatedTimeFromStart+=(Q-this._prevTime)*p,this._prevTime=Q,{projectionMatrix:M,modelviewMatrix:Y}}}class Bk extends Kg{constructor(d){super(4.25),this._params={overrideStyleParameters:!1,intensity:.5,timeFactor:1,velocityConeAperture:0,velocity:300,boxSize:2500,dropletSizeX:1,dropletSizeYScale:10,distortionStrength:70,screenThinning:{intensity:.57,start:.46,range:1.17,fadePower:.17,affectedRatio:1,particleOffset:-.2},color:{r:.66,g:.68,b:.74,a:.7},direction:{x:-50,y:-35},shapeDirPower:2,shapeNormalPower:1},this._revealParams=new pp("Precipitation > Rain"),this._vignetteParams={strength:1,start:.7,range:1,fadePower:.4,color:{r:.27,g:.27,b:.27,a:1}},this.particlesCount=16e3}update(d){const p=d.context;if(!this.particlesVx){const b=su(this.particlesCount),M=new a.eN,L=new a.b0;let O=0;const z=a.eq(1323123451230);for(let V=0;Vb)return;const M=md(0,1,p.revealStart,p.revealStart+p.revealRange,b);if(!this.particlesVx||!this.particlesIdx)return;const L=structuredClone(this._params);let O=[-L.direction.x,L.direction.y,-100];a.aw(O,O);const z=structuredClone(this._vignetteParams);z.strength*=M,L.overrideStyleParameters||(L.intensity=d.style.rain.state.density,L.timeFactor=d.style.rain.state.intensity,L.color=structuredClone(d.style.rain.state.color),O=structuredClone(d.style.rain.state.direction),L.screenThinning.intensity=d.style.rain.state.centerThinning,L.dropletSizeX=d.style.rain.state.dropletSize[0],L.dropletSizeYScale=d.style.rain.state.dropletSize[1]/d.style.rain.state.dropletSize[0],L.distortionStrength=100*d.style.rain.state.distortionStrength,z.strength=1,z.color=structuredClone(d.style.rain.state.vignetteColor));const V=this.updateOnRender(d,L.timeFactor),Y=d.context,Q=Y.gl,ce=d.transform;this.screenTexture&&this.screenTexture.size[0]===d.width&&this.screenTexture.size[1]===d.height||(this.screenTexture=new a.T(Y,{width:d.width,height:d.height,data:null},Q.RGBA8)),L.distortionStrength>0&&(Y.activeTexture.set(Q.TEXTURE0),this.screenTexture.bind(Q.LINEAR,Q.CLAMP_TO_EDGE),Q.copyTexSubImage2D(Q.TEXTURE_2D,0,0,0,0,0,d.width,d.height));const le=d.getOrCreateProgram("rainParticle");d.uploadCommonUniforms(Y,le),Y.activeTexture.set(Q.TEXTURE0),this.screenTexture.bind(Q.LINEAR,Q.CLAMP_TO_EDGE);const de=[L.color.r,L.color.g,L.color.b,L.color.a],be=(ye,Oe)=>{const Ee=zk(this._movement.getPosition(),ye),qe=L.dropletSizeX,Ze=L.dropletSizeX*L.dropletSizeYScale,Ve=d.width/2,gt=d.height/2,ct=md(0,L.screenThinning.start,0,1,L.screenThinning.intensity),ht=md(.001,L.screenThinning.range,0,1,L.screenThinning.intensity),ot=md(0,L.screenThinning.particleOffset,0,1,L.screenThinning.intensity),st=(vt={modelview:V.modelviewMatrix,projection:V.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:Ee,velocityConeAperture:L.velocityConeAperture,velocity:L.velocity,boxSize:ye,rainDropletSize:[qe,Ze],distortionStrength:L.distortionStrength,rainDirection:O,color:de,screenSize:[ce.width,ce.height],thinningCenterPos:[Ve,gt],thinningShape:[ct,ht,Math.pow(10,L.screenThinning.fadePower)],thinningAffectedRatio:L.screenThinning.affectedRatio,thinningParticleOffset:ot,shapeDirectionalPower:L.shapeDirPower,shapeNormalPower:L.shapeNormalPower,mode:Oe?0:1},{u_modelview:Float32Array.from(vt.modelview),u_projection:Float32Array.from(vt.projection),u_time:vt.time,u_cam_pos:vt.camPos,u_texScreen:0,u_velocityConeAperture:vt.velocityConeAperture,u_velocity:vt.velocity,u_boxSize:vt.boxSize,u_rainDropletSize:vt.rainDropletSize,u_distortionStrength:vt.distortionStrength,u_rainDirection:vt.rainDirection,u_color:vt.color,u_screenSize:vt.screenSize,u_thinningCenterPos:vt.thinningCenterPos,u_thinningShape:vt.thinningShape,u_thinningAffectedRatio:vt.thinningAffectedRatio,u_thinningParticleOffset:vt.thinningParticleOffset,u_shapeDirectionalPower:vt.shapeDirectionalPower,u_shapeNormalPower:vt.shapeNormalPower,u_mode:vt.mode});var vt;const Pt=Math.round(L.intensity*this.particlesCount),Tt=a.bg.simpleSegment(0,0,4*Pt,2*Pt);le.draw(d,Q.TRIANGLES,cn.disabled,Fn.disabled,Jn.alphaBlended,Rn.disabled,st,"rain_particles",this.particlesVx,this.particlesIdx,Tt)};L.distortionStrength>0&&be(L.boxSize,!0),be(L.boxSize,!1),this._vignette.draw(d,z)}}const Z3=a.ei([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_snowParticleData",components:4},{type:"Float32",name:"a_snowParticleDataHorizontalOscillation",components:2}]);class Y3 extends Kg{constructor(d){super(2.25),this._params={overrideStyleParameters:!1,intensity:.85,timeFactor:.75,velocityConeAperture:70,velocity:40,horizontalOscillationRadius:4,horizontalOscillationRate:1.5,boxSize:2e3,billboardSize:2,shapeFadeStart:.27,shapeFadePower:.21,screenThinning:{intensity:.4,start:.15,range:1.4,fadePower:.24,affectedRatio:1,particleOffset:-.2},color:{r:1,g:1,b:1,a:1},direction:{x:-50,y:-35}},this._revealParams=new pp("Precipitation > Snow"),this._vignetteParams={strength:.3,start:.78,range:.46,fadePower:.2,color:{r:1,g:1,b:1,a:1}},this.particlesCount=16e3}update(d){const p=d.context;if(!this.particlesVx){const b=su(this.particlesCount),M=new a.eO,L=new a.b0;let O=0;const z=a.eq(1323123451230);for(let V=0;VO)return;const z=md(0,1,L.revealStart,L.revealStart+L.revealRange,O);M.strength*=z,p.overrideStyleParameters||(p.intensity=d.style.snow.state.density,p.timeFactor=d.style.snow.state.intensity,p.color=structuredClone(d.style.snow.state.color),b=structuredClone(d.style.snow.state.direction),p.screenThinning.intensity=d.style.snow.state.centerThinning,p.billboardSize=2.79*d.style.snow.state.flakeSize,M.strength=1,M.color=structuredClone(d.style.snow.state.vignetteColor));const V=this.updateOnRender(d,p.timeFactor);if(!this.particlesVx||!this.particlesIdx)return;const Y=d.context,Q=Y.gl,ce=d.transform,le=d.getOrCreateProgram("snowParticle");d.uploadCommonUniforms(Y,le),((de,be,ye)=>{const Oe=zk(this._movement.getPosition(),de),Ee=ce.width/2,qe=ce.height/2,Ze=md(0,ye.screenThinning.start,0,1,ye.screenThinning.intensity),Ve=md(.001,ye.screenThinning.range,0,1,ye.screenThinning.intensity),gt=md(0,ye.screenThinning.particleOffset,0,1,ye.screenThinning.intensity),ct=(ht={modelview:V.modelviewMatrix,projection:V.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:Oe,velocityConeAperture:ye.velocityConeAperture,velocity:ye.velocity,horizontalOscillationRadius:ye.horizontalOscillationRadius,horizontalOscillationRate:ye.horizontalOscillationRate,boxSize:de,billboardSize:1*ye.billboardSize,simpleShapeParameters:[ye.shapeFadeStart,ye.shapeFadePower],screenSize:[ce.width,ce.height],thinningCenterPos:[Ee,qe],thinningShape:[Ze,Ve,Math.pow(10,ye.screenThinning.fadePower)],thinningAffectedRatio:ye.screenThinning.affectedRatio,thinningParticleOffset:gt,color:[ye.color.r,ye.color.g,ye.color.b,ye.color.a],direction:b},{u_modelview:Float32Array.from(ht.modelview),u_projection:Float32Array.from(ht.projection),u_time:ht.time,u_cam_pos:ht.camPos,u_velocityConeAperture:ht.velocityConeAperture,u_velocity:ht.velocity,u_horizontalOscillationRadius:ht.horizontalOscillationRadius,u_horizontalOscillationRate:ht.horizontalOscillationRate,u_boxSize:ht.boxSize,u_billboardSize:ht.billboardSize,u_simpleShapeParameters:ht.simpleShapeParameters,u_screenSize:ht.screenSize,u_thinningCenterPos:ht.thinningCenterPos,u_thinningShape:ht.thinningShape,u_thinningAffectedRatio:ht.thinningAffectedRatio,u_thinningParticleOffset:ht.thinningParticleOffset,u_particleColor:ht.color,u_direction:ht.direction});var ht;const ot=Math.round(ye.intensity*this.particlesCount),st=a.bg.simpleSegment(0,0,4*ot,2*ot);this.particlesVx&&this.particlesIdx&&le.draw(d,Q.TRIANGLES,cn.disabled,Fn.disabled,Jn.alphaBlended,Rn.disabled,ct,"snow_particles",this.particlesVx,this.particlesIdx,st)})(p.boxSize,0,p),this._vignette.draw(d,M)}}const Im={symbol:function(_,d,p,b,M){if(_.renderPass!=="translucent")return;const L=Fn.disabled,O=_.colorModeForRenderPass(),z=p.layout.get("text-variable-anchor"),V=p.layout.get("text-size-scale-range"),Y=a.aA(_.scaleFactor,V[0],V[1]);z&&function(le,de,be,ye,Oe,Ee,qe,Ze){const Ve=de.transform,gt=Oe==="map",ct=Ee==="map";for(const ht of le){const ot=ye.getTile(ht),st=ot.getBucket(be);if(!st||!st.text||!st.text.segments.get().length)continue;const vt=a.bK(st.textSizeData,Ve.zoom,Ze),Pt=tf(ht,st.getProjection(),Ve),Tt=Ve.calculatePixelsToTileUnitsMatrix(ot),qt=Cc(Pt,ot.tileID.canonical,ct,gt,Ve,st.getProjection(),Tt),Vt=st.hasIconTextFit()&&st.hasIconData();vt&&Cn(st,gt,ct,qe,Ve,qt,ht,Math.pow(2,Ve.zoom-ot.tileID.overscaledZ),vt,Vt)}}(b,_,p,d,p.layout.get("text-rotation-alignment"),p.layout.get("text-pitch-alignment"),M,Y);const Q=p.paint.get("icon-opacity").constantOr(1)!==0,ce=p.paint.get("text-opacity").constantOr(1)!==0;p.layout.get("symbol-sort-key").constantOr(1)!==void 0&&(Q||ce)?lv(_,d,p,b,L,O):(Q&&lv(_,d,p,b,L,O,{onlyIcons:!0}),ce&&lv(_,d,p,b,L,O,{onlyText:!0})),d.map.showCollisionBoxes&&(Yr(_,d,p,b,p.paint.get("text-translate"),p.paint.get("text-translate-anchor"),!0),Yr(_,d,p,b,p.paint.get("icon-translate"),p.paint.get("icon-translate-anchor"),!1))},circle:function(_,d,p,b){if(_.renderPass!=="translucent")return;const M=p.paint.get("circle-opacity"),L=p.paint.get("circle-stroke-width"),O=p.paint.get("circle-stroke-opacity"),z=p.layout.get("circle-sort-key").constantOr(1)!==void 0,V=p.paint.get("circle-emissive-strength");if(M.constantOr(1)===0&&(L.constantOr(1)===0||O.constantOr(1)===0))return;const Y=_.context,Q=Y.gl,ce=_.transform,le=!(!_.terrain||!_.terrain.enabled),de=p.layout.get("circle-elevation-reference"),be=_.depthModeForSublayer(0,cn.ReadOnly),ye=new cn(_.context.gl.LEQUAL,cn.ReadOnly,_.depthRangeFor3D),Oe=de==="none"||le?be:ye,Ee=Fn.disabled,qe=_.colorModeForDrapableLayerRenderPass(V),Ze=ce.projection.name==="globe",Ve=[a.aF(ce.center.lng),a.aJ(ce.center.lat)],gt=[];for(let ht=0;htht.sortKey-ot.sortKey);const ct={useDepthForOcclusion:ce.depthOcclusionForSymbolsAndCircles};for(const ht of gt){const{programConfiguration:ot,program:st,layoutVertexBuffer:vt,dynamicBuffers:Pt,indexBuffer:Tt,uniformValues:qt,tile:Vt}=ht.state,nr=ht.segments;_.terrain&&_.terrain.setupElevationDraw(Vt,st,ct),_.uploadCommonUniforms(Y,st,Vt.tileID.toUnwrapped()),st.draw(_,Q.TRIANGLES,Oe,Ee,qe,Rn.disabled,qt,p.id,vt,Tt,nr,p.paint,ce.zoom,ot,Pt)}},heatmap:function(_,d,p,b){if(p.paint.get("heatmap-opacity")!==0)if(_.renderPass==="offscreen"){const M=_.context,L=M.gl,O=Fn.disabled,z=new Jn([L.ONE,L.ONE,L.ONE,L.ONE],a.ao.transparent,[!0,!0,!0,!0]);(function(de,be,ye,Oe){const Ee=de.gl,qe=be.width*Oe,Ze=be.height*Oe;de.activeTexture.set(Ee.TEXTURE1),de.viewport.set([0,0,qe,Ze]);let Ve=ye.heatmapFbo;if(!Ve||Ve&&(Ve.width!==qe||Ve.height!==Ze)){Ve&&Ve.destroy();const gt=Ee.createTexture();Ee.bindTexture(Ee.TEXTURE_2D,gt),Ee.texParameteri(Ee.TEXTURE_2D,Ee.TEXTURE_WRAP_S,Ee.CLAMP_TO_EDGE),Ee.texParameteri(Ee.TEXTURE_2D,Ee.TEXTURE_WRAP_T,Ee.CLAMP_TO_EDGE),Ee.texParameteri(Ee.TEXTURE_2D,Ee.TEXTURE_MIN_FILTER,Ee.LINEAR),Ee.texParameteri(Ee.TEXTURE_2D,Ee.TEXTURE_MAG_FILTER,Ee.LINEAR),Ve=ye.heatmapFbo=de.createFramebuffer(qe,Ze,1,null),function(ct,ht,ot,st,vt,Pt){const Tt=ct.gl;Tt.texImage2D(Tt.TEXTURE_2D,0,ct.extRenderToTextureHalfFloat?Tt.RGBA16F:Tt.RGBA,vt,Pt,0,Tt.RGBA,ct.extRenderToTextureHalfFloat?Tt.HALF_FLOAT:Tt.UNSIGNED_BYTE,null),st.colorAttachment0.set(ot)}(de,0,gt,Ve,qe,Ze)}else Ee.bindTexture(Ee.TEXTURE_2D,Ve.colorAttachment0.get()),de.bindFramebuffer.set(Ve.framebuffer)})(M,_,p,_.transform.projection.name==="globe"?.5:.25),M.clear({color:a.ao.transparent});const V=_.transform,Y=V.projection.name==="globe",Q=Y?["PROJECTION_GLOBE_VIEW"]:[],ce=Y?Rn.frontCCW:Rn.disabled,le=[a.aF(V.center.lng),a.aJ(V.center.lat)];for(let de=0;de({u_image:0,u_color_ramp:1,u_opacity:ce.paint.get("heatmap-opacity")}))(0,L),L.id,M.viewportBuffer,M.quadTriangleIndexBuffer,M.viewportSegments,L.paint,M.transform.zoom)}(_,p))},line:function(_,d,p,b){if(_.renderPass!=="translucent")return;const M=p.paint.get("line-opacity"),L=p.paint.get("line-width");if(M.constantOr(1)===0||L.constantOr(1)===0)return;const O=p.paint.get("line-emissive-strength").isConstant(),z=p.paint.get("line-emissive-strength").constantOr(0),V=p.paint.get("line-occlusion-opacity"),Y=p.layout.get("line-elevation-reference"),Q=p.layout.get("line-width-unit")==="meters",ce=Y==="sea",le=!(!_.terrain||!_.terrain.enabled),de=_.context,be=de.gl;if(p.hasElevatedBuckets&&_.transform.projection.name==="globe")return;const ye=p.layout.get("line-cross-slope"),Oe=ye!==void 0,Ee=ye<1,qe=_.colorModeForDrapableLayerRenderPass(O?z:null),Ze=_.terrain&&_.terrain.renderingToTexture,Ve=Ze?1:a.o.devicePixelRatio,gt=p.paint.get("line-dasharray"),ct=gt.constantOr(1),ht=p.layout.get("line-cap"),ot=gt.constantOr(null),st=ht.constantOr(null),vt=p.paint.get("line-pattern"),Pt=vt.constantOr(1),Tt=p.paint.get("line-pattern-cross-fade"),qt=vt.constantOr(null),Vt=p.paint.get("line-opacity").constantOr(1);let nr=!Pt&&Vt!==1||_.depthOcclusion&&V>0&&V<1;const vr=p.paint.get("line-gradient"),Ft=Pt?"linePattern":"line",St=a.e2(p);let Kt;if(Ze&&_.terrain&&_.terrain.clipOrMaskOverlapStencilType()&&(nr=!1),V!==0&&_.depthOcclusion){const Ur=p.paint._values["line-opacity"];Ur&&Ur.value&&Ur.value.kind==="constant"?Kt=Ur.value:a.w(`Occlusion opacity for layer ${p.id} is supported only when line-opacity isn't data-driven.`)}L.value.kind!=="constant"&&L.value.isLineProgressConstant===!1&&St.push("VARIABLE_LINE_WIDTH"),Ze&&(_.emissiveMode!=="dual-source-blending"||O?_.emissiveMode==="mrt-fallback"&&St.push("USE_MRT1"):St.push("DUAL_SOURCE_BLENDING"));const Ut=(Ur,Nr,_r,nn,Jr,Dr)=>{for(const qr of Ur){const wn=d.getTile(qr);if(Pt&&!wn.patternsLoaded())continue;const Hn=wn.getBucket(p);if(!Hn||Hn.elevationType!=="none"&&!Jr||Hn.elevationType==="none"&&Jr)continue;_.prepareDrawTile();const As=[...Nr],ai=_.shadowRenderer,on=Hn.elevationType==="road"&&!!ai&&ai.enabled;let Js=[0,0,0];if(on){const rs=_.style.directionalLight,na=_.style.ambientLight;rs&&na&&(Js=lp(_.style,rs,na)),As.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET")}const Un=Hn.programConfigurations.get(p.id);let ui=!1;if(qt&&wn.imageAtlas){const rs=a.e3.from(qt),na=rs.getPrimary().scaleSelf(Ve).toString(),Za=wn.imageAtlas.patternPositions.get(na),ka=rs.getSecondary(),zi=ka?wn.imageAtlas.patternPositions.get(ka.scaleSelf(Ve).toString()):null;ui=!!Za&&!!zi,Za&&Un.setConstantPatternPositions(Za,zi)}Tt>0&&(ui||Un.getPatternTransitionVertexBuffer("line-pattern"))&&As.push("LINE_PATTERN_TRANSITION");const Ci=_.isTileAffectedByFog(qr),vi=_.getOrCreateProgram(Ft,{config:Un,defines:As,overrideFog:Ci});if(!Pt&&ot&&st&&wn.lineAtlas){const rs=wn.lineAtlas.getDash(ot,st);rs&&Un.setConstantPatternPositions(rs)}on&&ai.setupShadows(wn.tileID.toUnwrapped(),vi,"vector-tile");let[Ys,ts]=p.paint.get("line-trim-offset");(st==="round"||st==="square")&&Ys!==ts&&(Ys===0&&(Ys-=1),ts===1&&(ts+=1));const ci=Ze?qr.projMatrix:null,Ea=Q?1/Hn.tileToMeter/a.ay(wn,1,_.transform.zoom):1,ua=Q?1/Hn.tileToMeter/a.ay(wn,1,Math.floor(_.transform.zoom)):1,hi=Pt?a.e4(_,wn,p,ci,Ve,Ea,ua,[Ys,ts],Js,Tt):a.e5(_,wn,p,ci,Hn.lineClipsArray.length,Ve,Ea,ua,[Ys,ts],Js);if(vr){const rs=Hn.gradients[p.id];let na=rs.texture;if(p.gradientVersion!==rs.version){let Za=256;if(p.stepInterpolant){const ka=d.getSource().maxzoom,zi=qr.canonical.z===ka?Math.ceil(1<<_.transform.maxZoom-qr.canonical.z):1;Za=a.aA(a.e6(Hn.maxLineLength/a.al*1024*zi),256,de.maxTextureSize)}rs.gradient=a.e7({expression:p.gradientExpression(),evaluationKey:"lineProgress",resolution:Za,image:rs.gradient||void 0,clips:Hn.lineClipsArray}),rs.texture?rs.texture.update(rs.gradient):rs.texture=new a.T(de,rs.gradient,be.RGBA8),rs.version=p.gradientVersion,na=rs.texture}de.activeTexture.set(be.TEXTURE1),na.bind(p.stepInterpolant?be.NEAREST:be.LINEAR,be.CLAMP_TO_EDGE)}ct&&(de.activeTexture.set(be.TEXTURE0),wn.lineAtlasTexture&&wn.lineAtlasTexture.bind(be.LINEAR,be.REPEAT),Un.updatePaintBuffers()),Pt&&(de.activeTexture.set(be.TEXTURE0),wn.imageAtlasTexture&&wn.imageAtlasTexture.bind(be.LINEAR,be.CLAMP_TO_EDGE),Un.updatePaintBuffers()),Jr&&!ce&&_.terrain.setupElevationDraw(wn,vi),_.uploadCommonUniforms(de,vi,qr.toUnwrapped());const Hs=rs=>{Kt!=null&&(Kt.value=Vt*V),vi.draw(_,be.TRIANGLES,_r,rs,qe,Rn.disabled,hi,p.id,Hn.layoutVertexBuffer,Hn.indexBuffer,Hn.segments,p.paint,_.transform.zoom,Un,[Hn.layoutVertexBuffer2,Hn.patternVertexBuffer,Hn.zOffsetVertexBuffer]),Kt!=null&&(Kt.value=Vt)};if(nr&&!Jr){const rs=_.stencilModeForClipping(qr).ref;rs===0&&Ze&&de.clear({stencil:0});const na={func:be.EQUAL,mask:255};hi.u_alpha_discard_threshold=.8,Hs(new Fn(na,rs,255,be.KEEP,be.KEEP,be.INVERT)),hi.u_alpha_discard_threshold=0,Hs(new Fn(na,rs,255,be.KEEP,be.KEEP,be.KEEP))}else hi.u_alpha_discard_threshold=nr&&Jr&&Dr?.8:0,Hs(Jr?nn:_.stencilModeForClipping(qr))}};let ur=_.depthModeForSublayer(0,cn.ReadOnly);const Ar=new cn(_.depthOcclusion?be.GREATER:be.LEQUAL,cn.ReadOnly,_.depthRangeFor3D);if(p.hasNonElevatedBuckets){const Ur=!Ze&&_.terrain;V!==0&&Ur?a.w(`Occlusion opacity for layer ${p.id} is supported on terrain only if the layer has line-z-offset enabled.`):Ur?a.w(`Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ${p.id}.`):Ut(b,St,ur,Fn.disabled,!1,!0)}if(p.hasElevatedBuckets){Y==="hd-road-markup"?le||(ur=Ar,St.push("ELEVATED_ROADS")):(St.push("ELEVATED"),ur=Ar,Oe&&St.push(Ee?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),ce&&St.push("ELEVATION_REFERENCE_SEA"));const Ur=nr?_.stencilModeFor3D():Fn.disabled;_.forceTerrainMode=!0,Ut(b,St,ur,Ur,!0,!0),nr&&Ut(b,St,ur,Ur,!0,!1),_.forceTerrainMode=!1}nr&&(_.resetStencilClippingMasks(),Ze&&de.clear({stencil:0})),V===0||_.depthOcclusion||Ze||_.layersWithOcclusionOpacity.push(_.currentLayer)},fill:function(_,d,p,b){const M=p.paint.get("fill-color"),L=p.paint.get("fill-opacity");if(L.constantOr(1)===0)return;const O=p.paint.get("fill-emissive-strength"),z=_.colorModeForDrapableLayerRenderPass(O),V=p.paint.get("fill-pattern"),Y=_.opaquePassEnabledForLayer()&&!V.constantOr(1)&&M.constantOr(a.ao.transparent).a===1&&L.constantOr(0)===1?"opaque":"translucent";let Q="none";p.layout.get("fill-elevation-reference")!=="none"?Q="road":p.paint.get("fill-z-offset").constantOr(1)!==0&&(Q="offset");const ce=!(!_.terrain||!_.terrain.enabled),le={painter:_,sourceCache:d,layer:p,coords:b,colorMode:z,elevationType:Q,terrainEnabled:ce,pass:Y};if(_.renderPass==="shadow")return void(_.shadowRenderer&&Q==="road"&&!ce&&function(be){const{painter:ye,sourceCache:Oe,layer:Ee,coords:qe}=be,Ze=ye.context.gl,Ve=be.painter.shadowRenderer;for(const gt of qe){const ct=Oe.getTile(gt),ht=ct.getBucket(Ee);if(!ht)continue;const ot=ht.elevatedStructures;if(!ot||!ot.shadowCasterSegments||ot.shadowCasterSegments.segments[0].primitiveLength===0)continue;ye.prepareDrawTile();const st=ht.bufferData.programConfigurations.get(Ee.id),vt=ye.isTileAffectedByFog(gt),Pt=ye.getOrCreateProgram("elevatedStructuresDepth",{config:st,overrideFog:vt}),Tt=Ve.calculateShadowPassMatrixFromTile(ct.tileID.toUnwrapped());ye.uploadCommonUniforms(ye.context,Pt,gt.toUnwrapped());const qt={u_matrix:Tt,u_depth_bias:0};Pt.draw(ye,Ze.TRIANGLES,Ve.getShadowPassDepthMode(),Fn.disabled,Ve.getShadowPassColorMode(),Rn.disabled,qt,Ee.id,ot.vertexBuffer,ot.indexBuffer,ot.shadowCasterSegments,Ee.paint,ye.transform.zoom,st)}}(le));const de=_.emissiveMode==="mrt-fallback";if(Q!=="offset"){if(Mk(le,!1,de),Q==="road"){const be=!ce&&_.renderPass==="translucent";be&&Ck(_,d,p,b,"geometry"),Mk(le,!0,de,Fn.disabled),be&&function(ye){const{painter:Oe,sourceCache:Ee,layer:qe,coords:Ze,colorMode:Ve}=ye,gt=Oe.context.gl,ct=ye.painter.shadowRenderer,ht=!!ct&&ct.enabled,ot=new cn(Oe.context.gl.LEQUAL,cn.ReadOnly,Oe.depthRangeFor3D);let st=[0,0,0];if(ht){const Pt=Oe.style.directionalLight,Tt=Oe.style.ambientLight;Pt&&Tt&&(st=lp(Oe.style,Pt,Tt))}const vt=Pt=>{for(const Tt of Ze){const qt=Ee.getTile(Tt),Vt=qt.getBucket(qe);if(!Vt)continue;const nr=Vt.elevatedStructures;if(!nr)continue;let vr,Ft;if(Pt?(vr=nr.renderableBridgeSegments,Ft=nr.bridgeProgramConfigurations.get(qe.id)):(vr=nr.renderableTunnelSegments,Ft=nr.tunnelProgramConfigurations.get(qe.id)),!vr||vr.segments[0].primitiveLength===0)continue;Ft.updatePaintBuffers(),Oe.prepareDrawTile();const St=Oe.isTileAffectedByFog(Tt),Kt=[];ht&&Kt.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET");const Ut=Oe.getOrCreateProgram("elevatedStructures",{config:Ft,overrideFog:St,defines:Kt}),ur=Oe.translatePosMatrix(Tt.projMatrix,qt,qe.paint.get("fill-translate"),qe.paint.get("fill-translate-anchor"));ht&&ct.setupShadows(qt.tileID.toUnwrapped(),Ut,"vector-tile");const Ar=Cm(ur,st);Oe.uploadCommonUniforms(Oe.context,Ut,Tt.toUnwrapped()),Ut.draw(Oe,gt.TRIANGLES,ot,Fn.disabled,Ve,Rn.backCCW,Ar,qe.id,nr.vertexBuffer,nr.indexBuffer,vr,qe.paint,Oe.transform.zoom,Ft,[nr.vertexBufferNormal])}};vt(!0),vt(!1)}(le)}}else Mk(le,!1,de,_.stencilModeFor3D())},"fill-extrusion":function(_,d,p,b){const M=p.paint.get("fill-extrusion-opacity"),L=_.context,O=L.gl,z=_.terrain,V=z&&z.renderingToTexture;if(M===0)return;const Y=_.emissiveMode==="mrt-fallback",Q=_.conflationActive&&_.style.isLayerClipped(p,d.getSource()),ce=_.style.order.indexOf(p.fqid);if(Q&&function(le,de,be,ye,Oe){for(const Ee of ye){const qe=de.getTile(Ee).getBucket(be);qe&&(qe.updateReplacement(Ee,le.replacementSource,Oe),qe.uploadCentroid(le.context))}}(_,d,p,b,ce),z||Q)for(const le of b){const de=d.getTile(le).getBucket(p);de&&Qie(_.context,d,le,de,p,z,Q)}if(_.renderPass==="shadow"&&_.shadowRenderer){const le=_.shadowRenderer;if(z&&M<.65&&p._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof a.ad)return;const de=le.getShadowPassDepthMode(),be=le.getShadowPassColorMode();Tk(_,d,p,b,de,Fn.disabled,be,Q)}else if(_.renderPass==="translucent"){const le=!p.paint.get("fill-extrusion-pattern").constantOr(1),de=p.paint.get("fill-extrusion-color").constantOr(a.ao.white);if(!V&&de.a!==0){const be=new cn(_.context.gl.LEQUAL,cn.ReadWrite,_.depthRangeFor3D);M===1&&le?Tk(_,d,p,b,be,Fn.disabled,Jn.unblended,Q):(Tk(_,d,p,b,be,Fn.disabled,Jn.disabled,Q),Tk(_,d,p,b,be,_.stencilModeFor3D(),_.colorModeForRenderPass(),Q),_.resetStencilClippingMasks())}if(_.style.enable3dLights()&&le&&(!z&&_.transform.projection.name!=="globe"||V)){const be=p.paint.get("fill-extrusion-opacity"),ye=p.paint.get("fill-extrusion-ambient-occlusion-intensity"),Oe=p.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),Ee=p.paint.get("fill-extrusion-flood-light-intensity"),qe=p.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",Ze=p.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(qe?null:p.lut).toArray01().slice(0,3),Ve=ye>0&&Oe>0,gt=Ee>0,ct=(st,vt,Pt)=>(1-Pt)*st+Pt*vt,ht=new q3;ht.translate=p.paint.get("fill-extrusion-translate"),ht.translateAnchor=p.paint.get("fill-extrusion-translate-anchor"),ht.edgeRadius=p.layout.get("fill-extrusion-edge-radius"),ht.cutoffFadeRange=p.paint.get("fill-extrusion-cutoff-fade-range");const ot=st=>{const vt=_.depthModeForSublayer(1,cn.ReadOnly,O.LEQUAL,!0),Pt=p.paint.get(st?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),Tt=ct(.1,3,Pt),qt=_._showOverdrawInspector;if(!qt){const Vt=new Fn({func:O.ALWAYS,mask:255},255,255,O.KEEP,O.KEEP,O.REPLACE),nr=new Jn([O.ONE,O.ONE,O.ONE,O.ONE],a.ao.transparent,[!1,!1,!1,!0],O.MIN);up(ht,_,d,p,b,vt,Vt,nr,Rn.disabled,st,"sdf",be,ye,Oe,Ee,Ze,Tt,Q,!1)}{const Vt=qt?Fn.disabled:new Fn({func:O.EQUAL,mask:255},255,255,O.KEEP,O.DECR,O.DECR),nr=qt?_.colorModeForRenderPass():new Jn([O.ONE_MINUS_DST_ALPHA,O.DST_ALPHA,O.ONE,O.ONE],a.ao.transparent,[!0,!0,!0,!0]);up(ht,_,d,p,b,vt,Vt,nr,Rn.disabled,st,"color",be,ye,Oe,Ee,Ze,Tt,Q,!1)}};if(V){const st=()=>{const Pt=z.drapeBufferSize[0],Tt=z.drapeBufferSize[1];let qt=z.framebufferCopyTexture;return qt&&(!qt||qt.size[0]===Pt&&qt.size[1]===Tt)||(qt&&qt.destroy(),qt=z.framebufferCopyTexture=new a.T(L,new a.q({width:Pt,height:Tt}),O.RGBA8)),qt.bind(O.LINEAR,O.CLAMP_TO_EDGE),O.copyTexSubImage2D(O.TEXTURE_2D,0,0,0,0,0,Pt,Tt),qt},vt=(Pt,Tt,qt)=>{const Vt=_.depthModeForSublayer(1,cn.ReadOnly,O.LEQUAL,!1),nr=p.paint.get(Pt?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),vr=ct(.1,3,nr);{const Ft=new Jn([O.ONE,O.ONE,O.ONE,O.ONE],a.ao.transparent,[!1,!1,!1,!0]);up(ht,_,d,p,b,Vt,Fn.disabled,Ft,Rn.disabled,Pt,"clear",be,ye,Oe,Ee,Ze,vr,Q,Tt)}{const Ft=new Fn({func:O.ALWAYS,mask:255},255,255,O.KEEP,O.KEEP,O.REPLACE),St=new Jn([O.ONE,O.ONE,O.ONE,O.ONE],a.ao.transparent,[!1,!1,!1,!0],O.MIN);up(ht,_,d,p,b,Vt,Ft,St,Rn.disabled,Pt,"sdf",be,ye,Oe,Ee,Ze,vr,Q,Tt)}Y&&!Pt&&(qt=st());{const Ft=Pt?O.ZERO:O.ONE_MINUS_DST_ALPHA,St=new Fn({func:O.EQUAL,mask:255},255,255,O.KEEP,O.DECR,O.DECR),Kt=new Jn([Ft,O.DST_ALPHA,O.ONE_MINUS_DST_ALPHA,O.ZERO],a.ao.transparent,[!0,!0,!0,!0]);up(ht,_,d,p,b,Vt,St,Kt,Rn.disabled,Pt,"color",be,ye,Oe,Ee,Ze,vr,Q,Tt)}if(!Y||Pt){const Ft=new Jn([O.ONE,O.ONE,O.ONE,Pt?O.ZERO:O.ONE],a.ao.transparent,[!1,!1,!1,!0],Pt?O.FUNC_ADD:O.MAX);up(ht,_,d,p,b,Vt,Fn.disabled,Ft,Rn.disabled,Pt,"clear",be,ye,Oe,Ee,Ze,vr,Q,Tt,qt)}else{O.drawBuffers([O.NONE,O.COLOR_ATTACHMENT1]);const Ft=new Fn({func:O.EQUAL,mask:255},254,255,O.KEEP,O.DECR,O.DECR),St=new Jn([O.ONE,O.ONE,O.ONE,O.ONE],a.ao.transparent,[!0,!1,!1,!1],O.MAX);up(ht,_,d,p,b,Vt,Ft,St,Rn.disabled,Pt,"emissive",be,ye,Oe,Ee,Ze,vr,Q,Tt,qt),O.drawBuffers([O.COLOR_ATTACHMENT0])}};if(Ve||gt){let Pt;_.prepareDrawTile(),Y&&!Ve||(Pt=st()),Ve&&vt(!0,!1,Pt),gt&&vt(!1,!0,Pt)}}else Ve&&ot(!0),gt&&ot(!1),(Ve||gt)&&_.resetStencilClippingMasks()}}},building:function(_,d,p,b){_.currentLayer<_.firstLightBeamLayer&&(_.firstLightBeamLayer=_.currentLayer);const M=p.paint.get("building-ambient-occlusion-ground-intensity"),L=p.paint.get("building-ambient-occlusion-ground-radius"),O=p.paint.get("building-ambient-occlusion-ground-attenuation"),z=p.paint.get("building-opacity");if(z<=0)return;let V=M>0&&L>0,Y=!0;const Q=p.paint.get("building-vertical-scale");if(Q<=0)return;_.shadowRenderer||(Y=!1);const ce=_.conflationActive&&_.style.isLayerClipped(p,d.getSource()),le=_.style.order.indexOf(p.fqid);if(function(de,be,ye,Oe,Ee,qe){for(const Ze of qe){const Ve=be.getTile(Ze).getBucket(ye);Ve&&(Ee&&Ve.updateReplacement(Ze,de.replacementSource,Oe),Ve.uploadUpdatedIndexBuffer(de.context))}}(_,d,p,le,ce,b),function(de,be,ye,Oe){for(const Ee of Oe){const qe=be.getTile(Ee).getBucket(ye);qe&&qe.needsEvaluation()&&qe.uploadUpdatedColorBuffer(de.context)}}(_,d,p,b),p.resetLayerRenderingStats(_),_.shadowRenderer&&(_.shadowRenderer.useNormalOffset=!0),_.renderPass==="shadow"&&_.shadowRenderer){const de=_.shadowRenderer,be=[],ye=de.getShadowPassDepthMode();cv({painter:_,source:d,layer:p,coords:b,defines:be,blendMode:de.getShadowPassColorMode(),depthMode:ye,opacity:z,verticalScale:Q,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}else if(_.renderPass==="translucent"){let de=["HAS_ATTRIBUTE_a_part_color_emissive","LIGHTING_3D_MODE"];Y&&(de=de.concat("RENDER_SHADOWS","DEPTH_TEXTURE")),_.shadowRenderer&&_.shadowRenderer.useNormalOffset&&(de=de.concat("NORMAL_OFFSET"));const be=p.paint.get("building-facade-emissive-chance"),ye=p.paint.get("building-ambient-occlusion-intensity"),Oe=p.paint.get("building-flood-light-intensity"),Ee=p.paint.get("building-flood-light-color-use-theme").constantOr("default")==="none",qe=p.paint.get("building-flood-light-color").toNonPremultipliedRenderColor(Ee?null:p.lut).toArray01().slice(0,3),Ze=p.paint.get("building-flood-light-ground-attenuation"),Ve=Oe>0,gt=new cn(_.context.gl.LEQUAL,cn.ReadWrite,_.depthRangeFor3D);z<1&&cv({painter:_,source:d,layer:p,coords:b,defines:de,blendMode:Jn.disabled,depthMode:gt,opacity:z,verticalScale:Q,facadeEmissiveChance:be,facadeAOIntensity:ye,floodLightIntensity:Oe,floodLightColor:qe,depthOnly:!0});const ct=_.colorModeForRenderPass();cv({painter:_,source:d,layer:p,coords:b,defines:de,blendMode:ct,depthMode:gt,opacity:z,verticalScale:Q,facadeEmissiveChance:be,facadeAOIntensity:ye,floodLightIntensity:Oe,floodLightColor:qe}),V&&Ak(_,d,p,b,!0,z,M,L,Oe,qe,O,ce),Ve&&Ak(_,d,p,b,!1,z,M,L,Oe,qe,Ze,ce)}else if(_.renderPass==="light-beam"){const de=["HAS_ATTRIBUTE_a_part_color_emissive","HAS_ATTRIBUTE_a_bloom_attenuation"],be=new cn(_.context.gl.LEQUAL,cn.ReadOnly,_.depthRangeFor3D);cv({painter:_,source:d,layer:p,coords:b,defines:de,blendMode:Jn.alphaBlended,depthMode:be,opacity:z,verticalScale:Q,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}_.shadowRenderer&&(_.shadowRenderer.useNormalOffset=!1),_.resetStencilClippingMasks()},hillshade:function(_,d,p,b){if(_.renderPass!=="offscreen"&&_.renderPass!=="translucent"||_.style.disableElevatedTerrain)return;const M=_.context,L=_.terrain&&_.terrain.renderingToTexture,[O,z]=_.renderPass!=="translucent"||L?[{},b]:_.stencilConfigForOverlap(b);for(const V of z){const Y=d.getTile(V);if(Y.needsHillshadePrepare&&_.renderPass==="offscreen")Uie(_,Y,p);else if(_.renderPass==="translucent"){const Q=_.depthModeForSublayer(0,cn.ReadOnly),ce=p.paint.get("hillshade-emissive-strength"),le=_.colorModeForDrapableLayerRenderPass(ce),de=L&&_.terrain?_.terrain.stencilModeForRTTOverlap(V):O[V.overscaledZ];$ie(_,V,Y,p,Q,de,le)}}M.viewport.set([0,0,_.width,_.height]),_.resetStencilClippingMasks()},raster:function(_,d,p,b,M,L){if(_.renderPass!=="translucent"||p.paint.get("raster-opacity")===0)return;const O=_.transform.projection.name==="globe",z=p.paint.get("raster-elevation")!==0,V=z&&O;if(_.renderElevatedRasterBackface&&!V)return;const Y=_.context,Q=Y.gl,ce=d.getSource(),le=function(ct,ht,ot,st,vt){const Pt=ht.paint.get("raster-color"),Tt=ct.type==="raster-array",qt=[],Vt=ht.paint.get("raster-resampling"),nr=ht.paint.get("raster-color-mix");let vr=ht.paint.get("raster-color-range");const Ft=[nr[0],nr[1],nr[2],0],St=nr[3];let Kt=Vt==="nearest"?st.NEAREST:st.LINEAR;if(Tt&&(qt.push("RASTER_ARRAY"),Pt||qt.push("RASTER_COLOR"),Vt==="linear"&&qt.push("RASTER_ARRAY_LINEAR"),Kt=st.NEAREST,!vr&&ct.rasterLayers)){const Ut=ct.rasterLayers.find(({id:ur})=>ur===ht.sourceLayer);Ut&&Ut.fields&&Ut.fields.range&&(vr=Ut.fields.range)}if(vr=vr||[0,1],Pt){qt.push("RASTER_COLOR"),ot.activeTexture.set(st.TEXTURE2),ht.updateColorRamp(vr);let Ut=ht.colorRampTexture;Ut||(Ut=ht.colorRampTexture=new a.T(ot,ht.colorRamp,st.RGBA8)),Ut.bind(st.LINEAR,st.CLAMP_TO_EDGE)}return vt&&qt.push("USE_MRT1"),{mix:Ft,range:vr,offset:St,defines:qt,resampling:Kt}}(ce,p,Y,Q,_.terrain&&_.terrain.renderingToTexture&&_.emissiveMode==="mrt-fallback");if(ce instanceof a.aU&&!b.length&&!O)return;const de=p.paint.get("raster-emissive-strength"),be=_.colorModeForDrapableLayerRenderPass(de),ye=_.terrain&&_.terrain.renderingToTexture,Oe=!_.options.moving,Ee=p.paint.get("raster-resampling")==="nearest"?Q.NEAREST:Q.LINEAR;if(ce instanceof a.aU&&!b.length&&(ce.onNorthPole||ce.onSouthPole)){const ct=z?_.stencilModeFor3D():Fn.disabled;return void dv(!!ce.onNorthPole,null,_,d,p,de,le,Rn.disabled,ct)}if(!b.length)return;const[qe,Ze]=ce instanceof a.aU||ye?[{},b]:_.stencilConfigForOverlap(b),Ve=Ze[Ze.length-1].overscaledZ;V&&le.defines.push("PROJECTION_GLOBE_VIEW"),z&&le.defines.push("RENDER_CUTOFF");const gt=(ct,ht,ot)=>{for(const st of ct){const vt=st.toUnwrapped(),Pt=d.getTile(st);if(ye&&(!Pt||!Pt.hasData()))continue;Y.activeTexture.set(Q.TEXTURE0);const Tt=fp(Pt,ce,p,le);if(!Tt||!Tt.texture)continue;const{texture:qt,mix:Vt,offset:nr,tileSize:vr,buffer:Ft}=Tt;let St,Kt;ye?(St=cn.disabled,Kt=st.projMatrix):z?(St=new cn(Q.LEQUAL,cn.ReadWrite,_.depthRangeFor3D),Kt=O?Float32Array.from(_.transform.expandedFarZProjMatrix):_.transform.calculateProjMatrix(vt,Oe)):(St=_.depthModeForSublayer(st.overscaledZ-Ve,p.paint.get("raster-opacity")===1?cn.ReadWrite:cn.ReadOnly,Q.LESS),Kt=_.transform.calculateProjMatrix(vt,Oe));const Ut=_.terrain&&ye?_.terrain.stencilModeForRTTOverlap(st):qe[st.overscaledZ],ur=L?0:p.paint.get("raster-fade-duration");Pt.registerFadeDuration(ur);const Ar=d.findLoadedParent(st,0),Ur=sv(Pt,Ar,d,_.transform,ur);let Nr,_r;!Ur.isFading&&Pt.refreshedUponExpiration&&(Pt.refreshedUponExpiration=!1),_.terrain&&_.terrain.prepareDrawTile(),Y.activeTexture.set(Q.TEXTURE0),qt.bind(Ee,Q.CLAMP_TO_EDGE),Y.activeTexture.set(Q.TEXTURE1),Ar?(Ar.texture&&Ar.texture.bind(Ee,Q.CLAMP_TO_EDGE),Nr=Math.pow(2,Ar.tileID.overscaledZ-Pt.tileID.overscaledZ),_r=[Pt.tileID.canonical.x*Nr%1,Pt.tileID.canonical.y*Nr%1]):qt.bind(Ee,Q.CLAMP_TO_EDGE),"useMipmap"in qt&&Y.extTextureFilterAnisotropic&&_.transform.pitch>20&&Q.texParameterf(Q.TEXTURE_2D,Y.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,Y.extTextureFilterAnisotropicMax);const nn=_.transform;let Jr;const Dr=z?iP(nn):[0,0,0,0];let qr,wn,Hn,As,ai,on=0;if(V&&ce instanceof a.aU&&ce.coordinates.length>3)qr=Float32Array.from(a.bk(a.dJ(new a.cD(0,0,0)))),wn=Float32Array.from(nn.globeMatrix),Hn=Float32Array.from(a.dF(nn)),As=[a.aF(nn.center.lng),a.aJ(nn.center.lat)],Jr=ce.elevatedGlobePerspectiveTransform,ai=ce.elevatedGlobeGridMatrix||new Float32Array(9);else if(V){const Ci=a.dG(st.canonical);on=a.dH(Ci.getCenter().lat),qr=Float32Array.from(a.bk(a.dJ(st.canonical))),wn=Float32Array.from(nn.globeMatrix),Hn=Float32Array.from(a.dF(nn)),As=[a.aF(nn.center.lng),a.aJ(nn.center.lat)],Jr=[0,0],ai=Float32Array.from(a.dI(st.canonical,Ci,on,nn.worldSize/nn._pixelsPerMercatorPixel))}else Jr=ce instanceof a.aU?ce.perspectiveTransform:[0,0],qr=new Float32Array(16),wn=new Float32Array(9),Hn=new Float32Array(16),As=[0,0],ai=new Float32Array(9);const Js=QI(Kt,qr,wn,Hn,ai,_r||[0,0],a.aj(_.transform.zoom),As,Dr,Nr||1,Ur,p,Jr,z?p.paint.get("raster-elevation"):0,2,Vt,nr,le.range,vr,Ft,de),Un=_.isTileAffectedByFog(st),ui=_.getOrCreateProgram("raster",{defines:le.defines,overrideFog:Un});if(_.uploadCommonUniforms(Y,ui,vt),ce instanceof a.aU){const Ci=ce.elevatedGlobeVertexBuffer,vi=ce.elevatedGlobeIndexBuffer;if(ye||!O)ce.boundsBuffer&&ce.boundsSegments&&ui.draw(_,Q.TRIANGLES,St,Fn.disabled,be,Rn.disabled,Js,p.id,ce.boundsBuffer,_.quadTriangleIndexBuffer,ce.boundsSegments);else if(Ci&&vi){const Ys=nn.zoom<=a.c_?ce.elevatedGlobeSegments:ce.getSegmentsForLongitude(nn.center.lng);Ys&&ui.draw(_,Q.TRIANGLES,St,Fn.disabled,be,ht,Js,p.id,Ci,vi,Ys)}}else if(V){St=new cn(Q.LEQUAL,cn.ReadOnly,_.depthRangeFor3D);const Ci=_.globeSharedBuffers;if(Ci){const[vi,Ys,ts]=Ci.getGridBuffers(on,!1);ui.draw(_,Q.TRIANGLES,St,ot||Ut,_.colorModeForRenderPass(),ht,Js,p.id,vi,Ys,ts)}}else{const{tileBoundsBuffer:Ci,tileBoundsIndexBuffer:vi,tileBoundsSegments:Ys}=_.getTileBoundsBuffers(Pt);ui.draw(_,Q.TRIANGLES,St,Ut,be,Rn.disabled,Js,p.id,Ci,vi,Ys)}}if(!(ce instanceof a.aU)&&V)for(const st of ct){const vt=st.canonical.y===(1<>>16,2654435769),((st=Math.imul(st^st>>>16,2654435769))>>>0)/4294967296},ot=1/1.1;for(let st=0;sta.e9[Ut](qt));Ft.push(qt);const St=qt.canonical.x,Kt=qt.canonical.y;for(const Ut of Ft){const ur=Ve.getTile(vt?Ut.wrapped():Ut);if(!ur)continue;const Ar=ur.rasterParticleState;if(!Ar)continue;const Ur=Ut.canonical.x+(1<ht.tileID)),de&&(Y.activeTexture.set(Q.TEXTURE0),_.imageManager.bind(_.context,p.scope));const ct=[];if(_.terrain&&_.terrain.renderingToTexture&&_.emissiveMode==="mrt-fallback"&&ct.push("USE_MRT1"),V){const ht=_.getOrCreateProgram(Ze,{overrideFog:!1,overrideRtt:!0,defines:ct}),ot=new Float32Array(a.bA([])),st=new a.aQ(0,0,0,0,0),vt=de?Tm(ot,z,O,_,0,p.scope,be,V,{tileID:st,tileSize:le}):av(ot,z,O,M.toPremultipliedRenderColor(L?null:p.lut));ht.draw(_,Q.TRIANGLES,Ee,Oe,qe,Rn.disabled,vt,p.id,_.viewportBuffer,_.quadTriangleIndexBuffer,_.viewportSegments)}else for(const ht of gt){const ot=_.isTileAffectedByFog(ht),st=_.getOrCreateProgram(Ze,{overrideFog:ot,defines:ct}),vt=ht.toUnwrapped(),Pt=b?ht.projMatrix:_.transform.calculateProjMatrix(vt);_.prepareDrawTile();const Tt=d?d.getTile(ht):Ve?Ve[ht.key]:new np(ht,le,ce.zoom,_),qt=de?Tm(Pt,z,O,_,0,p.scope,be,V,{tileID:ht,tileSize:le}):av(Pt,z,O,M.toPremultipliedRenderColor(L?null:p.lut));_.uploadCommonUniforms(Y,st,vt);const{tileBoundsBuffer:Vt,tileBoundsIndexBuffer:nr,tileBoundsSegments:vr}=_.getTileBoundsBuffers(Tt);st.draw(_,Q.TRIANGLES,Ee,Oe,qe,Rn.disabled,qt,p.id,Vt,nr,vr)}},sky:function(_,d,p){const b=_._atmosphere?a.aj(_.transform.zoom):1,M=p.paint.get("sky-opacity")*b;if(M===0)return;const L=_.context,O=p.paint.get("sky-type"),z=new cn(L.gl.LEQUAL,cn.ReadOnly,[0,1]),V=_.frameCounter/1e3%1;O==="atmosphere"?_.renderPass==="offscreen"?p.needsSkyboxCapture(_)&&(function(Y,Q,ce,le){const de=Y.context,be=de.gl;let ye=Q.skyboxFbo;if(!ye){ye=Q.skyboxFbo=de.createFramebuffer(32,32,1,null),Q.skyboxGeometry=new Lk(de),Q.skyboxTexture=de.gl.createTexture(),be.bindTexture(be.TEXTURE_CUBE_MAP,Q.skyboxTexture),be.texParameteri(be.TEXTURE_CUBE_MAP,be.TEXTURE_WRAP_S,be.CLAMP_TO_EDGE),be.texParameteri(be.TEXTURE_CUBE_MAP,be.TEXTURE_WRAP_T,be.CLAMP_TO_EDGE),be.texParameteri(be.TEXTURE_CUBE_MAP,be.TEXTURE_MIN_FILTER,be.LINEAR),be.texParameteri(be.TEXTURE_CUBE_MAP,be.TEXTURE_MAG_FILTER,be.LINEAR);for(let Ze=0;Ze<6;++Ze)be.texImage2D(be.TEXTURE_CUBE_MAP_POSITIVE_X+Ze,0,be.RGBA,32,32,0,be.RGBA,be.UNSIGNED_BYTE,null)}de.bindFramebuffer.set(ye.framebuffer),de.viewport.set([0,0,32,32]);const Oe=Q.getCenter(Y,!0),Ee=Y.getOrCreateProgram("skyboxCapture"),qe=new Float64Array(16);a.bA(qe),a.en(qe,qe,.5*-Math.PI),Wg(Y,Q,Ee,qe,Oe,0),a.bA(qe),a.en(qe,qe,.5*Math.PI),Wg(Y,Q,Ee,qe,Oe,1),a.bA(qe),a.cU(qe,qe,.5*-Math.PI),Wg(Y,Q,Ee,qe,Oe,2),a.bA(qe),a.cU(qe,qe,.5*Math.PI),Wg(Y,Q,Ee,qe,Oe,3),a.bA(qe),Wg(Y,Q,Ee,qe,Oe,4),a.bA(qe),a.en(qe,qe,Math.PI),Wg(Y,Q,Ee,qe,Oe,5),de.viewport.set([0,0,Y.width,Y.height])}(_,p),p.markSkyboxValid(_)):_.renderPass==="sky"&&function(Y,Q,ce,le,de){const be=Y.context,ye=be.gl,Oe=Y.transform,Ee=Y.getOrCreateProgram("skybox");be.activeTexture.set(ye.TEXTURE0),ye.bindTexture(ye.TEXTURE_CUBE_MAP,Q.skyboxTexture);const qe=((Ze,Ve,gt,ct,ht)=>({u_matrix:Ze,u_sun_direction:Ve,u_cubemap:0,u_opacity:ct,u_temporal_offset:ht}))(Oe.skyboxMatrix,Q.getCenter(Y,!1),0,le,de);Y.uploadCommonUniforms(be,Ee),Ee.draw(Y,ye.TRIANGLES,ce,Fn.disabled,Y.colorModeForRenderPass(),Rn.backCW,qe,"skybox",Q.skyboxGeometry.vertexBuffer,Q.skyboxGeometry.indexBuffer,Q.skyboxGeometry.segment)}(_,p,z,M,V):O==="gradient"&&_.renderPass==="sky"&&function(Y,Q,ce,le,de){const be=Y.context,ye=be.gl,Oe=Y.transform,Ee=Y.getOrCreateProgram("skyboxGradient");Q.skyboxGeometry||(Q.skyboxGeometry=new Lk(be)),be.activeTexture.set(ye.TEXTURE0);let qe=Q.colorRampTexture;qe||(qe=Q.colorRampTexture=new a.T(be,Q.colorRamp,ye.RGBA8)),qe.bind(ye.LINEAR,ye.CLAMP_TO_EDGE);const Ze=((Ve,gt,ct,ht,ot)=>({u_matrix:Ve,u_color_ramp:0,u_center_direction:gt,u_radius:a.an(ct),u_opacity:ht,u_temporal_offset:ot}))(Oe.skyboxMatrix,Q.getCenter(Y,!1),Q.paint.get("sky-gradient-radius"),le,de);Y.uploadCommonUniforms(be,Ee),Ee.draw(Y,ye.TRIANGLES,ce,Fn.disabled,Y.colorModeForRenderPass(),Rn.backCW,Ze,"skyboxGradient",Q.skyboxGeometry.vertexBuffer,Q.skyboxGeometry.indexBuffer,Q.skyboxGeometry.segment)}(_,p,z,M,V)},custom:function(_,d,p,b){const M=_.context,L=p.implementation;if(!_.transform.projection.unsupportedLayers||!_.transform.projection.unsupportedLayers.includes("custom")||_.terrain&&(_.terrain.renderingToTexture||_.renderPass==="offscreen")&&p.isDraped(d)){if(_.renderPass==="offscreen"){const O=L.prerender;if(O){if(_.setCustomLayerDefaults(),M.setColorMode(_.colorModeForRenderPass()),_.transform.projection.name==="globe"){const z=_.transform.pointMerc;O.call(L,M.gl,_.transform.customLayerMatrix(),_.transform.getProjection(),_.transform.globeToMercatorMatrix(),a.aj(_.transform.zoom),[z.x,z.y],_.transform.pixelsPerMeterRatio)}else O.call(L,M.gl,_.transform.customLayerMatrix());M.setDirty(),_.setBaseState()}}else if(_.renderPass==="translucent"){if(_.terrain&&_.terrain.renderingToTexture){const z=L.renderToTile;if(z){const V=b[0].canonical,Y={x:V.x+b[0].wrap*(L.wrapTileId?0:1<{Y&&(Y.useNormalOffset=!0,Q||(Y.enabled=!0))},le=d.getSource();if(_.renderPass==="light-beam"&&le.type!=="batched-model")return;if(le.type==="vector"||le.type==="geojson")return function(Ve,gt,ct,ht,ot){const st=Ve.transform,vt=st.projection.name==="globe",Pt=st.getFreeCameraOptions().position;if(!Ve.modelManager)return;const Tt=Ve.modelManager;ct.modelManager=Tt;const qt=Ve.shadowRenderer;if(!ct._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const Vt=ct._unevaluatedLayout._values["model-id"],nr=Object.assign({},ct.layout.get("model-id").parameters),vr=Ve.style.order.indexOf(ct.fqid),Ft=ct.paint.get("model-opacity").constantOr(1);for(const St of ht){const Kt=gt.getTile(St).getBucket(ct);if(!Kt||Kt.projection.name!==st.projection.name)continue;const Ut=Kt.getModelUris();if(Ut&&!Kt.modelsRequested&&(Tt.addModelsFromBucket(Ut,ot),Kt.modelsRequested=!0),vt)nr.zoom=St.overscaledZ;else{const Dr=Kc(St,st);nr.zoom=Dr}const ur=Vt.possiblyEvaluate(nr);if(gP(Ve,Kt,St),cf.shadowUniformsInitialized=!1,cf.useSingleShadowCascade=!!qt&&qt.getMaxCascadeForTile(St.toUnwrapped())===0,Ve.renderPass==="shadow"&&qt){if(Ve.currentShadowCascade===1&&Kt.isInsideFirstShadowMapFrustum)continue;const Dr=st.calculatePosMatrix(St.toUnwrapped(),st.worldSize);if(cf.tileMatrix.set(Dr),cf.shadowTileMatrix=Float32Array.from(qt.calculateShadowPassMatrixFromMatrix(Dr)),cf.aabb.min=[0,0,0],cf.aabb.max[0]=cf.aabb.max[1]=a.al,cf.aabb.max[2]=0,tae(Kt,cf,Ve,ct.scope))continue}const Ar=1<0&&Ve.style.isLayerClipped(ct,gt.getSource())&&Kt.updateReplacement(St,Ve.replacementSource,vr,ct.scope)&&(Kt.uploaded=!1,Kt.upload(Ve.context));let Nr=0;const _r=new Array,nn=new Array,Jr=new Array;for(let Dr in Kt.instancesPerModel){const qr=Kt.instancesPerModel[Dr];qr.features.length>0&&!vt&&(Dr=ur.evaluate(qr.features[0].feature,{}));const wn=Tt.getModel(Dr,ot);if(wn||Tt.hasURLBeenRequested(Dr)||Kt.modelUris.includes(Dr)||(Kt.modelUris.push(Dr),Kt.modelsRequested=!1),wn&&wn.uploaded)if(vt){const Hn=a.c5([],[Pt.x,Pt.y,Pt.z],Ve.transform.worldSize);a.ew(Hn,Hn);for(let As=0;As0&&Js.elevationUpdate(Dr.terrain,As,on,wn.source),Js.needsReEvaluation(Dr,ai,wn)&&Js.evaluate(wn))}})(Ve,gt,ct,ht),function(){let Dr,qr,wn;_r?(Dr=ht.length-1,qr=-1,wn=-1):(Dr=0,qr=ht.length,wn=1);const Hn=new Float64Array(16),As=a.cA(),ai=new a.P(0,0);for(let on=Dr;on!==qr;on+=wn){const Js=ht[on],Un=gt.getTile(Js).getBucket(ct);if(!Un||!Un.uploaded)continue;let ui=!1;Pt&&(ui=Pt.getMaxCascadeForTile(Js.toUnwrapped())===0);const Ci=st.calculatePosMatrix(Js.toUnwrapped(),st.worldSize),vi=Un.modelTraits;!Ar&&_r&&(a.bl(Hn,Ci),a.af(As,qt,Hn),ai.x=As[0],ai.y=As[1]);const Ys=[];Un.setFilter(ct.filter);for(const ts of Un.getNodesInfo()){if(ts.hiddenByReplacement||!ts.node.meshes)continue;const ci=ts.node;let Ea=0;Ve.terrain&&ci.elevation&&(Ea=ci.elevation*Ve.terrain.exaggeration());const ua=(()=>{const uc=ts.aabb;return ur.min=[...uc.min],ur.max=[...uc.max],ur.min[2]+=Ea,ur.max[2]+=Ea,a.af(ur.min,ur.min,Ci),a.af(ur.max,ur.max,Ci),ur})(),hi=ts.evaluatedScale;if(hi[0]<=1&&hi[1]<=1&&hi[2]<=1&&ua.intersects(Ur)===0)continue;if(!Ar&&_r){const uc=.16666666666666666;ts.cameraCollisionOpacity=qt[0]>ua.min[0]&&qt[0]ua.min[1]&&qt[1]!_r||ts.opacity===1&&ci.opacity===1?ts.depthci.depth?-1:1);for(const ts of Ys){const ci=ts.nodeInfo,Ea=ci.node;let ua=a.aB([],Ft,ts.tileModelMatrix);a.aB(ua,nr,ua);const hi=a.bl([],ua);a.eg(hi,hi),a.cS(hi,hi,hv),ua=a.aB(ua,ua,Ea.globalMatrix);const Hs=Ve.renderPass==="light-beam",rs=ct.paint.get("model-color-use-theme").constantOr("default")==="none",na=vi&a.eI.HasMapboxMeshFeatures,Za=na?0:ci.evaluatedRMEA[0][2];for(let ka=0;ka=ir||Na>=ir}}const Il=zi.material;let au;Il.occlusionTexture&&Il.occlusionTexture.offsetScale&&(au=Il.occlusionTexture.offsetScale,zo.defines.push("OCCLUSION_TEXTURE_TRANSFORM"));const Ku=Ve.getOrCreateProgram("model",zo);!Ar&&Pt&&Pt.setupShadowsFromMatrix(ts.tileModelMatrix,Ku,Pt.useNormalOffset),Ve.uploadCommonUniforms(ot,Ku,null,hc);const yd=Il.pbrMetallicRoughness;yd.metallicFactor=.9,yd.roughnessFactor=.5;const Fa=$g(new Float32Array(Xl),new Float32Array(ua),new Float32Array(hi),new Float32Array(Ea.globalMatrix),Ve,ts.opacity,yd.baseColorFactor,Il.emissiveFactor,yd.metallicFactor,yd.roughnessFactor,Il,Za,ct,[0,0,0],au);!Zc&&(ci.hasTranslucentParts||ts.opacity<1)&&Ku.draw(Ve,ot.gl.TRIANGLES,Kt,Fn.disabled,Jn.disabled,Rn.backCCW,Fa,ct.id,zi.vertexBuffer,zi.indexBuffer,zi.segments,ct.paint,Ve.transform.zoom,void 0,uc),Ku.draw(Ve,ot.gl.TRIANGLES,Zc?Ut:Kt,Fn.disabled,Zc||ts.opacity<1||ci.hasTranslucentParts?Jn.alphaBlended:Jn.unblended,Rn.backCCW,Fa,ct.id,zi.vertexBuffer,zi.indexBuffer,zi.segments,ct.paint,Ve.transform.zoom,void 0,uc)}}}}()}(_,d,p,b),void ce();if(le.type!=="model")return;const de=le.getModels(),be=[],ye=_.transform.getFreeCameraOptions().position,Oe=a.c5([],[ye.x,ye.y,ye.z],_.transform.worldSize);a.ew(Oe,Oe);const Ee=[],qe=[];let Ze=0;for(const Ve of de){const gt=d.getFeatureState("",Ve.id),ct={type:"Unknown",id:Ve.id,properties:Ve.featureProperties},ht=p.paint.get("model-rotation").evaluate(ct,gt),ot=p.paint.get("model-scale").evaluate(ct,gt),st=p.paint.get("model-translation").evaluate(ct,gt),vt=p.paint.get("model-opacity").evaluate(ct,gt);fP(p,Ve.id,gt,Ve.featureProperties,Ve.nodeOverrideNames,Ve.nodeOverrides),pP(p,Ve.id,gt,Ve.featureProperties,Ve.materialOverrideNames,Ve.materialOverrides),Ve.nodeOverrides.size>0&&Ve.computeBoundsAndApplyParent(),Ve.computeModelMatrix(_,ht,ot,st,z,O,!1);const Pt=a.bA([]),Tt=a.ef(Ve.position.lat,_.transform.zoom),qt=a.bq([],[1,1,1/Tt]);a.br(Pt,Pt,Oe),be.push({zScaleMatrix:qt,negCameraPosMatrix:Pt});for(const Vt of Ve.nodes)Gg(_,Vt,Ve.matrix,_.transform.expandedFarZProjMatrix,Ze,Ee,qe,Ve.materialOverrides,vt);Ze++}if(Ee.sort((Ve,gt)=>gt.depth-Ve.depth),_.renderPass!=="shadow")mP(_,p,Ee,qe,be),ce();else{for(const Ve of qe)wh(Ve.mesh,Ve.nodeModelMatrix,_,p);for(const Ve of Ee)wh(Ve.mesh,Ve.nodeModelMatrix,_,p);ce()}}},$k={line:function(_,d,p){if(_.hasElevatedBuckets=!1,_.hasNonElevatedBuckets=!1,_._unevaluatedLayout.getValue("line-elevation-reference")!==void 0||_._unevaluatedLayout.getValue("line-z-offset")!==void 0){if(d){const b=d.getVisibleCoordinates();for(const M of b){const L=d.getTile(M).getBucket(_);if(L&&(L.elevationType!=="none"?_.hasElevatedBuckets=!0:_.hasNonElevatedBuckets=!0,_.hasElevatedBuckets&&_.hasNonElevatedBuckets))break}}}else _.hasNonElevatedBuckets=!0},model:function(_,d,p){const b=d.getSource();if(!b.loaded())return;if(b.type==="vector"||b.type==="geojson")return void(p.modelManager&&p.modelManager.upload(p,uv(p,_)));if(b.type==="batched-model"||b.type!=="model")return;const M=b.getModels();for(const L of M)L.upload(p.context)},raster:function(_,d,p){const b=d.getSource();if(!(b instanceof Qo&&b.loaded()))return;const M=_.sourceLayer||b.rasterLayerIds&&b.rasterLayerIds[0];if(!M)return;const L=_.paint.get("raster-array-band")||b.getInitialBand(M);if(L==null)return;const O=d.getIds().map(z=>d.getTileByID(z));for(const z of O)z.updateNeeded(_.id,L)&&b.prepareTile(z,M,_.id,L)},"raster-particle":function(_,d,p){const b=d.getSource();if(!(b instanceof Qo&&b.loaded()))return;const M=_.sourceLayer||b.rasterLayerIds&&b.rasterLayerIds[0];if(!M)return;const L=_.paint.get("raster-particle-array-band")||b.getInitialBand(M);if(L==null)return;const O=d.getIds().map(z=>d.getTileByID(z));for(const z of O)z.updateNeeded(_.id,L)&&b.prepareTile(z,M,_.id,L)}},iu={fill:Ck},Uk={fill:function(_,d,p,b){if(!p.layout||p.layout.get("fill-elevation-reference")==="none"||p.paint.get("fill-opacity").constantOr(1)===0)return;const M=_.context.gl,L=new cn(M.LEQUAL,cn.ReadOnly,_.depthRangeFor3D),O=new Fn({func:M.ALWAYS,mask:255},255,255,M.KEEP,M.KEEP,M.REPLACE),z=_.transform.getFreeCameraOptions().position,V=_.getOrCreateProgram("elevatedStructuresDepthReconstruct");for(const Y of b){const Q=d.getTile(Y),ce=Q.getBucket(p);if(!ce)continue;const le=ce.elevatedStructures;if(!le||le.depthSegments.segments[0].primitiveLength===0)continue;const de=sP(Y.toUnwrapped(),z),be=_.translatePosMatrix(Y.projMatrix,Q,p.paint.get("fill-translate"),p.paint.get("fill-translate-anchor")),ye=Bg(be,de,0,1,0);V.draw(_,M.TRIANGLES,L,O,Jn.disabled,Rn.disabled,ye,p.id,le.vertexBuffer,le.indexBuffer,le.depthSegments,p.paint,_.transform.zoom)}}};class qk{constructor(d,p,b,M,L){this.context=new _x(d,p),this.transform=b,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this._timeStamp=a.o.now(),this._averageFPS=0,this._fpsHistory=[],this._dt=0,this._debugParams={forceEnablePrecipitation:!1,showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,enabledLayers:{}};const O=["fill","line","symbol","circle","heatmap","fill-extrusion","building","raster","raster-particle","hillshade","model","background","sky"];for(const V of O)this._debugParams.enabledLayers[V]=!0;for(const V of O);this.occlusionParams=new wx,this.setup(),this.numSublayers=qc.maxUnderzooming+qc.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new a.eP,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new lx(this),this._wireframeDebugCache=new Em,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const z=new a.q({width:1,height:1},Uint8Array.of(0,0,0,0));this.emptyDepthTexture=new a.T(this.context,z,d.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=M,this.worldview=L,this._forceEmissiveMode=!1,this.emissiveMode="constant"}updateTerrain(d,p){const b=!!d&&!!d.terrain&&this.transform.projection.supportsTerrain;if(!(b||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new L3(this,d));const M=this._terrain;this.transform.elevation=b?M:null,M.update(d,this.transform,p),this.transform.elevation&&!M.enabled&&(this.transform.elevation=null)}_updateFog(d){const p=d.fog;if(!p||this.transform.projection.name==="globe"||p.getOpacity(this.transform.pitch)<1||p.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[b,M]=p.getFovAdjustedRange(this.transform._fov);if(b>M)return void(this.transform.fogCullDistSq=null);const L=b+.78*(M-b);this.transform.fogCullDistSq=L*L}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled||this._forceTerrainMode?this._terrain:null}get forceTerrainMode(){return this._forceTerrainMode}set forceTerrainMode(d){d&&!this._terrain&&(this._terrain=new L3(this,this.style)),this._forceTerrainMode=d}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(d,p){if(this.width=d*a.o.devicePixelRatio,this.height=p*a.o.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const b of this.style.order)this.style._mergedLayers[b].resize()}setup(){const d=this.context,p=new a.bd;p.emplaceBack(0,0),p.emplaceBack(a.al,0),p.emplaceBack(0,a.al),p.emplaceBack(a.al,a.al),this.tileExtentBuffer=d.createVertexBuffer(p,a.bf.members),this.tileExtentSegments=a.bg.simpleSegment(0,0,4,2);const b=new a.bd;b.emplaceBack(0,0),b.emplaceBack(a.al,0),b.emplaceBack(0,a.al),b.emplaceBack(a.al,a.al),this.debugBuffer=d.createVertexBuffer(b,a.bf.members),this.debugSegments=a.bg.simpleSegment(0,0,4,5);const M=new a.bd;M.emplaceBack(-1,-1),M.emplaceBack(1,-1),M.emplaceBack(-1,1),M.emplaceBack(1,1),this.viewportBuffer=d.createVertexBuffer(M,a.bf.members),this.viewportSegments=a.bg.simpleSegment(0,0,4,2);const L=new a.b1;L.emplaceBack(0,0,0,0),L.emplaceBack(a.al,0,a.al,0),L.emplaceBack(0,a.al,0,a.al),L.emplaceBack(a.al,a.al,a.al,a.al),this.mercatorBoundsBuffer=d.createVertexBuffer(L,a.bi.members),this.mercatorBoundsSegments=a.bg.simpleSegment(0,0,4,2);const O=new a.b0;O.emplaceBack(0,1,2),O.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=d.createIndexBuffer(O);const z=new a.be;for(const Y of[0,1,3,2,0])z.emplaceBack(Y);this.debugIndexBuffer=d.createIndexBuffer(z),this.emptyTexture=new a.T(d,new a.q({width:1,height:1},Uint8Array.of(0,0,0,0)),d.gl.RGBA8),this.identityMat=a.bC();const V=this.context.gl;this.stencilClearMode=new Fn({func:V.ALWAYS,mask:0},0,255,V.ZERO,V.ZERO,V.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(d){return d._makeTileBoundsBuffers(this.context,this.transform.projection),d._tileBoundsBuffer?{tileBoundsBuffer:d._tileBoundsBuffer,tileBoundsIndexBuffer:d._tileBoundsIndexBuffer,tileBoundsSegments:d._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const d=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,d.TRIANGLES,cn.disabled,this.stencilClearMode,Jn.disabled,Rn.disabled,nv(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(d,p,b){if(!p||this.currentStencilSource===p.id||!d.isTileClipped()||!b||b.length===0)return;if(this._tileClippingMaskIDs&&!this.terrain){let z=!1;for(const V of b)if(this._tileClippingMaskIDs[V.key]===void 0){z=!0;break}if(!z)return}this.currentStencilSource=p.id;const M=this.context,L=M.gl;this.nextStencilID+b.length>256&&this.clearStencil(),M.setColorMode(Jn.disabled),M.setDepthMode(cn.disabled);const O=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const z of b){const V=p.getTile(z),Y=this._tileClippingMaskIDs[z.key]=this.nextStencilID++,{tileBoundsBuffer:Q,tileBoundsIndexBuffer:ce,tileBoundsSegments:le}=this.getTileBoundsBuffers(V);O.draw(this,L.TRIANGLES,cn.disabled,new Fn({func:L.ALWAYS,mask:0},Y,255,L.KEEP,L.KEEP,L.REPLACE),Jn.disabled,Rn.disabled,nv(z.projMatrix),"$clipping",Q,ce,le)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const d=this.nextStencilID++,p=this.context.gl;return new Fn({func:p.NOTEQUAL,mask:255},d,255,p.KEEP,p.KEEP,p.REPLACE)}stencilModeForClipping(d){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(d);const p=this.context.gl;return new Fn({func:p.EQUAL,mask:255},this._tileClippingMaskIDs[d.key],0,p.KEEP,p.KEEP,p.REPLACE)}stencilConfigForOverlap(d){const p=this.context.gl,b=d.sort((O,z)=>z.overscaledZ-O.overscaledZ),M=b[b.length-1].overscaledZ,L=b[0].overscaledZ-M+1;if(L>1){this.currentStencilSource=void 0,this.nextStencilID+L>256&&this.clearStencil();const O={};for(let z=0;zthis._debugParams.fpsWindow&&this._fpsHistory.splice(0,this._fpsHistory.length-this._debugParams.fpsWindow),this._averageFPS=Math.round(this._fpsHistory.reduce((d,p)=>d+p/this._fpsHistory.length,0))}render(d,p){const b=a.o.now();this._dt=b-this._timeStamp,this._timeStamp=b,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=d.map.repaint,this.style=d,this.options=p;const M=this.style._mergedLayers,L=!(!this.terrain||!this.terrain.enabled),O=()=>this.style._getOrder(L).filter(Ft=>{const St=M[Ft];return!(St.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[St.type]});let z=O(),V=!1,Y=!1,Q=null,ce=0,le=!1;for(const Ft of z){const St=M[Ft];St.visibility!=="none"&&(St.type==="circle"?V=!0:St.type==="building"?(Q=St,++ce):St.type==="symbol"&&(St.hasOcclusionOpacityProperties?Y=!0:V=!0))}this.updateEmissiveMode();let de=z.map(Ft=>M[Ft]);const be=this.style._mergedSourceCaches;this.imageManager=d.imageManager,this.modelManager=d.modelManager,this.symbolFadeChange=d.placement.symbolFadeChange(a.o.now()),this.imageManager.beginFrame();for(const Ft in be){const St=be[Ft];St.used&&(St.prepare(this.context),St.getSource().usedInConflation&&++ce)}let ye=!1;for(const Ft of de)Ft.isHidden(this.transform.zoom)||(Ft.type==="clip"&&(ye=!0),this.prepareLayer(Ft));const Oe={},Ee={},qe={},Ze={},Ve={};for(const Ft in be){const St=be[Ft];Oe[Ft]=St.getVisibleCoordinates(),Ee[Ft]=Oe[Ft].slice().reverse(),qe[Ft]=St.getVisibleCoordinates(!0).reverse(),Ze[Ft]=St.getShadowCasterCoordinates(),Ve[Ft]=St.sortCoordinatesByDistance(Oe[Ft])}const gt=Ft=>{const St=this.style.getLayerSourceCache(Ft);return St&&St.used?St.getSource():null};if(ce||ye||this._clippingActiveLastFrame){const Ft=[],St=[];let Kt=0;for(const Ut of de)this.isSourceForClippingOrConflation(Ut,gt(Ut))&&(Ft.push(Ut),St.push(Kt)),Kt++;if(Ft&&(ye||Ft.length>1)||this._clippingActiveLastFrame){ye=!1;const Ut=[];for(let ur=0;ur0){const Ut=gt(St);Ut&&(this.minCutoffZoom=Math.max(Ut.minzoom,this.minCutoffZoom)),St.minzoom&&(this.minCutoffZoom=Math.max(St.minzoom,this.minCutoffZoom))}St.is3D(L)&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=Ft),this._lastOcclusionLayer=Ft)}const ct=this.style&&this.style.fog;ct?(this._fogVisible=ct.getOpacity(this.transform.pitch)!==0,this._fogVisible&&this.transform.projection.name!=="globe"&&(this._fogVisible=ct.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(qe),this.opaquePassCutoff=0,z=O(),de=z.map(Ft=>M[Ft]));const ht=this._shadowRenderer;if(ht){ht.updateShadowParameters(this.transform,this.style.directionalLight);for(const Ft in be)for(const St of Oe[Ft]){let Kt={min:0,max:0};this.terrain&&(Kt=this.terrain.getMinMaxForTile(St)||Kt),ht.addShadowReceiver(St.toUnwrapped(),Kt.min,Kt.max)}}this.transform.projection.name!=="globe"||this.globeSharedBuffers||(this.globeSharedBuffers=new a.eR(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new hP(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);const ot=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.snow),st=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.rain);if(ot&&!this._snow&&(this._snow=new Y3(this)),!ot&&this._snow&&(this._snow.destroy(),delete this._snow),st&&!this._rain&&(this._rain=new Bk(this)),!st&&this._rain&&(this._rain.destroy(),delete this._rain),this._snow&&this._snow.update(this),this._rain&&this._rain.update(this),Q){this.buildingTileBorderManager||(this.buildingTileBorderManager=new Ok);const Ft=this.style.getLayerSourceCache(Q);this.buildingTileBorderManager.updateBorders(Ft,Q)}if(!rt.has(this.context.gl))return;this.renderPass="offscreen";for(const Ft of de){const St=d.getLayerSourceCache(Ft);if(!Ft.hasOffscreenPass()||Ft.isHidden(this.transform.zoom))continue;const Kt=St?Ee[St.id]:void 0;(Ft.type==="custom"||Ft.type==="raster"||Ft.type==="raster-particle"||Ft.isSky()||Kt&&Kt.length)&&this.renderLayer(this,St,Ft,Kt)}this.depthRangeFor3D=[0,1-(de.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,Ze)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const vt=this.transform.projection.name==="globe"||this.transform.isHorizonVisible(),Pt=(()=>{if(p.showOverdrawInspector)return a.ao.black;const Ft=this.style.fog;if(Ft&&this.transform.projection.supportsFog){const St=this.style.getLut(Ft.scope);if(!vt){const Kt=Ft.properties.get("color-use-theme")==="none",Ut=Ft.properties.get("color").toNonPremultipliedRenderColor(Kt?null:St).toArray01();return new a.ao(...Ut)}if(vt){const Kt=Ft.properties.get("space-color-use-theme")==="none",Ut=Ft.properties.get("space-color").toNonPremultipliedRenderColor(Kt?null:St).toArray01();return new a.ao(...Ut)}}return a.ao.transparent})();if(this.context.clear({color:Pt,depth:1}),this.clearStencil(),this._showOverdrawInspector=p.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&vt&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=z.length-1;this.currentLayer>=0;this.currentLayer--){const Ft=de[this.currentLayer],St=d.getLayerSourceCache(Ft);if(Ft.isSky())continue;const Kt=St?(Ft.is3D(L)?Ve:Ee)[St.id]:void 0;this._renderTileClippingMasks(Ft,St,Kt),this.renderLayer(this,St,Ft,Kt)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&vt&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||a.aj(this.transform.zoom)>0)&&(this.transform.projection.name==="globe"||this.transform.isHorizonVisible()))for(this.currentLayer=0;this.currentLayer{for(this.currentLayer=0;this.currentLayer0&&Ft.hasShadowPass()&&--qt==0){{this.clearStencil(),this.resetStencilClippingMasks();const Kt=this.currentLayer;for(this.currentLayer=0;this.currentLayer=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){const Kt=this.currentLayer;this.depthOcclusion=!0;for(const Ut of this.layersWithOcclusionOpacity){this.currentLayer=Ut;const ur=de[this.currentLayer],Ar=d.getLayerSourceCache(ur),Ur=Ar?Ee[Ar.id]:void 0;this.terrain||this._renderTileClippingMasks(ur,Ar,Ar?Oe[Ar.id]:void 0),this.renderLayer(this,Ar,ur,Ur)}this.depthOcclusion=!1,this.currentLayer=Kt,this.renderPass="translucent",this.layersWithOcclusionOpacity=[]}++this.currentLayer}}if(this.terrain&&this.terrain.postRender(),this._snow&&this._snow.draw(this),this._rain&&this._rain.draw(this),this.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){let Ft=null;de.forEach(St=>{const Kt=d.getLayerSourceCache(St);Kt&&!St.isHidden(this.transform.zoom)&&Kt.getVisibleCoordinates().length&&(!Ft||Ft.getSource().maxzoom0?p.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return this.context.extTextureFloatLinear!=null}currentGlobalDefines(d,p,b){const M=b===void 0?this.terrain&&this.terrain.renderingToTexture:b,L=[];return this.style&&this.style.enable3dLights()&&(d==="globeRaster"||d==="terrainRaster"?(L.push("LIGHTING_3D_MODE"),L.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):M||L.push("LIGHTING_3D_MODE")),this.renderPass==="shadow"&&(this._shadowMapDebug||L.push("DEPTH_TEXTURE")),this.terrainRenderModeElevated()&&(L.push("TERRAIN"),this.linearFloatFilteringSupported()&&L.push("TERRAIN_DEM_FLOAT_FORMAT")),this.transform.projection.name==="globe"&&L.push("GLOBE"),!this._fogVisible||M||p!==void 0&&!p||L.push("FOG","FOG_DITHERING"),M&&L.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&L.push("OVERDRAW_INSPECTOR"),L}getOrCreateProgram(d,p){this.cache=this.cache||{};const b=p&&p.defines||[],M=p&&p.config,L=this.currentGlobalDefines(d,p&&p.overrideFog,p&&p.overrideRtt).concat(b),O=HI.cacheKey(b3[d],d,L,M);return this.cache[O]||(this.cache[O]=new HI(this.context,d,b3[d],M,Sk[d],L)),this.cache[O]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const d=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(d.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new a.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA8))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy(),this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),this.emptyDepthTexture&&this.emptyDepthTexture.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(d,p){if(this.style.enable3dLights()){const b=this.style.directionalLight,M=this.style.ambientLight;if(b&&M){const L=((O,z,V)=>{const Y=O.properties.get("direction"),Q=O.properties.get("color-use-theme")==="none",ce=O.properties.get("color").toNonPremultipliedRenderColor(Q?null:V.getLut(O.scope)).toArray01(),le=O.properties.get("intensity"),de=z.properties.get("color-use-theme")==="none",be=z.properties.get("color").toNonPremultipliedRenderColor(de?null:V.getLut(z.scope)).toArray01(),ye=z.properties.get("intensity"),Oe=[Y.x,Y.y,Y.z],Ee=a.dN(be,ye),qe=a.dN(ce,le);return{u_lighting_ambient_color:Ee,u_lighting_directional_dir:Oe,u_lighting_directional_color:qe,u_ground_radiance:yx(Oe,qe,Ee)}})(b,M,this.style);p.setLightsUniformValues(d,L)}}}uploadCommonUniforms(d,p,b,M,L){if(this.uploadCommonLightUniforms(d,p),this.terrain&&this.terrain.renderingToTexture)return;const O=this.style.fog;if(O){const z=O.getOpacity(this.transform.pitch),V=((Y,Q,ce,le,de,be,ye,Oe,Ee,qe,Ze,Ve)=>{const gt=Y.transform,ct=Q.properties.get("color-use-theme")==="none",ht=Q.properties.get("color").toNonPremultipliedRenderColor(ct?null:Y.style.getLut(Q.scope)).toArray01();ht[3]=le;const ot=Y.frameCounter/1e3%1,[st,vt]=Q.properties.get("vertical-range");return{u_fog_matrix:ce?gt.calculateFogTileMatrix(ce):Ve||Y.identityMat,u_fog_range:Q.getFovAdjustedRange(gt._fov),u_fog_color:ht,u_fog_horizon_blend:Q.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(st,vt),vt],u_fog_temporal_offset:ot,u_frustum_tl:de,u_frustum_tr:be,u_frustum_br:ye,u_frustum_bl:Oe,u_globe_pos:Ee,u_globe_radius:qe,u_viewport:Ze,u_globe_transition:a.aj(gt.zoom),u_is_globe:+(gt.projection.name==="globe")}})(this,O,b,z,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*a.o.devicePixelRatio,this.transform.height*a.o.devicePixelRatio],M);p.setFogUniformValues(d,V)}L&&p.setCutoffUniformValues(d,L.uniformValues)}setTileLoadedFlag(d){this.tileLoaded=d}saveCanvasCopy(){const d=this.canvasCopy();d&&(this.frameCopies.push(d),this.tileLoaded=!1)}canvasCopy(){const d=this.context.gl,p=d.createTexture();return d.bindTexture(d.TEXTURE_2D,p),d.copyTexImage2D(d.TEXTURE_2D,0,d.RGBA,0,0,d.drawingBufferWidth,d.drawingBufferHeight,0),p}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const d=this.style&&this.style.fog;return!!d&&d.getOpacity(this.transform.pitch)!==0}getBackgroundTiles(){const d=this._backgroundTiles,p=this._backgroundTiles={},b=this.transform.coveringTiles({tileSize:512});for(const M of b)p[M.key]=d[M.key]||new np(M,512,this.transform.tileZoom,this,void 0,this.worldview);return p}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(d,p){return!(!d.is3D(!(!this.terrain||!this.terrain.enabled))||d.type!=="clip"&&d.type!=="building"&&(d.minzoom&&d.minzoom>this.transform.zoom||(this.style._clipLayerPresent||d.sourceLayer!=="building"&&d.sourceLayer!=="procedural_buildings")&&(!p||p.type!=="batched-model")))}isTileAffectedByFog(d){if(!this.style||!this.style.fog)return!1;if(this.transform.projection.name==="globe")return!0;let p=this._cachedTileFogOpacities[d.key];return p||(this._cachedTileFogOpacities[d.key]=p=this.style.fog.getOpacityForTile(d)),p[0]>=ir||p[1]>=ir}setupDepthForOcclusion(d,p,b){const M=this.context,L=M.gl,O=!!b;var z;b||(b={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0}),M.activeTexture.set(L.TEXTURE3),d&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(L.NEAREST,L.CLAMP_TO_EDGE),b.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],b.u_depth_range_unpack=[2/((z=this.depthRangeFor3D)[1]-z[0]),-1-2*z[0]/(z[1]-z[0])],b.u_occluder_half_size=.5*this.occlusionParams.occluderSize,b.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.emptyDepthTexture.bind(L.NEAREST,L.CLAMP_TO_EDGE),M.activeTexture.set(L.TEXTURE0),O||p.setTerrainUniformValues(M,b)}updateEmissiveMode(){if(this._forceEmissiveMode)return;const d=this.style.hasDataDrivenEmissiveStrength();this.emissiveMode=d?this.context.extBlendFuncExtended?"dual-source-blending":"mrt-fallback":"constant"}}function Vk(_,d){let p=!1,b=null;const M=()=>{b=null,p&&(_(),b=setTimeout(M,d),p=!1)};return()=>(p=!0,b||M(),b)}class X3{constructor(d){this._hashName=d&&encodeURIComponent(d),a.aY(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=Vk(this._updateHashUnthrottled.bind(this),300)}addTo(d){return this._map=d,window.addEventListener("hashchange",this._onHashChange,!1),d.on("moveend",this._updateHash),this}remove(){return this._map?(this._map.off("moveend",this._updateHash),window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}getHashString(){const d=this._map;if(!d)return"";const p=Ro(d);if(this._hashName){const b=this._hashName;let M=!1;const L=location.hash.slice(1).split("&").map(O=>{const z=O.split("=")[0];return z===b?(M=!0,`${z}=${p}`):O}).filter(O=>O);return M||L.push(`${b}=${p}`),`#${L.join("&")}`}return`#${p}`}_getCurrentHash(){const d=location.hash.replace("#","");if(this._hashName){let p;return d.split("&").map(b=>b.split("=")).forEach(b=>{b[0]===this._hashName&&(p=b)}),(p&&p[1]||"").split("/")}return d.split("/")}_onHashChange(){const d=this._map;if(!d)return!1;const p=this._getCurrentHash();if(p.length>=3&&!p.some(b=>isNaN(Number(b)))){const b=d.dragRotate.isEnabled()&&d.touchZoomRotate.isEnabled()?+(p[3]||0):d.getBearing();return d.jumpTo({center:[+p[2],+p[1]],zoom:+p[0],bearing:b,pitch:+(p[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function Ro(_,d){const p=_.getCenter(),b=Math.round(100*_.getZoom())/100,M=Math.ceil((b*Math.LN2+Math.log(512/360/.5))/Math.LN10),L=Math.pow(10,M),O=Math.round(p.lng*L)/L,z=Math.round(p.lat*L)/L,V=_.getBearing(),Y=_.getPitch();let Q=d?`/${O}/${z}/${b}`:`${b}/${z}/${O}`;return(V||Y)&&(Q+="/"+Math.round(10*V)/10),Y&&(Q+=`/${Math.round(Y)}`),Q}const kx={linearity:.3,easing:a.eT(0,0,.3,1)},Q3=Object.assign({deceleration:2500,maxSpeed:1400},kx),J3=Object.assign({deceleration:20,maxSpeed:1400},kx),Zg=Object.assign({deceleration:1e3,maxSpeed:360},kx),eM=Object.assign({deceleration:1e3,maxSpeed:90},kx);class tM{constructor(d){this._map=d,this.clear()}clear(){this._inertiaBuffer=[]}record(d){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:a.o.now(),settings:d})}_drainInertiaBuffer(){const d=this._inertiaBuffer,p=a.o.now();for(;d.length>0&&p-d[0].time>160;)d.shift()}_onMoveEnd(d){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;const p={zoom:0,bearing:0,pitch:0,pan:new a.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:L}of this._inertiaBuffer)p.zoom+=L.zoomDelta||0,p.bearing+=L.bearingDelta||0,p.pitch+=L.pitchDelta||0,L.panDelta&&p.pan._add(L.panDelta),L.around&&(p.around=L.around),L.pinchAround&&(p.pinchAround=L.pinchAround);const b=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,M={};if(p.pan.mag()){const L=df(p.pan.mag(),b,Object.assign({},Q3,d||{}));M.offset=p.pan.mult(L.amount/p.pan.mag()),M.center=this._map.transform.center,Nx(M,L)}if(p.zoom){const L=df(p.zoom,b,J3);M.zoom=this._map.transform.zoom+L.amount,Nx(M,L)}if(p.bearing){const L=df(p.bearing,b,Zg);M.bearing=this._map.transform.bearing+a.aA(L.amount,-179,179),Nx(M,L)}if(p.pitch){const L=df(p.pitch,b,eM);M.pitch=this._map.transform.pitch+L.amount,Nx(M,L)}if(M.zoom||M.bearing){const L=p.pinchAround===void 0?p.around:p.pinchAround;M.around=L?this._map.unproject(L):this._map.getCenter()}return this.clear(),M.noMoveStart=!0,M}}function Nx(_,d){(!_.duration||_.durationp.unproject(V)),z=L.reduce((V,Y,Q,ce)=>V.add(Y.div(ce.length)),new a.P(0,0));super(d,{points:L,point:z,lngLats:O,lngLat:p.unproject(z),originalEvent:b}),this._defaultPrevented=!1}}class rM extends a.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(d,p){super("wheel",{originalEvent:p}),this._defaultPrevented=!1}}class Hk{constructor(d,p){this._map=d,this._clickTolerance=p.clickTolerance}reset(){this._mousedownPos=void 0}wheel(d){return this._firePreventable(new rM(this._map,d))}mousedown(d,p){return this._mousedownPos=p,this._firePreventable(new gd(d.type,this._map,d))}mouseup(d){this._map.fire(new gd(d.type,this._map,d))}preclick(d){const p=new MouseEvent("preclick",d);this._map.fire(new gd(p.type,this._map,p))}click(d,p){this._mousedownPos&&this._mousedownPos.dist(p)>=this._clickTolerance||(this.preclick(d),this._map.fire(new gd(d.type,this._map,d)))}dblclick(d){return this._firePreventable(new gd(d.type,this._map,d))}mouseover(d){this._map.fire(new gd(d.type,this._map,d))}mouseout(d){this._map.fire(new gd(d.type,this._map,d))}touchstart(d){return this._firePreventable(new Pm(d.type,this._map,d))}touchmove(d){this._map.fire(new Pm(d.type,this._map,d))}touchend(d){this._map.fire(new Pm(d.type,this._map,d))}touchcancel(d){this._map.fire(new Pm(d.type,this._map,d))}_firePreventable(d){if(this._map.fire(d),d.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class nM{constructor(d){this._map=d}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(d){this._map.fire(new gd(d.type,this._map,d))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new gd("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(d){this._delayContextMenu?this._contextMenuEvent=d:this._map.fire(new gd(d.type,this._map,d)),this._map.listens("contextmenu")&&d.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Wk{constructor(d,p){this._map=d,this._el=d.getCanvasContainer(),this._container=d.getContainer(),this._clickTolerance=p.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(d,p){this.isEnabled()&&d.shiftKey&&d.button===0&&($(),this._startPos=this._lastPos=p,this._active=!0)}mousemoveWindow(d,p){if(!this._active)return;const b=p,M=this._startPos,L=this._lastPos;if(!M||!L||L.equals(b)||!this._box&&b.dist(M){this._box&&(this._box.style.transform=`translate(${O}px,${V}px)`,this._box.style.width=z-O+"px",this._box.style.height=Y-V+"px")})}mouseupWindow(d,p){if(!this._active)return;const b=this._startPos,M=p;if(b&&d.button===0){if(this.reset(),W(),b.x!==M.x||b.y!==M.y)return this._map.fire(new a.z("boxzoomend",{originalEvent:d})),{cameraAnimation:L=>L.fitScreenCoordinates(b,M,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",d)}}keydown(d){this._active&&d.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",d))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),F(),delete this._startPos,delete this._lastPos}_fireEvent(d,p){return this._map.fire(new a.z(d,{originalEvent:p}))}}function Gk(_,d){const p={};for(let b=0;b<_.length;b++)p[_[b].identifier]=d[b];return p}class vP{constructor(d){this.reset(),this.numTouches=d.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(d,p,b){(this.centroid||b.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===0&&(this.startTime=d.timeStamp),b.length===this.numTouches&&(this.centroid=function(M){const L=new a.P(0,0);for(const O of M)L._add(O);return L.div(M.length)}(p),this.touches=Gk(b,p)))}touchmove(d,p,b){if(this.aborted||!this.centroid)return;const M=Gk(b,p);for(const L in this.touches){const O=M[L];(!O||O.dist(this.touches[L])>30)&&(this.aborted=!0)}}touchend(d,p,b){if((!this.centroid||d.timeStamp-this.startTime>500)&&(this.aborted=!0),b.length===0){const M=!this.aborted&&this.centroid;if(this.reset(),M)return M}}}class Kk{constructor(d){this.singleTap=new vP(d),this.numTaps=d.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(d,p,b){this.singleTap.touchstart(d,p,b)}touchmove(d,p,b){this.singleTap.touchmove(d,p,b)}touchend(d,p,b){const M=this.singleTap.touchend(d,p,b);if(M){const L=d.timeStamp-this.lastTime<500,O=!this.lastTap||this.lastTap.dist(M)<30;if(L&&O||this.reset(),this.count++,this.lastTime=d.timeStamp,this.lastTap=M,this.count===this.numTaps)return this.reset(),M}}}class _P{constructor(){this._zoomIn=new Kk({numTouches:1,numTaps:2}),this._zoomOut=new Kk({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(d,p,b){this._zoomIn.touchstart(d,p,b),this._zoomOut.touchstart(d,p,b)}touchmove(d,p,b){this._zoomIn.touchmove(d,p,b),this._zoomOut.touchmove(d,p,b)}touchend(d,p,b){const M=this._zoomIn.touchend(d,p,b),L=this._zoomOut.touchend(d,p,b);return M?(this._active=!0,d.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:O=>O.easeTo({duration:300,zoom:O.getZoom()+1,around:O.unproject(M)},{originalEvent:d})}):L?(this._active=!0,d.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:O=>O.easeTo({duration:300,zoom:O.getZoom()-1,around:O.unproject(L)},{originalEvent:d})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const bP={0:1,2:2},sM={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class Zk{constructor(d){this.reset(),this._clickTolerance=d.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(d,p){return!1}_move(d,p){return{}}mousedown(d,p){if(this._lastPoint)return;const b=re(d);this._correctButton(d,b)&&(this._lastPoint=p,this._eventButton=b)}mousemoveWindow(d,p){const b=this._lastPoint;if(b){if(d.preventDefault(),this._eventButton!=null&&function(M,L){const O=bP[L];return M.buttons===void 0||(M.buttons&O)!==O}(d,this._eventButton))this.reset();else if(this._moved||!(p.dist(b)0&&(this._active=!0);const M=Gk(b,p),L=new a.P(0,0),O=new a.P(0,0);let z=0;for(const Y in M){const Q=M[Y],ce=this._touches[Y];ce&&(L._add(Q),O._add(Q.sub(ce)),z++,M[Y]=Q)}if(this._touches=M,z{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.removeAttribute("role")},500)}}class Yk{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(d){}_move(d,p,b){return{}}touchstart(d,p,b){this._firstTwoTouches||b.length<2||(this._firstTwoTouches=[b[0].identifier,b[1].identifier],this._start([p[0],p[1]]))}touchmove(d,p,b){const M=this._firstTwoTouches;if(!M)return;d.preventDefault();const[L,O]=M,z=fv(b,p,L),V=fv(b,p,O);if(!z||!V)return;const Y=this._aroundCenter?null:z.add(V).div(2);return this._move([z,V],Y,d)}touchend(d,p,b){if(!this._firstTwoTouches)return;const[M,L]=this._firstTwoTouches,O=fv(b,p,M),z=fv(b,p,L);O&&z||(this._active&&W(),this.reset())}touchcancel(){this.reset()}enable(d){this._enabled=!0,this._aroundCenter=!!d&&d.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function fv(_,d,p){for(let b=0;b<_.length;b++)if(_[b].identifier===p)return d[b]}function kP(_,d){return Math.log2(_/d)}class rae extends Yk{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(d){this._startDistance=this._distance=d[0].dist(d[1])}_move(d,p){const b=this._distance;if(this._distance=d[0].dist(d[1]),this._active||!(Math.abs(kP(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:kP(this._distance,b),pinchAround:p}}}function NP(_,d){return 180*_.angleWith(d)/Math.PI}class ja extends Yk{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(d){this._startVector=this._vector=d[0].sub(d[1]),this._minDiameter=d[0].dist(d[1])}_move(d,p){const b=this._vector;if(this._vector=d[0].sub(d[1]),b&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:NP(this._vector,b),pinchAround:p}}_isBelowThreshold(d){this._minDiameter=Math.min(this._minDiameter,d.mag());const p=25/(Math.PI*this._minDiameter)*360,b=this._startVector;if(!b)return!1;const M=NP(d,b);return Math.abs(M)Math.abs(_.x)}class nae extends Yk{constructor(d){super(),this._map=d}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(d){this._lastPoints=d,Xk(d[0].sub(d[1]))&&(this._valid=!1)}_move(d,p,b){const M=this._lastPoints;if(!M)return;const L=d[0].sub(M[0]),O=d[1].sub(M[1]);return this._map._cooperativeGestures&&!a.eU()&&b.touches.length<3||(this._valid=this.gestureBeginsVertically(L,O,b.timeStamp),!this._valid)?void 0:(this._lastPoints=d,this._active=!0,{pitchDelta:(L.y+O.y)/2*-.5})}gestureBeginsVertically(d,p,b){if(this._valid!==void 0)return this._valid;const M=d.mag()>=2,L=p.mag()>=2;if(!M&&!L)return;if(!M||!L)return this._firstMove==null&&(this._firstMove=b),b-this._firstMove<100&&void 0;const O=d.y>0==p.y>0;return Xk(d)&&Xk(p)&&O}}const sae={panStep:100,bearingStep:15,pitchStep:10};class iae{constructor(){const d=sae;this._panStep=d.panStep,this._bearingStep=d.bearingStep,this._pitchStep=d.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(d){if(d.altKey||d.ctrlKey||d.metaKey)return;let p=0,b=0,M=0,L=0,O=0;switch(d.keyCode){case 61:case 107:case 171:case 187:p=1;break;case 189:case 109:case 173:p=-1;break;case 37:d.shiftKey?b=-1:(d.preventDefault(),L=-1);break;case 39:d.shiftKey?b=1:(d.preventDefault(),L=1);break;case 38:d.shiftKey?M=1:(d.preventDefault(),O=-1);break;case 40:d.shiftKey?M=-1:(d.preventDefault(),O=1);break;default:return}return this._rotationDisabled&&(b=0,M=0),{cameraAnimation:z=>{const V=z.getZoom();z.easeTo({duration:300,easeId:"keyboardHandler",easing:pv,zoom:p?Math.round(V)+p*(d.shiftKey?2:1):V,bearing:z.getBearing()+b*this._bearingStep,pitch:z.getPitch()+M*this._pitchStep,offset:[-L*this._panStep,-O*this._panStep],center:z.getCenter()},{originalEvent:d})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function pv(_){return _*(2-_)}const oM=4.000244140625,lM=1/450;class Qk{constructor(d,p){this._map=d,this._el=d.getCanvasContainer(),this._handler=p,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=lM,a.aY(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(d){this._defaultZoomRate=d}setWheelZoomRate(d){this._wheelZoomRate=d}isEnabled(){return!!this._enabled}isActive(){return this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(d){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!d&&d.around==="center",this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(d){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(d.ctrlKey||d.metaKey||this.isZooming()||a.eU()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let p=d.deltaMode===WheelEvent.DOM_DELTA_LINE?40*d.deltaY:d.deltaY;const b=a.o.now(),M=b-(this._lastWheelEventTime||0);this._lastWheelEventTime=b,p!==0&&p%oM==0?this._type="wheel":p!==0&&Math.abs(p)<4?this._type="trackpad":M>400?(this._type=null,this._lastValue=p,this._timeout=window.setTimeout(this._onTimeout,40,d)):this._type||(this._type=Math.abs(M*p)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,p+=this._lastValue)),d.shiftKey&&p&&(p/=4),this._type&&(this._lastWheelEvent=d,this._delta-=p,this._active||this._start(d)),d.preventDefault()}_onTimeout(d){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(d)}_start(d){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const p=K(this._el,d);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:p,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const d=this._map.transform;this._type==="wheel"&&d.projection.wrap&&(d._center.lng>=180||d._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const p=()=>d._terrainEnabled()&&this._aroundCoord?d.computeZoomRelativeTo(this._aroundCoord):d.zoom;if(this._delta!==0){const Y=this._type==="wheel"&&Math.abs(this._delta)>oM?this._wheelZoomRate:this._defaultZoomRate;let Q=2/(1+Math.exp(-Math.abs(this._delta*Y)));this._delta<0&&Q!==0&&(Q=1/Q);const ce=p(),le=Math.pow(2,ce),de=typeof this._targetZoom=="number"?d.zoomScale(this._targetZoom):le;this._targetZoom=Math.min(d.maxZoom,Math.max(d.minZoom,d.scaleZoom(de*Q))),this._type==="wheel"&&(this._startZoom=ce,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const b=typeof this._targetZoom=="number"?this._targetZoom:p(),M=this._startZoom,L=this._easing;let O,z=!1;if(this._type==="wheel"&&M&&L){const Y=Math.min((a.o.now()-this._lastWheelEventTime)/200,1),Q=L(Y);O=a.ak(M,b,Q),Y<1?this._frameId||(this._frameId=!0):z=!0}else O=b,z=!0;this._active=!0,z&&(this._active=!1,this._finishTimeout=window.setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let V=O-p();return V*this._lastDelta<0&&(V=0),{noInertia:!0,needsRenderFrame:!z,zoomDelta:V,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(d){let p=a.eV;if(this._prevEase){const b=this._prevEase,M=(a.o.now()-b.start)/b.duration,L=b.easing(M+.01)-b.easing(M),O=.27/Math.sqrt(L*L+1e-4)*.01,z=Math.sqrt(.0729-O*O);p=a.eT(O,z,.25,1)}return this._prevEase={start:a.o.now(),duration:d,easing:p},p}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=S("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.removeAttribute("role")},200)}}class mp{constructor(d,p){this._clickZoom=d,this._tapZoom=p}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Jk{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(d,p){return d.preventDefault(),{cameraAnimation:b=>{b.easeTo({duration:300,zoom:b.getZoom()+(d.shiftKey?-1:1),around:b.unproject(p)},{originalEvent:d})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Fo{constructor(){this._tap=new Kk({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(d,p,b){this._swipePoint||(this._tapTime&&d.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?b.length>0&&(this._swipePoint=p[0],this._swipeTouch=b[0].identifier):this._tap.touchstart(d,p,b))}touchmove(d,p,b){if(this._tapTime){if(this._swipePoint){if(b[0].identifier!==this._swipeTouch)return;const M=p[0],L=M.y-this._swipePoint.y;return this._swipePoint=M,d.preventDefault(),this._active=!0,{zoomDelta:L/128}}}else this._tap.touchmove(d,p,b)}touchend(d,p,b){this._tapTime?this._swipePoint&&b.length===0&&this.reset():this._tap.touchend(d,p,b)&&(this._tapTime=d.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class uf{constructor(d,p,b){this._el=d,this._mousePan=p,this._touchPan=b}enable(d){this._inertiaOptions=d||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class mv{constructor(d,p,b){this._pitchWithRotate=d.pitchWithRotate,this._mouseRotate=p,this._mousePitch=b}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class eN{constructor(d,p,b,M){this._el=d,this._touchZoom=p,this._touchRotate=b,this._tapDragZoom=M,this._rotationDisabled=!1,this._enabled=!0}enable(d){this._touchZoom.enable(d),this._rotationDisabled||this._touchRotate.enable(d),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const gv=_=>_.zoom||_.drag||_.pitch||_.rotate;class aae extends a.z{}class yv{constructor(){this.constants=[1,1,.01],this.radius=0}setup(d,p){const b=a.av([],p,d);this.radius=a.ag(b[2]<0?a.eX([],b,this.constants):[b[0],b[1],0])}projectRay(d){a.eX(d,d,this.constants),a.aw(d,d),a.eY(d,d,this.constants);const p=a.c5([],d,this.radius);if(p[2]>0){const b=a.c5([],[0,0,1],a.bJ(p,[0,0,1])),M=a.c5([],a.aw([],[p[0],p[1],0]),this.radius),L=a.d8([],p,a.c5([],a.av([],a.d8([],M,b),p),2));p[0]=L[0],p[1]=L[1]}return p}}function tN(_){return _.panDelta&&_.panDelta.mag()||_.zoomDelta||_.bearingDelta||_.pitchDelta}class oae{constructor(d,p){this._map=d,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new tM(d),this._bearingSnap=p.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new yv,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(p),a.aY(["handleEvent","handleWindowEvent"],this);const b=this._el;this._listeners=[[b,"touchstart",{passive:!0}],[b,"touchmove",{passive:!1}],[b,"touchend",void 0],[b,"touchcancel",void 0],[b,"mousedown",void 0],[b,"mousemove",void 0],[b,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[b,"mouseover",void 0],[b,"mouseout",void 0],[b,"dblclick",void 0],[b,"click",void 0],[b,"keydown",{capture:!1}],[b,"keyup",void 0],[b,"wheel",{passive:!1}],[b,"contextmenu",void 0],[window,"blur",void 0]];for(const[M,L,O]of this._listeners){const z=M===document?this.handleWindowEvent:this.handleEvent;M.addEventListener(L,z,O)}}destroy(){for(const[d,p,b]of this._listeners){const M=d===document?this.handleWindowEvent:this.handleEvent;d.removeEventListener(p,M,b)}}_addDefaultHandlers(d){const p=this._map,b=p.getCanvasContainer();this._add("mapEvent",new Hk(p,d));const M=p.boxZoom=new Wk(p,d);this._add("boxZoom",M);const L=new _P,O=new Jk;p.doubleClickZoom=new mp(O,L),this._add("tapZoom",L),this._add("clickZoom",O);const z=new Fo;this._add("tapDragZoom",z);const V=p.touchPitch=new nae(p);this._add("touchPitch",V);const Y=new iM(d),Q=new aM(d);p.dragRotate=new mv(d,Y,Q),this._add("mouseRotate",Y,["mousePitch"]),this._add("mousePitch",Q,["mouseRotate"]);const ce=new wP(d),le=new jP(p,d);p.dragPan=new uf(b,ce,le),this._add("mousePan",ce),this._add("touchPan",le,["touchZoom","touchRotate"]);const de=new ja,be=new rae;p.touchZoomRotate=new eN(b,be,de,z),this._add("touchRotate",de,["touchPan","touchZoom"]),this._add("touchZoom",be,["touchPan","touchRotate"]),this._add("blockableMapEvent",new nM(p));const ye=p.scrollZoom=new Qk(p,this);this._add("scrollZoom",ye,["mousePan"]);const Oe=p.keyboard=new iae;this._add("keyboard",Oe);for(const Ee of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])d.interactive&&d[Ee]&&p[Ee].enable(d[Ee])}_add(d,p,b){this._handlers.push({handlerName:d,handler:p,allowed:b}),this._handlersById[d]=p}stop(d){if(!this._updatingCamera){for(const{handler:p}of this._handlers)p.reset();this._inertia.clear(),this._fireEvents({},{},d),this._changes=[],this._originalZoom=void 0}}isActive(){for(const{handler:d}of this._handlers)if(d.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!gv(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(d,p,b){for(const M in d)if(M!==b&&(!p||p.indexOf(M)<0))return!0;return!1}handleWindowEvent(d){this.handleEvent(d,`${d.type}Window`)}_getMapTouches(d){const p=[];for(const b of d)this._el.contains(b.target)&&p.push(b);return p}handleEvent(d,p){this._updatingCamera=!0;const b=d.type==="renderFrame",M=b?void 0:d,L={needsRenderFrame:!1},O={},z={},V=d.touches?this._getMapTouches(d.touches):void 0,Y=V?Z(this._el,V):b?void 0:K(this._el,d);for(const{handlerName:le,handler:de,allowed:be}of this._handlers){if(!de.isEnabled())continue;let ye;this._blockedByActive(z,be,le)?de.reset():de[p||d.type]&&(ye=de[p||d.type](d,Y,V),this.mergeHandlerResult(L,O,ye,le,M),ye&&ye.needsRenderFrame&&this._triggerRenderFrame()),(ye||de.isActive())&&(z[le]=de)}const Q={};for(const le in this._previousActiveHandlers)z[le]||(Q[le]=M);this._previousActiveHandlers=z,(Object.keys(Q).length||tN(L))&&(this._changes.push([L,O,Q]),this._triggerRenderFrame()),(Object.keys(z).length||tN(L))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:ce}=L;ce&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],ce(this._map))}mergeHandlerResult(d,p,b,M,L){if(!b)return;Object.assign(d,b);const O={handlerName:M,originalEvent:b.originalEvent||L};b.zoomDelta!==void 0&&(p.zoom=O),b.panDelta!==void 0&&(p.drag=O),b.pitchDelta!==void 0&&(p.pitch=O),b.bearingDelta!==void 0&&(p.rotate=O)}_applyChanges(){const d={},p={},b={};for(const[M,L,O]of this._changes)M.panDelta&&(d.panDelta=(d.panDelta||new a.P(0,0))._add(M.panDelta)),M.zoomDelta&&(d.zoomDelta=(d.zoomDelta||0)+M.zoomDelta),M.bearingDelta&&(d.bearingDelta=(d.bearingDelta||0)+M.bearingDelta),M.pitchDelta&&(d.pitchDelta=(d.pitchDelta||0)+M.pitchDelta),M.around!==void 0&&(d.around=M.around),M.aroundCoord!==void 0&&(d.aroundCoord=M.aroundCoord),M.pinchAround!==void 0&&(d.pinchAround=M.pinchAround),M.noInertia&&(d.noInertia=M.noInertia),Object.assign(p,L),Object.assign(b,O);this._updateMapTransform(d,p,b),this._changes=[]}_updateMapTransform(d,p,b){const M=this._map,L=M.transform,O=qe=>[qe.x,qe.y,qe.z];if((qe=>{const Ze=this._eventsInProgress.drag;return Ze&&!this._handlersById[Ze.handlerName].isActive()})()&&!tN(d)){const qe=L.zoom;L.cameraElevationReference="sea",this._originalZoom!=null&&L._orthographicProjectionAtLowPitch&&L.projection.name!=="globe"&&L.pitch===0?(L.cameraElevationReference="ground",L.zoom=this._originalZoom):(L.recenterOnTerrain(),L.cameraElevationReference="ground"),qe!==L.zoom&&this._map._update(!0)}if(L._isCameraConstrained&&M._stop(!0),!tN(d))return void this._fireEvents(p,b,!0);let{panDelta:z,zoomDelta:V,bearingDelta:Y,pitchDelta:Q,around:ce,aroundCoord:le,pinchAround:de}=d;L._isCameraConstrained&&(V>0&&(V=0),L._isCameraConstrained=!1),de!==void 0&&(ce=de),(V||(qe=>p[qe]&&!this._eventsInProgress[qe])("drag"))&&ce&&(this._dragOrigin=O(L.pointCoordinate3D(ce)),this._originalZoom=L.zoom,this._trackingEllipsoid.setup(L._camera.position,this._dragOrigin)),L.cameraElevationReference="sea",M._stop(!0),ce=ce||M.transform.centerPoint,Y&&(L.bearing+=Y),Q&&(L.pitch+=Q),L._updateCameraState();const be=[0,0,0];if(z)if(L.projection.name==="mercator"){const qe=this._trackingEllipsoid.projectRay(L.screenPointToMercatorRay(ce).dir),Ze=this._trackingEllipsoid.projectRay(L.screenPointToMercatorRay(ce.sub(z)).dir);be[0]=Ze[0]-qe[0],be[1]=Ze[1]-qe[1]}else{const qe=L.pointCoordinate(ce);if(L.projection.name==="globe"){z=z.rotate(-L.angle);const Ze=L._pixelsPerMercatorPixel/L.worldSize;be[0]=-z.x*a.eW(a.a$(qe.y))*Ze,be[1]=-z.y*a.eW(L.center.lat)*Ze}else{const Ze=L.pointCoordinate(ce.sub(z));qe&&Ze&&(be[0]=Ze.x-qe.x,be[1]=Ze.y-qe.y)}}const ye=L.zoom,Oe=[0,0,0];if(V){const qe=O(le||L.pointCoordinate3D(ce)),Ze={dir:a.aw([],a.av([],qe,L._camera.position))};if(Ze.dir[2]<0){const Ve=L.zoomDeltaToMovement(qe,V);a.c5(Oe,Ze.dir,Ve)}}const Ee=a.d8(be,be,Oe);L._translateCameraConstrained(Ee),V&&Math.abs(L.zoom-ye)>1e-4&&L.recenterOnTerrain(),L.cameraElevationReference="ground",this._map._update(),d.noInertia||this._inertia.record(d),this._fireEvents(p,b,!0)}_fireEvents(d,p,b){const M=gv(this._eventsInProgress),L=gv(d),O={};for(const Q in d){const{originalEvent:ce}=d[Q];this._eventsInProgress[Q]||(O[`${Q}start`]=ce),this._eventsInProgress[Q]=d[Q]}!M&&L&&this._fireEvent("movestart",L.originalEvent);for(const Q in O)this._fireEvent(Q,O[Q]);L&&this._fireEvent("move",L.originalEvent);for(const Q in d){const{originalEvent:ce}=d[Q];this._fireEvent(Q,ce)}const z={};let V;for(const Q in this._eventsInProgress){const{handlerName:ce,originalEvent:le}=this._eventsInProgress[Q];this._handlersById[ce].isActive()||(delete this._eventsInProgress[Q],V=p[ce]||le,z[`${Q}end`]=V)}for(const Q in z)this._fireEvent(Q,z[Q]);const Y=gv(this._eventsInProgress);if(b&&(M||L)&&!Y){this._updatingCamera=!0;const Q=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),ce=le=>le!==0&&-this._bearingSnap{this._frameId=void 0,this.handleEvent(new aae("renderFrame",{timeStamp:d})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const rN="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class cM extends a.E{constructor(d,p){super(),this._moving=!1,this._zooming=!1,this.transform=d,this._bearingSnap=p.bearingSnap,this._respectPrefersReducedMotion=p.respectPrefersReducedMotion!==!1,a.aY(["_renderFrameCallback"],this)}getCenter(){return new a.aT(this.transform.center.lng,this.transform.center.lat)}setCenter(d,p){return this.jumpTo({center:d},p)}panBy(d,p,b){return d=a.P.convert(d).mult(-1),this.panTo(this.transform.center,Object.assign({offset:d},p),b)}panTo(d,p,b){return this.easeTo(Object.assign({center:d},p),b)}getZoom(){return this.transform.zoom}setZoom(d,p){return this.jumpTo({zoom:d},p),this}zoomTo(d,p,b){return this.easeTo(Object.assign({zoom:d},p),b)}zoomIn(d,p){return this.zoomTo(this.getZoom()+1,d,p),this}zoomOut(d,p){return this.zoomTo(this.getZoom()-1,d,p),this}getBearing(){return this.transform.bearing}setBearing(d,p){return this.jumpTo({bearing:d},p),this}getPadding(){return this.transform.padding}setPadding(d,p){return this.jumpTo({padding:d},p),this}rotateTo(d,p,b){return this.easeTo(Object.assign({bearing:d},p),b)}resetNorth(d,p){return this.rotateTo(0,Object.assign({duration:1e3},d),p),this}resetNorthPitch(d,p){return this.easeTo(Object.assign({bearing:0,pitch:0,duration:1e3},d),p),this}snapToNorth(d,p){return Math.abs(this.getBearing())d.aspect?b/(2*Math.tan(.5*d.fovX)*d.aspect):M/(2*Math.tan(.5*d.fovY)*d.aspect)}_cameraForBoundsOnGlobe(d,p,b,M,L,O){const z=d.clone(),V=this._extendCameraOptions(O);z.bearing=M,z.pitch=L;const Y=a.aT.convert(p),Q=a.aT.convert(b),ce=.5*(Y.lat+Q.lat),le=.5*(Y.lng+Q.lng),de=a.eZ(ce,le),be=a.aw([],de),ye=a.aw([],a.bI([],be,[0,1,0])),Oe=a.bI([],ye,be),Ee=[ye[0],ye[1],ye[2],0,Oe[0],Oe[1],Oe[2],0,be[0],be[1],be[2],0,0,0,0,1],qe=[de,a.eZ(Y.lat,Y.lng),a.eZ(Q.lat,Y.lng),a.eZ(Q.lat,Q.lng),a.eZ(Y.lat,Q.lng),a.eZ(ce,Y.lng),a.eZ(ce,Q.lng),a.eZ(Y.lat,le),a.eZ(Q.lat,le)];let Ze=a.d9.fromPoints(qe.map(Ut=>[a.bJ(ye,Ut),a.bJ(Oe,Ut),a.bJ(be,Ut)]));const Ve=a.af([],Ze.center,Ee);a.e_(Ve)===0&&a.e$(Ve,0,0,1),a.aw(Ve,Ve),a.c5(Ve,Ve,a.aD),z.center=a.f0(Ve);const gt=z.getWorldToCameraMatrix(),ct=a.bl(new Float64Array(16),gt);Ze=a.d9.applyTransform(Ze,a.aB([],gt,Ee));const ht=this._extendAABB(Ze,z,V,M);if(!ht)return void a.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");Ze=ht,a.af(Ve,Ve,gt);const ot=.5*(Ze.max[2]-Ze.min[2]),st=this._minimumAABBFrustumDistance(z,Ze),vt=a.c5([],[0,0,1],ot),Pt=a.d8(vt,Ve,vt),Tt=st+(z.pitch===0?0:a.bG(Ve,Pt)),qt=z.globeCenterInViewSpace,Vt=a.av([],Ve,[qt[0],qt[1],qt[2]]);a.aw(Vt,Vt),a.c5(Vt,Vt,Tt);const nr=a.d8([],Ve,Vt);a.af(nr,nr,ct);const vr=a.eM/a.aD,Ft=a.ag(nr),St=a.cf(Math.max(Ft*vr-a.eM,Number.EPSILON),0),Kt=Math.min(z.zoomFromMercatorZAdjusted(St),V.maxZoom);return Kt>.5*(a.c_+a.cL)?(z.setProjection({name:"mercator"}),z.zoom=Kt,this._cameraForBounds(z,p,b,M,L,O)):{center:z.center,zoom:Kt,bearing:M,pitch:L}}_extendAABB(d,p,b,M){const L=.5*((b.padding.left||0)+(b.padding.right||0)),O=.5*((b.padding.top||0)+(b.padding.bottom||0)),z=O,V=L,Y=L,Q=O,ce=p.width-(V+Y),le=p.height-(z+Q),de=a.av([],d.max,d.min),be=Math.min(ce/de[0],le/de[1]),ye=Math.min(p.scaleZoom(p.scale*be),b.maxZoom);if(isNaN(ye))return null;const Oe=p.scale/p.zoomScale(ye),Ee=new a.d9([d.min[0]-V*Oe,d.min[1]-Q*Oe,d.min[2]],[d.max[0]+Y*Oe,d.max[1]+z*Oe,d.max[2]]),qe=(typeof b.offset.x=="number"&&typeof b.offset.y=="number"?new a.P(b.offset.x,b.offset.y):a.P.convert(b.offset)).rotate(-a.an(M));return Ee.center[0]-=qe.x*Oe,Ee.center[1]+=qe.y*Oe,Ee}queryTerrainElevation(d,p){const b=this.transform.elevation;return b?(p=Object.assign({},{exaggerated:!0},p),b.getAtPoint(a.ae.fromLngLat(d),null,p.exaggerated)):null}_cameraForBounds(d,p,b,M,L,O){if(d.projection.name==="globe")return this._cameraForBoundsOnGlobe(d,p,b,M,L,O);const z=d.clone(),V=this._extendCameraOptions(O);z.bearing=M,z.pitch=L;const Y=a.aT.convert(p),Q=a.aT.convert(b),ce=new a.aT(Y.lng,Q.lat),le=new a.aT(Q.lng,Y.lat),de=z.project(Y),be=z.project(Q),ye=this.queryTerrainElevation(Y),Oe=this.queryTerrainElevation(Q),Ee=this.queryTerrainElevation(ce),qe=this.queryTerrainElevation(le),Ze=[[de.x,de.y,Math.min(ye||0,Oe||0,Ee||0,qe||0)],[be.x,be.y,Math.max(ye||0,Oe||0,Ee||0,qe||0)]];let Ve=a.d9.fromPoints(Ze);const gt=z.getWorldToCameraMatrix(),ct=a.bl(new Float64Array(16),gt);Ve=a.d9.applyTransform(Ve,gt);const ht=this._extendAABB(Ve,z,V,M);if(!ht)return void a.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");Ve=ht;const ot=.5*a.av([],Ve.max,Ve.min)[2],st=this._minimumAABBFrustumDistance(z,Ve),vt=[0,0,1,0];a.aC(vt,vt,gt),a.f1(vt,vt);const Pt=a.c5([],vt,st+ot),Tt=a.d8([],Ve.center,Pt);a.af(Ve.center,Ve.center,ct),a.af(Tt,Tt,ct);const qt=z.unproject(new a.P(Ve.center[0],Ve.center[1])),Vt=a.f2(z.projection,qt),nr=Math.pow(2,Vt),vr=Math.min(z._zoomFromMercatorZ(Tt[2]*z.pixelsPerMeter*nr/z.worldSize),V.maxZoom);return z.mercatorFromTransition&&vr<.5*(a.c_+a.cL)?(z.setProjection({name:"globe"}),z.zoom=vr,this._cameraForBounds(z,p,b,M,L,O)):{center:qt,zoom:vr,bearing:M,pitch:L}}fitBounds(d,p,b){const M=this.cameraForBounds(d,p);return this._fitInternal(M,p,b)}fitScreenCoordinates(d,p,b,M,L){const O=a.P.convert(d),z=a.P.convert(p),V=new a.P(Math.min(O.x,z.x),Math.min(O.y,z.y)),Y=new a.P(Math.max(O.x,z.x),Math.max(O.y,z.y));if(this.transform.projection.name==="mercator"&&this.transform.anyCornerOffEdge(O,z))return this;const Q=this.transform.pointLocation3D(V),ce=this.transform.pointLocation3D(Y),le=this.transform.pointLocation3D(new a.P(V.x,Y.y)),de=this.transform.pointLocation3D(new a.P(Y.x,V.y)),be=[Math.min(Q.lng,ce.lng,le.lng,de.lng),Math.min(Q.lat,ce.lat,le.lat,de.lat)],ye=[Math.max(Q.lng,ce.lng,le.lng,de.lng),Math.max(Q.lat,ce.lat,le.lat,de.lat)],Oe=M&&M.pitch?M.pitch:this.getPitch(),Ee=this._cameraForBounds(this.transform,be,ye,b,Oe,M);return this._fitInternal(Ee,M,L)}_fitInternal(d,p,b){return d?(p=Object.assign(d,p)).linear?this.easeTo(p,b):this.flyTo(p,b):this}jumpTo(d,p){this.stop();const b=d.preloadOnly?this.transform.clone():this.transform;let M=!1,L=!1,O=!1;"zoom"in d&&b.zoom!==+d.zoom&&(M=!0,b.zoom=+d.zoom),d.center!==void 0&&(b.center=a.aT.convert(d.center)),"bearing"in d&&b.bearing!==+d.bearing&&(L=!0,b.bearing=+d.bearing),"pitch"in d&&b.pitch!==+d.pitch&&(O=!0,b.pitch=+d.pitch);const z=typeof d.padding=="number"?this._extendPadding(d.padding):d.padding;if(d.padding!=null&&!b.isPaddingEqual(z))if(d.retainPadding===!1){const V=b.clone();V.padding=z,b.setLocationAtPoint(b.center,V.centerPoint)}else b.padding=z;return d.preloadOnly?(this._preloadTiles(b),this):(this.fire(new a.z("movestart",p)).fire(new a.z("move",p)),M&&this.fire(new a.z("zoomstart",p)).fire(new a.z("zoom",p)).fire(new a.z("zoomend",p)),L&&this.fire(new a.z("rotatestart",p)).fire(new a.z("rotate",p)).fire(new a.z("rotateend",p)),O&&this.fire(new a.z("pitchstart",p)).fire(new a.z("pitch",p)).fire(new a.z("pitchend",p)),this.fire(new a.z("moveend",p)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||a.w(rN),this.transform.getFreeCameraOptions()}setFreeCameraOptions(d,p){const b=this.transform;if(!b.projection.supportsFreeCamera)return a.w(rN),this;this.stop();const M=b.zoom,L=b.pitch,O=b.bearing;b.setFreeCameraOptions(d);const z=M!==b.zoom,V=L!==b.pitch,Y=O!==b.bearing;return this.fire(new a.z("movestart",p)).fire(new a.z("move",p)),z&&this.fire(new a.z("zoomstart",p)).fire(new a.z("zoom",p)).fire(new a.z("zoomend",p)),Y&&this.fire(new a.z("rotatestart",p)).fire(new a.z("rotate",p)).fire(new a.z("rotateend",p)),V&&this.fire(new a.z("pitchstart",p)).fire(new a.z("pitch",p)).fire(new a.z("pitchend",p)),this.fire(new a.z("moveend",p)),this}easeTo(d,p){this._stop(!1,d.easeId),((d=Object.assign({offset:[0,0],duration:500,easing:a.eV},d)).animate===!1||this._prefersReducedMotion(d))&&(d.duration=0);const b=this.transform,M=this.getZoom(),L=this.getBearing(),O=this.getPitch(),z=this.getPadding(),V="zoom"in d?+d.zoom:M,Y="bearing"in d?this._normalizeBearing(d.bearing,L):L,Q="pitch"in d?+d.pitch:O,ce=this._extendPadding(d.padding),le=a.P.convert(d.offset);let de,be,ye;if(b.projection.name==="globe"){const vt=a.ae.fromLngLat(b.center),Pt=le.rotate(-b.angle);vt.x+=Pt.x/b.worldSize,vt.y+=Pt.y/b.worldSize;const Tt=vt.toLngLat(),qt=a.aT.convert(d.center||Tt);this._normalizeCenter(qt),de=b.centerPoint.add(Pt),be=new a.P(vt.x,vt.y).mult(b.worldSize),ye=new a.P(a.aF(qt.lng),a.aJ(qt.lat)).mult(b.worldSize).sub(be)}else{de=b.centerPoint.add(le);const vt=b.pointLocation(de),Pt=a.aT.convert(d.center||vt);this._normalizeCenter(Pt),be=b.project(vt),ye=b.project(Pt).sub(be)}const Oe=b.zoomScale(V-M);let Ee,qe;d.around&&(Ee=a.aT.convert(d.around),qe=b.locationPoint(Ee));const Ze=this._zooming||V!==M,Ve=this._rotating||L!==Y,gt=this._pitching||Q!==O,ct=!b.isPaddingEqual(ce),ht=d.retainPadding===!1?b.clone():b,ot=vt=>Pt=>{if(Ze&&(vt.zoom=a.ak(M,V,Pt)),Ve&&(vt.bearing=a.ak(L,Y,Pt)),gt&&(vt.pitch=a.ak(O,Q,Pt)),ct&&(ht.interpolatePadding(z,ce,Pt),de=ht.centerPoint.add(le)),Ee)vt.setLocationAtPoint(Ee,qe);else{const Tt=vt.zoomScale(vt.zoom-M),qt=V>M?Math.min(2,Oe):Math.max(.5,Oe),Vt=Math.pow(qt,1-Pt),nr=vt.unproject(be.add(ye.mult(Pt*Vt)).mult(Tt));vt.setLocationAtPoint(vt.renderWorldCopies?nr.wrap():nr,de)}return d.preloadOnly||this._fireMoveEvents(p),vt};if(d.preloadOnly){const vt=this._emulate(ot,d.duration,b);return this._preloadTiles(vt),this}const st={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=Ze,this._rotating=Ve,this._pitching=gt,this._padding=ct,this._easeId=d.easeId,this._prepareEase(p,d.noMoveStart,st),this._ease(ot(b),vt=>{b.cameraElevationReference==="sea"&&b.recenterOnTerrain(),this._afterEase(p,vt)},d),this}_prepareEase(d,p,b={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&this.transform.pitch===0&&this.transform.projection.name!=="globe"&&(this.transform.cameraElevationReference="ground"),p||b.moving||this.fire(new a.z("movestart",d)),this._zooming&&!b.zooming&&this.fire(new a.z("zoomstart",d)),this._rotating&&!b.rotating&&this.fire(new a.z("rotatestart",d)),this._pitching&&!b.pitching&&this.fire(new a.z("pitchstart",d))}_fireMoveEvents(d){this.fire(new a.z("move",d)),this._zooming&&this.fire(new a.z("zoom",d)),this._rotating&&this.fire(new a.z("rotate",d)),this._pitching&&this.fire(new a.z("pitch",d))}_afterEase(d,p){if(this._easeId&&p&&this._easeId===p)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const b=this._zooming,M=this._rotating,L=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,b&&this.fire(new a.z("zoomend",d)),M&&this.fire(new a.z("rotateend",d)),L&&this.fire(new a.z("pitchend",d)),this.fire(new a.z("moveend",d))}flyTo(d,p){if(this._prefersReducedMotion(d)){const Ut=a.aH(d,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(Ut,p)}this.stop(),d=Object.assign({offset:[0,0],speed:1.2,curve:1.42,easing:a.eV},d);const b=this.transform,M=this.getZoom(),L=this.getBearing(),O=this.getPitch(),z=this.getPadding(),V="zoom"in d?a.aA(+d.zoom,b.minZoom,b.maxZoom):M,Y="bearing"in d?this._normalizeBearing(d.bearing,L):L,Q="pitch"in d?+d.pitch:O,ce=this._extendPadding(d.padding),le=b.zoomScale(V-M),de=a.P.convert(d.offset);let be=b.centerPoint.add(de);const ye=b.pointLocation(be),Oe=a.aT.convert(d.center||ye);this._normalizeCenter(Oe);const Ee=b.project(ye),qe=b.project(Oe).sub(Ee);let Ze=d.curve;const Ve=Math.max(b.width,b.height),gt=Ve/le,ct=qe.mag();if("minZoom"in d){const Ut=a.aA(Math.min(d.minZoom,M,V),b.minZoom,b.maxZoom),ur=Ve/b.zoomScale(Ut-M);Ze=Math.sqrt(ur/ct*2)}const ht=Ze*Ze;function ot(Ut){const ur=(gt*gt-Ve*Ve+(Ut?-1:1)*ht*ht*ct*ct)/(2*(Ut?gt:Ve)*ht*ct);return Math.log(Math.sqrt(ur*ur+1)-ur)}function st(Ut){return(Math.exp(Ut)-Math.exp(-Ut))/2}function vt(Ut){return(Math.exp(Ut)+Math.exp(-Ut))/2}const Pt=ot(0);let Tt=function(Ut){return vt(Pt)/vt(Pt+Ze*Ut)},qt=function(Ut){return Ve*((vt(Pt)*(st(ur=Pt+Ze*Ut)/vt(ur))-st(Pt))/ht)/ct;var ur},Vt=(ot(1)-Pt)/Ze;if(Math.abs(ct)<1e-6||!isFinite(Vt)){if(Math.abs(Ve-gt)<1e-6)return this.easeTo(d,p);const Ut=gtd.maxDuration&&(d.duration=0);const nr=L!==Y,vr=Q!==O,Ft=!b.isPaddingEqual(ce),St=d.retainPadding===!1?b.clone():b,Kt=Ut=>ur=>{const Ar=ur*Vt,Ur=1/Tt(Ar);Ut.zoom=ur===1?V:M+Ut.scaleZoom(Ur),nr&&(Ut.bearing=a.ak(L,Y,ur)),vr&&(Ut.pitch=a.ak(O,Q,ur)),Ft&&(St.interpolatePadding(z,ce,ur),be=St.centerPoint.add(de));const Nr=ur===1?Oe:Ut.unproject(Ee.add(qe.mult(qt(Ar))).mult(Ur));return Ut.setLocationAtPoint(Ut.renderWorldCopies?Nr.wrap():Nr,be),Ut._updateCameraOnTerrain(),d.preloadOnly||this._fireMoveEvents(p),Ut};if(d.preloadOnly){const Ut=this._emulate(Kt,d.duration,b);return this._preloadTiles(Ut),this}return this._zooming=!0,this._rotating=nr,this._pitching=vr,this._padding=Ft,this._prepareEase(p,!1),this._ease(Kt(b),()=>this._afterEase(p),d),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(d){}_cancelRenderFrame(d){}_stop(d,p){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const b=this._onEaseEnd;this._onEaseEnd=void 0,b.call(this,p)}if(!d){const b=this.handlers;b&&b.stop(!1)}return this}_ease(d,p,b){b.animate===!1||b.duration===0?(d(1),p()):(this._easeStart=a.o.now(),this._easeOptions=b,this._onEaseFrame=d,this._onEaseEnd=p,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const d=Math.min((a.o.now()-this._easeStart)/this._easeOptions.duration,1),p=this._onEaseFrame;p&&p(this._easeOptions.easing(d)),d<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(d,p){d=a.bT(d,-180,180);const b=Math.abs(d-p);return Math.abs(d-360-p)180?-360:b<-180?360:0}_prefersReducedMotion(d){return this._respectPrefersReducedMotion&&a.o.prefersReducedMotion&&!(d&&d.essential)}_emulate(d,p,b){const M=Math.ceil(15*p/1e3),L=[],O=d(b.clone());for(let z=0;z<=M;z++){const V=O(z/M);L.push(V.clone())}return L}_preloadTiles(d,p){}}class xv{constructor(d={}){this.options=d,a.aY(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(d){const p=this.options&&this.options.compact,b=d._getUIString("AttributionControl.ToggleAttribution");this._map=d,this._container=S("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=S("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",b);const M=S("span","mapboxgl-ctrl-icon",this._compactButton);return M.setAttribute("aria-hidden","true"),M.setAttribute("title",b),this._innerContainer=S("div","mapboxgl-ctrl-attrib-inner",this._container),p&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),p===void 0&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let d=this._editLink;d||(d=this._editLink=this._container.querySelector(".mapbox-improve-map"));const p=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||a.e.ACCESS_TOKEN}];if(d){const b=p.reduce((M,L,O)=>(L.value&&(M+=`${L.key}=${L.value}${OM.length-L.length),d=d.filter((M,L)=>{for(let O=L+1;O=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?d=[...this.options.customAttribution,...d]:d.unshift(this.options.customAttribution));const b=d.map(M=>function(L){const O=new DOMParser().parseFromString(L,"text/html");return Array.from(O.body.querySelectorAll("*")).forEach(z=>{const V=z.textContent||"";if(z.tagName!=="A")return void z.replaceWith(O.createTextNode(V));const Y=z.getAttribute("href");if(!Y||!/^(https?:|mailto:)/i.test(Y))return void z.replaceWith(O.createTextNode(V));const Q=O.createElement("a");Q.href=Y,Q.textContent=V,Q.rel="noopener nofollow";const ce=z.getAttribute("class");ce&&(Q.className=ce),z.replaceWith(Q)}),O.body.innerHTML}(M)).join(" | ");b!==this._attribHTML&&(this._attribHTML=b,d.length?(this._innerContainer.innerHTML=b,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class vv{constructor(){a.aY(["_updateLogo","_updateCompact"],this)}onAdd(d){this._map=d,this._container=S("div","mapboxgl-ctrl");const p=S("a","mapboxgl-ctrl-logo");return p.target="_blank",p.rel="noopener nofollow",p.href="https://www.mapbox.com/",p.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),p.setAttribute("rel","noopener nofollow"),this._container.appendChild(p),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(d){d&&d.sourceDataType!=="metadata"||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const d=this._map.style._sourceCaches;if(Object.entries(d).length===0)return!0;for(const p in d){const b=d[p].getSource();if(b.hasOwnProperty("mapbox_logo")&&!b.mapbox_logo)return!1}return!0}_updateCompact(){const d=this._container.children;if(d.length){const p=d[0];this._map.getCanvasContainer().offsetWidth<250?p.classList.add("mapboxgl-compact"):p.classList.remove("mapboxgl-compact")}}}class Sx{constructor(){a.aY(["_onIndoorUpdate"],this)}onAdd(d){return this._map=d,this._container=S("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._map.indoor.on("selector-update",p=>this._onIndoorUpdate(p)),this._container}_createButton(d,p){const b=S("button",d,this._container);return b.type="button",b.addEventListener("click",p),b}_createSeparator(){return S("div","mapboxgl-ctrl-separator",this._container)}_setButtonTitle(d,p){this._map&&(d.setAttribute("aria-label",p),d.textContent=p)}onRemove(){this._container&&this._container.remove(),this._map&&this._map.indoor&&(this._map.indoor.off("selector-update",this._onIndoorUpdate),this._map=null)}getDefaultPosition(){return"right"}_onIndoorUpdate(d){if(!d||!d.floors)return this._model=d,void(this._container.style.display="none");const p=this._model;this._model=d,this._container.style.display="inline-block",this._container.style.borderRadius="8px",p&&Array.from(this._container.children).forEach(b=>b.remove()),d.floors.length>0&&(this.addBuildingsToggleButton(),this.addCurrentFloors(d.floors,d.activeFloorsVisible),this._updateBuildingsButtonState())}addBuildingsToggleButton(){const d=this._createButton("mapboxgl-ctrl-buildings-toggle",()=>{const p=this._map;this._model&&p&&p._setIndoorActiveFloorsVisibility(!this._model.activeFloorsVisible)});S("span","mapboxgl-ctrl-icon",d).setAttribute("aria-hidden","true"),d.classList.add("mapboxgl-ctrl-level-button","mapboxgl-ctrl-buildings-toggle"),this._model&&!this._model.activeFloorsVisible&&d.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.append(d),this._createSeparator()}_updateBuildingsButtonState(){const d=this._container.querySelector(".mapboxgl-ctrl-buildings-toggle");d&&this._model&&(this._model.activeFloorsVisible?d.classList.remove("mapboxgl-ctrl-level-button-selected"):d.classList.add("mapboxgl-ctrl-level-button-selected"))}addCurrentFloors(d,p){for(let b=0;b{this._map._selectIndoorFloor(M.id)});this._setButtonTitle(L,M.zIndex.toString()),this._model&&M.id===this._model.selectedFloorId&&p&&L.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.append(L),b=this._endTime)return this._end;const p=a.dD((d-this._startTime)/(this._endTime-this._startTime));return this._start*(1-p)+this._end*p}isEasing(d){return d>=this._startTime&&d<=this._endTime}jumpTo(d){this._startTime=-1/0,this._endTime=-1/0,this._start=d,this._end=d}easeTo(d,p,b){this._start=this.getValue(p),this._end=d,this._startTime=p,this._endTime=p+b}}const xp={"AttributionControl.ToggleAttribution":"Toggle attribution","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox homepage","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use ⌘ + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"};class Lm extends a.z{constructor(d,p,b,M){const{point:L,lngLat:O,originalEvent:z,target:V}=d;super(d.type,{point:L,lngLat:O,originalEvent:z,target:V}),this.preventDefault=()=>{d.preventDefault()},this.id=p,this.interaction=b,this.feature=M}}class jh{constructor(d){this.map=d,this.interactionsByType=new Map,this.delegatedInteractions=new Map,this.typeById=new Map,this.filters=new Map,this.handleType=this.handleType.bind(this),this.handleMove=this.handleMove.bind(this),this.handleOut=this.handleOut.bind(this),this.hoveredFeatures=new Map,this.prevHoveredFeatures=new Map}add(d,p){if(this.typeById.has(d))throw new Error(`Interaction id "${d}" already exists.`);const b=p.filter;let M=p.type;b&&this.filters.set(d,a.b6(b)),M==="mouseover"&&(M="mouseenter"),M==="mouseout"&&(M="mouseleave");const L=this.interactionsByType.get(M)||new Map;M==="mouseenter"||M==="mouseleave"?(this.delegatedInteractions.size===0&&(this.map.on("mousemove",this.handleMove),this.map.on("mouseout",this.handleOut)),this.delegatedInteractions.set(d,p)):L.size===0&&this.map.on(M,this.handleType),L.size===0&&this.interactionsByType.set(M,L),L.set(d,p),this.typeById.set(d,M)}get(d){const p=this.typeById.get(d);if(!p)return;const b=this.interactionsByType.get(p);return b?b.get(d):void 0}remove(d){const p=this.typeById.get(d);if(!p)return;this.typeById.delete(d),this.filters.delete(d);const b=this.interactionsByType.get(p);b&&(b.delete(d),p==="mouseenter"||p==="mouseleave"?(this.delegatedInteractions.delete(d),this.delegatedInteractions.size===0&&(this.map.off("mousemove",this.handleMove),this.map.off("mouseout",this.handleOut))):b.size===0&&this.map.off(p,this.handleType))}queryTargets(d,p){const b=[];for(const[M,L]of p)L.target&&b.push({targetId:M,target:L.target,filter:this.filters.get(M)});return this.map.style.queryRenderedTargets(d,b,this.map.transform)}handleMove(d){this.prevHoveredFeatures=this.hoveredFeatures,this.hoveredFeatures=new Map;const p=this.queryTargets(d.point,Array.from(this.delegatedInteractions).reverse());p.length&&(d.type="mouseenter",this.handleType(d,p));const b=new Map;for(const[M,{feature:L}]of this.prevHoveredFeatures)this.hoveredFeatures.has(M)||b.set(L.id,L);b.size&&(d.type="mouseleave",this.handleType(d,Array.from(b.values())))}handleOut(d){const p=Array.from(this.hoveredFeatures.values()).map(({feature:b})=>b);p.length&&(d.type="mouseleave",this.handleType(d,p)),this.hoveredFeatures.clear()}handleType(d,p){const b=d.type==="mouseenter";if(b&&!this.interactionsByType.has(d.type))return void a.w("mouseenter interaction required for mouseleave to work.");const M=Array.from(this.interactionsByType.get(d.type)).reverse(),L=!!p;p=p||this.queryTargets(d.point,M);let O=!1;const z=new Set;for(const V of p){for(const[Y,Q]of M){if(!Q.target)continue;const ce=V.variants?V.variants[Y]:null;if(ce){for(const le of ce){if(Du(le,V,z,Y))continue;const de=new a.dx(V,le),be=ef(le,V,Y);L&&de.id!==void 0&&(de.state=this.map.getFeatureState(de));const ye=b?this.prevHoveredFeatures.get(be):null,Oe=new Lm(d,Y,Q,de),Ee=ye?ye.stop:Q.handler(Oe);if(b&&this.hoveredFeatures.set(be,{feature:V,stop:Ee}),Ee!==!1){O=!0;break}}if(O)break}}if(O)break}if(!O)for(const[V,Y]of M){const{handler:Q,target:ce}=Y;if(!ce&&Q(new Lm(d,V,Y,null))!==!1)break}}}function lae(_,d){if(Array.isArray(_)&&Array.isArray(d)){const p=new Set(_),b=new Set(d);return p.size===b.size&&_.every(M=>b.has(M))}return a.by(_,d)}const cae={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,antialias:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1,precompilePrograms:!0,scaleFactor:1,spriteFormat:"auto"},dae={showCompass:!0,showZoom:!0,visualizePitch:!1};class uae{constructor(d,p,b=!1){this._clickTolerance=10,this.element=p,this.mouseRotate=new iM({clickTolerance:d.dragRotate._mouseRotate._clickTolerance}),this.map=d,b&&(this.mousePitch=new aM({clickTolerance:d.dragRotate._mousePitch._clickTolerance})),a.aY(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),p.addEventListener("mousedown",this.mousedown),p.addEventListener("touchstart",this.touchstart,{passive:!1}),p.addEventListener("touchmove",this.touchmove),p.addEventListener("touchend",this.touchend),p.addEventListener("touchcancel",this.reset)}down(d,p){this.mouseRotate.mousedown(d,p),this.mousePitch&&this.mousePitch.mousedown(d,p),$()}move(d,p){const b=this.map,M=this.mouseRotate.mousemoveWindow(d,p),L=M&&M.bearingDelta;if(L&&b.setBearing(b.getBearing()+L),this.mousePitch){const O=this.mousePitch.mousemoveWindow(d,p),z=O&&O.pitchDelta;z&&b.setPitch(b.getPitch()+z)}}off(){const d=this.element;d.removeEventListener("mousedown",this.mousedown),d.removeEventListener("touchstart",this.touchstart),d.removeEventListener("touchmove",this.touchmove),d.removeEventListener("touchend",this.touchend),d.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){F(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(d){this.down(Object.assign({},d,{ctrlKey:!0,preventDefault:()=>d.preventDefault()}),K(this.element,d)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(d){this.move(d,K(this.element,d))}mouseup(d){this.mouseRotate.mouseupWindow(d),this.mousePitch&&this.mousePitch.mouseupWindow(d),this.offTemp()}touchstart(d){d.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=Z(this.element,d.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>d.preventDefault()},this._startPos))}touchmove(d){d.targetTouches.length!==1?this.reset():(this._lastPos=Z(this.element,d.targetTouches)[0],this.move({preventDefault:()=>d.preventDefault()},this._lastPos))}touchend(d){d.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)p.width||d.y>p.height;p.locationPoint3D(b).distSqr(d)180;){const b=p.locationPoint3D(_);if(b.x>=0&&b.y>=0&&b.x<=p.width&&b.y<=p.height)break;_.lng>p.center.lng?_.lng-=360:_.lng+=360}return _}const dc={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"},Hu={rotation:0,rotationAlignment:"auto",pitchAlignment:"auto",occludedOpacity:.2,altitude:0};class nN extends a.E{constructor(d,p){super(),(d instanceof HTMLElement||p)&&(d=Object.assign({element:d},p)),a.aY(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this);const{anchor:b="center",color:M="#3FB1CE",scale:L=1,draggable:O=!1,clickTolerance:z=0,rotation:V=Hu.rotation,rotationAlignment:Y=Hu.rotationAlignment,pitchAlignment:Q=Hu.pitchAlignment,occludedOpacity:ce=Hu.occludedOpacity,altitude:le=Hu.altitude}=d||{};this._anchor=b,this._color=M,this._scale=L,this._draggable=O,this._clickTolerance=z,this._rotation=V,this._rotationAlignment=Y,this._pitchAlignment=Q,this._occludedOpacity=ce,this._altitude=le,this._state="inactive",this._isDragging=!1,this._updateMoving=()=>this._update(!0),d&&d.element?(this._element=d.element,this._offset=a.P.convert(d&&d.offset||[0,0])):(this._defaultMarker=!0,this._element=this._createDefaultMarker(),this._offset=a.P.convert(d&&d.offset||[0,-14])),this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.hasAttribute("role")||this._element.setAttribute("role","img"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",ye=>{ye.preventDefault()}),this._element.addEventListener("mousedown",ye=>{ye.preventDefault()});const de=this._element.classList;for(const ye in dc)de.remove(`mapboxgl-marker-anchor-${ye}`);de.add(`mapboxgl-marker-anchor-${this._anchor}`);const be=d&&d.className?d.className.trim().split(/\s+/):[];de.add(...be),this._popup=null}_createDefaultMarker(){const d=S("div"),p=T("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},d);if(this._altitude===0){const b=T("radialGradient",{id:"shadowGradient"},T("defs",{},p));T("stop",{offset:"10%","stop-opacity":.4},b),T("stop",{offset:"100%","stop-opacity":.05},b),T("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},p)}return T("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},p),T("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},p),T("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},p),d}addTo(d){return d===this._map||(this.remove(),this._map=d,d.getCanvasContainer().appendChild(this._element),d.on("move",this._updateMoving),d.on("moveend",this._update),d.on("remove",this._clearFadeTimer),d._addMarker(this),this.setDraggable(this._draggable),this._update(),d.on("click",this._onMapClick)),this}remove(){const d=this._map;return d&&(d.off("click",this._onMapClick),d.off("move",this._updateMoving),d.off("moveend",this._update),d.off("mousedown",this._addDragHandler),d.off("touchstart",this._addDragHandler),d.off("mouseup",this._onUp),d.off("touchend",this._onUp),d.off("mousemove",this._onMove),d.off("touchmove",this._onMove),d.off("remove",this._clearFadeTimer),d._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(d){return this._lngLat=a.aT.convert(d),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}setAltitude(d){return d===this._altitude||(this._defaultMarker&&(this._altitude===0&&d!==0||this._altitude!==0&&d===0)&&(this._element=this._createDefaultMarker()),this._altitude=d||Hu.altitude,this._update()),this}getAltitude(){return this._altitude}getElement(){return this._element}setPopup(d){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),d){if(!("offset"in d.options)){const M=Math.sqrt(Math.pow(13.5,2)/2);d.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[M,-1*(38.1-13.5+M)],"bottom-right":[-M,-1*(38.1-13.5+M)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=d,d._marker=this,d._altitude=this._altitude,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(d){const p=d.code,b=d.charCode||d.keyCode;p!=="Space"&&p!=="Enter"&&b!==32&&b!==13||this.togglePopup()}_onMapClick(d){const p=d.originalEvent.target,b=this._element;this._popup&&(p===b||b.contains(p))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const d=this._popup;return d?(d.isOpen()?(d.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(d.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const d=this._map,p=this._pos;if(!d||!p)return!1;const b=d.unproject(p,this._altitude),M=d.getFreeCameraOptions();if(!M.position)return!1;const L=M.position.toLngLat();return L.distanceTo(b)<.9*L.distanceTo(this._lngLat)}_evaluateOpacity(){const d=this._map;if(!d)return;const p=this._pos;if(!p||p.x<0||p.x>d.transform.width||p.y<0||p.y>d.transform.height)return void this._clearFadeTimer();const b=d.unproject(p,this._altitude);let M;d._showingGlobe()&&a.f5(d.transform,this._lngLat)?M=0:(M=1-d._queryFogOpacity(b),d.transform._terrainEnabled()&&d.getTerrain()&&this._behindTerrain()&&(M*=this._occludedOpacity)),this._element.style.opacity=`${M}`,this._element.style.pointerEvents=M>0?"auto":"none",this._popup&&this._popup._setOpacity(M),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const d=this._pos;if(!d||!this._map)return;const p=this._offset.mult(this._scale);this._element.style.transform=` translate(${d.x}px,${d.y}px) ${dc[this._anchor]} ${this._calculateXYTransform()} ${this._calculateZTransform()} translate(${p.x}px,${p.y}px) `}_calculateXYTransform(){const d=this._pos,p=this._map,b=this.getPitchAlignment();if(!p||!d||b!=="map")return"";if(!p._showingGlobe()){const V=p.getPitch();return V?`rotateX(${V}deg)`:""}const M=a.cX(a.f6(p.transform,this._lngLat)),L=d.sub(a.f7(p.transform)),O=Math.abs(L.x)+Math.abs(L.y);if(O===0)return"";const z=M/O;return`rotateX(${-L.y*z}deg) rotateY(${L.x*z}deg)`}_calculateZTransform(){const d=this._pos,p=this._map;if(!p||!d)return"";let b=0;const M=this.getRotationAlignment();if(M==="map")if(p._showingGlobe()){const L=p.project(new a.aT(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),O=p.project(new a.aT(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(L);b=a.cX(Math.atan2(O.y,O.x))-90}else b=-p.getBearing();else if(M==="horizon"){const L=a.ah(4,6,p.getZoom()),O=a.f7(p.transform);O.y+=L*p.transform.height;const z=d.sub(O),V=a.cX(Math.atan2(z.y,z.x));b=(V>90?V-270:V+90)*(1-L)}return b+=this._rotation,b?`rotateZ(${b}deg)`:""}_update(d){cancelAnimationFrame(this._updateFrameId);const p=this._map;p&&(p.transform.renderWorldCopies&&(this._lngLat=dM(this._lngLat,this._pos,p.transform)),this._pos=p.project(this._lngLat,this._altitude),d===!0?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),p._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(p._showingGlobe()||p.getTerrain()||p.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(d){return this._offset=a.P.convert(d),this._update(),this}addClassName(d){return this._element.classList.add(d),this}removeClassName(d){return this._element.classList.remove(d),this}toggleClassName(d){return this._element.classList.toggle(d)}_onMove(d){const p=this._map;if(!p)return;const b=this._pointerdownPos,M=this._positionDelta;if(b&&M){if(!this._isDragging){const L=this._clickTolerance||p._clickTolerance;if(d.point.dist(b)_.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(_.minPitch!=null&&_.maxPitch!=null&&_.minPitch>_.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(_.minPitch!=null&&_.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(_.maxPitch!=null&&_.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(_.antialias&&a.f3(window)&&(_.antialias=!1,a.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new p3(_.minZoom,_.maxZoom,_.minPitch,_.maxPitch,_.renderWorldCopies,null,null),_),this._repaint=!!_.repaint,this._interactive=_.interactive,this._minTileCacheSize=_.minTileCacheSize,this._maxTileCacheSize=_.maxTileCacheSize,this._failIfMajorPerformanceCaveat=_.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=_.preserveDrawingBuffer,this._antialias=_.antialias,this._trackResize=_.trackResize,this._bearingSnap=_.bearingSnap,this._refreshExpiredTiles=_.refreshExpiredTiles,this._fadeDuration=_.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=_.crossSourceCollisions,this._collectResourceTiming=_.collectResourceTiming,this._language=this._parseLanguage(_.language),this._worldview=_.worldview,this._renderTaskQueue=new gp,this._domRenderTaskQueue=new gp,this._controls=[],this._markers=[],this._popups=[],this._mapId=a.b2(),this._locale=Object.assign({},xp,_.locale),this._clickTolerance=_.clickTolerance,this._cooperativeGestures=_.cooperativeGestures,this._performanceMetricsCollection=_.performanceMetricsCollection,this._tessellationStep=_.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=_.precompilePrograms,this._scaleFactorChanged=!1,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new yp(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=_.scaleFactor,this._requestManager=new se(_.transformRequest,_.accessToken,_.testMode),this._silenceAuthErrors=!!_.testMode,this._contextCreateOptions=_.contextCreateOptions?Object.assign({},_.contextCreateOptions):{},typeof _.container=="string"){const p=document.getElementById(_.container);if(!p)throw new Error(`Container '${_.container.toString()}' not found.`);this._container=p}else{if(!(_.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=_.container}if(this._container.childNodes.length>0&&a.w("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),_.maxBounds&&this.setMaxBounds(_.maxBounds),this._spriteFormat=_.spriteFormat,a.aY(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");if(this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this._fullscreenchangeEvent="onfullscreenchange"in document?"fullscreenchange":"webkitfullscreenchange",window.addEventListener("online",this._onWindowOnline,!1),window.addEventListener("resize",this._onWindowResize,!1),window.addEventListener("orientationchange",this._onWindowResize,!1),window.addEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.addEventListener("visibilitychange",this._onVisibilityChange,!1),this.handlers=new oae(this,_),this._localFontFamily=_.localFontFamily,this._localIdeographFontFamily=_.localIdeographFontFamily,(_.style||!_.testMode)&&this.setStyle(_.style||a.e.DEFAULT_STYLE,{config:_.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),_.projection&&this.setProjection(_.projection),_.hash&&(this._hash=new X3(typeof _.hash=="string"&&_.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){d.center==null&&d.zoom==null||(this.transform._unmodified=!1),this.jumpTo({center:_.center,zoom:_.zoom,bearing:_.bearing,pitch:_.pitch});const p=_.bounds;p&&(this.resize(),this.fitBounds(p,Object.assign({},_.fitBoundsOptions,{duration:0})))}this.resize(),_.attributionControl&&this.addControl(new xv({customAttribution:_.customAttribution})),this._logoControl=new vv,this.addControl(this._logoControl,_.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent(),this._postStyleWithAppearanceEvent(),this._setupIndoor()}),this.on("data",p=>{this._update(p.dataType==="style"),this.fire(new a.z(`${p.dataType}data`,p))}),this.on("dataloading",p=>{this.fire(new a.z(`${p.dataType}dataloading`,p))}),this._interactions=new jh(this)}_getMapId(){return this._mapId}addControl(_,d){if(d===void 0&&(d=_.getDefaultPosition?_.getDefaultPosition():"top-right"),!_||!_.onAdd)return this.fire(new a.y(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const p=_.onAdd(this);this._controls.push(_);const b=this._controlPositions[d];return d.indexOf("bottom")!==-1?b.insertBefore(p,b.firstChild):b.appendChild(p),this}removeControl(_){if(!_||!_.onRemove)return this.fire(new a.y(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const d=this._controls.indexOf(_);return d>-1&&this._controls.splice(d,1),_.onRemove(this),this}hasControl(_){return this._controls.indexOf(_)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(_){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const d=!this._moving;return d&&this.fire(new a.z("movestart",_)).fire(new a.z("move",_)),this.fire(new a.z("resize",_)),d&&this.fire(new a.z("moveend",_)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(_){return this.transform.setMaxBounds(a.aI.convert(_)),this._update()}setMinZoom(_){if((_=_??-2)>=-2&&_<=this.transform.maxZoom)return this.transform.minZoom=_,this._update(),this.getZoom()<_?this.setZoom(_):this.fire(new a.z("zoomstart")).fire(new a.z("zoom")).fire(new a.z("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(_){if((_=_??22)>=this.transform.minZoom)return this.transform.maxZoom=_,this._update(),this.getZoom()>_?this.setZoom(_):this.fire(new a.z("zoomstart")).fire(new a.z("zoom")).fire(new a.z("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(_){if((_=_??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(_>=0&&_<=this.transform.maxPitch)return this.transform.minPitch=_,this._update(),this.getPitch()<_?this.setPitch(_):this.fire(new a.z("pitchstart")).fire(new a.z("pitch")).fire(new a.z("pitchend")),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(_){if((_=_??85)>85)throw new Error("maxPitch must be less than or equal to 85");if(_>=this.transform.minPitch)return this.transform.maxPitch=_,this._update(),this.getPitch()>_?this.setPitch(_):this.fire(new a.z("pitchstart")).fire(new a.z("pitch")).fire(new a.z("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getScaleFactor(){return this._scaleFactor}setScaleFactor(_){return this._scaleFactor=_,this.painter.scaleFactor=_,this._scaleFactorChanged=!0,this.style._updateFilteredLayers(d=>d.type==="symbol"),this._update(!0),this}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(_){return this.transform.renderWorldCopies=_,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(_){return _==="auto"?navigator.language:Array.isArray(_)?_.length===0?void 0:_.map(d=>d==="auto"?navigator.language:d):_}setLanguage(_){const d=this._parseLanguage(_);if(!this.style||d===this._language)return this;this._language=d,this.style.reloadSources();for(const p of this._controls)p._setLanguage&&p._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(_){return this.style&&_!==this._worldview?(this._worldview=_,this._styleDirty=!0,this.style.reloadSources(),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return this.transform.projection.name==="globe"}setProjection(_){return this._lazyInitEmptyStyle(),_?typeof _=="string"&&(_={name:_}):_=null,this._useExplicitProjection=!!_,this._prioritizeAndUpdateProjection(_,this.style.projection)}_updateProjectionTransition(){if(this.getProjection().name!=="globe")return;const _=this.transform,d=_.projection.name;let p;d==="globe"&&_.zoom>=a.cL?(_.setMercatorFromTransition(),p=!0):d==="mercator"&&_.zoom=a.cL?this.transform.setMercatorFromTransition():this.transform.setProjection(_),this.style.applyProjectionUpdate();const b=this.transform.getProjection().name==="mercator"&&p!==this.transform.mercatorFromTransition;return(d||b)&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(_,d){return this.transform.locationPoint3D(a.aT.convert(_),d)}unproject(_,d){return this.transform.pointLocation3D(a.P.convert(_),d)}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(_,d,p){const b=M=>{let L=[];if(Array.isArray(d)){const O=d.filter(z=>this.getLayer(z));L=O.length?this.queryRenderedFeatures(M,{layers:O}):[]}else L=this.queryRenderedFeatures(M,{target:d});return L};if(_==="mouseenter"||_==="mouseover"){let M=!1;return{listener:p,targets:d,delegates:{mousemove:O=>{const z=b(O.point);z.length?M||(M=!0,p.call(this,new gd(_,this,O.originalEvent,{features:z}))):M=!1},mouseout:()=>{M=!1}}}}if(_==="mouseleave"||_==="mouseout"){let M=!1;return{listener:p,targets:d,delegates:{mousemove:z=>{b(z.point).length?M=!0:M&&(M=!1,p.call(this,new gd(_,this,z.originalEvent)))},mouseout:z=>{M&&(M=!1,p.call(this,new gd(_,this,z.originalEvent)))}}}}{const M=L=>{const O=b(L.point);O.length&&(L.features=O,p.call(this,L),delete L.features)};return{listener:p,targets:d,delegates:{[_]:M}}}}on(_,d,p){if(typeof d=="function"||p===void 0)return super.on(_,d);if(typeof d=="string"&&(d=[d]),!this._areTargetsValid(d))return this;const b=this._createDelegatedListener(_,d,p);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[_]=this._delegatedListeners[_]||[],this._delegatedListeners[_].push(b);for(const M in b.delegates)this.on(M,b.delegates[M]);return this}once(_,d,p){if(typeof d=="function"||p===void 0)return super.once(_,d);if(typeof d=="string"&&(d=[d]),!this._areTargetsValid(d))return this;const b=this._createDelegatedListener(_,d,p);for(const M in b.delegates)this.once(M,b.delegates[M]);return this}off(_,d,p){if(typeof d=="function"||p===void 0)return super.off(_,d);if(typeof d=="string"&&(d=[d]),!this._areTargetsValid(d))return this;const b=this._delegatedListeners?this._delegatedListeners[_]:void 0;return b&&(M=>{for(let L=0;L{if(p){const M=typeof p=="string"?p:p instanceof Error?p.message:p.error;a.w(`Unable to perform style diff: ${M}. Rebuilding the style from scratch.`),this._updateStyle(_,d)}else b&&this._update(!0)},()=>this._postStyleLoadEvent()),this):(this._localIdeographFontFamily=d.localIdeographFontFamily,this._localFontFamily=d.localFontFamily,this._updateStyle(_,d))}_getUIString(_){const d=this._locale[_];if(d==null)throw new Error(`Missing UI string '${_}'`);return d}_updateStyle(_,d){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),_){const p=Object.assign({},d);d&&d.config&&(p.initialConfig=d.config,delete p.config),this.style=new Vu(this,p).load(_),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new Vu(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(a.w("There is no style added to the map."),!1)}_isValidId(_){return _==null?(this.fire(new a.y(new Error("IDs can't be empty."))),!1):!a.dr(_)||(this.fire(new a.y(new Error(`IDs can't contain special symbols: "${_}".`))),!1)}_isTargetValid(_){return"featuresetId"in _?this._isValidId("importId"in _?_.importId:_.featuresetId):"layerId"in _&&this._isValidId(_.layerId)}_areTargetsValid(_){if(Array.isArray(_)){for(const d of _)if(!this._isValidId(d))return!1;return!0}return this._isTargetValid(_)}addSource(_,d){return this._isValidId(_)?(this._lazyInitEmptyStyle(),this.style.addSource(_,d),this._update(!0)):this}isSourceLoaded(_){return!!this._isValidId(_)&&!!this.style&&this.style._isSourceCacheLoaded(_)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(_,d,p){this._lazyInitEmptyStyle(),this.style.addSourceType(_,d,p)}removeSource(_){return this._isValidId(_)?(this.style.removeSource(_),this._updateTerrain(),this._update(!0)):this}getSource(_){return this._isValidId(_)?this.style.getOwnSource(_):null}addImage(_,d,{pixelRatio:p=1,sdf:b=!1,stretchX:M,stretchY:L,content:O}={}){this._lazyInitEmptyStyle();const z=a.I.from(_);if(d instanceof HTMLImageElement||ImageBitmap&&d instanceof ImageBitmap){const{width:V,height:Y,data:Q}=a.o.getImageData(d);this.style.addImage(z,{data:new a.q({width:V,height:Y},Q),pixelRatio:p,stretchX:M,stretchY:L,content:O,sdf:b,version:0,usvg:!1})}else if(d.width===void 0||d.height===void 0)this.fire(new a.y(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{const{width:V,height:Y}=d,Q=d;this.style.addImage(z,{data:new a.q({width:V,height:Y},new Uint8Array(Q.data)),pixelRatio:p,stretchX:M,stretchY:L,content:O,sdf:b,usvg:!1,version:0,userImage:Q}),Q.onAdd&&Q.onAdd(this,_)}}updateImage(_,d){this._lazyInitEmptyStyle();const p=a.I.from(_),b=this.style.getImage(p);if(!b)return void this.fire(new a.y(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const M=d instanceof HTMLImageElement||ImageBitmap&&d instanceof ImageBitmap?a.o.getImageData(d):d,{width:L,height:O,data:z}=M;if(L===void 0||O===void 0)return void this.fire(new a.y(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(L!==(b.usvg?b.icon.usvg_tree.width:b.data.width)||O!==(b.usvg?b.icon.usvg_tree.height:b.data.height))return void this.fire(new a.y(new Error(`The width and height of the updated image (${L}, ${O}) must be that same as the previous version of the image (${b.data.width}, ${b.data.height})`)));const V=!(d instanceof HTMLImageElement||ImageBitmap&&d instanceof ImageBitmap);let Y=!1;b.usvg?(b.data=new a.q({width:L,height:O},new Uint8Array(z)),b.usvg=!1,b.icon=void 0,Y=!0):b.data.replace(z,V),this.style.updateImage(p,b,Y)}hasImage(_){return _?!!this.style&&!!this.style.getImage(a.I.from(_)):(this.fire(new a.y(new Error("Missing required image id"))),!1)}removeImage(_){this.style.removeImage(a.I.from(_))}loadImage(_,d){a.n(this._requestManager.transformRequest(_,a.R.Image),(p,b)=>{d(p,b instanceof HTMLImageElement?a.o.getImageData(b):b)})}listImages(){return this.style.listImages().map(_=>_.name)}addModel(_,d){this._lazyInitEmptyStyle(),this.style.addModel(_,d)}hasModel(_){return _?this.style.hasModel(_):(this.fire(new a.y(new Error("Missing required model id"))),!1)}removeModel(_){this.style.removeModel(_)}listModels(){return this.style.listModels()}addLayer(_,d){return this._isValidId(_.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(_,d),this._update(!0)):this}getSlot(_){const d=this.getLayer(_);return d&&d.slot||null}setSlot(_,d){return this.style.setSlot(_,d),this.style.mergeLayers(),this._update(!0)}addImport(_,d){return this.style.addImport(_,d).catch(p=>this.fire(new a.y(new Error("Failed to add import",p)))),this}updateImport(_,d){return typeof d!="string"&&d.id!==_?(this.removeImport(_),this.addImport(d)):(this.style.updateImport(_,d),this._update(!0))}removeImport(_){return this.style.removeImport(_),this}moveImport(_,d){return this.style.moveImport(_,d),this._update(!0)}moveLayer(_,d){return this._isValidId(_)?(this.style.moveLayer(_,d),this._update(!0)):this}removeLayer(_){return this._isValidId(_)?(this.style.removeLayer(_),this._update(!0)):this}getLayer(_){if(!this._isValidId(_))return null;const d=this.style.getOwnLayer(_);return d?d.type==="custom"?d.implementation:d.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(_,d,p){return this._isValidId(_)?(this.style.setLayerZoomRange(_,d,p),this._update(!0)):this}setFilter(_,d,p={}){return this._isValidId(_)?(this.style.setFilter(_,d,p),this._update(!0)):this}getFilter(_){return this._isValidId(_)?this.style.getFilter(_):null}setPaintProperty(_,d,p,b={}){return this._isValidId(_)?(this.style.setPaintProperty(_,d,p,b),this._update(!0)):this}getPaintProperty(_,d){return this._isValidId(_)?this.style.getPaintProperty(_,d):null}setLayoutProperty(_,d,p,b={}){return this._isValidId(_)?(this.style.setLayoutProperty(_,d,p,b),this._update(!0)):this}getLayoutProperty(_,d){return this._isValidId(_)?this.style.getLayoutProperty(_,d):null}setLayerProperty(_,d,p,b={}){return this._isValidId(_)?(d==="appearances"&&this._postAddingAppearancesToStyleEvent(),this.style.setLayerProperty(_,d,p,b),this._update(!0)):this}getGlyphsUrl(){return this.style.getGlyphsUrl()}setGlyphsUrl(_){return this.style.setGlyphsUrl(_),this._update(!0)}getSchema(_){return this.style.getSchema(_)}setSchema(_,d){return this.style.setSchema(_,d),this._update(!0)}getConfig(_){return this.style.getConfig(_)}setConfig(_,d){return this.style.setConfig(_,d),this._update(!0)}getConfigProperty(_,d){return this.style.getConfigProperty(_,d)}setConfigProperty(_,d,p){return this.style.setConfigProperty(_,d,p),this._update(!0)}getFeaturesetDescriptors(_){return this.style.getFeaturesetDescriptors(_)}setLights(_){if(this._lazyInitEmptyStyle(),_&&_.length===1&&_[0].type==="flat"){const d=_[0];d.properties?this.style.setFlatLight(d.properties,d.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(_),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const _=this.style.getLights()||[];return _.length===0&&_.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),_}setLight(_,d={}){return console.log("The `map.setLight` function is deprecated, prefer using `map.setLights` with `flat` light type instead."),this.setLights([{id:"flat",type:"flat",properties:_}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(_){return this._lazyInitEmptyStyle(),!_&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(_),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(_){return this._lazyInitEmptyStyle(),this.style.setFog(_),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setSnow(_){return this._lazyInitEmptyStyle(),this.style.setSnow(_),this._update(!0)}getSnow(){return this.style?this.style.getSnow():null}setRain(_){return this._lazyInitEmptyStyle(),this.style.setRain(_),this._update(!0)}getRain(){return this.style?this.style.getRain():null}setColorTheme(_){return this._lazyInitEmptyStyle(),this.style.setColorTheme(_),this._update(!0)}setImportColorTheme(_,d){return this._lazyInitEmptyStyle(),this.style.setImportColorTheme(_,d),this._update(!0)}setCamera(_){return this.style.setCamera(_),this._triggerCameraUpdate(_)}_triggerCameraUpdate(_){return this._update(this.transform.setOrthographicProjectionAtLowPitch(_["camera-projection"]==="orthographic"))}getCamera(){return this.style.camera}_queryFogOpacity(_){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(a.aT.convert(_),this.transform):0}setFeatureState(_,d){return _.source&&!this._isValidId(_.source)?this:(this.style.setFeatureState(_,d),this._update())}removeFeatureState(_,d){return _.source&&!this._isValidId(_.source)?this:(this.style.removeFeatureState(_,d),this._update())}getFeatureState(_){return _.source&&!this._isValidId(_.source)?null:this.style.getFeatureState(_)}_selectIndoorFloor(_){this.indoor.selectFloor(_)}_setIndoorActiveFloorsVisibility(_){this.indoor.setActiveFloorsVisibility(_)}_addIndoorControl(){this._indoorControl||(this._indoorControl=new Sx),this.addControl(this._indoorControl,"right")}_removeIndoorControl(){this._indoorControl&&this.removeControl(this._indoorControl)}_updateContainerDimensions(){if(!this._container)return;const _=this._container.getBoundingClientRect().width||400,d=this._container.getBoundingClientRect().height||300;let p,b,M,L=this._container;for(;L&&(!b||!M);){const O=window.getComputedStyle(L).transform;O&&O!=="none"&&(p=O.match(/matrix.*\((.+)\)/)[1].split(", "),p[0]&&p[0]!=="0"&&p[0]!=="1"&&(b=p[0]),p[3]&&p[3]!=="0"&&p[3]!=="1"&&(M=p[3])),L=L.parentElement}this._containerWidth=b?Math.abs(_/b):_,this._containerHeight=M?Math.abs(d/M):d}_detectMissingCSS(){window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")!=="rgb(250, 128, 114)"&&a.w("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupIndoor(){this.style.isIndoorEnabled()&&(this.indoor=new PI(this.style),this.on("load",()=>{this._addIndoorControl(),this.indoor._updateUI(this.transform.zoom,this.transform.center,this.transform.getBounds()),this.on("move",()=>{this.indoor._updateUI(this.transform.zoom,this.transform.center,this.transform.getBounds())}),this.on("idle",()=>{this.indoor._updateUI(this.transform.zoom,this.transform.center,this.transform.getBounds())})}))}_setupContainer(){const _=this._container;_.classList.add("mapboxgl-map"),(this._missingCSSCanary=S("div","mapboxgl-canary",_)).style.visibility="hidden",this._detectMissingCSS();const d=this._canvasContainer=S("div","mapboxgl-canvas-container",_);this._canvas=S("canvas","mapboxgl-canvas",d),this._interactive&&(d.classList.add("mapboxgl-interactive"),this._canvas.setAttribute("tabindex","0")),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const p=this._controlContainer=S("div","mapboxgl-control-container",_),b=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(M=>{b[M]=S("div",`mapboxgl-ctrl-${M}`,p)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(_,d){const p=a.o.devicePixelRatio||1;this._canvas.width=p*Math.ceil(_),this._canvas.height=p*Math.ceil(d),this._canvas.style.width=`${_}px`,this._canvas.style.height=`${d}px`}_addMarker(_){this._markers.push(_)}_removeMarker(_){const d=this._markers.indexOf(_);d!==-1&&this._markers.splice(d,1)}_addPopup(_){this._popups.push(_)}_removePopup(_){const d=this._popups.indexOf(_);d!==-1&&this._popups.splice(d,1)}_setupPainter(){const _=Object.assign({},C.supported.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),d=this._canvas.getContext("webgl2",_);d?(We(d,!0),this.painter=new qk(d,this._contextCreateOptions,this.transform,this._scaleFactor,this._worldview),this.on("data",p=>{p.dataType==="source"&&this.painter.setTileLoadedFlag(!0)}),a.k.testSupport(d)):this.fire(new a.y(new Error("Failed to initialize WebGL")))}_contextLost(_){_.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new a.z("webglcontextlost",{originalEvent:_}))}_contextRestored(_){this._setupPainter(),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight)),this._updateTerrain(),this.style&&(this.style.clearLayers(),this.style.imageManager.destroyAtlasTextures(),this.style.reloadModels(),this.style.clearSources()),this._update(),this.fire(new a.z("webglcontextrestored",{originalEvent:_}))}_onMapScroll(_){if(_.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}idle(){return!this.isMoving()&&this.loaded()}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}frameReady(){return this.loaded()&&!this._placementDirty}_update(_){return this.style?(this._styleDirty=this._styleDirty||_,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(_){return this._update(),this._renderTaskQueue.add(_)}_cancelRenderFrame(_){this._renderTaskQueue.remove(_)}_requestDomTask(_){!this.loaded()||this.loaded()&&!this.isMoving()?_():this._domRenderTaskQueue.add(_)}_render(_){let d;this.fire(new a.z("renderstart")),++this._frameId;const p=this.painter.context.extTimerQuery,b=a.o.now(),M=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(d=M.createQuery(),M.beginQuery(p.TIME_ELAPSED_EXT,d)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&(this._interactionRange[0]=Math.min(this._interactionRange[0],performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],performance.now())),this._renderTaskQueue.run(_),this._domRenderTaskQueue.run(_),this._removed)return;this._updateProjectionTransition();const L=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const Y=this.transform.zoom,Q=this.transform.pitch,ce=a.o.now(),le=new a.ac(Y,{now:ce,fadeDuration:L,pitch:Q,transition:this.style.transition,worldview:this._worldview});this.style.update(le)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let O=!1;this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),O=this._updateAverageElevation(b),this.style.updateSources(this.transform),this.style.updateImageProviders(),this.isMoving()||this._forceMarkerAndPopupUpdate()):O=this._updateAverageElevation(b);const z=this.style&&this.style._updatePlacement(this.painter,this.painter.transform,this.showCollisionBoxes,L,this._crossSourceCollisions,this.painter.replacementSource,this._scaleFactorChanged);if(this._scaleFactorChanged&&(this._scaleFactorChanged=!1),z&&(this._placementDirty=z.needsRerender),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showParseStatus:this.showParseStatus,wireframe:{terrain:this.showTerrainWireframe,layers2D:this.showLayers2DWireframe,layers3D:this.showLayers3DWireframe},showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:L,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new a.z("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,y.mark(m.load),this.fire(new a.z("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&(this.style.snow||this.style.rain)&&(this._styleDirty=!0),this.style&&this.style.imageManager.hasPatternsInFlight()&&(this._styleDirty=!0),this.style&&!this.style.modelManager.isLoaded()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),d){const Y=a.o.now()-b;M.endQuery(p.TIME_ELAPSED_EXT),setTimeout(()=>{const Q=M.getQueryParameter(d,M.QUERY_RESULT)/1e6;M.deleteQuery(d),this.fire(new a.z("gpu-timing-frame",{cpuTime:Y,gpuTime:Q}))},50)}if(this.listens("gpu-timing-layer")){const Y=this.painter.collectGpuTimers();setTimeout(()=>{const Q=this.painter.queryGpuTimers(Y);this.fire(new a.z("gpu-timing-layer",{layerTimes:Q}))},50)}if(this.listens("gpu-timing-deferred-render")){const Y=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const Q=this.painter.queryGpuTimeDeferredRender(Y);this.fire(new a.z("gpu-timing-deferred-render",{gpuTime:Q}))},50)}const V=this._sourcesDirty||this._styleDirty||this._placementDirty||O;if(V||this._repaint)this.triggerRepaint();else{const Y=this.idle();if(Y&&(O=this._updateAverageElevation(b,!0)),O)this.triggerRepaint();else if(this._triggerFrame(!1),Y&&(this.fire(new a.z("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const Q=this._calculateSpeedIndex();this.fire(new a.z("speedindexcompleted",{speedIndex:Q})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||V||(this._fullyLoaded=!0,y.mark(m.fullLoad),this._performanceMetricsCollection&&Xe(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(_){for(const d of this._markers)_&&!this.getRenderWorldCopies()&&(d._lngLat=d._lngLat.wrap()),d._update();for(const d of this._popups)!_||this.getRenderWorldCopies()||d._trackPointer||(d._lngLat=d._lngLat.wrap()),d._update()}_updateAverageElevation(_,d=!1){const p=M=>(this.transform.averageElevation=M,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&&p(0);const b=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(b||(d||_-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(_)){const M=this.transform.averageElevation;let L=this.transform.sampleAverageElevation();this.transform.elevation!=null&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(L)?L=0:this._averageElevationLastSampledAt=_;const O=Math.abs(M-L);if(O>1){if(this._isInitialLoad||b)return this._averageElevation.jumpTo(L),p(L);this._averageElevation.easeTo(L,_,300)}else if(O>1e-4)return this._averageElevation.jumpTo(L),p(L)}return!!this._averageElevation.isEasing(_)&&p(this._averageElevation.getValue(_))}_authenticate(){mt(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,_=>{if(_&&(_.message===Ne||_.status===401)){const d=this.painter.context.gl;We(d,!1),this._logoControl instanceof vv&&this._logoControl._updateLogo(),d&&d.clear(d.DEPTH_BUFFER_BIT|d.COLOR_BUFFER_BIT|d.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new a.y(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}}),Me(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&Re(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_postStyleWithAppearanceEvent(){this.style.globalId&&this.style.hasAppearances()&&Pe(this._requestManager._customAccessToken)}_postAddingAppearancesToStyleEvent(){nt(this._requestManager._customAccessToken)}_updateTerrain(){const _=this._isDragging();this.painter.updateTerrain(this.style,_)}_calculateSpeedIndex(){const _=this.painter.canvasCopy(),d=this.painter.getCanvasCopiesAndTimestamps();d.timeStamps.push(performance.now());const p=this.painter.context.gl,b=p.createFramebuffer();function M(L){p.framebufferTexture2D(p.FRAMEBUFFER,p.COLOR_ATTACHMENT0,p.TEXTURE_2D,L,0);const O=new Uint8Array(p.drawingBufferWidth*p.drawingBufferHeight*4);return p.readPixels(0,0,p.drawingBufferWidth,p.drawingBufferHeight,p.RGBA,p.UNSIGNED_BYTE,O),O}return p.bindFramebuffer(p.FRAMEBUFFER,b),this._canvasPixelComparison(M(_),d.canvasCopies.map(M),d.timeStamps)}_canvasPixelComparison(_,d,p){let b=p[1]-p[0];const M=_.length/4;for(let L=0;L{const p=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,p&&this._render(d)}))}_preloadTiles(_){const d=this.style?this.style.getSourceCaches():[];return a.bw(d,(p,b)=>p._preloadTiles(_,b),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(_){this._trackResize&&this.resize({originalEvent:_})._update()}_onVisibilityChange(){document.visibilityState==="hidden"&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(_){this._showTileBoundaries!==_&&(this._showTileBoundaries=_,this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(_){this._showParseStatus!==_&&(this._showParseStatus=_,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(_){this._showTerrainWireframe!==_&&(this._showTerrainWireframe=_,this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(_){this._showLayers2DWireframe!==_&&(this._showLayers2DWireframe=_,this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(_){this._showLayers3DWireframe!==_&&(this._showLayers3DWireframe=_,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(_){this._speedIndexTiming!==_&&(this._speedIndexTiming=_,this._update())}get showPadding(){return!!this._showPadding}set showPadding(_){this._showPadding!==_&&(this._showPadding=_,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(_){this._showCollisionBoxes!==_&&(this._showCollisionBoxes=_,this.style&&_?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(_){this._showOverdrawInspector!==_&&(this._showOverdrawInspector=_,this._update())}get repaint(){return!!this._repaint}set repaint(_){this._repaint!==_&&(this._repaint=_,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(_){this._vertices=_,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(_){this._showTileAABBs!==_&&(this._showTileAABBs=_,_&&this._update())}_setCacheLimits(_,d){a.f4(_,d)}get version(){return f}},NavigationControl:class{constructor(_={}){this.options=Object.assign({},dae,_),this._container=S("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",d=>d.preventDefault()),this.options.showZoom&&(a.aY(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",d=>{this._map&&this._map.zoomIn({},{originalEvent:d})}),S("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",d=>{this._map&&this._map.zoomOut({},{originalEvent:d})}),S("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(a.aY(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",d=>{const p=this._map;p&&(this.options.visualizePitch?p.resetNorthPitch({},{originalEvent:d}):p.resetNorth({},{originalEvent:d}))}),this._compassIcon=S("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const _=this._map;if(!_)return;const d=_.getZoom(),p=d===_.getMaxZoom(),b=d===_.getMinZoom();this._zoomInButton.disabled=p,this._zoomOutButton.disabled=b,this._zoomInButton.setAttribute("aria-disabled",p.toString()),this._zoomOutButton.setAttribute("aria-disabled",b.toString())}_rotateCompassArrow(){const _=this._map;if(!_)return;const d=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(_.transform.pitch*(Math.PI/180)),.5)}) rotateX(${_.transform.pitch}deg) rotateZ(${_.transform.angle*(180/Math.PI)}deg)`:`rotate(${_.transform.angle*(180/Math.PI)}deg)`;_._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=d)})}onAdd(_){return this._map=_,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),_.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&_.on("pitch",this._rotateCompassArrow),_.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new uae(_,this._compass,this.options.visualizePitch)),this._container}onRemove(){const _=this._map;_&&(this._container.remove(),this.options.showZoom&&_.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&_.off("pitch",this._rotateCompassArrow),_.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(_,d){const p=S("button",_,this._container);return p.type="button",p.addEventListener("click",d),p}_setButtonTitle(_,d){if(!this._map)return;const p=this._map._getUIString(`NavigationControl.${d}`);_.setAttribute("aria-label",p),_.firstElementChild&&_.firstElementChild.setAttribute("title",p)}},GeolocateControl:class extends a.E{constructor(_={}){super();const d=navigator.geolocation;this.options=Object.assign({geolocation:d},hae,_),a.aY(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=Vk(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(_){return this._map=_,this._container=S("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){this._geolocationWatchID!==void 0&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(_){const d=(p=!!this.options.geolocation)=>{this._supportsGeolocation=p,_(p)};this._supportsGeolocation!==void 0?_(this._supportsGeolocation):navigator.permissions!==void 0?navigator.permissions.query({name:"geolocation"}).then(p=>d(p.state!=="denied")).catch(()=>d()):d()}_isOutOfMapMaxBounds(_){const d=this._map.getMaxBounds(),p=_.coords;return!!d&&(p.longituded.getEast()||p.latituded.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(_){if(this._map){if(this._isOutOfMapMaxBounds(_))return this._setErrorState(),this.fire(new a.z("outofmaxbounds",_)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=_,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(_),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(_),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new a.z("geolocate",Object.assign({coords:_.coords,timestamp:_.timestamp},_.toJSON?{toJSON:_.toJSON.bind(_)}:{}))),this._finish()}}_updateCamera(_){const d=new a.aT(_.coords.longitude,_.coords.latitude),p=_.coords.accuracy,b=this._map.getBearing(),M=Object.assign({bearing:b},this.options.fitBoundsOptions);this._map.fitBounds(d.toBounds(p),M,{geolocateSource:!0})}_updateMarker(_){if(_){const d=new a.aT(_.coords.longitude,_.coords.latitude);this._accuracyCircleMarker.setLngLat(d).addTo(this._map),this._userLocationDotMarker.setLngLat(d).addTo(this._map),this._accuracy=_.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const _=this._map.transform,d=a.cf(1,_._center.lat)*_.worldSize,p=Math.ceil(2*this._accuracy*d);this._circleElement.style.width=`${p}px`,this._circleElement.style.height=`${p}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&typeof this._heading=="number"?(this._userLocationDotMarker.setRotation(this._heading),this._userLocationDotMarker.addClassName("mapboxgl-user-location-show-heading")):(this._userLocationDotMarker.removeClassName("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(_){if(this._map){if(this.options.trackUserLocation)if(_.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const d=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",d),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",d),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(_.code===3&&this._noTimeout)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new a.z("error",_)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(_){if(this._map!==void 0){if(this._container.addEventListener("contextmenu",d=>d.preventDefault()),this._geolocateButton=S("button","mapboxgl-ctrl-geolocate",this._container),S("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",_===!1){a.w("Geolocation support is not available so the GeolocateControl will be disabled.");const d=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",d),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",d)}else{const d=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",d),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",d)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=S("div","mapboxgl-user-location"),this._dotElement.appendChild(S("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(S("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new nN({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=S("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new nN({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",d=>{d.geolocateSource||this._watchState!=="ACTIVE_LOCK"||d.originalEvent&&d.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new a.z("trackuserlocationend")))})}}_onDeviceOrientation(_){this._userLocationDotMarker&&(_.webkitCompassHeading?this._heading=_.webkitCompassHeading:_.absolute===!0&&(this._heading=-1*_.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return a.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new a.z("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new a.z("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new a.z("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let _;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(_={maximumAge:6e5,timeout:0},this._noTimeout=!0):(_=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,_),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=window.setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const _=()=>{"ondeviceorientationabsolute"in window?window.addEventListener("deviceorientationabsolute",this._onDeviceOrientation):window.addEventListener("deviceorientation",this._onDeviceOrientation)};typeof DeviceMotionEvent<"u"&&typeof DeviceMotionEvent.requestPermission=="function"?DeviceOrientationEvent.requestPermission().then(d=>{d==="granted"&&_()}).catch(console.error):_()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:xv,ScaleControl:class{constructor(_={}){this.options=Object.assign({},Cx,_),a.aY(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const _=this.options.maxWidth||100,d=this._map,p=d._containerHeight/2,b=d._containerWidth/2-_/2,M=d.unproject([b,p]),L=d.unproject([b+_,p]),O=M.distanceTo(L);if(this.options.unit==="imperial"){const z=3.2808*O;z>5280?this._setScale(_,z/5280,"mile"):this._setScale(_,z,"foot")}else this.options.unit==="nautical"?this._setScale(_,O/1852,"nautical-mile"):O>=1e3?this._setScale(_,O/1e3,"kilometer"):this._setScale(_,O,"meter")}_setScale(_,d,p){this._map._requestDomTask(()=>{const b=function(L){const O=Math.pow(10,`${Math.floor(L)}`.length-1);let z=L/O;return z=z>=10?10:z>=5?5:z>=3?3:z>=2?2:z>=1?1:function(V){const Y=Math.pow(10,Math.ceil(-Math.log(V)/Math.LN10));return Math.round(V*Y)/Y}(z),O*z}(d),M=b/d;this._container.innerHTML=p!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:p}).format(b):`${b} ${uM[p]}`,this._container.style.width=_*M+"px"})}onAdd(_){return this._map=_,this._language=_.getLanguage(),this._container=S("div","mapboxgl-ctrl mapboxgl-ctrl-scale",_.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(_){this._language=_,this._update()}setUnit(_){this.options.unit=_,this._update()}},FullscreenControl:class{constructor(_={}){this._fullscreen=!1,_&&_.container&&(_.container instanceof HTMLElement?this._container=_.container:a.w("Full screen control 'container' must be a DOM element.")),a.aY(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(_){return this._map=_,this._container||(this._container=this._map.getContainer()),this._controlContainer=S("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",a.w("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!document.fullscreenEnabled&&!document.webkitFullscreenEnabled)}_setupUI(){const _=this._fullscreenButton=S("button","mapboxgl-ctrl-fullscreen",this._controlContainer);S("span","mapboxgl-ctrl-icon",_).setAttribute("aria-hidden","true"),_.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const _=this._getTitle();this._fullscreenButton.setAttribute("aria-label",_),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",_)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(document.fullscreenElement||document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},IndoorControl:Sx,Popup:class extends a.E{constructor(_){super(),this.options=Object.assign(Object.create(Wu),_),this._altitude=this.options.altitude,a.aY(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(_&&_.className?_.className.trim().split(/\s+/):[])}addTo(_){return this._map&&this.remove(),this._map=_,this.options.closeOnClick&&_.on("preclick",this._onClose),this.options.closeOnMove&&_.on("move",this._onClose),_.on("remove",this.remove),this._update(),_._addPopup(this),this._focusFirstElement(),this._trackPointer?(_.on("mousemove",this._onMouseEvent),_.on("mouseup",this._onMouseEvent),_._canvasContainer.classList.add("mapboxgl-track-pointer")):_.on("move",this._update),this.fire(new a.z("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const _=this._map;return _&&(_.off("move",this._update),_.off("move",this._onClose),_.off("preclick",this._onClose),_.off("click",this._onClose),_.off("remove",this.remove),_.off("mousemove",this._onMouseEvent),_.off("mouseup",this._onMouseEvent),_.off("drag",this._onMouseEvent),_._canvasContainer&&_._canvasContainer.classList.remove("mapboxgl-track-pointer"),_._removePopup(this),this._map=void 0),this.fire(new a.z("close")),this}getLngLat(){return this._lngLat}setLngLat(_){this._lngLat=a.aT.convert(_),this._pos=null,this._trackPointer=!1,this._update();const d=this._map;return d&&(d.on("move",this._update),d.off("mousemove",this._onMouseEvent),d._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}getAltitude(){return this._altitude}setAltitude(_){return this._altitude=_,this._update(),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const _=this._map;return _&&(_.off("move",this._update),_.on("mousemove",this._onMouseEvent),_.on("drag",this._onMouseEvent),_._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(_){return this.setDOMContent(document.createTextNode(_))}setHTML(_){const d=document.createDocumentFragment(),p=document.createElement("body");let b;for(p.innerHTML=_;b=p.firstChild,b;)d.appendChild(b);return this.setDOMContent(d)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(_){return this.options.maxWidth=_,this._update(),this}setDOMContent(_){let d=this._content;if(d)for(;d.hasChildNodes();)d.firstChild&&d.removeChild(d.firstChild);else d=this._content=S("div","mapboxgl-popup-content",this._container||void 0);if(d.appendChild(_),this.options.closeButton){const p=this._closeButton=S("button","mapboxgl-popup-close-button",d);p.type="button",p.setAttribute("aria-label","Close popup"),p.innerHTML='',p.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(_){return this._classList.add(_),this._updateClassList(),this}removeClassName(_){return this._classList.delete(_),this._updateClassList(),this}setOffset(_){return this.options.offset=_,this._update(),this}toggleClassName(_){let d;return this._classList.delete(_)?d=!1:(this._classList.add(_),d=!0),this._updateClassList(),d}_onMouseEvent(_){this._update(_.point)}_getAnchor(_){if(this.options.anchor)return this.options.anchor;const d=this._map,p=this._container,b=this._pos;if(!d||!p||!b)return"bottom";const M=p.offsetWidth,L=p.offsetHeight,O=b.xd.transform.width-M/2;if(b.y+_d.transform.height-L){if(O)return"bottom-left";if(z)return"bottom-right"}return O?"left":z?"right":"bottom"}_updateClassList(){const _=this._container;if(!_)return;const d=[...this._classList];d.push("mapboxgl-popup"),this._anchor&&d.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&d.push("mapboxgl-popup-track-pointer"),_.className=d.join(" ")}_update(_){const d=this._map,p=this._content;if(!d||!this._lngLat&&!this._trackPointer||!p)return;let b=this._container;if(b||(b=this._container=S("div","mapboxgl-popup",d.getContainer()),this._tip=S("div","mapboxgl-popup-tip",b),b.appendChild(p)),this.options.maxWidth&&b.style.maxWidth!==this.options.maxWidth&&(b.style.maxWidth=this.options.maxWidth),d.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=dM(this._lngLat,this._pos,d.transform)),!this._trackPointer||_){const M=this._pos=this._trackPointer&&_ instanceof a.P?_:d.project(this._lngLat,this._altitude),L=Yg(this.options.offset),O=this._anchor=this._getAnchor(L.y),z=Yg(this.options.offset,O),V=M.add(z).round();d._requestDomTask(()=>{this._container&&O&&(this._container.style.transform=`${dc[O]} translate(${V.x}px,${V.y}px)`)})}if(!this._marker&&d._showingGlobe()){const M=a.f5(d.transform,this._lngLat)?0:1;this._setOpacity(M)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const _=this._container.querySelector(Gu);_&&_.focus()}_onClose(){this.remove()}_setOpacity(_){this._container&&(this._container.style.opacity=`${_}`),this._content&&(this._content.style.pointerEvents=_?"auto":"none")}},Marker:nN,Style:Vu,LngLat:a.aT,LngLatBounds:a.aI,Point:a.P,MercatorCoordinate:a.ae,FreeCameraOptions:Wc,Evented:a.E,config:a.e,prewarm:a.f9,clearPrewarmedResources:a.f8,get accessToken(){return a.e.ACCESS_TOKEN},set accessToken(_){a.e.ACCESS_TOKEN=_},get baseApiUrl(){return a.e.API_URL},set baseApiUrl(_){a.e.API_URL=_},get workerCount(){return a.fi.workerCount},set workerCount(_){a.fi.workerCount=_},get maxParallelImageRequests(){return a.e.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(_){a.e.MAX_PARALLEL_IMAGE_REQUESTS=_},clearStorage(_){a.fh(_)},get workerUrl(){return a.fg.workerUrl},set workerUrl(_){a.fg.workerUrl=_},get workerClass(){return a.fg.workerClass},set workerClass(_){a.fg.workerClass=_},get workerParams(){return a.fg.workerParams},set workerParams(_){a.fg.workerParams=_},get dracoUrl(){return a.ff()},set dracoUrl(_){a.fe(_)},get meshoptUrl(){return a.fd()},set meshoptUrl(_){a.fc(_)},setNow:a.o.setNow,restoreNow:a.o.restoreNow}});var c=i;return c})})(dze);var jwt=dze.exports;const _L=Oa(jwt);function kwt(){const t=es(),{isAdmin:e}=Fr(),n=P.useRef(null),s=P.useRef(null),i=P.useRef([]),o=ize(),{data:c}=nze(),a=oze(),[f,m]=P.useState(""),[y,v]=P.useState(""),[w,k]=P.useState(!0),[C,S]=P.useState(null),[T,I]=P.useState(null),[A,D]=P.useState(!1),[$,F]=P.useState({popby_item_id:"",notes:""}),q=o.filter(re=>re.address||re.city&&re.state);P.useEffect(()=>{(async()=>{k(!0);try{const{data:he}=await ee.from("settings").select("value").eq("key","mapbox_public_token").maybeSingle();he!=null&&he.value&&m(he.value)}catch(he){console.error("Error fetching mapbox token:",he)}k(!1)})()},[]),P.useEffect(()=>{"geolocation"in navigator&&navigator.geolocation.getCurrentPosition(re=>{S([re.coords.longitude,re.coords.latitude])},re=>{console.log("Could not get location:",re)})},[]),P.useEffect(()=>{if(!(!n.current||!f||s.current))return _L.accessToken=f,s.current=new _L.Map({container:n.current,style:"mapbox://styles/mapbox/streets-v12",zoom:C?12:4,center:C||[-98.5795,39.8283]}),s.current.addControl(new _L.NavigationControl,"top-right"),()=>{var re;(re=s.current)==null||re.remove(),s.current=null}},[f,C]),P.useEffect(()=>{!s.current||!f||(i.current.forEach(re=>re.remove()),i.current=[],q.forEach(async re=>{var ue;const he=[re.address,re.city,re.state,re.zip].filter(Boolean).join(", ");if(he)try{const se=await(await fetch(`https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURIComponent(he)}.json?access_token=${f}`)).json();if(se.features&&se.features.length>0){const[xe,ie]=se.features[0].center,me=document.createElement("div");me.className="cursor-pointer",me.innerHTML=`
${re.first_name[0]}${((ue=re.last_name)==null?void 0:ue[0])||""}
${re.isDue?'
':""}
`;const fe=new _L.Marker(me).setLngLat([xe,ie]).addTo(s.current);me.addEventListener("click",()=>{I(re)}),i.current.push(fe)}}catch(Ne){console.error("Geocoding error for",re.first_name,Ne)}}))},[q,f]);const W=()=>{C&&s.current?s.current.flyTo({center:C,zoom:13}):Wi({title:"Location not available",description:"Please enable location services",variant:"destructive"})},K=async()=>{T&&(await a.mutateAsync({contact_id:T.id,popby_item_id:$.popby_item_id||void 0,notes:$.notes||void 0,latitude:C==null?void 0:C[1],longitude:C==null?void 0:C[0]}),D(!1),I(null),F({popby_item_id:"",notes:""}))},Z=async()=>{if(y.trim())try{await ee.from("settings").upsert({key:"mapbox_public_token",value:y.trim()}),m(y.trim()),Wi({title:"Mapbox token saved!"})}catch{Wi({title:"Error saving token",variant:"destructive"})}};return w?r.jsx(Or,{title:"Popby Map",children:r.jsx("div",{className:"flex items-center justify-center h-[60vh]",children:r.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})})}):f?r.jsx(Or,{title:"Popby Map",children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(te,{variant:"ghost",onClick:()=>t("/innercircle/popbys"),children:[r.jsx(Va,{className:"h-4 w-4 mr-2"}),"Back to Popbys"]}),r.jsxs(te,{onClick:W,children:[r.jsx(fT,{className:"h-4 w-4 mr-2"}),"My Location"]})]}),r.jsxs("div",{className:"flex gap-4 text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-4 h-4 rounded-full bg-primary"}),r.jsx("span",{children:"Up to date"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-4 h-4 rounded-full bg-amber-500"}),r.jsx("span",{children:"Due for popby"})]})]}),r.jsxs("div",{className:"relative",children:[r.jsx("div",{ref:n,className:"w-full h-[60vh] rounded-lg shadow-lg"}),q.length===0&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/80 rounded-lg",children:r.jsxs("div",{className:"text-center p-6",children:[r.jsx(Bl,{className:"h-12 w-12 mx-auto text-muted-foreground mb-2"}),r.jsx("p",{className:"font-medium",children:"No contacts with addresses"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Add addresses to your contacts to see them on the map."})]})})]}),T&&r.jsx(Ye,{className:"fixed bottom-4 left-4 right-4 md:left-auto md:right-4 md:w-96 z-50 shadow-xl",children:r.jsxs(Je,{className:"p-4",children:[r.jsxs("div",{className:"flex items-start justify-between mb-3",children:[r.jsxs("div",{children:[r.jsxs("h3",{className:"font-semibold",children:[T.first_name," ",T.last_name]}),T.address&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[T.city,", ",T.state]})]}),r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>I(null),children:"×"})]}),r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[T.isDue?r.jsxs(Rt,{variant:"destructive",children:[T.daysOverdue,"+ days overdue"]}):r.jsx(Rt,{variant:"secondary",children:"Up to date"}),T.lastPopby&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Last: ",un(new Date(T.lastPopby),"MMM d")]})]}),r.jsxs("div",{className:"flex gap-2",children:[T.phone&&r.jsx(te,{size:"sm",variant:"outline",asChild:!0,className:"flex-1",children:r.jsxs("a",{href:`tel:${T.phone}`,children:[r.jsx(Wa,{className:"h-4 w-4 mr-1"}),"Call"]})}),T.address&&r.jsxs(te,{size:"sm",variant:"outline",className:"flex-1",onClick:()=>{const re=[T.address,T.city,T.state,T.zip].filter(Boolean).join(", ");window.open(`https://maps.google.com/maps?daddr=${encodeURIComponent(re)}`,"_blank")},children:[r.jsx(xT,{className:"h-4 w-4 mr-1"}),"Navigate"]}),r.jsxs(te,{size:"sm",className:"flex-1",onClick:()=>D(!0),children:[r.jsx(Qa,{className:"h-4 w-4 mr-1"}),"Log Popby"]})]})]})}),r.jsx($r,{open:A,onOpenChange:D,children:r.jsxs(zr,{children:[r.jsx(Zr,{children:r.jsxs(Kr,{children:["Log Popby for ",T==null?void 0:T.first_name," ",T==null?void 0:T.last_name]})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Popby Item (optional)"}),r.jsxs(_n,{value:$.popby_item_id,onValueChange:re=>F(he=>({...he,popby_item_id:re})),children:[r.jsx(xn,{children:r.jsx(bn,{placeholder:"Select a popby item..."})}),r.jsx(vn,{children:c==null?void 0:c.map(re=>r.jsx(er,{value:re.id,children:re.name},re.id))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Notes (optional)"}),r.jsx(ps,{placeholder:"Any notes about this popby...",value:$.notes,onChange:re=>F(he=>({...he,notes:re.target.value}))})]}),C&&r.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[r.jsx(yl,{className:"h-3 w-3"}),"Your current location will be recorded"]})]}),r.jsxs(ni,{children:[r.jsx(te,{variant:"outline",onClick:()=>D(!1),children:"Cancel"}),r.jsxs(te,{onClick:K,disabled:a.isPending,children:[r.jsx(za,{className:"h-4 w-4 mr-1"}),"Log Popby"]})]})]})})]})}):e?r.jsx(Or,{title:"Popby Map",children:r.jsx("div",{className:"max-w-md mx-auto mt-8",children:r.jsx(Ye,{children:r.jsxs(Je,{className:"p-6 space-y-4",children:[r.jsxs("div",{className:"text-center mb-4",children:[r.jsx(yl,{className:"h-12 w-12 mx-auto text-muted-foreground mb-2"}),r.jsx("h2",{className:"text-lg font-semibold",children:"Setup Map"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Enter your Mapbox public token to enable the map feature."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Mapbox Public Token"}),r.jsx(yt,{placeholder:"pk.eyJ1I...",value:y,onChange:re=>v(re.target.value)}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your token at"," ",r.jsx("a",{href:"https://mapbox.com/",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"mapbox.com"})]})]}),r.jsx(te,{onClick:Z,className:"w-full",children:"Save Token"}),r.jsxs(te,{variant:"outline",className:"w-full",onClick:()=>t("/innercircle/popbys"),children:[r.jsx(Va,{className:"h-4 w-4 mr-2"}),"Back to Popbys"]})]})})})}):r.jsx(Or,{title:"Popby Map",children:r.jsx("div",{className:"max-w-md mx-auto mt-8",children:r.jsx(Ye,{children:r.jsxs(Je,{className:"p-6 space-y-4",children:[r.jsxs("div",{className:"text-center",children:[r.jsx(Bl,{className:"h-12 w-12 mx-auto text-muted-foreground mb-2"}),r.jsx("h2",{className:"text-lg font-semibold",children:"Map Not Available"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"The map feature has not been configured yet. Please contact your administrator."})]}),r.jsxs(te,{variant:"outline",className:"w-full",onClick:()=>t("/innercircle/popbys"),children:[r.jsx(Va,{className:"h-4 w-4 mr-2"}),"Back to Popbys"]})]})})})})}const Nwt=UC({property_address:ec().min(1,"Property address is required"),city:ec().optional(),state:ec().optional(),zip:ec().optional(),transaction_type:GPe(["buyer","seller"]),close_date:ec().min(1,"Close date is required"),sale_price:DT().min(0,"Sale price must be positive"),commission_amount:DT().optional(),lead_source_id:ec().optional(),client_type_id:ec().optional(),contact_id:ec().optional(),notes:ec().optional(),is_win:lit()});function hze({open:t,onOpenChange:e,transaction:n}){const[s,i]=P.useState(!1),[o,c]=P.useState(""),[a,f]=P.useState(!1),[m,y]=P.useState(""),v=fse(),w=Eht(),{data:k}=hse(),{data:C}=Ag(),{data:S}=mm(),T=$Oe(),I=Aht(),{data:A}=pse(),D=(A==null?void 0:A.show_commission)??!0,$=ese({resolver:tse(Nwt),defaultValues:{property_address:"",city:"",state:"",zip:"",transaction_type:"buyer",close_date:new Date().toISOString().split("T")[0],sale_price:0,commission_amount:void 0,lead_source_id:void 0,client_type_id:void 0,contact_id:void 0,notes:"",is_win:!1}});P.useEffect(()=>{n?$.reset({property_address:n.property_address,city:n.city||"",state:n.state||"",zip:n.zip||"",transaction_type:n.transaction_type,close_date:n.close_date,sale_price:Number(n.sale_price),commission_amount:n.commission_amount?Number(n.commission_amount):void 0,lead_source_id:n.lead_source_id||void 0,client_type_id:n.client_type_id||void 0,contact_id:n.contact_id||void 0,notes:n.notes||"",is_win:n.is_win}):$.reset({property_address:"",city:"",state:"",zip:"",transaction_type:"buyer",close_date:new Date().toISOString().split("T")[0],sale_price:0,commission_amount:void 0,lead_source_id:void 0,client_type_id:void 0,contact_id:void 0,notes:"",is_win:!1})},[n,$]);const F=async Z=>{const re={property_address:Z.property_address,transaction_type:Z.transaction_type,close_date:Z.close_date,sale_price:Z.sale_price,is_win:Z.is_win,commission_amount:Z.commission_amount||null,lead_source_id:Z.lead_source_id||null,client_type_id:Z.client_type_id||null,contact_id:Z.contact_id||null,city:Z.city||null,state:Z.state||null,zip:Z.zip||null,notes:Z.notes||null};n?await w.mutateAsync({id:n.id,...re}):await v.mutateAsync(re),e(!1)},q=async()=>{if(!o.trim())return;const[Z,...re]=o.trim().split(" "),he=re.join(" ")||null,ue=await T.mutateAsync({first_name:Z,last_name:he,tagIds:[]});ue&&($.setValue("contact_id",ue.id),c(""),f(!1),i(!1))},W=async()=>{if(!m.trim())return;const Z=await I.mutateAsync(m.trim());Z&&($.setValue("lead_source_id",Z.id),y(""))},K=S==null?void 0:S.find(Z=>Z.id===$.watch("contact_id"));return r.jsx($r,{open:t,onOpenChange:e,children:r.jsxs(zr,{className:"max-w-lg max-h-[90vh]",children:[r.jsx(Zr,{children:r.jsx(Kr,{children:n?"Edit Transaction":"Add Transaction"})}),r.jsx(xl,{className:"max-h-[70vh] pr-4",children:r.jsx(rse,{...$,children:r.jsxs("form",{onSubmit:$.handleSubmit(F),className:"space-y-4",children:[r.jsx(jl,{control:$.control,name:"property_address",render:({field:Z})=>r.jsxs(hl,{children:[r.jsx(fl,{children:"Property Address *"}),r.jsx(pl,{children:r.jsx(yt,{placeholder:"123 Main St",...Z})}),r.jsx(gu,{})]})}),r.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[r.jsx(jl,{control:$.control,name:"city",render:({field:Z})=>r.jsxs(hl,{children:[r.jsx(fl,{children:"City"}),r.jsx(pl,{children:r.jsx(yt,{placeholder:"City",...Z})})]})}),r.jsx(jl,{control:$.control,name:"state",render:({field:Z})=>r.jsxs(hl,{children:[r.jsx(fl,{children:"State"}),r.jsx(pl,{children:r.jsx(yt,{placeholder:"TX",...Z})})]})}),r.jsx(jl,{control:$.control,name:"zip",render:({field:Z})=>r.jsxs(hl,{children:[r.jsx(fl,{children:"Zip"}),r.jsx(pl,{children:r.jsx(yt,{placeholder:"75001",...Z})})]})})]}),r.jsx(jl,{control:$.control,name:"transaction_type",render:({field:Z})=>r.jsxs(hl,{children:[r.jsx(fl,{children:"Transaction Type *"}),r.jsxs(_n,{onValueChange:Z.onChange,value:Z.value,children:[r.jsx(pl,{children:r.jsx(xn,{children:r.jsx(bn,{placeholder:"Select type"})})}),r.jsxs(vn,{children:[r.jsx(er,{value:"buyer",children:"Buyer"}),r.jsx(er,{value:"seller",children:"Seller"})]})]}),r.jsx(gu,{})]})}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsx(jl,{control:$.control,name:"close_date",render:({field:Z})=>r.jsxs(hl,{children:[r.jsx(fl,{children:"Close Date *"}),r.jsx(pl,{children:r.jsx(yt,{type:"date",...Z})}),r.jsx(gu,{})]})}),r.jsx(jl,{control:$.control,name:"sale_price",render:({field:Z})=>r.jsxs(hl,{children:[r.jsx(fl,{children:"Sale Price *"}),r.jsx(pl,{children:r.jsx(yt,{type:"number",placeholder:"0",...Z,onChange:re=>Z.onChange(Number(re.target.value))})}),r.jsx(gu,{})]})})]}),D&&r.jsx(jl,{control:$.control,name:"commission_amount",render:({field:Z})=>r.jsxs(hl,{children:[r.jsx(fl,{children:"Commission"}),r.jsx(pl,{children:r.jsx(yt,{type:"number",placeholder:"0",...Z,value:Z.value??"",onChange:re=>Z.onChange(re.target.value?Number(re.target.value):void 0)})})]})}),r.jsx(jl,{control:$.control,name:"lead_source_id",render:({field:Z})=>r.jsxs(hl,{children:[r.jsx(fl,{children:"Lead Source"}),r.jsxs(_n,{onValueChange:Z.onChange,value:Z.value||"",children:[r.jsx(pl,{children:r.jsx(xn,{children:r.jsx(bn,{placeholder:"Select source"})})}),r.jsx(vn,{children:k==null?void 0:k.map(re=>r.jsx(er,{value:re.id,children:re.name},re.id))})]})]})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(yt,{placeholder:"Add custom source...",value:m,onChange:Z=>y(Z.target.value),className:"flex-1"}),r.jsx(te,{type:"button",variant:"outline",size:"icon",onClick:W,disabled:!m.trim(),children:r.jsx(Sn,{className:"h-4 w-4"})})]}),r.jsx(jl,{control:$.control,name:"client_type_id",render:({field:Z})=>r.jsxs(hl,{children:[r.jsx(fl,{children:"Client Type"}),r.jsxs(_n,{onValueChange:Z.onChange,value:Z.value||"",children:[r.jsx(pl,{children:r.jsx(xn,{children:r.jsx(bn,{placeholder:"Select client type"})})}),r.jsx(vn,{children:C==null?void 0:C.map(re=>r.jsx(er,{value:re.id,children:re.name},re.id))})]})]})}),r.jsx(jl,{control:$.control,name:"contact_id",render:({field:Z})=>r.jsxs(hl,{children:[r.jsx(fl,{children:"Client Contact"}),r.jsxs(Zh,{open:s,onOpenChange:i,children:[r.jsx(Yh,{asChild:!0,children:r.jsx(pl,{children:r.jsxs(te,{variant:"outline",role:"combobox",className:zt("w-full justify-between",!Z.value&&"text-muted-foreground"),children:[K?`${K.first_name} ${K.last_name||""}`.trim():"Select contact",r.jsx(Fw,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})})}),r.jsxs(mh,{className:"w-full p-0",align:"start",children:[r.jsxs(gj,{children:[r.jsx(yj,{placeholder:"Search contacts..."}),r.jsxs(xj,{children:[r.jsx(vj,{children:r.jsxs("div",{className:"p-2 space-y-2",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"No contact found."}),!a&&r.jsxs(te,{variant:"outline",size:"sm",className:"w-full",onClick:()=>f(!0),children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Add New Contact"]})]})}),r.jsx(_j,{children:S==null?void 0:S.map(re=>r.jsxs(bj,{value:`${re.first_name} ${re.last_name||""}`,onSelect:()=>{Z.onChange(re.id),i(!1)},children:[r.jsx(Ba,{className:zt("mr-2 h-4 w-4",re.id===Z.value?"opacity-100":"opacity-0")}),re.first_name," ",re.last_name||""]},re.id))})]})]}),a&&r.jsxs("div",{className:"p-2 border-t space-y-2",children:[r.jsx(yt,{placeholder:"Enter contact name...",value:o,onChange:re=>c(re.target.value)}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(te,{size:"sm",onClick:q,disabled:!o.trim()||T.isPending,children:"Add Contact"}),r.jsx(te,{size:"sm",variant:"outline",onClick:()=>{f(!1),c("")},children:"Cancel"})]})]})]})]})]})}),r.jsx(jl,{control:$.control,name:"notes",render:({field:Z})=>r.jsxs(hl,{children:[r.jsx(fl,{children:"Notes"}),r.jsx(pl,{children:r.jsx(ps,{placeholder:"Any notes about this transaction...",...Z})})]})}),r.jsx(jl,{control:$.control,name:"is_win",render:({field:Z})=>r.jsxs(hl,{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(fl,{children:"Mark as Win 🏆"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Highlight this as a notable success"})]}),r.jsx(pl,{children:r.jsx(Zs,{checked:Z.value,onCheckedChange:Z.onChange})})]})}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsxs(te,{type:"submit",disabled:v.isPending||w.isPending,children:[n?"Update":"Add"," Transaction"]})]})]})})})]})})}function fze({transactions:t,showCommission:e,isLoading:n}){const[s,i]=P.useState(null),[o,c]=P.useState(null),[a,f]=P.useState(""),[m,y]=P.useState("all"),[v,w]=P.useState("all"),[k,C]=P.useState("all"),[S,T]=P.useState(!1),I=Iht(),A=fse(),{data:D}=hse(),{data:$}=Ag(),F=yI(),q=Z=>{const{id:re,created_at:he,updated_at:ue,lead_source:Ne,client_type:se,contact:xe,...ie}=Z;A.mutate(ie)},W=()=>{o&&(I.mutate(o),c(null))},K=t.filter(Z=>{var xe,ie,me,fe;const re=a===""||Z.property_address.toLowerCase().includes(a.toLowerCase())||((ie=(xe=Z.contact)==null?void 0:xe.first_name)==null?void 0:ie.toLowerCase().includes(a.toLowerCase()))||((fe=(me=Z.contact)==null?void 0:me.last_name)==null?void 0:fe.toLowerCase().includes(a.toLowerCase())),he=m==="all"||Z.transaction_type===m,ue=v==="all"||Z.lead_source_id===v,Ne=k==="all"||Z.client_type_id===k,se=!S||Z.is_win;return re&&he&&ue&&Ne&&se});return n?r.jsx(Ye,{children:r.jsx(Je,{className:"p-6 space-y-4",children:[1,2,3].map(Z=>r.jsx(Gr,{className:"h-16 w-full"},Z))})}):r.jsxs(r.Fragment,{children:[r.jsxs(Ye,{children:[r.jsx(Ht,{className:"pb-3",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[r.jsxs(Yt,{children:["Transactions (",K.length,")"]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs("div",{className:"relative",children:[r.jsx(Ti,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),r.jsx(yt,{placeholder:"Search...",value:a,onChange:Z=>f(Z.target.value),className:"pl-8 w-[150px]"})]}),r.jsxs(_n,{value:m,onValueChange:y,children:[r.jsx(xn,{className:"w-[100px]",children:r.jsx(bn,{placeholder:"Type"})}),r.jsxs(vn,{children:[r.jsx(er,{value:"all",children:"All Types"}),r.jsx(er,{value:"buyer",children:"Buyer"}),r.jsx(er,{value:"seller",children:"Seller"})]})]}),r.jsxs(_n,{value:v,onValueChange:w,children:[r.jsx(xn,{className:"w-[130px]",children:r.jsx(bn,{placeholder:"Lead Source"})}),r.jsxs(vn,{children:[r.jsx(er,{value:"all",children:"All Sources"}),D==null?void 0:D.map(Z=>r.jsx(er,{value:Z.id,children:Z.name},Z.id))]})]}),r.jsxs(te,{variant:S?"default":"outline",size:"sm",onClick:()=>T(!S),children:[r.jsx(Cu,{className:"h-4 w-4 mr-1"}),"Wins"]})]})]})}),r.jsx(Je,{children:K.length===0?r.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No transactions found"}):F?r.jsx("div",{className:"space-y-3",children:K.map(Z=>r.jsxs(Ye,{className:"p-4",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"font-medium truncate",children:Z.property_address}),Z.is_win&&r.jsx(Cu,{className:"h-4 w-4 text-yellow-500 flex-shrink-0"})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[Z.city,Z.state?`, ${Z.state}`:""]})]}),r.jsx(Rt,{variant:Z.transaction_type==="buyer"?"default":"secondary",children:Z.transaction_type})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2 mt-3 text-sm",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Close Date: "}),Obe(Z.close_date)]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Price: "}),jd(Z.sale_price)]}),e&&Z.commission_amount&&r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Commission: "}),jd(Z.commission_amount)]}),Z.lead_source&&r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Source: "}),Z.lead_source.name]}),Z.contact&&r.jsxs("div",{className:"col-span-2",children:[r.jsx("span",{className:"text-muted-foreground",children:"Client: "}),Z.contact.first_name," ",Z.contact.last_name]})]}),r.jsxs("div",{className:"flex justify-end gap-2 mt-3 pt-3 border-t",children:[r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>i(Z),children:r.jsx(Jl,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>q(Z),children:r.jsx(Ul,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>c(Z.id),children:r.jsx(Xn,{className:"h-4 w-4 text-destructive"})})]})]},Z.id))}):r.jsx("div",{className:"overflow-x-auto",children:r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"Property"}),r.jsx(At,{children:"Type"}),r.jsx(At,{children:"Close Date"}),r.jsx(At,{children:"Sale Price"}),e&&r.jsx(At,{children:"Commission"}),r.jsx(At,{children:"Lead Source"}),r.jsx(At,{children:"Client"}),r.jsx(At,{className:"w-[50px]"})]})}),r.jsx(qs,{children:K.map(Z=>{var re;return r.jsxs(Er,{children:[r.jsx(_t,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[Z.is_win&&r.jsx(Cu,{className:"h-4 w-4 text-yellow-500"}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Z.property_address}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[Z.city,Z.state?`, ${Z.state}`:""]})]})]})}),r.jsx(_t,{children:r.jsx(Rt,{variant:Z.transaction_type==="buyer"?"default":"secondary",children:Z.transaction_type})}),r.jsx(_t,{children:Obe(Z.close_date)}),r.jsx(_t,{children:jd(Z.sale_price)}),e&&r.jsx(_t,{children:Z.commission_amount?jd(Z.commission_amount):"-"}),r.jsx(_t,{children:((re=Z.lead_source)==null?void 0:re.name)||"-"}),r.jsx(_t,{children:Z.contact?`${Z.contact.first_name} ${Z.contact.last_name||""}`.trim():"-"}),r.jsx(_t,{children:r.jsxs(fm,{children:[r.jsx(pm,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",children:r.jsx(gy,{className:"h-4 w-4"})})}),r.jsxs(Xf,{align:"end",children:[r.jsxs(uo,{onClick:()=>i(Z),children:[r.jsx(Jl,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsxs(uo,{onClick:()=>q(Z),children:[r.jsx(Ul,{className:"h-4 w-4 mr-2"}),"Duplicate"]}),r.jsxs(uo,{onClick:()=>c(Z.id),className:"text-destructive",children:[r.jsx(Xn,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})})]},Z.id)})})]})})})]}),r.jsx(hze,{open:!!s,onOpenChange:Z=>!Z&&i(null),transaction:s||void 0}),r.jsx(ih,{open:!!o,onOpenChange:Z=>!Z&&c(null),children:r.jsxs(yu,{children:[r.jsxs(xu,{children:[r.jsx(_u,{children:"Delete Transaction?"}),r.jsx(bu,{children:"This action cannot be undone. This will permanently delete this transaction."})]}),r.jsxs(vu,{children:[r.jsx(wu,{children:"Cancel"}),r.jsx(Hd,{onClick:W,className:"bg-destructive text-destructive-foreground",children:"Delete"})]})]})})]})}function pze({goals:t,stats:e,year:n,showCommission:s}){const i=new Date().getMonth()+1,o=new Date().getFullYear()===n?i:12,c=12-o,a=(w,k)=>{if(!k||k===0)return null;const C=Math.min(w/k*100,100),S=Math.max(k-w,0),T=c>0?S/c:0,I=o/12*100,A=C>=I?"ahead":C>=I*.8?"on-track":"behind";return{percent:C,remaining:S,pace:T,status:A}},f=a(e.totalTransactions,t.transactions_goal),m=a(e.totalVolume,t.volume_goal),y=s?a(e.totalCommission,t.gci_goal):null,v=w=>{switch(w){case"ahead":return r.jsxs(Rt,{className:"bg-green-500 text-white",children:[r.jsx(Bf,{className:"h-3 w-3 mr-1"}),"Ahead"]});case"on-track":return r.jsxs(Rt,{variant:"secondary",children:[r.jsx(Y0,{className:"h-3 w-3 mr-1"}),"On Track"]});case"behind":return r.jsxs(Rt,{variant:"destructive",children:[r.jsx(Kw,{className:"h-3 w-3 mr-1"}),"Behind"]});default:return null}};return!t.transactions_goal&&!t.volume_goal&&!t.gci_goal?null:r.jsxs(Ye,{children:[r.jsx(Ht,{className:"pb-3",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ey,{className:"h-5 w-5 text-primary"}),r.jsxs(Yt,{children:[n," Goals Progress"]})]})}),r.jsx(Je,{children:r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[t.transactions_goal&&f&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-sm font-medium",children:"Transactions"}),v(f.status)]}),r.jsx(zc,{value:f.percent,className:"h-2"}),r.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[r.jsxs("span",{children:[e.totalTransactions," of ",t.transactions_goal]}),r.jsxs("span",{children:[Math.round(f.percent),"%"]})]}),f.remaining>0&&c>0&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Need ",Math.ceil(f.pace),"/month to hit goal"]})]}),t.volume_goal&&m&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-sm font-medium",children:"Volume"}),v(m.status)]}),r.jsx(zc,{value:m.percent,className:"h-2"}),r.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[r.jsxs("span",{children:[jd(e.totalVolume,!0)," of ",jd(t.volume_goal,!0)]}),r.jsxs("span",{children:[Math.round(m.percent),"%"]})]}),m.remaining>0&&c>0&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Need ",jd(m.pace,!0),"/month"]})]}),s&&t.gci_goal&&y&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-sm font-medium",children:"GCI"}),v(y.status)]}),r.jsx(zc,{value:y.percent,className:"h-2"}),r.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[r.jsxs("span",{children:[jd(e.totalCommission,!0)," of ",jd(t.gci_goal,!0)]}),r.jsxs("span",{children:[Math.round(y.percent),"%"]})]}),y.remaining>0&&c>0&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Need ",jd(y.pace,!0),"/month"]})]})]})})]})}var Swt=Array.isArray,yh=Swt,Cwt=typeof _y=="object"&&_y&&_y.Object===Object&&_y,mze=Cwt,Mwt=mze,Twt=typeof self=="object"&&self&&self.Object===Object&&self,Awt=Mwt||Twt||Function("return this")(),Eg=Awt,Ewt=Eg,Iwt=Ewt.Symbol,xI=Iwt,XNe=xI,gze=Object.prototype,Pwt=gze.hasOwnProperty,Lwt=gze.toString,b5=XNe?XNe.toStringTag:void 0;function Owt(t){var e=Pwt.call(t,b5),n=t[b5];try{t[b5]=void 0;var s=!0}catch{}var i=Lwt.call(t);return s&&(e?t[b5]=n:delete t[b5]),i}var Dwt=Owt,Rwt=Object.prototype,Fwt=Rwt.toString;function zwt(t){return Fwt.call(t)}var Bwt=zwt,QNe=xI,$wt=Dwt,Uwt=Bwt,qwt="[object Null]",Vwt="[object Undefined]",JNe=QNe?QNe.toStringTag:void 0;function Hwt(t){return t==null?t===void 0?Vwt:qwt:JNe&&JNe in Object(t)?$wt(t):Uwt(t)}var Jy=Hwt;function Wwt(t){return t!=null&&typeof t=="object"}var ex=Wwt,Gwt=Jy,Kwt=ex,Zwt="[object Symbol]";function Ywt(t){return typeof t=="symbol"||Kwt(t)&&Gwt(t)==Zwt}var GC=Ywt,Xwt=yh,Qwt=GC,Jwt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ejt=/^\w*$/;function tjt(t,e){if(Xwt(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||Qwt(t)?!0:ejt.test(t)||!Jwt.test(t)||e!=null&&t in Object(e)}var lxe=tjt;function rjt(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var R1=rjt;const KC=Oa(R1);var njt=Jy,sjt=R1,ijt="[object AsyncFunction]",ajt="[object Function]",ojt="[object GeneratorFunction]",ljt="[object Proxy]";function cjt(t){if(!sjt(t))return!1;var e=njt(t);return e==ajt||e==ojt||e==ijt||e==ljt}var cxe=cjt;const Pi=Oa(cxe);var djt=Eg,ujt=djt["__core-js_shared__"],hjt=ujt,Cce=hjt,eSe=function(){var t=/[^.]+$/.exec(Cce&&Cce.keys&&Cce.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function fjt(t){return!!eSe&&eSe in t}var pjt=fjt,mjt=Function.prototype,gjt=mjt.toString;function yjt(t){if(t!=null){try{return gjt.call(t)}catch{}try{return t+""}catch{}}return""}var yze=yjt,xjt=cxe,vjt=pjt,_jt=R1,bjt=yze,wjt=/[\\^$.*+?()[\]{}|]/g,jjt=/^\[object .+?Constructor\]$/,kjt=Function.prototype,Njt=Object.prototype,Sjt=kjt.toString,Cjt=Njt.hasOwnProperty,Mjt=RegExp("^"+Sjt.call(Cjt).replace(wjt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Tjt(t){if(!_jt(t)||vjt(t))return!1;var e=xjt(t)?Mjt:jjt;return e.test(bjt(t))}var Ajt=Tjt;function Ejt(t,e){return t==null?void 0:t[e]}var Ijt=Ejt,Pjt=Ajt,Ljt=Ijt;function Ojt(t,e){var n=Ljt(t,e);return Pjt(n)?n:void 0}var $j=Ojt,Djt=$j,Rjt=Djt(Object,"create"),Rse=Rjt,tSe=Rse;function Fjt(){this.__data__=tSe?tSe(null):{},this.size=0}var zjt=Fjt;function Bjt(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var $jt=Bjt,Ujt=Rse,qjt="__lodash_hash_undefined__",Vjt=Object.prototype,Hjt=Vjt.hasOwnProperty;function Wjt(t){var e=this.__data__;if(Ujt){var n=e[t];return n===qjt?void 0:n}return Hjt.call(e,t)?e[t]:void 0}var Gjt=Wjt,Kjt=Rse,Zjt=Object.prototype,Yjt=Zjt.hasOwnProperty;function Xjt(t){var e=this.__data__;return Kjt?e[t]!==void 0:Yjt.call(e,t)}var Qjt=Xjt,Jjt=Rse,ekt="__lodash_hash_undefined__";function tkt(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Jjt&&e===void 0?ekt:e,this}var rkt=tkt,nkt=zjt,skt=$jt,ikt=Gjt,akt=Qjt,okt=rkt;function ZC(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e-1}var kkt=jkt,Nkt=Fse;function Skt(t,e){var n=this.__data__,s=Nkt(n,t);return s<0?(++this.size,n.push([t,e])):n[s][1]=e,this}var Ckt=Skt,Mkt=dkt,Tkt=xkt,Akt=bkt,Ekt=kkt,Ikt=Ckt;function YC(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e0?1:-1},vw=function(e){return Mj(e)&&e.indexOf("%")===e.length-1},Pn=function(e){return QNt(e)&&!vI(e)},rSt=function(e){return pa(e)},Rc=function(e){return Pn(e)||Mj(e)},nSt=0,_I=function(e){var n=++nSt;return"".concat(e||"").concat(n)},ku=function(e,n){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Pn(e)&&!Mj(e))return s;var o;if(vw(e)){var c=e.indexOf("%");o=n*parseFloat(e.slice(0,c))/100}else o=+e;return vI(o)&&(o=s),i&&o>n&&(o=n),o},h0=function(e){if(!e)return null;var n=Object.keys(e);return n&&n.length?e[n[0]]:null},sSt=function(e){if(!Array.isArray(e))return!1;for(var n=e.length,s={},i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function uSt(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}var lSe={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},Oy=function(e){return typeof e=="string"?e:e?e.displayName||e.name||"Component":""},cSe=null,Tce=null,vxe=function t(e){if(e===cSe&&Array.isArray(Tce))return Tce;var n=[];return P.Children.forEach(e,function(s){pa(s)||(GNt.isFragment(s)?n=n.concat(t(s.props.children)):n.push(s))}),Tce=n,cSe=e,n};function Vf(t,e){var n=[],s=[];return Array.isArray(e)?s=e.map(function(i){return Oy(i)}):s=[Oy(e)],vxe(t).forEach(function(i){var o=Vh(i,"type.displayName")||Vh(i,"type.name");s.indexOf(o)!==-1&&n.push(i)}),n}function Eh(t,e){var n=Vf(t,e);return n&&n[0]}var dSe=function(e){if(!e||!e.props)return!1;var n=e.props,s=n.width,i=n.height;return!(!Pn(s)||s<=0||!Pn(i)||i<=0)},hSt=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],fSt=function(e){return e&&e.type&&Mj(e.type)&&hSt.indexOf(e.type)>=0},pSt=function(e,n,s,i){var o,c=(o=Mce==null?void 0:Mce[i])!==null&&o!==void 0?o:[];return n.startsWith("data-")||!Pi(e)&&(i&&c.includes(n)||oSt.includes(n))||s&&xxe.includes(n)},ki=function(e,n,s){if(!e||typeof e=="function"||typeof e=="boolean")return null;var i=e;if(P.isValidElement(e)&&(i=e.props),!KC(i))return null;var o={};return Object.keys(i).forEach(function(c){var a;pSt((a=i)===null||a===void 0?void 0:a[c],c,n,s)&&(o[c]=i[c])}),o},efe=function t(e,n){if(e===n)return!0;var s=P.Children.count(e);if(s!==P.Children.count(n))return!1;if(s===0)return!0;if(s===1)return uSe(Array.isArray(e)?e[0]:e,Array.isArray(n)?n[0]:n);for(var i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function vSt(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}function rfe(t){var e=t.children,n=t.width,s=t.height,i=t.viewBox,o=t.className,c=t.style,a=t.title,f=t.desc,m=xSt(t,ySt),y=i||{width:n,height:s,x:0,y:0},v=ta("recharts-surface",o);return lt.createElement("svg",tfe({},ki(m,!0,"svg"),{className:v,width:n,height:s,style:c,viewBox:"".concat(y.x," ").concat(y.y," ").concat(y.width," ").concat(y.height)}),lt.createElement("title",null,a),lt.createElement("desc",null,f),e)}var _St=["children","className"];function nfe(){return nfe=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function wSt(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}var vo=lt.forwardRef(function(t,e){var n=t.children,s=t.className,i=bSt(t,_St),o=ta("recharts-layer",s);return lt.createElement("g",nfe({className:o},ki(i,!0),{ref:e}),n)}),om=function(e,n){for(var s=arguments.length,i=new Array(s>2?s-2:0),o=2;oi?0:i+e),n=n>i?i:n,n<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var o=Array(i);++s=s?t:NSt(t,e,n)}var CSt=SSt,MSt="\\ud800-\\udfff",TSt="\\u0300-\\u036f",ASt="\\ufe20-\\ufe2f",ESt="\\u20d0-\\u20ff",ISt=TSt+ASt+ESt,PSt="\\ufe0e\\ufe0f",LSt="\\u200d",OSt=RegExp("["+LSt+MSt+ISt+PSt+"]");function DSt(t){return OSt.test(t)}var Cze=DSt;function RSt(t){return t.split("")}var FSt=RSt,Mze="\\ud800-\\udfff",zSt="\\u0300-\\u036f",BSt="\\ufe20-\\ufe2f",$St="\\u20d0-\\u20ff",USt=zSt+BSt+$St,qSt="\\ufe0e\\ufe0f",VSt="["+Mze+"]",sfe="["+USt+"]",ife="\\ud83c[\\udffb-\\udfff]",HSt="(?:"+sfe+"|"+ife+")",Tze="[^"+Mze+"]",Aze="(?:\\ud83c[\\udde6-\\uddff]){2}",Eze="[\\ud800-\\udbff][\\udc00-\\udfff]",WSt="\\u200d",Ize=HSt+"?",Pze="["+qSt+"]?",GSt="(?:"+WSt+"(?:"+[Tze,Aze,Eze].join("|")+")"+Pze+Ize+")*",KSt=Pze+Ize+GSt,ZSt="(?:"+[Tze+sfe+"?",sfe,Aze,Eze,VSt].join("|")+")",YSt=RegExp(ife+"(?="+ife+")|"+ZSt+KSt,"g");function XSt(t){return t.match(YSt)||[]}var QSt=XSt,JSt=FSt,e4t=Cze,t4t=QSt;function r4t(t){return e4t(t)?t4t(t):JSt(t)}var n4t=r4t,s4t=CSt,i4t=Cze,a4t=n4t,o4t=bze;function l4t(t){return function(e){e=o4t(e);var n=i4t(e)?a4t(e):void 0,s=n?n[0]:e.charAt(0),i=n?s4t(n,1).join(""):e.slice(1);return s[t]()+i}}var c4t=l4t,d4t=c4t,u4t=d4t("toUpperCase"),h4t=u4t;const Qse=Oa(h4t);function Vo(t){return function(){return t}}const Lze=Math.cos,are=Math.sin,ym=Math.sqrt,ore=Math.PI,Jse=2*ore,afe=Math.PI,ofe=2*afe,tw=1e-6,f4t=ofe-tw;function Oze(t){this._+=t[0];for(let e=1,n=t.length;e=0))throw new Error(`invalid digits: ${t}`);if(e>15)return Oze;const n=10**e;return function(s){this._+=s[0];for(let i=1,o=s.length;itw)if(!(Math.abs(v*f-m*y)>tw)||!o)this._append`L${this._x1=e},${this._y1=n}`;else{let k=s-c,C=i-a,S=f*f+m*m,T=k*k+C*C,I=Math.sqrt(S),A=Math.sqrt(w),D=o*Math.tan((afe-Math.acos((S+w-T)/(2*I*A)))/2),$=D/A,F=D/I;Math.abs($-1)>tw&&this._append`L${e+$*y},${n+$*v}`,this._append`A${o},${o},0,0,${+(v*k>y*C)},${this._x1=e+F*f},${this._y1=n+F*m}`}}arc(e,n,s,i,o,c){if(e=+e,n=+n,s=+s,c=!!c,s<0)throw new Error(`negative radius: ${s}`);let a=s*Math.cos(i),f=s*Math.sin(i),m=e+a,y=n+f,v=1^c,w=c?i-o:o-i;this._x1===null?this._append`M${m},${y}`:(Math.abs(this._x1-m)>tw||Math.abs(this._y1-y)>tw)&&this._append`L${m},${y}`,s&&(w<0&&(w=w%ofe+ofe),w>f4t?this._append`A${s},${s},0,1,${v},${e-a},${n-f}A${s},${s},0,1,${v},${this._x1=m},${this._y1=y}`:w>tw&&this._append`A${s},${s},0,${+(w>=afe)},${v},${this._x1=e+s*Math.cos(o)},${this._y1=n+s*Math.sin(o)}`)}rect(e,n,s,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${s=+s}v${+i}h${-s}Z`}toString(){return this._}}function _xe(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(n==null)e=null;else{const s=Math.floor(n);if(!(s>=0))throw new RangeError(`invalid digits: ${n}`);e=s}return t},()=>new m4t(e)}function bxe(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function Dze(t){this._context=t}Dze.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function eie(t){return new Dze(t)}function Rze(t){return t[0]}function Fze(t){return t[1]}function zze(t,e){var n=Vo(!0),s=null,i=eie,o=null,c=_xe(a);t=typeof t=="function"?t:t===void 0?Rze:Vo(t),e=typeof e=="function"?e:e===void 0?Fze:Vo(e);function a(f){var m,y=(f=bxe(f)).length,v,w=!1,k;for(s==null&&(o=i(k=c())),m=0;m<=y;++m)!(m=k;--C)a.point(D[C],$[C]);a.lineEnd(),a.areaEnd()}I&&(D[w]=+t(T,w,v),$[w]=+e(T,w,v),a.point(s?+s(T,w,v):D[w],n?+n(T,w,v):$[w]))}if(A)return a=null,A+""||null}function y(){return zze().defined(i).curve(c).context(o)}return m.x=function(v){return arguments.length?(t=typeof v=="function"?v:Vo(+v),s=null,m):t},m.x0=function(v){return arguments.length?(t=typeof v=="function"?v:Vo(+v),m):t},m.x1=function(v){return arguments.length?(s=v==null?null:typeof v=="function"?v:Vo(+v),m):s},m.y=function(v){return arguments.length?(e=typeof v=="function"?v:Vo(+v),n=null,m):e},m.y0=function(v){return arguments.length?(e=typeof v=="function"?v:Vo(+v),m):e},m.y1=function(v){return arguments.length?(n=v==null?null:typeof v=="function"?v:Vo(+v),m):n},m.lineX0=m.lineY0=function(){return y().x(t).y(e)},m.lineY1=function(){return y().x(t).y(n)},m.lineX1=function(){return y().x(s).y(e)},m.defined=function(v){return arguments.length?(i=typeof v=="function"?v:Vo(!!v),m):i},m.curve=function(v){return arguments.length?(c=v,o!=null&&(a=c(o)),m):c},m.context=function(v){return arguments.length?(v==null?o=a=null:a=c(o=v),m):o},m}class Bze{constructor(e,n){this._context=e,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,n){switch(e=+e,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,n,e,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,e,this._y0,e,n);break}}this._x0=e,this._y0=n}}function g4t(t){return new Bze(t,!0)}function y4t(t){return new Bze(t,!1)}const wxe={draw(t,e){const n=ym(e/ore);t.moveTo(n,0),t.arc(0,0,n,0,Jse)}},x4t={draw(t,e){const n=ym(e/5)/2;t.moveTo(-3*n,-n),t.lineTo(-n,-n),t.lineTo(-n,-3*n),t.lineTo(n,-3*n),t.lineTo(n,-n),t.lineTo(3*n,-n),t.lineTo(3*n,n),t.lineTo(n,n),t.lineTo(n,3*n),t.lineTo(-n,3*n),t.lineTo(-n,n),t.lineTo(-3*n,n),t.closePath()}},$ze=ym(1/3),v4t=$ze*2,_4t={draw(t,e){const n=ym(e/v4t),s=n*$ze;t.moveTo(0,-n),t.lineTo(s,0),t.lineTo(0,n),t.lineTo(-s,0),t.closePath()}},b4t={draw(t,e){const n=ym(e),s=-n/2;t.rect(s,s,n,n)}},w4t=.8908130915292852,Uze=are(ore/10)/are(7*ore/10),j4t=are(Jse/10)*Uze,k4t=-Lze(Jse/10)*Uze,N4t={draw(t,e){const n=ym(e*w4t),s=j4t*n,i=k4t*n;t.moveTo(0,-n),t.lineTo(s,i);for(let o=1;o<5;++o){const c=Jse*o/5,a=Lze(c),f=are(c);t.lineTo(f*n,-a*n),t.lineTo(a*s-f*i,f*s+a*i)}t.closePath()}},Ace=ym(3),S4t={draw(t,e){const n=-ym(e/(Ace*3));t.moveTo(0,n*2),t.lineTo(-Ace*n,-n),t.lineTo(Ace*n,-n),t.closePath()}},gf=-.5,yf=ym(3)/2,lfe=1/ym(12),C4t=(lfe/2+1)*3,M4t={draw(t,e){const n=ym(e/C4t),s=n/2,i=n*lfe,o=s,c=n*lfe+n,a=-o,f=c;t.moveTo(s,i),t.lineTo(o,c),t.lineTo(a,f),t.lineTo(gf*s-yf*i,yf*s+gf*i),t.lineTo(gf*o-yf*c,yf*o+gf*c),t.lineTo(gf*a-yf*f,yf*a+gf*f),t.lineTo(gf*s+yf*i,gf*i-yf*s),t.lineTo(gf*o+yf*c,gf*c-yf*o),t.lineTo(gf*a+yf*f,gf*f-yf*a),t.closePath()}};function T4t(t,e){let n=null,s=_xe(i);t=typeof t=="function"?t:Vo(t||wxe),e=typeof e=="function"?e:Vo(e===void 0?64:+e);function i(){let o;if(n||(n=o=s()),t.apply(this,arguments).draw(n,+e.apply(this,arguments)),o)return n=null,o+""||null}return i.type=function(o){return arguments.length?(t=typeof o=="function"?o:Vo(o),i):t},i.size=function(o){return arguments.length?(e=typeof o=="function"?o:Vo(+o),i):e},i.context=function(o){return arguments.length?(n=o??null,i):n},i}function lre(){}function cre(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function qze(t){this._context=t}qze.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:cre(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:cre(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function A4t(t){return new qze(t)}function Vze(t){this._context=t}Vze.prototype={areaStart:lre,areaEnd:lre,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:cre(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function E4t(t){return new Vze(t)}function Hze(t){this._context=t}Hze.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,s=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,s):this._context.moveTo(n,s);break;case 3:this._point=4;default:cre(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function I4t(t){return new Hze(t)}function Wze(t){this._context=t}Wze.prototype={areaStart:lre,areaEnd:lre,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function P4t(t){return new Wze(t)}function fSe(t){return t<0?-1:1}function pSe(t,e,n){var s=t._x1-t._x0,i=e-t._x1,o=(t._y1-t._y0)/(s||i<0&&-0),c=(n-t._y1)/(i||s<0&&-0),a=(o*i+c*s)/(s+i);return(fSe(o)+fSe(c))*Math.min(Math.abs(o),Math.abs(c),.5*Math.abs(a))||0}function mSe(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function Ece(t,e,n){var s=t._x0,i=t._y0,o=t._x1,c=t._y1,a=(o-s)/3;t._context.bezierCurveTo(s+a,i+a*e,o-a,c-a*n,o,c)}function dre(t){this._context=t}dre.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Ece(this,this._t0,mSe(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,Ece(this,mSe(this,n=pSe(this,t,e)),n);break;default:Ece(this,this._t0,n=pSe(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function Gze(t){this._context=new Kze(t)}(Gze.prototype=Object.create(dre.prototype)).point=function(t,e){dre.prototype.point.call(this,e,t)};function Kze(t){this._context=t}Kze.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,s,i,o){this._context.bezierCurveTo(e,t,s,n,o,i)}};function L4t(t){return new dre(t)}function O4t(t){return new Gze(t)}function Zze(t){this._context=t}Zze.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),n===2)this._context.lineTo(t[1],e[1]);else for(var s=gSe(t),i=gSe(e),o=0,c=1;c=0;--e)i[e]=(c[e]-i[e+1])/o[e];for(o[n-1]=(t[n]+i[n-1])/2,e=0;e=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}break}}this._x=t,this._y=e}};function R4t(t){return new tie(t,.5)}function F4t(t){return new tie(t,0)}function z4t(t){return new tie(t,1)}function eC(t,e){if((c=t.length)>1)for(var n=1,s,i,o=t[e[0]],c,a=o.length;n=0;)n[e]=e;return n}function B4t(t,e){return t[e]}function $4t(t){const e=[];return e.key=t,e}function U4t(){var t=Vo([]),e=cfe,n=eC,s=B4t;function i(o){var c=Array.from(t.apply(this,arguments),$4t),a,f=c.length,m=-1,y;for(const v of o)for(a=0,++m;a0){for(var n,s,i=0,o=t[0].length,c;i0){for(var n=0,s=t[e[0]],i,o=s.length;n0)||!((o=(i=t[e[0]]).length)>0))){for(var n=0,s=1,i,o,c;s=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function X4t(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}var Yze={symbolCircle:wxe,symbolCross:x4t,symbolDiamond:_4t,symbolSquare:b4t,symbolStar:N4t,symbolTriangle:S4t,symbolWye:M4t},Q4t=Math.PI/180,J4t=function(e){var n="symbol".concat(Qse(e));return Yze[n]||wxe},eCt=function(e,n,s){if(n==="area")return e;switch(s){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var i=18*Q4t;return 1.25*e*e*(Math.tan(i)-Math.tan(i*2)*Math.pow(Math.tan(i),2))}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},tCt=function(e,n){Yze["symbol".concat(Qse(e))]=n},jxe=function(e){var n=e.type,s=n===void 0?"circle":n,i=e.size,o=i===void 0?64:i,c=e.sizeType,a=c===void 0?"area":c,f=Y4t(e,W4t),m=xSe(xSe({},f),{},{type:s,size:o,sizeType:a}),y=function(){var T=J4t(s),I=T4t().type(T).size(eCt(o,a,s));return I()},v=m.className,w=m.cx,k=m.cy,C=ki(m,!0);return w===+w&&k===+k&&o===+o?lt.createElement("path",dfe({},C,{className:ta("recharts-symbols",v),transform:"translate(".concat(w,", ").concat(k,")"),d:y()})):null};jxe.registerSymbol=tCt;function tC(t){"@babel/helpers - typeof";return tC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},tC(t)}function ufe(){return ufe=Object.assign?Object.assign.bind():function(t){for(var e=1;e`);var A=k.inactive?m:k.color;return lt.createElement("li",ufe({className:T,style:v,key:"legend-item-".concat(C)},Tj(s.props,k,C)),lt.createElement(rfe,{width:c,height:c,viewBox:y,style:w},s.renderIcon(k)),lt.createElement("span",{className:"recharts-legend-item-text",style:{color:A}},S?S(I,k,C):I))})}},{key:"render",value:function(){var s=this.props,i=s.payload,o=s.layout,c=s.align;if(!i||!i.length)return null;var a={padding:0,margin:0,textAlign:o==="horizontal"?c:"left"};return lt.createElement("ul",{className:"recharts-default-legend",style:a},this.renderItems())}}])}(P.PureComponent);QA(kxe,"displayName","Legend");QA(kxe,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var uCt=zse;function hCt(){this.__data__=new uCt,this.size=0}var fCt=hCt;function pCt(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}var mCt=pCt;function gCt(t){return this.__data__.get(t)}var yCt=gCt;function xCt(t){return this.__data__.has(t)}var vCt=xCt,_Ct=zse,bCt=uxe,wCt=hxe,jCt=200;function kCt(t,e){var n=this.__data__;if(n instanceof _Ct){var s=n.__data__;if(!bCt||s.lengtha))return!1;var m=o.get(t),y=o.get(e);if(m&&y)return m==e&&y==t;var v=-1,w=!0,k=n&WCt?new UCt:void 0;for(o.set(t,e),o.set(e,t);++v-1&&t%1==0&&t-1&&t%1==0&&t<=Y3t}var Mxe=X3t,Q3t=Jy,J3t=Mxe,eMt=ex,tMt="[object Arguments]",rMt="[object Array]",nMt="[object Boolean]",sMt="[object Date]",iMt="[object Error]",aMt="[object Function]",oMt="[object Map]",lMt="[object Number]",cMt="[object Object]",dMt="[object RegExp]",uMt="[object Set]",hMt="[object String]",fMt="[object WeakMap]",pMt="[object ArrayBuffer]",mMt="[object DataView]",gMt="[object Float32Array]",yMt="[object Float64Array]",xMt="[object Int8Array]",vMt="[object Int16Array]",_Mt="[object Int32Array]",bMt="[object Uint8Array]",wMt="[object Uint8ClampedArray]",jMt="[object Uint16Array]",kMt="[object Uint32Array]",sl={};sl[gMt]=sl[yMt]=sl[xMt]=sl[vMt]=sl[_Mt]=sl[bMt]=sl[wMt]=sl[jMt]=sl[kMt]=!0;sl[tMt]=sl[rMt]=sl[pMt]=sl[nMt]=sl[mMt]=sl[sMt]=sl[iMt]=sl[aMt]=sl[oMt]=sl[lMt]=sl[cMt]=sl[dMt]=sl[uMt]=sl[hMt]=sl[fMt]=!1;function NMt(t){return eMt(t)&&J3t(t.length)&&!!sl[Q3t(t)]}var SMt=NMt;function CMt(t){return function(e){return t(e)}}var o7e=CMt,pre={exports:{}};pre.exports;(function(t,e){var n=mze,s=e&&!e.nodeType&&e,i=s&&!0&&t&&!t.nodeType&&t,o=i&&i.exports===s,c=o&&n.process,a=function(){try{var f=i&&i.require&&i.require("util").types;return f||c&&c.binding&&c.binding("util")}catch{}}();t.exports=a})(pre,pre.exports);var MMt=pre.exports,TMt=SMt,AMt=o7e,NSe=MMt,SSe=NSe&&NSe.isTypedArray,EMt=SSe?AMt(SSe):TMt,l7e=EMt,IMt=O3t,PMt=Sxe,LMt=yh,OMt=a7e,DMt=Cxe,RMt=l7e,FMt=Object.prototype,zMt=FMt.hasOwnProperty;function BMt(t,e){var n=LMt(t),s=!n&&PMt(t),i=!n&&!s&&OMt(t),o=!n&&!s&&!i&&RMt(t),c=n||s||i||o,a=c?IMt(t.length,String):[],f=a.length;for(var m in t)(e||zMt.call(t,m))&&!(c&&(m=="length"||i&&(m=="offset"||m=="parent")||o&&(m=="buffer"||m=="byteLength"||m=="byteOffset")||DMt(m,f)))&&a.push(m);return a}var $Mt=BMt,UMt=Object.prototype;function qMt(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||UMt;return t===n}var VMt=qMt;function HMt(t,e){return function(n){return t(e(n))}}var c7e=HMt,WMt=c7e,GMt=WMt(Object.keys,Object),KMt=GMt,ZMt=VMt,YMt=KMt,XMt=Object.prototype,QMt=XMt.hasOwnProperty;function JMt(t){if(!ZMt(t))return YMt(t);var e=[];for(var n in Object(t))QMt.call(t,n)&&n!="constructor"&&e.push(n);return e}var e5t=JMt,t5t=cxe,r5t=Mxe;function n5t(t){return t!=null&&r5t(t.length)&&!t5t(t)}var bI=n5t,s5t=$Mt,i5t=e5t,a5t=bI;function o5t(t){return a5t(t)?s5t(t):i5t(t)}var rie=o5t,l5t=j3t,c5t=P3t,d5t=rie;function u5t(t){return l5t(t,d5t,c5t)}var h5t=u5t,CSe=h5t,f5t=1,p5t=Object.prototype,m5t=p5t.hasOwnProperty;function g5t(t,e,n,s,i,o){var c=n&f5t,a=CSe(t),f=a.length,m=CSe(e),y=m.length;if(f!=y&&!c)return!1;for(var v=f;v--;){var w=a[v];if(!(c?w in e:m5t.call(e,w)))return!1}var k=o.get(t),C=o.get(e);if(k&&C)return k==e&&C==t;var S=!0;o.set(t,e),o.set(e,t);for(var T=c;++v-1}var pAt=fAt;function mAt(t,e,n){for(var s=-1,i=t==null?0:t.length;++s=AAt){var m=e?null:MAt(t);if(m)return TAt(m);c=!1,i=CAt,f=new kAt}else f=e?[]:a;e:for(;++s=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function WAt(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}function GAt(t){return t.value}function KAt(t,e){if(lt.isValidElement(t))return lt.cloneElement(t,e);if(typeof t=="function")return lt.createElement(t,e);e.ref;var n=HAt(e,RAt);return lt.createElement(kxe,n)}var qSe=1,u4=function(t){function e(){var n;FAt(this,e);for(var s=arguments.length,i=new Array(s),o=0;oqSe||Math.abs(i.height-this.lastBoundingBox.height)>qSe)&&(this.lastBoundingBox.width=i.width,this.lastBoundingBox.height=i.height,s&&s(i)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,s&&s(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?oy({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(s){var i=this.props,o=i.layout,c=i.align,a=i.verticalAlign,f=i.margin,m=i.chartWidth,y=i.chartHeight,v,w;if(!s||(s.left===void 0||s.left===null)&&(s.right===void 0||s.right===null))if(c==="center"&&o==="vertical"){var k=this.getBBoxSnapshot();v={left:((m||0)-k.width)/2}}else v=c==="right"?{right:f&&f.right||0}:{left:f&&f.left||0};if(!s||(s.top===void 0||s.top===null)&&(s.bottom===void 0||s.bottom===null))if(a==="middle"){var C=this.getBBoxSnapshot();w={top:((y||0)-C.height)/2}}else w=a==="bottom"?{bottom:f&&f.bottom||0}:{top:f&&f.top||0};return oy(oy({},v),w)}},{key:"render",value:function(){var s=this,i=this.props,o=i.content,c=i.width,a=i.height,f=i.wrapperStyle,m=i.payloadUniqBy,y=i.payload,v=oy(oy({position:"absolute",width:c||"auto",height:a||"auto"},this.getDefaultPosition(f)),f);return lt.createElement("div",{className:"recharts-legend-wrapper",style:v,ref:function(k){s.wrapperNode=k}},KAt(o,oy(oy({},this.props),{},{payload:g7e(y,m,GAt)})))}}],[{key:"getWithHeight",value:function(s,i){var o=oy(oy({},this.defaultProps),s.props),c=o.layout;return c==="vertical"&&Pn(s.props.height)?{height:s.props.height}:c==="horizontal"?{width:s.props.width||i}:null}}])}(P.PureComponent);nie(u4,"displayName","Legend");nie(u4,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var VSe=xI,ZAt=Sxe,YAt=yh,HSe=VSe?VSe.isConcatSpreadable:void 0;function XAt(t){return YAt(t)||ZAt(t)||!!(HSe&&t&&t[HSe])}var QAt=XAt,JAt=s7e,eEt=QAt;function v7e(t,e,n,s,i){var o=-1,c=t.length;for(n||(n=eEt),i||(i=[]);++o0&&n(a)?e>1?v7e(a,e-1,n,s,i):JAt(i,a):s||(i[i.length]=a)}return i}var _7e=v7e;function tEt(t){return function(e,n,s){for(var i=-1,o=Object(e),c=s(e),a=c.length;a--;){var f=c[t?a:++i];if(n(o[f],f,o)===!1)break}return e}}var rEt=tEt,nEt=rEt,sEt=nEt(),iEt=sEt,aEt=iEt,oEt=rie;function lEt(t,e){return t&&aEt(t,e,oEt)}var b7e=lEt,cEt=bI;function dEt(t,e){return function(n,s){if(n==null)return n;if(!cEt(n))return t(n,s);for(var i=n.length,o=e?i:-1,c=Object(n);(e?o--:++oe||o&&c&&f&&!a&&!m||s&&c&&f||!n&&f||!i)return 1;if(!s&&!o&&!m&&t=a)return f;var m=n[s];return f*(m=="desc"?-1:1)}}return t.index-e.index}var kEt=jEt,Oce=pxe,NEt=mxe,SEt=Ig,CEt=w7e,MEt=vEt,TEt=o7e,AEt=kEt,EEt=e3,IEt=yh;function PEt(t,e,n){e.length?e=Oce(e,function(o){return IEt(o)?function(c){return NEt(c,o.length===1?o[0]:o)}:o}):e=[EEt];var s=-1;e=Oce(e,TEt(SEt));var i=CEt(t,function(o,c,a){var f=Oce(e,function(m){return m(o)});return{criteria:f,index:++s,value:o}});return MEt(i,function(o,c){return AEt(o,c,n)})}var LEt=PEt;function OEt(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}var DEt=OEt,REt=DEt,GSe=Math.max;function FEt(t,e,n){return e=GSe(e===void 0?t.length-1:e,0),function(){for(var s=arguments,i=-1,o=GSe(s.length-e,0),c=Array(o);++i0){if(++e>=KEt)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var QEt=XEt,JEt=GEt,eIt=QEt,tIt=eIt(JEt),rIt=tIt,nIt=e3,sIt=zEt,iIt=rIt;function aIt(t,e){return iIt(sIt(t,e,nIt),t+"")}var oIt=aIt,lIt=dxe,cIt=bI,dIt=Cxe,uIt=R1;function hIt(t,e,n){if(!uIt(n))return!1;var s=typeof e;return(s=="number"?cIt(n)&&dIt(e,n.length):s=="string"&&e in n)?lIt(n[e],t):!1}var sie=hIt,fIt=_7e,pIt=LEt,mIt=oIt,ZSe=sie,gIt=mIt(function(t,e){if(t==null)return[];var n=e.length;return n>1&&ZSe(t,e[0],e[1])?e=[]:n>2&&ZSe(e[0],e[1],e[2])&&(e=[e[0]]),pIt(t,fIt(e,1),[])}),yIt=gIt;const Exe=Oa(yIt);function JA(t){"@babel/helpers - typeof";return JA=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},JA(t)}function vfe(){return vfe=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,s=new Array(e);n=e.x),"".concat(w5,"-left"),Pn(n)&&e&&Pn(e.x)&&n=e.y),"".concat(w5,"-top"),Pn(s)&&e&&Pn(e.y)&&sS?Math.max(y,f[s]):Math.max(v,f[s])}function IIt(t){var e=t.translateX,n=t.translateY,s=t.useTranslate3d;return{transform:s?"translate3d(".concat(e,"px, ").concat(n,"px, 0)"):"translate(".concat(e,"px, ").concat(n,"px)")}}function PIt(t){var e=t.allowEscapeViewBox,n=t.coordinate,s=t.offsetTopLeft,i=t.position,o=t.reverseDirection,c=t.tooltipBox,a=t.useTranslate3d,f=t.viewBox,m,y,v;return c.height>0&&c.width>0&&n?(y=QSe({allowEscapeViewBox:e,coordinate:n,key:"x",offsetTopLeft:s,position:i,reverseDirection:o,tooltipDimension:c.width,viewBox:f,viewBoxDimension:f.width}),v=QSe({allowEscapeViewBox:e,coordinate:n,key:"y",offsetTopLeft:s,position:i,reverseDirection:o,tooltipDimension:c.height,viewBox:f,viewBoxDimension:f.height}),m=IIt({translateX:y,translateY:v,useTranslate3d:a})):m=AIt,{cssProperties:m,cssClasses:EIt({translateX:y,translateY:v,coordinate:n})}}function nC(t){"@babel/helpers - typeof";return nC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},nC(t)}function JSe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,s)}return n}function e4e(t){for(var e=1;et4e||Math.abs(s.height-this.state.lastBoundingBox.height)>t4e)&&this.setState({lastBoundingBox:{width:s.width,height:s.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var s,i;this.props.active&&this.updateBBox(),this.state.dismissed&&(((s=this.props.coordinate)===null||s===void 0?void 0:s.x)!==this.state.dismissedAtCoordinate.x||((i=this.props.coordinate)===null||i===void 0?void 0:i.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var s=this,i=this.props,o=i.active,c=i.allowEscapeViewBox,a=i.animationDuration,f=i.animationEasing,m=i.children,y=i.coordinate,v=i.hasPayload,w=i.isAnimationActive,k=i.offset,C=i.position,S=i.reverseDirection,T=i.useTranslate3d,I=i.viewBox,A=i.wrapperStyle,D=PIt({allowEscapeViewBox:c,coordinate:y,offsetTopLeft:k,position:C,reverseDirection:S,tooltipBox:this.state.lastBoundingBox,useTranslate3d:T,viewBox:I}),$=D.cssClasses,F=D.cssProperties,q=e4e(e4e({transition:w&&o?"transform ".concat(a,"ms ").concat(f):void 0},F),{},{pointerEvents:"none",visibility:!this.state.dismissed&&o&&v?"visible":"hidden",position:"absolute",top:0,left:0},A);return lt.createElement("div",{tabIndex:-1,className:$,style:q,ref:function(K){s.wrapperNode=K}},m)}}])}(P.PureComponent),qIt=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},t3={isSsr:qIt()};function sC(t){"@babel/helpers - typeof";return sC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},sC(t)}function r4e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,s)}return n}function n4e(t){for(var e=1;e0;return lt.createElement(UIt,{allowEscapeViewBox:c,animationDuration:a,animationEasing:f,isAnimationActive:w,active:o,coordinate:y,hasPayload:q,offset:k,position:T,reverseDirection:I,useTranslate3d:A,viewBox:D,wrapperStyle:$},JIt(m,n4e(n4e({},this.props),{},{payload:F})))}}])}(P.PureComponent);Ixe(Up,"displayName","Tooltip");Ixe(Up,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!t3.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var ePt=Eg,tPt=function(){return ePt.Date.now()},rPt=tPt,nPt=/\s/;function sPt(t){for(var e=t.length;e--&&nPt.test(t.charAt(e)););return e}var iPt=sPt,aPt=iPt,oPt=/^\s+/;function lPt(t){return t&&t.slice(0,aPt(t)+1).replace(oPt,"")}var cPt=lPt,dPt=cPt,s4e=R1,uPt=GC,i4e=NaN,hPt=/^[-+]0x[0-9a-f]+$/i,fPt=/^0b[01]+$/i,pPt=/^0o[0-7]+$/i,mPt=parseInt;function gPt(t){if(typeof t=="number")return t;if(uPt(t))return i4e;if(s4e(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=s4e(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=dPt(t);var n=fPt.test(t);return n||pPt.test(t)?mPt(t.slice(2),n?2:8):hPt.test(t)?i4e:+t}var M7e=gPt,yPt=R1,Rce=rPt,a4e=M7e,xPt="Expected a function",vPt=Math.max,_Pt=Math.min;function bPt(t,e,n){var s,i,o,c,a,f,m=0,y=!1,v=!1,w=!0;if(typeof t!="function")throw new TypeError(xPt);e=a4e(e)||0,yPt(n)&&(y=!!n.leading,v="maxWait"in n,o=v?vPt(a4e(n.maxWait)||0,e):o,w="trailing"in n?!!n.trailing:w);function k(q){var W=s,K=i;return s=i=void 0,m=q,c=t.apply(K,W),c}function C(q){return m=q,a=setTimeout(I,e),y?k(q):c}function S(q){var W=q-f,K=q-m,Z=e-W;return v?_Pt(Z,o-K):Z}function T(q){var W=q-f,K=q-m;return f===void 0||W>=e||W<0||v&&K>=o}function I(){var q=Rce();if(T(q))return A(q);a=setTimeout(I,S(q))}function A(q){return a=void 0,w&&s?k(q):(s=i=void 0,c)}function D(){a!==void 0&&clearTimeout(a),m=0,s=f=i=a=void 0}function $(){return a===void 0?c:A(Rce())}function F(){var q=Rce(),W=T(q);if(s=arguments,i=this,f=q,W){if(a===void 0)return C(f);if(v)return clearTimeout(a),a=setTimeout(I,e),k(f)}return a===void 0&&(a=setTimeout(I,e)),c}return F.cancel=D,F.flush=$,F}var wPt=bPt,jPt=wPt,kPt=R1,NPt="Expected a function";function SPt(t,e,n){var s=!0,i=!0;if(typeof t!="function")throw new TypeError(NPt);return kPt(n)&&(s="leading"in n?!!n.leading:s,i="trailing"in n?!!n.trailing:i),jPt(t,e,{leading:s,maxWait:e,trailing:i})}var CPt=SPt;const T7e=Oa(CPt);function tE(t){"@babel/helpers - typeof";return tE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},tE(t)}function o4e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,s)}return n}function kL(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,s=new Array(e);n0&&(Ne=T7e(Ne,S,{trailing:!0,leading:!1}));var se=new ResizeObserver(Ne),xe=F.current.getBoundingClientRect(),ie=xe.width,me=xe.height;return he(ie,me),se.observe(F.current),function(){se.disconnect()}},[he,S]);var ue=P.useMemo(function(){var Ne=Z.containerWidth,se=Z.containerHeight;if(Ne<0||se<0)return null;om(vw(c)||vw(f),`The width(%s) and height(%s) are both fixed numbers, maybe you don't need to use a ResponsiveContainer.`,c,f),om(!n||n>0,"The aspect(%s) must be greater than zero.",n);var xe=vw(c)?Ne:c,ie=vw(f)?se:f;n&&n>0&&(xe?ie=xe/n:ie&&(xe=ie*n),w&&ie>w&&(ie=w)),om(xe>0||ie>0,`The width(%s) and height(%s) of chart should be greater than 0, please check the style of container, or the props width(%s) and height(%s), or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the height and width.`,xe,ie,c,f,y,v,n);var me=!Array.isArray(k)&&Oy(k.type).endsWith("Chart");return lt.Children.map(k,function(fe){return lt.isValidElement(fe)?P.cloneElement(fe,kL({width:xe,height:ie},me?{style:kL({height:"100%",width:"100%",maxHeight:ie,maxWidth:xe},fe.props.style)}:{})):fe})},[n,k,f,w,v,y,Z,c]);return lt.createElement("div",{id:T?"".concat(T):void 0,className:ta("recharts-responsive-container",I),style:kL(kL({},$),{},{width:c,height:f,minWidth:y,minHeight:v,maxHeight:w}),ref:F},ue)}),iie=function(e){return null};iie.displayName="Cell";function rE(t){"@babel/helpers - typeof";return rE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},rE(t)}function c4e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,s)}return n}function kfe(t){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||t3.isSsr)return{width:0,height:0};var s=$Pt(n),i=JSON.stringify({text:e,copyStyle:s});if(VN.widthCache[i])return VN.widthCache[i];try{var o=document.getElementById(d4e);o||(o=document.createElement("span"),o.setAttribute("id",d4e),o.setAttribute("aria-hidden","true"),document.body.appendChild(o));var c=kfe(kfe({},BPt),s);Object.assign(o.style,c),o.textContent="".concat(e);var a=o.getBoundingClientRect(),f={width:a.width,height:a.height};return VN.widthCache[i]=f,++VN.cacheCount>zPt&&(VN.cacheCount=0,VN.widthCache={}),f}catch{return{width:0,height:0}}},UPt=function(e){return{top:e.top+window.scrollY-document.documentElement.clientTop,left:e.left+window.scrollX-document.documentElement.clientLeft}};function nE(t){"@babel/helpers - typeof";return nE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},nE(t)}function xre(t,e){return WPt(t)||HPt(t,e)||VPt(t,e)||qPt()}function qPt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function VPt(t,e){if(t){if(typeof t=="string")return u4e(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u4e(t,e)}}function u4e(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,s=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function a6t(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}function y4e(t,e){return d6t(t)||c6t(t,e)||l6t(t,e)||o6t()}function o6t(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function l6t(t,e){if(t){if(typeof t=="string")return x4e(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return x4e(t,e)}}function x4e(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,s=new Array(e);n0&&arguments[0]!==void 0?arguments[0]:[];return xe.reduce(function(ie,me){var fe=me.word,ve=me.width,Ie=ie[ie.length-1];if(Ie&&(i==null||o||Ie.width+ve+sme.width?ie:me})};if(!y)return k;for(var S="…",T=function(xe){var ie=v.slice(0,xe),me=P7e({breakAll:m,style:f,children:ie+S}).wordsWithComputedWidth,fe=w(me),ve=fe.length>c||C(fe).width>Number(i);return[ve,fe]},I=0,A=v.length-1,D=0,$;I<=A&&D<=v.length-1;){var F=Math.floor((I+A)/2),q=F-1,W=T(q),K=y4e(W,2),Z=K[0],re=K[1],he=T(F),ue=y4e(he,1),Ne=ue[0];if(!Z&&!Ne&&(I=F+1),Z&&Ne&&(A=F-1),!Z&&Ne){$=re;break}D++}return $||k},v4e=function(e){var n=pa(e)?[]:e.toString().split(I7e);return[{words:n}]},h6t=function(e){var n=e.width,s=e.scaleToFit,i=e.children,o=e.style,c=e.breakAll,a=e.maxLines;if((n||s)&&!t3.isSsr){var f,m,y=P7e({breakAll:c,children:i,style:o});if(y){var v=y.wordsWithComputedWidth,w=y.spaceWidth;f=v,m=w}else return v4e(i);return u6t({breakAll:c,children:i,maxLines:a,style:o},f,m,n,s)}return v4e(i)},_4e="#808080",Aj=function(e){var n=e.x,s=n===void 0?0:n,i=e.y,o=i===void 0?0:i,c=e.lineHeight,a=c===void 0?"1em":c,f=e.capHeight,m=f===void 0?"0.71em":f,y=e.scaleToFit,v=y===void 0?!1:y,w=e.textAnchor,k=w===void 0?"start":w,C=e.verticalAnchor,S=C===void 0?"end":C,T=e.fill,I=T===void 0?_4e:T,A=g4e(e,s6t),D=P.useMemo(function(){return h6t({breakAll:A.breakAll,children:A.children,maxLines:A.maxLines,scaleToFit:v,style:A.style,width:A.width})},[A.breakAll,A.children,A.maxLines,v,A.style,A.width]),$=A.dx,F=A.dy,q=A.angle,W=A.className,K=A.breakAll,Z=g4e(A,i6t);if(!Rc(s)||!Rc(o))return null;var re=s+(Pn($)?$:0),he=o+(Pn(F)?F:0),ue;switch(S){case"start":ue=Fce("calc(".concat(m,")"));break;case"middle":ue=Fce("calc(".concat((D.length-1)/2," * -").concat(a," + (").concat(m," / 2))"));break;default:ue=Fce("calc(".concat(D.length-1," * -").concat(a,")"));break}var Ne=[];if(v){var se=D[0].width,xe=A.width;Ne.push("scale(".concat((Pn(xe)?xe/se:1)/se,")"))}return q&&Ne.push("rotate(".concat(q,", ").concat(re,", ").concat(he,")")),Ne.length&&(Z.transform=Ne.join(" ")),lt.createElement("text",Nfe({},ki(Z,!0),{x:re,y:he,className:ta("recharts-text",W),textAnchor:k,fill:I.includes("url")?_4e:I}),D.map(function(ie,me){var fe=ie.words.join(K?"":" ");return lt.createElement("tspan",{x:re,dy:me===0?ue:a,key:"".concat(fe,"-").concat(me)},fe)}))};function c1(t,e){return t==null||e==null?NaN:te?1:t>=e?0:NaN}function f6t(t,e){return t==null||e==null?NaN:et?1:e>=t?0:NaN}function Pxe(t){let e,n,s;t.length!==2?(e=c1,n=(a,f)=>c1(t(a),f),s=(a,f)=>t(a)-f):(e=t===c1||t===f6t?t:p6t,n=t,s=t);function i(a,f,m=0,y=a.length){if(m>>1;n(a[v],f)<0?m=v+1:y=v}while(m>>1;n(a[v],f)<=0?m=v+1:y=v}while(mm&&s(a[v-1],f)>-s(a[v],f)?v-1:v}return{left:i,center:c,right:o}}function p6t(){return 0}function L7e(t){return t===null?NaN:+t}function*m6t(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const g6t=Pxe(c1),wI=g6t.right;Pxe(L7e).center;class b4e extends Map{constructor(e,n=v6t){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),e!=null)for(const[s,i]of e)this.set(s,i)}get(e){return super.get(w4e(this,e))}has(e){return super.has(w4e(this,e))}set(e,n){return super.set(y6t(this,e),n)}delete(e){return super.delete(x6t(this,e))}}function w4e({_intern:t,_key:e},n){const s=e(n);return t.has(s)?t.get(s):n}function y6t({_intern:t,_key:e},n){const s=e(n);return t.has(s)?t.get(s):(t.set(s,n),n)}function x6t({_intern:t,_key:e},n){const s=e(n);return t.has(s)&&(n=t.get(s),t.delete(s)),n}function v6t(t){return t!==null&&typeof t=="object"?t.valueOf():t}function _6t(t=c1){if(t===c1)return O7e;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,n)=>{const s=t(e,n);return s||s===0?s:(t(n,n)===0)-(t(e,e)===0)}}function O7e(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(te?1:0)}const b6t=Math.sqrt(50),w6t=Math.sqrt(10),j6t=Math.sqrt(2);function vre(t,e,n){const s=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(s)),o=s/Math.pow(10,i),c=o>=b6t?10:o>=w6t?5:o>=j6t?2:1;let a,f,m;return i<0?(m=Math.pow(10,-i)/c,a=Math.round(t*m),f=Math.round(e*m),a/me&&--f,m=-m):(m=Math.pow(10,i)*c,a=Math.round(t/m),f=Math.round(e/m),a*me&&--f),f0))return[];if(t===e)return[t];const s=e=i))return[];const a=o-i+1,f=new Array(a);if(s)if(c<0)for(let m=0;m=s)&&(n=s);return n}function k4e(t,e){let n;for(const s of t)s!=null&&(n>s||n===void 0&&s>=s)&&(n=s);return n}function D7e(t,e,n=0,s=1/0,i){if(e=Math.floor(e),n=Math.floor(Math.max(0,n)),s=Math.floor(Math.min(t.length-1,s)),!(n<=e&&e<=s))return t;for(i=i===void 0?O7e:_6t(i);s>n;){if(s-n>600){const f=s-n+1,m=e-n+1,y=Math.log(f),v=.5*Math.exp(2*y/3),w=.5*Math.sqrt(y*v*(f-v)/f)*(m-f/2<0?-1:1),k=Math.max(n,Math.floor(e-m*v/f+w)),C=Math.min(s,Math.floor(e+(f-m)*v/f+w));D7e(t,e,k,C,i)}const o=t[e];let c=n,a=s;for(j5(t,n,e),i(t[s],o)>0&&j5(t,n,s);c0;)--a}i(t[n],o)===0?j5(t,n,a):(++a,j5(t,a,s)),a<=e&&(n=a+1),e<=a&&(s=a-1)}return t}function j5(t,e,n){const s=t[e];t[e]=t[n],t[n]=s}function k6t(t,e,n){if(t=Float64Array.from(m6t(t)),!(!(s=t.length)||isNaN(e=+e))){if(e<=0||s<2)return k4e(t);if(e>=1)return j4e(t);var s,i=(s-1)*e,o=Math.floor(i),c=j4e(D7e(t,o).subarray(0,o+1)),a=k4e(t.subarray(o+1));return c+(a-c)*(i-o)}}function N6t(t,e,n=L7e){if(!(!(s=t.length)||isNaN(e=+e))){if(e<=0||s<2)return+n(t[0],0,t);if(e>=1)return+n(t[s-1],s-1,t);var s,i=(s-1)*e,o=Math.floor(i),c=+n(t[o],o,t),a=+n(t[o+1],o+1,t);return c+(a-c)*(i-o)}}function S6t(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var s=-1,i=Math.max(0,Math.ceil((e-t)/n))|0,o=new Array(i);++s>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?SL(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?SL(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=M6t.exec(t))?new ah(e[1],e[2],e[3],1):(e=T6t.exec(t))?new ah(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=A6t.exec(t))?SL(e[1],e[2],e[3],e[4]):(e=E6t.exec(t))?SL(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=I6t.exec(t))?E4e(e[1],e[2]/100,e[3]/100,1):(e=P6t.exec(t))?E4e(e[1],e[2]/100,e[3]/100,e[4]):N4e.hasOwnProperty(t)?M4e(N4e[t]):t==="transparent"?new ah(NaN,NaN,NaN,0):null}function M4e(t){return new ah(t>>16&255,t>>8&255,t&255,1)}function SL(t,e,n,s){return s<=0&&(t=e=n=NaN),new ah(t,e,n,s)}function D6t(t){return t instanceof jI||(t=oE(t)),t?(t=t.rgb(),new ah(t.r,t.g,t.b,t.opacity)):new ah}function Afe(t,e,n,s){return arguments.length===1?D6t(t):new ah(t,e,n,s??1)}function ah(t,e,n,s){this.r=+t,this.g=+e,this.b=+n,this.opacity=+s}Oxe(ah,Afe,F7e(jI,{brighter(t){return t=t==null?_re:Math.pow(_re,t),new ah(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?iE:Math.pow(iE,t),new ah(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new ah(tj(this.r),tj(this.g),tj(this.b),bre(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:T4e,formatHex:T4e,formatHex8:R6t,formatRgb:A4e,toString:A4e}));function T4e(){return`#${_w(this.r)}${_w(this.g)}${_w(this.b)}`}function R6t(){return`#${_w(this.r)}${_w(this.g)}${_w(this.b)}${_w((isNaN(this.opacity)?1:this.opacity)*255)}`}function A4e(){const t=bre(this.opacity);return`${t===1?"rgb(":"rgba("}${tj(this.r)}, ${tj(this.g)}, ${tj(this.b)}${t===1?")":`, ${t})`}`}function bre(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function tj(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function _w(t){return t=tj(t),(t<16?"0":"")+t.toString(16)}function E4e(t,e,n,s){return s<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Kp(t,e,n,s)}function z7e(t){if(t instanceof Kp)return new Kp(t.h,t.s,t.l,t.opacity);if(t instanceof jI||(t=oE(t)),!t)return new Kp;if(t instanceof Kp)return t;t=t.rgb();var e=t.r/255,n=t.g/255,s=t.b/255,i=Math.min(e,n,s),o=Math.max(e,n,s),c=NaN,a=o-i,f=(o+i)/2;return a?(e===o?c=(n-s)/a+(n0&&f<1?0:c,new Kp(c,a,f,t.opacity)}function F6t(t,e,n,s){return arguments.length===1?z7e(t):new Kp(t,e,n,s??1)}function Kp(t,e,n,s){this.h=+t,this.s=+e,this.l=+n,this.opacity=+s}Oxe(Kp,F6t,F7e(jI,{brighter(t){return t=t==null?_re:Math.pow(_re,t),new Kp(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?iE:Math.pow(iE,t),new Kp(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,s=n+(n<.5?n:1-n)*e,i=2*n-s;return new ah(zce(t>=240?t-240:t+120,i,s),zce(t,i,s),zce(t<120?t+240:t-120,i,s),this.opacity)},clamp(){return new Kp(I4e(this.h),CL(this.s),CL(this.l),bre(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=bre(this.opacity);return`${t===1?"hsl(":"hsla("}${I4e(this.h)}, ${CL(this.s)*100}%, ${CL(this.l)*100}%${t===1?")":`, ${t})`}`}}));function I4e(t){return t=(t||0)%360,t<0?t+360:t}function CL(t){return Math.max(0,Math.min(1,t||0))}function zce(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const Dxe=t=>()=>t;function z6t(t,e){return function(n){return t+n*e}}function B6t(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(s){return Math.pow(t+s*e,n)}}function $6t(t){return(t=+t)==1?B7e:function(e,n){return n-e?B6t(e,n,t):Dxe(isNaN(e)?n:e)}}function B7e(t,e){var n=e-t;return n?z6t(t,n):Dxe(isNaN(t)?e:t)}const P4e=function t(e){var n=$6t(e);function s(i,o){var c=n((i=Afe(i)).r,(o=Afe(o)).r),a=n(i.g,o.g),f=n(i.b,o.b),m=B7e(i.opacity,o.opacity);return function(y){return i.r=c(y),i.g=a(y),i.b=f(y),i.opacity=m(y),i+""}}return s.gamma=t,s}(1);function U6t(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,s=e.slice(),i;return function(o){for(i=0;in&&(o=e.slice(n,o),a[c]?a[c]+=o:a[++c]=o),(s=s[0])===(i=i[0])?a[c]?a[c]+=i:a[++c]=i:(a[++c]=null,f.push({i:c,x:wre(s,i)})),n=Bce.lastIndex;return ne&&(n=t,t=e,e=n),function(s){return Math.max(t,Math.min(e,s))}}function J6t(t,e,n){var s=t[0],i=t[1],o=e[0],c=e[1];return i2?eLt:J6t,f=m=null,v}function v(w){return w==null||isNaN(w=+w)?o:(f||(f=a(t.map(s),e,n)))(s(c(w)))}return v.invert=function(w){return c(i((m||(m=a(e,t.map(s),wre)))(w)))},v.domain=function(w){return arguments.length?(t=Array.from(w,jre),y()):t.slice()},v.range=function(w){return arguments.length?(e=Array.from(w),y()):e.slice()},v.rangeRound=function(w){return e=Array.from(w),n=Rxe,y()},v.clamp=function(w){return arguments.length?(c=w?!0:Nu,y()):c!==Nu},v.interpolate=function(w){return arguments.length?(n=w,y()):n},v.unknown=function(w){return arguments.length?(o=w,v):o},function(w,k){return s=w,i=k,y()}}function Fxe(){return aie()(Nu,Nu)}function tLt(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function kre(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,s=t.slice(0,n);return[s.length>1?s[0]+s.slice(2):s,+t.slice(n+1)]}function iC(t){return t=kre(Math.abs(t)),t?t[1]:NaN}function rLt(t,e){return function(n,s){for(var i=n.length,o=[],c=0,a=t[0],f=0;i>0&&a>0&&(f+a+1>s&&(a=Math.max(1,s-f)),o.push(n.substring(i-=a,i+a)),!((f+=a+1)>s));)a=t[c=(c+1)%t.length];return o.reverse().join(e)}}function nLt(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var sLt=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function lE(t){if(!(e=sLt.exec(t)))throw new Error("invalid format: "+t);var e;return new zxe({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}lE.prototype=zxe.prototype;function zxe(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}zxe.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function iLt(t){e:for(var e=t.length,n=1,s=-1,i;n0&&(s=0);break}return s>0?t.slice(0,s)+t.slice(i+1):t}var $7e;function aLt(t,e){var n=kre(t,e);if(!n)return t+"";var s=n[0],i=n[1],o=i-($7e=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,c=s.length;return o===c?s:o>c?s+new Array(o-c+1).join("0"):o>0?s.slice(0,o)+"."+s.slice(o):"0."+new Array(1-o).join("0")+kre(t,Math.max(0,e+o-1))[0]}function O4e(t,e){var n=kre(t,e);if(!n)return t+"";var s=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+s:s.length>i+1?s.slice(0,i+1)+"."+s.slice(i+1):s+new Array(i-s.length+2).join("0")}const D4e={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:tLt,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>O4e(t*100,e),r:O4e,s:aLt,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function R4e(t){return t}var F4e=Array.prototype.map,z4e=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function oLt(t){var e=t.grouping===void 0||t.thousands===void 0?R4e:rLt(F4e.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",s=t.currency===void 0?"":t.currency[1]+"",i=t.decimal===void 0?".":t.decimal+"",o=t.numerals===void 0?R4e:nLt(F4e.call(t.numerals,String)),c=t.percent===void 0?"%":t.percent+"",a=t.minus===void 0?"−":t.minus+"",f=t.nan===void 0?"NaN":t.nan+"";function m(v){v=lE(v);var w=v.fill,k=v.align,C=v.sign,S=v.symbol,T=v.zero,I=v.width,A=v.comma,D=v.precision,$=v.trim,F=v.type;F==="n"?(A=!0,F="g"):D4e[F]||(D===void 0&&(D=12),$=!0,F="g"),(T||w==="0"&&k==="=")&&(T=!0,w="0",k="=");var q=S==="$"?n:S==="#"&&/[boxX]/.test(F)?"0"+F.toLowerCase():"",W=S==="$"?s:/[%p]/.test(F)?c:"",K=D4e[F],Z=/[defgprs%]/.test(F);D=D===void 0?6:/[gprs]/.test(F)?Math.max(1,Math.min(21,D)):Math.max(0,Math.min(20,D));function re(he){var ue=q,Ne=W,se,xe,ie;if(F==="c")Ne=K(he)+Ne,he="";else{he=+he;var me=he<0||1/he<0;if(he=isNaN(he)?f:K(Math.abs(he),D),$&&(he=iLt(he)),me&&+he==0&&C!=="+"&&(me=!1),ue=(me?C==="("?C:a:C==="-"||C==="("?"":C)+ue,Ne=(F==="s"?z4e[8+$7e/3]:"")+Ne+(me&&C==="("?")":""),Z){for(se=-1,xe=he.length;++seie||ie>57){Ne=(ie===46?i+he.slice(se+1):he.slice(se))+Ne,he=he.slice(0,se);break}}}A&&!T&&(he=e(he,1/0));var fe=ue.length+he.length+Ne.length,ve=fe>1)+ue+he+Ne+ve.slice(fe);break;default:he=ve+ue+he+Ne;break}return o(he)}return re.toString=function(){return v+""},re}function y(v,w){var k=m((v=lE(v),v.type="f",v)),C=Math.max(-8,Math.min(8,Math.floor(iC(w)/3)))*3,S=Math.pow(10,-C),T=z4e[8+C/3];return function(I){return k(S*I)+T}}return{format:m,formatPrefix:y}}var ML,Bxe,U7e;lLt({thousands:",",grouping:[3],currency:["$",""]});function lLt(t){return ML=oLt(t),Bxe=ML.format,U7e=ML.formatPrefix,ML}function cLt(t){return Math.max(0,-iC(Math.abs(t)))}function dLt(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(iC(e)/3)))*3-iC(Math.abs(t)))}function uLt(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,iC(e)-iC(t))+1}function q7e(t,e,n,s){var i=Mfe(t,e,n),o;switch(s=lE(s??",f"),s.type){case"s":{var c=Math.max(Math.abs(t),Math.abs(e));return s.precision==null&&!isNaN(o=dLt(i,c))&&(s.precision=o),U7e(s,c)}case"":case"e":case"g":case"p":case"r":{s.precision==null&&!isNaN(o=uLt(i,Math.max(Math.abs(t),Math.abs(e))))&&(s.precision=o-(s.type==="e"));break}case"f":case"%":{s.precision==null&&!isNaN(o=cLt(i))&&(s.precision=o-(s.type==="%")*2);break}}return Bxe(s)}function F1(t){var e=t.domain;return t.ticks=function(n){var s=e();return Sfe(s[0],s[s.length-1],n??10)},t.tickFormat=function(n,s){var i=e();return q7e(i[0],i[i.length-1],n??10,s)},t.nice=function(n){n==null&&(n=10);var s=e(),i=0,o=s.length-1,c=s[i],a=s[o],f,m,y=10;for(a0;){if(m=Cfe(c,a,n),m===f)return s[i]=c,s[o]=a,e(s);if(m>0)c=Math.floor(c/m)*m,a=Math.ceil(a/m)*m;else if(m<0)c=Math.ceil(c*m)/m,a=Math.floor(a*m)/m;else break;f=m}return t},t}function Nre(){var t=Fxe();return t.copy=function(){return kI(t,Nre())},Jf.apply(t,arguments),F1(t)}function V7e(t){var e;function n(s){return s==null||isNaN(s=+s)?e:s}return n.invert=n,n.domain=n.range=function(s){return arguments.length?(t=Array.from(s,jre),n):t.slice()},n.unknown=function(s){return arguments.length?(e=s,n):e},n.copy=function(){return V7e(t).unknown(e)},t=arguments.length?Array.from(t,jre):[0,1],F1(n)}function H7e(t,e){t=t.slice();var n=0,s=t.length-1,i=t[n],o=t[s],c;return oMath.pow(t,e)}function gLt(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function U4e(t){return(e,n)=>-t(-e,n)}function $xe(t){const e=t(B4e,$4e),n=e.domain;let s=10,i,o;function c(){return i=gLt(s),o=mLt(s),n()[0]<0?(i=U4e(i),o=U4e(o),t(hLt,fLt)):t(B4e,$4e),e}return e.base=function(a){return arguments.length?(s=+a,c()):s},e.domain=function(a){return arguments.length?(n(a),c()):n()},e.ticks=a=>{const f=n();let m=f[0],y=f[f.length-1];const v=y0){for(;w<=k;++w)for(C=1;Cy)break;I.push(S)}}else for(;w<=k;++w)for(C=s-1;C>=1;--C)if(S=w>0?C/o(-w):C*o(w),!(Sy)break;I.push(S)}I.length*2{if(a==null&&(a=10),f==null&&(f=s===10?"s":","),typeof f!="function"&&(!(s%1)&&(f=lE(f)).precision==null&&(f.trim=!0),f=Bxe(f)),a===1/0)return f;const m=Math.max(1,s*a/e.ticks().length);return y=>{let v=y/o(Math.round(i(y)));return v*sn(H7e(n(),{floor:a=>o(Math.floor(i(a))),ceil:a=>o(Math.ceil(i(a)))})),e}function W7e(){const t=$xe(aie()).domain([1,10]);return t.copy=()=>kI(t,W7e()).base(t.base()),Jf.apply(t,arguments),t}function q4e(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function V4e(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function Uxe(t){var e=1,n=t(q4e(e),V4e(e));return n.constant=function(s){return arguments.length?t(q4e(e=+s),V4e(e)):e},F1(n)}function G7e(){var t=Uxe(aie());return t.copy=function(){return kI(t,G7e()).constant(t.constant())},Jf.apply(t,arguments)}function H4e(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function yLt(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function xLt(t){return t<0?-t*t:t*t}function qxe(t){var e=t(Nu,Nu),n=1;function s(){return n===1?t(Nu,Nu):n===.5?t(yLt,xLt):t(H4e(n),H4e(1/n))}return e.exponent=function(i){return arguments.length?(n=+i,s()):n},F1(e)}function Vxe(){var t=qxe(aie());return t.copy=function(){return kI(t,Vxe()).exponent(t.exponent())},Jf.apply(t,arguments),t}function vLt(){return Vxe.apply(null,arguments).exponent(.5)}function W4e(t){return Math.sign(t)*t*t}function _Lt(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function K7e(){var t=Fxe(),e=[0,1],n=!1,s;function i(o){var c=_Lt(t(o));return isNaN(c)?s:n?Math.round(c):c}return i.invert=function(o){return t.invert(W4e(o))},i.domain=function(o){return arguments.length?(t.domain(o),i):t.domain()},i.range=function(o){return arguments.length?(t.range((e=Array.from(o,jre)).map(W4e)),i):e.slice()},i.rangeRound=function(o){return i.range(o).round(!0)},i.round=function(o){return arguments.length?(n=!!o,i):n},i.clamp=function(o){return arguments.length?(t.clamp(o),i):t.clamp()},i.unknown=function(o){return arguments.length?(s=o,i):s},i.copy=function(){return K7e(t.domain(),e).round(n).clamp(t.clamp()).unknown(s)},Jf.apply(i,arguments),F1(i)}function Z7e(){var t=[],e=[],n=[],s;function i(){var c=0,a=Math.max(1,e.length);for(n=new Array(a-1);++c0?n[a-1]:t[0],a=n?[s[n-1],e]:[s[m-1],s[m]]},c.unknown=function(f){return arguments.length&&(o=f),c},c.thresholds=function(){return s.slice()},c.copy=function(){return Y7e().domain([t,e]).range(i).unknown(o)},Jf.apply(F1(c),arguments)}function X7e(){var t=[.5],e=[0,1],n,s=1;function i(o){return o!=null&&o<=o?e[wI(t,o,0,s)]:n}return i.domain=function(o){return arguments.length?(t=Array.from(o),s=Math.min(t.length,e.length-1),i):t.slice()},i.range=function(o){return arguments.length?(e=Array.from(o),s=Math.min(t.length,e.length-1),i):e.slice()},i.invertExtent=function(o){var c=e.indexOf(o);return[t[c-1],t[c]]},i.unknown=function(o){return arguments.length?(n=o,i):n},i.copy=function(){return X7e().domain(t).range(e).unknown(n)},Jf.apply(i,arguments)}const $ce=new Date,Uce=new Date;function Bc(t,e,n,s){function i(o){return t(o=arguments.length===0?new Date:new Date(+o)),o}return i.floor=o=>(t(o=new Date(+o)),o),i.ceil=o=>(t(o=new Date(o-1)),e(o,1),t(o),o),i.round=o=>{const c=i(o),a=i.ceil(o);return o-c(e(o=new Date(+o),c==null?1:Math.floor(c)),o),i.range=(o,c,a)=>{const f=[];if(o=i.ceil(o),a=a==null?1:Math.floor(a),!(o0))return f;let m;do f.push(m=new Date(+o)),e(o,a),t(o);while(mBc(c=>{if(c>=c)for(;t(c),!o(c);)c.setTime(c-1)},(c,a)=>{if(c>=c)if(a<0)for(;++a<=0;)for(;e(c,-1),!o(c););else for(;--a>=0;)for(;e(c,1),!o(c););}),n&&(i.count=(o,c)=>($ce.setTime(+o),Uce.setTime(+c),t($ce),t(Uce),Math.floor(n($ce,Uce))),i.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?i.filter(s?c=>s(c)%o===0:c=>i.count(0,c)%o===0):i)),i}const Sre=Bc(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Sre.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?Bc(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):Sre);Sre.range;const ky=1e3,If=ky*60,Ny=If*60,Wy=Ny*24,Hxe=Wy*7,G4e=Wy*30,qce=Wy*365,bw=Bc(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*ky)},(t,e)=>(e-t)/ky,t=>t.getUTCSeconds());bw.range;const Wxe=Bc(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*ky)},(t,e)=>{t.setTime(+t+e*If)},(t,e)=>(e-t)/If,t=>t.getMinutes());Wxe.range;const Gxe=Bc(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*If)},(t,e)=>(e-t)/If,t=>t.getUTCMinutes());Gxe.range;const Kxe=Bc(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*ky-t.getMinutes()*If)},(t,e)=>{t.setTime(+t+e*Ny)},(t,e)=>(e-t)/Ny,t=>t.getHours());Kxe.range;const Zxe=Bc(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*Ny)},(t,e)=>(e-t)/Ny,t=>t.getUTCHours());Zxe.range;const NI=Bc(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*If)/Wy,t=>t.getDate()-1);NI.range;const oie=Bc(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Wy,t=>t.getUTCDate()-1);oie.range;const Q7e=Bc(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Wy,t=>Math.floor(t/Wy));Q7e.range;function Uj(t){return Bc(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*If)/Hxe)}const lie=Uj(0),Cre=Uj(1),bLt=Uj(2),wLt=Uj(3),aC=Uj(4),jLt=Uj(5),kLt=Uj(6);lie.range;Cre.range;bLt.range;wLt.range;aC.range;jLt.range;kLt.range;function qj(t){return Bc(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/Hxe)}const cie=qj(0),Mre=qj(1),NLt=qj(2),SLt=qj(3),oC=qj(4),CLt=qj(5),MLt=qj(6);cie.range;Mre.range;NLt.range;SLt.range;oC.range;CLt.range;MLt.range;const Yxe=Bc(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());Yxe.range;const Xxe=Bc(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());Xxe.range;const Gy=Bc(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());Gy.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:Bc(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});Gy.range;const Ky=Bc(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());Ky.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:Bc(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});Ky.range;function J7e(t,e,n,s,i,o){const c=[[bw,1,ky],[bw,5,5*ky],[bw,15,15*ky],[bw,30,30*ky],[o,1,If],[o,5,5*If],[o,15,15*If],[o,30,30*If],[i,1,Ny],[i,3,3*Ny],[i,6,6*Ny],[i,12,12*Ny],[s,1,Wy],[s,2,2*Wy],[n,1,Hxe],[e,1,G4e],[e,3,3*G4e],[t,1,qce]];function a(m,y,v){const w=yT).right(c,w);if(k===c.length)return t.every(Mfe(m/qce,y/qce,v));if(k===0)return Sre.every(Math.max(Mfe(m,y,v),1));const[C,S]=c[w/c[k-1][2]53)return null;"w"in Te||(Te.w=1),"Z"in Te?(ge=Hce(k5(Te.y,0,1)),mt=ge.getUTCDay(),ge=mt>4||mt===0?Mre.ceil(ge):Mre(ge),ge=oie.offset(ge,(Te.V-1)*7),Te.y=ge.getUTCFullYear(),Te.m=ge.getUTCMonth(),Te.d=ge.getUTCDate()+(Te.w+6)%7):(ge=Vce(k5(Te.y,0,1)),mt=ge.getDay(),ge=mt>4||mt===0?Cre.ceil(ge):Cre(ge),ge=NI.offset(ge,(Te.V-1)*7),Te.y=ge.getFullYear(),Te.m=ge.getMonth(),Te.d=ge.getDate()+(Te.w+6)%7)}else("W"in Te||"U"in Te)&&("w"in Te||(Te.w="u"in Te?Te.u%7:"W"in Te?1:0),mt="Z"in Te?Hce(k5(Te.y,0,1)).getUTCDay():Vce(k5(Te.y,0,1)).getDay(),Te.m=0,Te.d="W"in Te?(Te.w+6)%7+Te.W*7-(mt+5)%7:Te.w+Te.U*7-(mt+6)%7);return"Z"in Te?(Te.H+=Te.Z/100|0,Te.M+=Te.Z%100,Hce(Te)):Vce(Te)}}function K(Pe,Ae,nt,Te){for(var Xe=0,ge=Ae.length,mt=nt.length,rt,We;Xe=mt)return-1;if(rt=Ae.charCodeAt(Xe++),rt===37){if(rt=Ae.charAt(Xe++),We=F[rt in K4e?Ae.charAt(Xe++):rt],!We||(Te=We(Pe,nt,Te))<0)return-1}else if(rt!=nt.charCodeAt(Te++))return-1}return Te}function Z(Pe,Ae,nt){var Te=m.exec(Ae.slice(nt));return Te?(Pe.p=y.get(Te[0].toLowerCase()),nt+Te[0].length):-1}function re(Pe,Ae,nt){var Te=k.exec(Ae.slice(nt));return Te?(Pe.w=C.get(Te[0].toLowerCase()),nt+Te[0].length):-1}function he(Pe,Ae,nt){var Te=v.exec(Ae.slice(nt));return Te?(Pe.w=w.get(Te[0].toLowerCase()),nt+Te[0].length):-1}function ue(Pe,Ae,nt){var Te=I.exec(Ae.slice(nt));return Te?(Pe.m=A.get(Te[0].toLowerCase()),nt+Te[0].length):-1}function Ne(Pe,Ae,nt){var Te=S.exec(Ae.slice(nt));return Te?(Pe.m=T.get(Te[0].toLowerCase()),nt+Te[0].length):-1}function se(Pe,Ae,nt){return K(Pe,e,Ae,nt)}function xe(Pe,Ae,nt){return K(Pe,n,Ae,nt)}function ie(Pe,Ae,nt){return K(Pe,s,Ae,nt)}function me(Pe){return c[Pe.getDay()]}function fe(Pe){return o[Pe.getDay()]}function ve(Pe){return f[Pe.getMonth()]}function Ie(Pe){return a[Pe.getMonth()]}function Se(Pe){return i[+(Pe.getHours()>=12)]}function oe(Pe){return 1+~~(Pe.getMonth()/3)}function ae(Pe){return c[Pe.getUTCDay()]}function je(Pe){return o[Pe.getUTCDay()]}function Me(Pe){return f[Pe.getUTCMonth()]}function Ue(Pe){return a[Pe.getUTCMonth()]}function Re(Pe){return i[+(Pe.getUTCHours()>=12)]}function $e(Pe){return 1+~~(Pe.getUTCMonth()/3)}return{format:function(Pe){var Ae=q(Pe+="",D);return Ae.toString=function(){return Pe},Ae},parse:function(Pe){var Ae=W(Pe+="",!1);return Ae.toString=function(){return Pe},Ae},utcFormat:function(Pe){var Ae=q(Pe+="",$);return Ae.toString=function(){return Pe},Ae},utcParse:function(Pe){var Ae=W(Pe+="",!0);return Ae.toString=function(){return Pe},Ae}}}var K4e={"-":"",_:" ",0:"0"},ud=/^\s*\d+/,LLt=/^%/,OLt=/[\\^$*+?|[\]().{}]/g;function Ja(t,e,n){var s=t<0?"-":"",i=(s?-t:t)+"",o=i.length;return s+(o[e.toLowerCase(),n]))}function RLt(t,e,n){var s=ud.exec(e.slice(n,n+1));return s?(t.w=+s[0],n+s[0].length):-1}function FLt(t,e,n){var s=ud.exec(e.slice(n,n+1));return s?(t.u=+s[0],n+s[0].length):-1}function zLt(t,e,n){var s=ud.exec(e.slice(n,n+2));return s?(t.U=+s[0],n+s[0].length):-1}function BLt(t,e,n){var s=ud.exec(e.slice(n,n+2));return s?(t.V=+s[0],n+s[0].length):-1}function $Lt(t,e,n){var s=ud.exec(e.slice(n,n+2));return s?(t.W=+s[0],n+s[0].length):-1}function Z4e(t,e,n){var s=ud.exec(e.slice(n,n+4));return s?(t.y=+s[0],n+s[0].length):-1}function Y4e(t,e,n){var s=ud.exec(e.slice(n,n+2));return s?(t.y=+s[0]+(+s[0]>68?1900:2e3),n+s[0].length):-1}function ULt(t,e,n){var s=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return s?(t.Z=s[1]?0:-(s[2]+(s[3]||"00")),n+s[0].length):-1}function qLt(t,e,n){var s=ud.exec(e.slice(n,n+1));return s?(t.q=s[0]*3-3,n+s[0].length):-1}function VLt(t,e,n){var s=ud.exec(e.slice(n,n+2));return s?(t.m=s[0]-1,n+s[0].length):-1}function X4e(t,e,n){var s=ud.exec(e.slice(n,n+2));return s?(t.d=+s[0],n+s[0].length):-1}function HLt(t,e,n){var s=ud.exec(e.slice(n,n+3));return s?(t.m=0,t.d=+s[0],n+s[0].length):-1}function Q4e(t,e,n){var s=ud.exec(e.slice(n,n+2));return s?(t.H=+s[0],n+s[0].length):-1}function WLt(t,e,n){var s=ud.exec(e.slice(n,n+2));return s?(t.M=+s[0],n+s[0].length):-1}function GLt(t,e,n){var s=ud.exec(e.slice(n,n+2));return s?(t.S=+s[0],n+s[0].length):-1}function KLt(t,e,n){var s=ud.exec(e.slice(n,n+3));return s?(t.L=+s[0],n+s[0].length):-1}function ZLt(t,e,n){var s=ud.exec(e.slice(n,n+6));return s?(t.L=Math.floor(s[0]/1e3),n+s[0].length):-1}function YLt(t,e,n){var s=LLt.exec(e.slice(n,n+1));return s?n+s[0].length:-1}function XLt(t,e,n){var s=ud.exec(e.slice(n));return s?(t.Q=+s[0],n+s[0].length):-1}function QLt(t,e,n){var s=ud.exec(e.slice(n));return s?(t.s=+s[0],n+s[0].length):-1}function J4e(t,e){return Ja(t.getDate(),e,2)}function JLt(t,e){return Ja(t.getHours(),e,2)}function eOt(t,e){return Ja(t.getHours()%12||12,e,2)}function tOt(t,e){return Ja(1+NI.count(Gy(t),t),e,3)}function eBe(t,e){return Ja(t.getMilliseconds(),e,3)}function rOt(t,e){return eBe(t,e)+"000"}function nOt(t,e){return Ja(t.getMonth()+1,e,2)}function sOt(t,e){return Ja(t.getMinutes(),e,2)}function iOt(t,e){return Ja(t.getSeconds(),e,2)}function aOt(t){var e=t.getDay();return e===0?7:e}function oOt(t,e){return Ja(lie.count(Gy(t)-1,t),e,2)}function tBe(t){var e=t.getDay();return e>=4||e===0?aC(t):aC.ceil(t)}function lOt(t,e){return t=tBe(t),Ja(aC.count(Gy(t),t)+(Gy(t).getDay()===4),e,2)}function cOt(t){return t.getDay()}function dOt(t,e){return Ja(Cre.count(Gy(t)-1,t),e,2)}function uOt(t,e){return Ja(t.getFullYear()%100,e,2)}function hOt(t,e){return t=tBe(t),Ja(t.getFullYear()%100,e,2)}function fOt(t,e){return Ja(t.getFullYear()%1e4,e,4)}function pOt(t,e){var n=t.getDay();return t=n>=4||n===0?aC(t):aC.ceil(t),Ja(t.getFullYear()%1e4,e,4)}function mOt(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Ja(e/60|0,"0",2)+Ja(e%60,"0",2)}function eCe(t,e){return Ja(t.getUTCDate(),e,2)}function gOt(t,e){return Ja(t.getUTCHours(),e,2)}function yOt(t,e){return Ja(t.getUTCHours()%12||12,e,2)}function xOt(t,e){return Ja(1+oie.count(Ky(t),t),e,3)}function rBe(t,e){return Ja(t.getUTCMilliseconds(),e,3)}function vOt(t,e){return rBe(t,e)+"000"}function _Ot(t,e){return Ja(t.getUTCMonth()+1,e,2)}function bOt(t,e){return Ja(t.getUTCMinutes(),e,2)}function wOt(t,e){return Ja(t.getUTCSeconds(),e,2)}function jOt(t){var e=t.getUTCDay();return e===0?7:e}function kOt(t,e){return Ja(cie.count(Ky(t)-1,t),e,2)}function nBe(t){var e=t.getUTCDay();return e>=4||e===0?oC(t):oC.ceil(t)}function NOt(t,e){return t=nBe(t),Ja(oC.count(Ky(t),t)+(Ky(t).getUTCDay()===4),e,2)}function SOt(t){return t.getUTCDay()}function COt(t,e){return Ja(Mre.count(Ky(t)-1,t),e,2)}function MOt(t,e){return Ja(t.getUTCFullYear()%100,e,2)}function TOt(t,e){return t=nBe(t),Ja(t.getUTCFullYear()%100,e,2)}function AOt(t,e){return Ja(t.getUTCFullYear()%1e4,e,4)}function EOt(t,e){var n=t.getUTCDay();return t=n>=4||n===0?oC(t):oC.ceil(t),Ja(t.getUTCFullYear()%1e4,e,4)}function IOt(){return"+0000"}function tCe(){return"%"}function rCe(t){return+t}function nCe(t){return Math.floor(+t/1e3)}var HN,sBe,iBe;POt({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function POt(t){return HN=PLt(t),sBe=HN.format,HN.parse,iBe=HN.utcFormat,HN.utcParse,HN}function LOt(t){return new Date(t)}function OOt(t){return t instanceof Date?+t:+new Date(+t)}function Qxe(t,e,n,s,i,o,c,a,f,m){var y=Fxe(),v=y.invert,w=y.domain,k=m(".%L"),C=m(":%S"),S=m("%I:%M"),T=m("%I %p"),I=m("%a %d"),A=m("%b %d"),D=m("%B"),$=m("%Y");function F(q){return(f(q)e(i/(t.length-1)))},n.quantiles=function(s){return Array.from({length:s+1},(i,o)=>k6t(t,o/s))},n.copy=function(){return cBe(e).domain(t)},tx.apply(n,arguments)}function uie(){var t=0,e=.5,n=1,s=1,i,o,c,a,f,m=Nu,y,v=!1,w;function k(S){return isNaN(S=+S)?w:(S=.5+((S=+y(S))-o)*(s*Se}var fBe=UOt,qOt=hie,VOt=fBe,HOt=e3;function WOt(t){return t&&t.length?qOt(t,HOt,VOt):void 0}var GOt=WOt;const fie=Oa(GOt);function KOt(t,e){return tt.e^o.s<0?1:-1;for(s=o.d.length,i=t.d.length,e=0,n=st.d[e]^o.s<0?1:-1;return s===i?0:s>i^o.s<0?1:-1};gs.decimalPlaces=gs.dp=function(){var t=this,e=t.d.length-1,n=(e-t.e)*al;if(e=t.d[e],e)for(;e%10==0;e/=10)n--;return n<0?0:n};gs.dividedBy=gs.div=function(t){return Dy(this,new this.constructor(t))};gs.dividedToIntegerBy=gs.idiv=function(t){var e=this,n=e.constructor;return Po(Dy(e,new n(t),0,1),n.precision)};gs.equals=gs.eq=function(t){return!this.cmp(t)};gs.exponent=function(){return kc(this)};gs.greaterThan=gs.gt=function(t){return this.cmp(t)>0};gs.greaterThanOrEqualTo=gs.gte=function(t){return this.cmp(t)>=0};gs.isInteger=gs.isint=function(){return this.e>this.d.length-2};gs.isNegative=gs.isneg=function(){return this.s<0};gs.isPositive=gs.ispos=function(){return this.s>0};gs.isZero=function(){return this.s===0};gs.lessThan=gs.lt=function(t){return this.cmp(t)<0};gs.lessThanOrEqualTo=gs.lte=function(t){return this.cmp(t)<1};gs.logarithm=gs.log=function(t){var e,n=this,s=n.constructor,i=s.precision,o=i+5;if(t===void 0)t=new s(10);else if(t=new s(t),t.s<1||t.eq(Fh))throw Error(Kf+"NaN");if(n.s<1)throw Error(Kf+(n.s?"NaN":"-Infinity"));return n.eq(Fh)?new s(0):(gl=!1,e=Dy(cE(n,o),cE(t,o),o),gl=!0,Po(e,i))};gs.minus=gs.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?xBe(e,t):gBe(e,(t.s=-t.s,t))};gs.modulo=gs.mod=function(t){var e,n=this,s=n.constructor,i=s.precision;if(t=new s(t),!t.s)throw Error(Kf+"NaN");return n.s?(gl=!1,e=Dy(n,t,0,1).times(t),gl=!0,n.minus(e)):Po(new s(n),i)};gs.naturalExponential=gs.exp=function(){return yBe(this)};gs.naturalLogarithm=gs.ln=function(){return cE(this)};gs.negated=gs.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};gs.plus=gs.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?gBe(e,t):xBe(e,(t.s=-t.s,t))};gs.precision=gs.sd=function(t){var e,n,s,i=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(rj+t);if(e=kc(i)+1,s=i.d.length-1,n=s*al+1,s=i.d[s],s){for(;s%10==0;s/=10)n--;for(s=i.d[0];s>=10;s/=10)n++}return t&&e>n?e:n};gs.squareRoot=gs.sqrt=function(){var t,e,n,s,i,o,c,a=this,f=a.constructor;if(a.s<1){if(!a.s)return new f(0);throw Error(Kf+"NaN")}for(t=kc(a),gl=!1,i=Math.sqrt(+a),i==0||i==1/0?(e=rg(a.d),(e.length+t)%2==0&&(e+="0"),i=Math.sqrt(e),t=s3((t+1)/2)-(t<0||t%2),i==1/0?e="5e"+t:(e=i.toExponential(),e=e.slice(0,e.indexOf("e")+1)+t),s=new f(e)):s=new f(i.toString()),n=f.precision,i=c=n+3;;)if(o=s,s=o.plus(Dy(a,o,c+2)).times(.5),rg(o.d).slice(0,c)===(e=rg(s.d)).slice(0,c)){if(e=e.slice(c-3,c+1),i==c&&e=="4999"){if(Po(o,n+1,0),o.times(o).eq(a)){s=o;break}}else if(e!="9999")break;c+=4}return gl=!0,Po(s,n)};gs.times=gs.mul=function(t){var e,n,s,i,o,c,a,f,m,y=this,v=y.constructor,w=y.d,k=(t=new v(t)).d;if(!y.s||!t.s)return new v(0);for(t.s*=y.s,n=y.e+t.e,f=w.length,m=k.length,f=0;){for(e=0,i=f+s;i>s;)a=o[i]+k[s]*w[i-s-1]+e,o[i--]=a%Qc|0,e=a/Qc|0;o[i]=(o[i]+e)%Qc|0}for(;!o[--c];)o.pop();return e?++n:o.shift(),t.d=o,t.e=n,gl?Po(t,v.precision):t};gs.toDecimalPlaces=gs.todp=function(t,e){var n=this,s=n.constructor;return n=new s(n),t===void 0?n:(jg(t,0,n3),e===void 0?e=s.rounding:jg(e,0,8),Po(n,t+kc(n)+1,e))};gs.toExponential=function(t,e){var n,s=this,i=s.constructor;return t===void 0?n=Ej(s,!0):(jg(t,0,n3),e===void 0?e=i.rounding:jg(e,0,8),s=Po(new i(s),t+1,e),n=Ej(s,!0,t+1)),n};gs.toFixed=function(t,e){var n,s,i=this,o=i.constructor;return t===void 0?Ej(i):(jg(t,0,n3),e===void 0?e=o.rounding:jg(e,0,8),s=Po(new o(i),t+kc(i)+1,e),n=Ej(s.abs(),!1,t+kc(s)+1),i.isneg()&&!i.isZero()?"-"+n:n)};gs.toInteger=gs.toint=function(){var t=this,e=t.constructor;return Po(new e(t),kc(t)+1,e.rounding)};gs.toNumber=function(){return+this};gs.toPower=gs.pow=function(t){var e,n,s,i,o,c,a=this,f=a.constructor,m=12,y=+(t=new f(t));if(!t.s)return new f(Fh);if(a=new f(a),!a.s){if(t.s<1)throw Error(Kf+"Infinity");return a}if(a.eq(Fh))return a;if(s=f.precision,t.eq(Fh))return Po(a,s);if(e=t.e,n=t.d.length-1,c=e>=n,o=a.s,c){if((n=y<0?-y:y)<=mBe){for(i=new f(Fh),e=Math.ceil(s/al+4),gl=!1;n%2&&(i=i.times(a),aCe(i.d,e)),n=s3(n/2),n!==0;)a=a.times(a),aCe(a.d,e);return gl=!0,t.s<0?new f(Fh).div(i):Po(i,s)}}else if(o<0)throw Error(Kf+"NaN");return o=o<0&&t.d[Math.max(e,n)]&1?-1:1,a.s=1,gl=!1,i=t.times(cE(a,s+m)),gl=!0,i=yBe(i),i.s=o,i};gs.toPrecision=function(t,e){var n,s,i=this,o=i.constructor;return t===void 0?(n=kc(i),s=Ej(i,n<=o.toExpNeg||n>=o.toExpPos)):(jg(t,1,n3),e===void 0?e=o.rounding:jg(e,0,8),i=Po(new o(i),t,e),n=kc(i),s=Ej(i,t<=n||n<=o.toExpNeg,t)),s};gs.toSignificantDigits=gs.tosd=function(t,e){var n=this,s=n.constructor;return t===void 0?(t=s.precision,e=s.rounding):(jg(t,1,n3),e===void 0?e=s.rounding:jg(e,0,8)),Po(new s(n),t,e)};gs.toString=gs.valueOf=gs.val=gs.toJSON=gs[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=kc(t),n=t.constructor;return Ej(t,e<=n.toExpNeg||e>=n.toExpPos)};function gBe(t,e){var n,s,i,o,c,a,f,m,y=t.constructor,v=y.precision;if(!t.s||!e.s)return e.s||(e=new y(t)),gl?Po(e,v):e;if(f=t.d,m=e.d,c=t.e,i=e.e,f=f.slice(),o=c-i,o){for(o<0?(s=f,o=-o,a=m.length):(s=m,i=c,a=f.length),c=Math.ceil(v/al),a=c>a?c+1:a+1,o>a&&(o=a,s.length=1),s.reverse();o--;)s.push(0);s.reverse()}for(a=f.length,o=m.length,a-o<0&&(o=a,s=m,m=f,f=s),n=0;o;)n=(f[--o]=f[o]+m[o]+n)/Qc|0,f[o]%=Qc;for(n&&(f.unshift(n),++i),a=f.length;f[--a]==0;)f.pop();return e.d=f,e.e=i,gl?Po(e,v):e}function jg(t,e,n){if(t!==~~t||tn)throw Error(rj+t)}function rg(t){var e,n,s,i=t.length-1,o="",c=t[0];if(i>0){for(o+=c,e=1;ec?1:-1;else for(a=f=0;ai[a]?1:-1;break}return f}function n(s,i,o){for(var c=0;o--;)s[o]-=c,c=s[o]1;)s.shift()}return function(s,i,o,c){var a,f,m,y,v,w,k,C,S,T,I,A,D,$,F,q,W,K,Z=s.constructor,re=s.s==i.s?1:-1,he=s.d,ue=i.d;if(!s.s)return new Z(s);if(!i.s)throw Error(Kf+"Division by zero");for(f=s.e-i.e,W=ue.length,F=he.length,k=new Z(re),C=k.d=[],m=0;ue[m]==(he[m]||0);)++m;if(ue[m]>(he[m]||0)&&--f,o==null?A=o=Z.precision:c?A=o+(kc(s)-kc(i))+1:A=o,A<0)return new Z(0);if(A=A/al+2|0,m=0,W==1)for(y=0,ue=ue[0],A++;(m1&&(ue=t(ue,y),he=t(he,y),W=ue.length,F=he.length),$=W,S=he.slice(0,W),T=S.length;T=Qc/2&&++q;do y=0,a=e(ue,S,W,T),a<0?(I=S[0],W!=T&&(I=I*Qc+(S[1]||0)),y=I/q|0,y>1?(y>=Qc&&(y=Qc-1),v=t(ue,y),w=v.length,T=S.length,a=e(v,S,w,T),a==1&&(y--,n(v,W16)throw Error(t0e+kc(t));if(!t.s)return new y(Fh);for(gl=!1,a=v,c=new y(.03125);t.abs().gte(.1);)t=t.times(c),m+=5;for(s=Math.log(nw(2,m))/Math.LN10*2+5|0,a+=s,n=i=o=new y(Fh),y.precision=a;;){if(i=Po(i.times(t),a),n=n.times(++f),c=o.plus(Dy(i,n,a)),rg(c.d).slice(0,a)===rg(o.d).slice(0,a)){for(;m--;)o=Po(o.times(o),a);return y.precision=v,e==null?(gl=!0,Po(o,v)):o}o=c}}function kc(t){for(var e=t.e*al,n=t.d[0];n>=10;n/=10)e++;return e}function Wce(t,e,n){if(e>t.LN10.sd())throw gl=!0,n&&(t.precision=n),Error(Kf+"LN10 precision limit exceeded");return Po(new t(t.LN10),e)}function a0(t){for(var e="";t--;)e+="0";return e}function cE(t,e){var n,s,i,o,c,a,f,m,y,v=1,w=10,k=t,C=k.d,S=k.constructor,T=S.precision;if(k.s<1)throw Error(Kf+(k.s?"NaN":"-Infinity"));if(k.eq(Fh))return new S(0);if(e==null?(gl=!1,m=T):m=e,k.eq(10))return e==null&&(gl=!0),Wce(S,m);if(m+=w,S.precision=m,n=rg(C),s=n.charAt(0),o=kc(k),Math.abs(o)<15e14){for(;s<7&&s!=1||s==1&&n.charAt(1)>3;)k=k.times(t),n=rg(k.d),s=n.charAt(0),v++;o=kc(k),s>1?(k=new S("0."+n),o++):k=new S(s+"."+n.slice(1))}else return f=Wce(S,m+2,T).times(o+""),k=cE(new S(s+"."+n.slice(1)),m-w).plus(f),S.precision=T,e==null?(gl=!0,Po(k,T)):k;for(a=c=k=Dy(k.minus(Fh),k.plus(Fh),m),y=Po(k.times(k),m),i=3;;){if(c=Po(c.times(y),m),f=a.plus(Dy(c,new S(i),m)),rg(f.d).slice(0,m)===rg(a.d).slice(0,m))return a=a.times(2),o!==0&&(a=a.plus(Wce(S,m+2,T).times(o+""))),a=Dy(a,new S(v),m),S.precision=T,e==null?(gl=!0,Po(a,T)):a;a=f,i+=2}}function iCe(t,e){var n,s,i;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(s=e.search(/e/i))>0?(n<0&&(n=s),n+=+e.slice(s+1),e=e.substring(0,s)):n<0&&(n=e.length),s=0;e.charCodeAt(s)===48;)++s;for(i=e.length;e.charCodeAt(i-1)===48;)--i;if(e=e.slice(s,i),e){if(i-=s,n=n-s-1,t.e=s3(n/al),t.d=[],s=(n+1)%al,n<0&&(s+=al),sTre||t.e<-Tre))throw Error(t0e+n)}else t.s=0,t.e=0,t.d=[0];return t}function Po(t,e,n){var s,i,o,c,a,f,m,y,v=t.d;for(c=1,o=v[0];o>=10;o/=10)c++;if(s=e-c,s<0)s+=al,i=e,m=v[y=0];else{if(y=Math.ceil((s+1)/al),o=v.length,y>=o)return t;for(m=o=v[y],c=1;o>=10;o/=10)c++;s%=al,i=s-al+c}if(n!==void 0&&(o=nw(10,c-i-1),a=m/o%10|0,f=e<0||v[y+1]!==void 0||m%o,f=n<4?(a||f)&&(n==0||n==(t.s<0?3:2)):a>5||a==5&&(n==4||f||n==6&&(s>0?i>0?m/nw(10,c-i):0:v[y-1])%10&1||n==(t.s<0?8:7))),e<1||!v[0])return f?(o=kc(t),v.length=1,e=e-o-1,v[0]=nw(10,(al-e%al)%al),t.e=s3(-e/al)||0):(v.length=1,v[0]=t.e=t.s=0),t;if(s==0?(v.length=y,o=1,y--):(v.length=y+1,o=nw(10,al-s),v[y]=i>0?(m/nw(10,c-i)%nw(10,i)|0)*o:0),f)for(;;)if(y==0){(v[0]+=o)==Qc&&(v[0]=1,++t.e);break}else{if(v[y]+=o,v[y]!=Qc)break;v[y--]=0,o=1}for(s=v.length;v[--s]===0;)v.pop();if(gl&&(t.e>Tre||t.e<-Tre))throw Error(t0e+kc(t));return t}function xBe(t,e){var n,s,i,o,c,a,f,m,y,v,w=t.constructor,k=w.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new w(t),gl?Po(e,k):e;if(f=t.d,v=e.d,s=e.e,m=t.e,f=f.slice(),c=m-s,c){for(y=c<0,y?(n=f,c=-c,a=v.length):(n=v,s=m,a=f.length),i=Math.max(Math.ceil(k/al),a)+2,c>i&&(c=i,n.length=1),n.reverse(),i=c;i--;)n.push(0);n.reverse()}else{for(i=f.length,a=v.length,y=i0;--i)f[a++]=0;for(i=v.length;i>c;){if(f[--i]0?o=o.charAt(0)+"."+o.slice(1)+a0(s):c>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(i<0?"e":"e+")+i):i<0?(o="0."+a0(-i-1)+o,n&&(s=n-c)>0&&(o+=a0(s))):i>=c?(o+=a0(i+1-c),n&&(s=n-i-1)>0&&(o=o+"."+a0(s))):((s=i+1)0&&(i+1===c&&(o+="."),o+=a0(s))),t.s<0?"-"+o:o}function aCe(t,e){if(t.length>e)return t.length=e,!0}function vBe(t){var e,n,s;function i(o){var c=this;if(!(c instanceof i))return new i(o);if(c.constructor=i,o instanceof i){c.s=o.s,c.e=o.e,c.d=(o=o.d)?o.slice():o;return}if(typeof o=="number"){if(o*0!==0)throw Error(rj+o);if(o>0)c.s=1;else if(o<0)o=-o,c.s=-1;else{c.s=0,c.e=0,c.d=[0];return}if(o===~~o&&o<1e7){c.e=0,c.d=[o];return}return iCe(c,o.toString())}else if(typeof o!="string")throw Error(rj+o);if(o.charCodeAt(0)===45?(o=o.slice(1),c.s=-1):c.s=1,mDt.test(o))iCe(c,o);else throw Error(rj+o)}if(i.prototype=gs,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=vBe,i.config=i.set=gDt,t===void 0&&(t={}),t)for(s=["precision","rounding","toExpNeg","toExpPos","LN10"],e=0;e=i[e+1]&&s<=i[e+2])this[n]=s;else throw Error(rj+n+": "+s);if((s=t[n="LN10"])!==void 0)if(s==Math.LN10)this[n]=new this(s);else throw Error(rj+n+": "+s);return this}var r0e=vBe(pDt);Fh=new r0e(1);const Co=r0e;function yDt(t){return bDt(t)||_Dt(t)||vDt(t)||xDt()}function xDt(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vDt(t,e){if(t){if(typeof t=="string")return Pfe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Pfe(t,e)}}function _Dt(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function bDt(t){if(Array.isArray(t))return Pfe(t)}function Pfe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,s=new Array(e);n=e?n.apply(void 0,i):t(e-c,oCe(function(){for(var a=arguments.length,f=new Array(a),m=0;mt.length)&&(e=t.length);for(var n=0,s=new Array(e);n"u"||!(Symbol.iterator in Object(t)))){var n=[],s=!0,i=!1,o=void 0;try{for(var c=t[Symbol.iterator](),a;!(s=(a=c.next()).done)&&(n.push(a.value),!(e&&n.length===e));s=!0);}catch(f){i=!0,o=f}finally{try{!s&&c.return!=null&&c.return()}finally{if(i)throw o}}return n}}function DDt(t){if(Array.isArray(t))return t}function kBe(t){var e=dE(t,2),n=e[0],s=e[1],i=n,o=s;return n>s&&(i=s,o=n),[i,o]}function NBe(t,e,n){if(t.lte(0))return new Co(0);var s=yie.getDigitCount(t.toNumber()),i=new Co(10).pow(s),o=t.div(i),c=s!==1?.05:.1,a=new Co(Math.ceil(o.div(c).toNumber())).add(n).mul(c),f=a.mul(i);return e?f:new Co(Math.ceil(f))}function RDt(t,e,n){var s=1,i=new Co(t);if(!i.isint()&&n){var o=Math.abs(t);o<1?(s=new Co(10).pow(yie.getDigitCount(t)-1),i=new Co(Math.floor(i.div(s).toNumber())).mul(s)):o>1&&(i=new Co(Math.floor(t)))}else t===0?i=new Co(Math.floor((e-1)/2)):n||(i=new Co(Math.floor(t)));var c=Math.floor((e-1)/2),a=NDt(kDt(function(f){return i.add(new Co(f-c).mul(s)).toNumber()}),Lfe);return a(0,e)}function SBe(t,e,n,s){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((e-t)/(n-1)))return{step:new Co(0),tickMin:new Co(0),tickMax:new Co(0)};var o=NBe(new Co(e).sub(t).div(n-1),s,i),c;t<=0&&e>=0?c=new Co(0):(c=new Co(t).add(e).div(2),c=c.sub(new Co(c).mod(o)));var a=Math.ceil(c.sub(t).div(o).toNumber()),f=Math.ceil(new Co(e).sub(c).div(o).toNumber()),m=a+f+1;return m>n?SBe(t,e,n,s,i+1):(m0?f+(n-m):f,a=e>0?a:a+(n-m)),{step:o,tickMin:c.sub(new Co(a).mul(o)),tickMax:c.add(new Co(f).mul(o))})}function FDt(t){var e=dE(t,2),n=e[0],s=e[1],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,c=Math.max(i,2),a=kBe([n,s]),f=dE(a,2),m=f[0],y=f[1];if(m===-1/0||y===1/0){var v=y===1/0?[m].concat(Dfe(Lfe(0,i-1).map(function(){return 1/0}))):[].concat(Dfe(Lfe(0,i-1).map(function(){return-1/0})),[y]);return n>s?Ofe(v):v}if(m===y)return RDt(m,i,o);var w=SBe(m,y,c,o),k=w.step,C=w.tickMin,S=w.tickMax,T=yie.rangeStep(C,S.add(new Co(.1).mul(k)),k);return n>s?Ofe(T):T}function zDt(t,e){var n=dE(t,2),s=n[0],i=n[1],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,c=kBe([s,i]),a=dE(c,2),f=a[0],m=a[1];if(f===-1/0||m===1/0)return[s,i];if(f===m)return[f];var y=Math.max(e,2),v=NBe(new Co(m).sub(f).div(y-1),o,0),w=[].concat(Dfe(yie.rangeStep(new Co(f),new Co(m).sub(new Co(.99).mul(v)),v)),[m]);return s>i?Ofe(w):w}var BDt=wBe(FDt),$Dt=wBe(zDt),UDt="Invariant failed";function Ij(t,e){throw new Error(UDt)}var qDt=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function lC(t){"@babel/helpers - typeof";return lC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},lC(t)}function Are(){return Are=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,s=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function YDt(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}function XDt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function QDt(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,s=new Array(e);n1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,c=-1,a=(n=s==null?void 0:s.length)!==null&&n!==void 0?n:0;if(a<=1)return 0;if(o&&o.axisType==="angleAxis"&&Math.abs(Math.abs(o.range[1]-o.range[0])-360)<=1e-6)for(var f=o.range,m=0;m0?i[m-1].coordinate:i[a-1].coordinate,v=i[m].coordinate,w=m>=a-1?i[0].coordinate:i[m+1].coordinate,k=void 0;if(ju(v-y)!==ju(w-v)){var C=[];if(ju(w-v)===ju(f[1]-f[0])){k=w;var S=v+f[1]-f[0];C[0]=Math.min(S,(S+y)/2),C[1]=Math.max(S,(S+y)/2)}else{k=y;var T=w+f[1]-f[0];C[0]=Math.min(v,(T+v)/2),C[1]=Math.max(v,(T+v)/2)}var I=[Math.min(v,(k+v)/2),Math.max(v,(k+v)/2)];if(e>I[0]&&e<=I[1]||e>=C[0]&&e<=C[1]){c=i[m].index;break}}else{var A=Math.min(y,w),D=Math.max(y,w);if(e>(A+v)/2&&e<=(D+v)/2){c=i[m].index;break}}}else for(var $=0;$0&&$(s[$].coordinate+s[$-1].coordinate)/2&&e<=(s[$].coordinate+s[$+1].coordinate)/2||$===a-1&&e>(s[$].coordinate+s[$-1].coordinate)/2){c=s[$].index;break}return c},n0e=function(e){var n,s=e,i=s.type.displayName,o=(n=e.type)!==null&&n!==void 0&&n.defaultProps?Fl(Fl({},e.type.defaultProps),e.props):e.props,c=o.stroke,a=o.fill,f;switch(i){case"Line":f=c;break;case"Area":case"Radar":f=c&&c!=="none"?c:a;break;default:f=a;break}return f},m8t=function(e){var n=e.barSize,s=e.totalSize,i=e.stackGroups,o=i===void 0?{}:i;if(!o)return{};for(var c={},a=Object.keys(o),f=0,m=a.length;f=0});if(I&&I.length){var A=I[0].type.defaultProps,D=A!==void 0?Fl(Fl({},A),I[0].props):I[0].props,$=D.barSize,F=D[T];c[F]||(c[F]=[]);var q=pa($)?n:$;c[F].push({item:I[0],stackList:I.slice(1),barSize:pa(q)?void 0:ku(q,s,0)})}}return c},g8t=function(e){var n=e.barGap,s=e.barCategoryGap,i=e.bandSize,o=e.sizeList,c=o===void 0?[]:o,a=e.maxBarSize,f=c.length;if(f<1)return null;var m=ku(n,i,0,!0),y,v=[];if(c[0].barSize===+c[0].barSize){var w=!1,k=i/f,C=c.reduce(function($,F){return $+F.barSize||0},0);C+=(f-1)*m,C>=i&&(C-=(f-1)*m,m=0),C>=i&&k>0&&(w=!0,k*=.9,C=f*k);var S=(i-C)/2>>0,T={offset:S-m,size:0};y=c.reduce(function($,F){var q={item:F.item,position:{offset:T.offset+T.size+m,size:w?k:F.barSize}},W=[].concat(dCe($),[q]);return T=W[W.length-1].position,F.stackList&&F.stackList.length&&F.stackList.forEach(function(K){W.push({item:K,position:T})}),W},v)}else{var I=ku(s,i,0,!0);i-2*I-(f-1)*m<=0&&(m=0);var A=(i-2*I-(f-1)*m)/f;A>1&&(A>>=0);var D=a===+a?Math.min(A,a):A;y=c.reduce(function($,F,q){var W=[].concat(dCe($),[{item:F.item,position:{offset:I+(A+m)*q+(A-D)/2,size:D}}]);return F.stackList&&F.stackList.length&&F.stackList.forEach(function(K){W.push({item:K,position:W[W.length-1].position})}),W},v)}return y},y8t=function(e,n,s,i){var o=s.children,c=s.width,a=s.margin,f=c-(a.left||0)-(a.right||0),m=ABe({children:o,legendWidth:f});if(m){var y=i||{},v=y.width,w=y.height,k=m.align,C=m.verticalAlign,S=m.layout;if((S==="vertical"||S==="horizontal"&&C==="middle")&&k!=="center"&&Pn(e[k]))return Fl(Fl({},e),{},f4({},k,e[k]+(v||0)));if((S==="horizontal"||S==="vertical"&&k==="center")&&C!=="middle"&&Pn(e[C]))return Fl(Fl({},e),{},f4({},C,e[C]+(w||0)))}return e},x8t=function(e,n,s){return pa(n)?!0:e==="horizontal"?n==="yAxis":e==="vertical"||s==="x"?n==="xAxis":s==="y"?n==="yAxis":!0},EBe=function(e,n,s,i,o){var c=n.props.children,a=Vf(c,xie).filter(function(m){return x8t(i,o,m.props.direction)});if(a&&a.length){var f=a.map(function(m){return m.props.dataKey});return e.reduce(function(m,y){var v=qd(y,s);if(pa(v))return m;var w=Array.isArray(v)?[pie(v),fie(v)]:[v,v],k=f.reduce(function(C,S){var T=qd(y,S,0),I=w[0]-Math.abs(Array.isArray(T)?T[0]:T),A=w[1]+Math.abs(Array.isArray(T)?T[1]:T);return[Math.min(I,C[0]),Math.max(A,C[1])]},[1/0,-1/0]);return[Math.min(k[0],m[0]),Math.max(k[1],m[1])]},[1/0,-1/0])}return null},v8t=function(e,n,s,i,o){var c=n.map(function(a){return EBe(e,a,s,o,i)}).filter(function(a){return!pa(a)});return c&&c.length?c.reduce(function(a,f){return[Math.min(a[0],f[0]),Math.max(a[1],f[1])]},[1/0,-1/0]):null},IBe=function(e,n,s,i,o){var c=n.map(function(f){var m=f.props.dataKey;return s==="number"&&m&&EBe(e,f,m,i)||rA(e,m,s,o)});if(s==="number")return c.reduce(function(f,m){return[Math.min(f[0],m[0]),Math.max(f[1],m[1])]},[1/0,-1/0]);var a={};return c.reduce(function(f,m){for(var y=0,v=m.length;y=2?ju(a[0]-a[1])*2*m:m,n&&(e.ticks||e.niceTicks)){var y=(e.ticks||e.niceTicks).map(function(v){var w=o?o.indexOf(v):v;return{coordinate:i(w)+m,value:v,offset:m}});return y.filter(function(v){return!vI(v.coordinate)})}return e.isCategorical&&e.categoricalDomain?e.categoricalDomain.map(function(v,w){return{coordinate:i(v)+m,value:v,index:w,offset:m}}):i.ticks&&!s?i.ticks(e.tickCount).map(function(v){return{coordinate:i(v)+m,value:v,offset:m}}):i.domain().map(function(v,w){return{coordinate:i(v)+m,value:o?o[v]:v,index:w,offset:m}})},Gce=new WeakMap,TL=function(e,n){if(typeof n!="function")return e;Gce.has(e)||Gce.set(e,new WeakMap);var s=Gce.get(e);if(s.has(n))return s.get(n);var i=function(){e.apply(void 0,arguments),n.apply(void 0,arguments)};return s.set(n,i),i},OBe=function(e,n,s){var i=e.scale,o=e.type,c=e.layout,a=e.axisType;if(i==="auto")return c==="radial"&&a==="radiusAxis"?{scale:sE(),realScaleType:"band"}:c==="radial"&&a==="angleAxis"?{scale:Nre(),realScaleType:"linear"}:o==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!s)?{scale:tA(),realScaleType:"point"}:o==="category"?{scale:sE(),realScaleType:"band"}:{scale:Nre(),realScaleType:"linear"};if(Mj(i)){var f="scale".concat(Qse(i));return{scale:(sCe[f]||tA)(),realScaleType:sCe[f]?f:"point"}}return Pi(i)?{scale:i}:{scale:tA(),realScaleType:"point"}},hCe=1e-4,DBe=function(e){var n=e.domain();if(!(!n||n.length<=2)){var s=n.length,i=e.range(),o=Math.min(i[0],i[1])-hCe,c=Math.max(i[0],i[1])+hCe,a=e(n[0]),f=e(n[s-1]);(ac||fc)&&e.domain([n[0],n[s-1]])}},_8t=function(e,n){if(!e)return null;for(var s=0,i=e.length;si)&&(o[1]=i),o[0]>i&&(o[0]=i),o[1]=0?(e[a][s][0]=o,e[a][s][1]=o+f,o=e[a][s][1]):(e[a][s][0]=c,e[a][s][1]=c+f,c=e[a][s][1])}},j8t=function(e){var n=e.length;if(!(n<=0))for(var s=0,i=e[0].length;s=0?(e[c][s][0]=o,e[c][s][1]=o+a,o=e[c][s][1]):(e[c][s][0]=0,e[c][s][1]=0)}},k8t={sign:w8t,expand:q4t,none:eC,silhouette:V4t,wiggle:H4t,positive:j8t},N8t=function(e,n,s){var i=n.map(function(a){return a.props.dataKey}),o=k8t[s],c=U4t().keys(i).value(function(a,f){return+qd(a,f,0)}).order(cfe).offset(o);return c(e)},S8t=function(e,n,s,i,o,c){if(!e)return null;var a=c?n.reverse():n,f={},m=a.reduce(function(v,w){var k,C=(k=w.type)!==null&&k!==void 0&&k.defaultProps?Fl(Fl({},w.type.defaultProps),w.props):w.props,S=C.stackId,T=C.hide;if(T)return v;var I=C[s],A=v[I]||{hasStack:!1,stackGroups:{}};if(Rc(S)){var D=A.stackGroups[S]||{numericAxisId:s,cateAxisId:i,items:[]};D.items.push(w),A.hasStack=!0,A.stackGroups[S]=D}else A.stackGroups[_I("_stackId_")]={numericAxisId:s,cateAxisId:i,items:[w]};return Fl(Fl({},v),{},f4({},I,A))},f),y={};return Object.keys(m).reduce(function(v,w){var k=m[w];if(k.hasStack){var C={};k.stackGroups=Object.keys(k.stackGroups).reduce(function(S,T){var I=k.stackGroups[T];return Fl(Fl({},S),{},f4({},T,{numericAxisId:s,cateAxisId:i,items:I.items,stackedData:N8t(e,I.items,o)}))},C)}return Fl(Fl({},v),{},f4({},w,k))},y)},RBe=function(e,n){var s=n.realScaleType,i=n.type,o=n.tickCount,c=n.originalDomain,a=n.allowDecimals,f=s||n.scale;if(f!=="auto"&&f!=="linear")return null;if(o&&i==="number"&&c&&(c[0]==="auto"||c[1]==="auto")){var m=e.domain();if(!m.length)return null;var y=BDt(m,o,a);return e.domain([pie(y),fie(y)]),{niceTicks:y}}if(o&&i==="number"){var v=e.domain(),w=$Dt(v,o,a);return{niceTicks:w}}return null},fCe=function(e){var n=e.axis,s=e.ticks,i=e.offset,o=e.bandSize,c=e.entry,a=e.index;if(n.type==="category")return s[a]?s[a].coordinate+i:null;var f=qd(c,n.dataKey,n.domain[a]);return pa(f)?null:n.scale(f)-o/2+i},C8t=function(e){var n=e.numericAxis,s=n.scale.domain();if(n.type==="number"){var i=Math.min(s[0],s[1]),o=Math.max(s[0],s[1]);return i<=0&&o>=0?0:o<0?o:i}return s[0]},M8t=function(e,n){var s,i=(s=e.type)!==null&&s!==void 0&&s.defaultProps?Fl(Fl({},e.type.defaultProps),e.props):e.props,o=i.stackId;if(Rc(o)){var c=n[o];if(c){var a=c.items.indexOf(e);return a>=0?c.stackedData[a]:null}}return null},T8t=function(e){return e.reduce(function(n,s){return[pie(s.concat([n[0]]).filter(Pn)),fie(s.concat([n[1]]).filter(Pn))]},[1/0,-1/0])},FBe=function(e,n,s){return Object.keys(e).reduce(function(i,o){var c=e[o],a=c.stackedData,f=a.reduce(function(m,y){var v=T8t(y.slice(n,s+1));return[Math.min(m[0],v[0]),Math.max(m[1],v[1])]},[1/0,-1/0]);return[Math.min(f[0],i[0]),Math.max(f[1],i[1])]},[1/0,-1/0]).map(function(i){return i===1/0||i===-1/0?0:i})},pCe=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,mCe=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Bfe=function(e,n,s){if(Pi(e))return e(n,s);if(!Array.isArray(e))return n;var i=[];if(Pn(e[0]))i[0]=s?e[0]:Math.min(e[0],n[0]);else if(pCe.test(e[0])){var o=+pCe.exec(e[0])[1];i[0]=n[0]-o}else Pi(e[0])?i[0]=e[0](n[0]):i[0]=n[0];if(Pn(e[1]))i[1]=s?e[1]:Math.max(e[1],n[1]);else if(mCe.test(e[1])){var c=+mCe.exec(e[1])[1];i[1]=n[1]+c}else Pi(e[1])?i[1]=e[1](n[1]):i[1]=n[1];return i},Ire=function(e,n,s){if(e&&e.scale&&e.scale.bandwidth){var i=e.scale.bandwidth();if(!s||i>0)return i}if(e&&n&&n.length>=2){for(var o=Exe(n,function(v){return v.coordinate}),c=1/0,a=1,f=o.length;at.length)&&(e=t.length);for(var n=0,s=new Array(e);n2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(e-(s.left||0)-(s.right||0)),Math.abs(n-(s.top||0)-(s.bottom||0)))/2},F8t=function(e,n,s,i,o){var c=e.width,a=e.height,f=e.startAngle,m=e.endAngle,y=ku(e.cx,c,c/2),v=ku(e.cy,a,a/2),w=$Be(c,a,s),k=ku(e.innerRadius,w,0),C=ku(e.outerRadius,w,w*.8),S=Object.keys(n);return S.reduce(function(T,I){var A=n[I],D=A.domain,$=A.reversed,F;if(pa(A.range))i==="angleAxis"?F=[f,m]:i==="radiusAxis"&&(F=[k,C]),$&&(F=[F[1],F[0]]);else{F=A.range;var q=F,W=I8t(q,2);f=W[0],m=W[1]}var K=OBe(A,o),Z=K.realScaleType,re=K.scale;re.domain(D).range(F),DBe(re);var he=RBe(re,fy(fy({},A),{},{realScaleType:Z})),ue=fy(fy(fy({},A),he),{},{range:F,radius:C,realScaleType:Z,scale:re,cx:y,cy:v,innerRadius:k,outerRadius:C,startAngle:f,endAngle:m});return fy(fy({},T),{},BBe({},I,ue))},{})},z8t=function(e,n){var s=e.x,i=e.y,o=n.x,c=n.y;return Math.sqrt(Math.pow(s-o,2)+Math.pow(i-c,2))},B8t=function(e,n){var s=e.x,i=e.y,o=n.cx,c=n.cy,a=z8t({x:s,y:i},{x:o,y:c});if(a<=0)return{radius:a};var f=(s-o)/a,m=Math.acos(f);return i>c&&(m=2*Math.PI-m),{radius:a,angle:R8t(m),angleInRadian:m}},$8t=function(e){var n=e.startAngle,s=e.endAngle,i=Math.floor(n/360),o=Math.floor(s/360),c=Math.min(i,o);return{startAngle:n-c*360,endAngle:s-c*360}},U8t=function(e,n){var s=n.startAngle,i=n.endAngle,o=Math.floor(s/360),c=Math.floor(i/360),a=Math.min(o,c);return e+a*360},vCe=function(e,n){var s=e.x,i=e.y,o=B8t({x:s,y:i},n),c=o.radius,a=o.angle,f=n.innerRadius,m=n.outerRadius;if(cm)return!1;if(c===0)return!0;var y=$8t(n),v=y.startAngle,w=y.endAngle,k=a,C;if(v<=w){for(;k>w;)k-=360;for(;k=v&&k<=w}else{for(;k>v;)k-=360;for(;k=w&&k<=v}return C?fy(fy({},n),{},{radius:c,angle:U8t(k,n)}):null},UBe=function(e){return!P.isValidElement(e)&&!Pi(e)&&typeof e!="boolean"?e.className:""};function pE(t){"@babel/helpers - typeof";return pE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pE(t)}var q8t=["offset"];function V8t(t){return K8t(t)||G8t(t)||W8t(t)||H8t()}function H8t(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function W8t(t,e){if(t){if(typeof t=="string")return $fe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return $fe(t,e)}}function G8t(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function K8t(t){if(Array.isArray(t))return $fe(t)}function $fe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,s=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function Y8t(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}function _Ce(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,s)}return n}function Tc(t){for(var e=1;e=0?1:-1,D,$;i==="insideStart"?(D=k+A*c,$=S):i==="insideEnd"?(D=C-A*c,$=!S):i==="end"&&(D=C+A*c,$=S),$=I<=0?$:!$;var F=Ko(m,y,T,D),q=Ko(m,y,T,D+($?1:-1)*359),W="M".concat(F.x,",").concat(F.y,` A`).concat(T,",").concat(T,",0,1,").concat($?0:1,`, `).concat(q.x,",").concat(q.y),K=pa(e.id)?_I("recharts-radial-line-"):e.id;return lt.createElement("text",mE({},s,{dominantBaseline:"central",className:ta("recharts-radial-bar-label",a)}),lt.createElement("defs",null,lt.createElement("path",{id:K,d:W})),lt.createElement("textPath",{xlinkHref:"#".concat(K)},n))},nRt=function(e){var n=e.viewBox,s=e.offset,i=e.position,o=n,c=o.cx,a=o.cy,f=o.innerRadius,m=o.outerRadius,y=o.startAngle,v=o.endAngle,w=(y+v)/2;if(i==="outside"){var k=Ko(c,a,m+s,w),C=k.x,S=k.y;return{x:C,y:S,textAnchor:C>=c?"start":"end",verticalAnchor:"middle"}}if(i==="center")return{x:c,y:a,textAnchor:"middle",verticalAnchor:"middle"};if(i==="centerTop")return{x:c,y:a,textAnchor:"middle",verticalAnchor:"start"};if(i==="centerBottom")return{x:c,y:a,textAnchor:"middle",verticalAnchor:"end"};var T=(f+m)/2,I=Ko(c,a,T,w),A=I.x,D=I.y;return{x:A,y:D,textAnchor:"middle",verticalAnchor:"middle"}},sRt=function(e){var n=e.viewBox,s=e.parentViewBox,i=e.offset,o=e.position,c=n,a=c.x,f=c.y,m=c.width,y=c.height,v=y>=0?1:-1,w=v*i,k=v>0?"end":"start",C=v>0?"start":"end",S=m>=0?1:-1,T=S*i,I=S>0?"end":"start",A=S>0?"start":"end";if(o==="top"){var D={x:a+m/2,y:f-v*i,textAnchor:"middle",verticalAnchor:k};return Tc(Tc({},D),s?{height:Math.max(f-s.y,0),width:m}:{})}if(o==="bottom"){var $={x:a+m/2,y:f+y+w,textAnchor:"middle",verticalAnchor:C};return Tc(Tc({},$),s?{height:Math.max(s.y+s.height-(f+y),0),width:m}:{})}if(o==="left"){var F={x:a-T,y:f+y/2,textAnchor:I,verticalAnchor:"middle"};return Tc(Tc({},F),s?{width:Math.max(F.x-s.x,0),height:y}:{})}if(o==="right"){var q={x:a+m+T,y:f+y/2,textAnchor:A,verticalAnchor:"middle"};return Tc(Tc({},q),s?{width:Math.max(s.x+s.width-q.x,0),height:y}:{})}var W=s?{width:m,height:y}:{};return o==="insideLeft"?Tc({x:a+T,y:f+y/2,textAnchor:A,verticalAnchor:"middle"},W):o==="insideRight"?Tc({x:a+m-T,y:f+y/2,textAnchor:I,verticalAnchor:"middle"},W):o==="insideTop"?Tc({x:a+m/2,y:f+w,textAnchor:"middle",verticalAnchor:C},W):o==="insideBottom"?Tc({x:a+m/2,y:f+y-w,textAnchor:"middle",verticalAnchor:k},W):o==="insideTopLeft"?Tc({x:a+T,y:f+w,textAnchor:A,verticalAnchor:C},W):o==="insideTopRight"?Tc({x:a+m-T,y:f+w,textAnchor:I,verticalAnchor:C},W):o==="insideBottomLeft"?Tc({x:a+T,y:f+y-w,textAnchor:A,verticalAnchor:k},W):o==="insideBottomRight"?Tc({x:a+m-T,y:f+y-w,textAnchor:I,verticalAnchor:k},W):KC(o)&&(Pn(o.x)||vw(o.x))&&(Pn(o.y)||vw(o.y))?Tc({x:a+ku(o.x,m),y:f+ku(o.y,y),textAnchor:"end",verticalAnchor:"end"},W):Tc({x:a+m/2,y:f+y/2,textAnchor:"middle",verticalAnchor:"middle"},W)},iRt=function(e){return"cx"in e&&Pn(e.cx)};function td(t){var e=t.offset,n=e===void 0?5:e,s=Z8t(t,q8t),i=Tc({offset:n},s),o=i.viewBox,c=i.position,a=i.value,f=i.children,m=i.content,y=i.className,v=y===void 0?"":y,w=i.textBreakAll;if(!o||pa(a)&&pa(f)&&!P.isValidElement(m)&&!Pi(m))return null;if(P.isValidElement(m))return P.cloneElement(m,i);var k;if(Pi(m)){if(k=P.createElement(m,i),P.isValidElement(k))return k}else k=eRt(i);var C=iRt(o),S=ki(i,!0);if(C&&(c==="insideStart"||c==="insideEnd"||c==="end"))return rRt(i,k,S);var T=C?nRt(i):sRt(i);return lt.createElement(Aj,mE({className:ta("recharts-label",v)},S,T,{breakAll:w}),k)}td.displayName="Label";var qBe=function(e){var n=e.cx,s=e.cy,i=e.angle,o=e.startAngle,c=e.endAngle,a=e.r,f=e.radius,m=e.innerRadius,y=e.outerRadius,v=e.x,w=e.y,k=e.top,C=e.left,S=e.width,T=e.height,I=e.clockWise,A=e.labelViewBox;if(A)return A;if(Pn(S)&&Pn(T)){if(Pn(v)&&Pn(w))return{x:v,y:w,width:S,height:T};if(Pn(k)&&Pn(C))return{x:k,y:C,width:S,height:T}}return Pn(v)&&Pn(w)?{x:v,y:w,width:0,height:0}:Pn(n)&&Pn(s)?{cx:n,cy:s,startAngle:o||i||0,endAngle:c||i||0,innerRadius:m||0,outerRadius:y||f||a||0,clockWise:I}:e.viewBox?e.viewBox:{}},aRt=function(e,n){return e?e===!0?lt.createElement(td,{key:"label-implicit",viewBox:n}):Rc(e)?lt.createElement(td,{key:"label-implicit",viewBox:n,value:e}):P.isValidElement(e)?e.type===td?P.cloneElement(e,{key:"label-implicit",viewBox:n}):lt.createElement(td,{key:"label-implicit",content:e,viewBox:n}):Pi(e)?lt.createElement(td,{key:"label-implicit",content:e,viewBox:n}):KC(e)?lt.createElement(td,mE({viewBox:n},e,{key:"label-implicit"})):null:null},oRt=function(e,n){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&s&&!e.label)return null;var i=e.children,o=qBe(e),c=Vf(i,td).map(function(f,m){return P.cloneElement(f,{viewBox:n||o,key:"label-".concat(m)})});if(!s)return c;var a=aRt(e.label,n||o);return[a].concat(V8t(c))};td.parseViewBox=qBe;td.renderCallByParent=oRt;function lRt(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var cRt=lRt;const dRt=Oa(cRt);function gE(t){"@babel/helpers - typeof";return gE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gE(t)}var uRt=["valueAccessor"],hRt=["data","dataKey","clockWise","id","textBreakAll"];function fRt(t){return yRt(t)||gRt(t)||mRt(t)||pRt()}function pRt(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mRt(t,e){if(t){if(typeof t=="string")return Ufe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ufe(t,e)}}function gRt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function yRt(t){if(Array.isArray(t))return Ufe(t)}function Ufe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,s=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function bRt(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}var wRt=function(e){return Array.isArray(e.value)?dRt(e.value):e.value};function d1(t){var e=t.valueAccessor,n=e===void 0?wRt:e,s=jCe(t,uRt),i=s.data,o=s.dataKey,c=s.clockWise,a=s.id,f=s.textBreakAll,m=jCe(s,hRt);return!i||!i.length?null:lt.createElement(vo,{className:"recharts-label-list"},i.map(function(y,v){var w=pa(o)?n(y,v):qd(y&&y.payload,o),k=pa(a)?{}:{id:"".concat(a,"-").concat(v)};return lt.createElement(td,Lre({},ki(y,!0),m,k,{parentViewBox:y.parentViewBox,value:w,textBreakAll:f,viewBox:td.parseViewBox(pa(c)?y:wCe(wCe({},y),{},{clockWise:c})),key:"label-".concat(v),index:v}))}))}d1.displayName="LabelList";function jRt(t,e){return t?t===!0?lt.createElement(d1,{key:"labelList-implicit",data:e}):lt.isValidElement(t)||Pi(t)?lt.createElement(d1,{key:"labelList-implicit",data:e,content:t}):KC(t)?lt.createElement(d1,Lre({data:e},t,{key:"labelList-implicit"})):null:null}function kRt(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&n&&!t.label)return null;var s=t.children,i=Vf(s,d1).map(function(c,a){return P.cloneElement(c,{data:e,key:"labelList-".concat(a)})});if(!n)return i;var o=jRt(t.label,e);return[o].concat(fRt(i))}d1.renderCallByParent=kRt;function yE(t){"@babel/helpers - typeof";return yE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},yE(t)}function qfe(){return qfe=Object.assign?Object.assign.bind():function(t){for(var e=1;e180),",").concat(+(c>m),`, `).concat(v.x,",").concat(v.y,` `);if(i>0){var k=Ko(n,s,i,c),C=Ko(n,s,i,m);w+="L ".concat(C.x,",").concat(C.y,` A `).concat(i,",").concat(i,`,0, `).concat(+(Math.abs(f)>180),",").concat(+(c<=m),`, `).concat(k.x,",").concat(k.y," Z")}else w+="L ".concat(n,",").concat(s," Z");return w},TRt=function(e){var n=e.cx,s=e.cy,i=e.innerRadius,o=e.outerRadius,c=e.cornerRadius,a=e.forceCornerRadius,f=e.cornerIsExternal,m=e.startAngle,y=e.endAngle,v=ju(y-m),w=AL({cx:n,cy:s,radius:o,angle:m,sign:v,cornerRadius:c,cornerIsExternal:f}),k=w.circleTangency,C=w.lineTangency,S=w.theta,T=AL({cx:n,cy:s,radius:o,angle:y,sign:-v,cornerRadius:c,cornerIsExternal:f}),I=T.circleTangency,A=T.lineTangency,D=T.theta,$=f?Math.abs(m-y):Math.abs(m-y)-S-D;if($<0)return a?"M ".concat(C.x,",").concat(C.y,` a`).concat(c,",").concat(c,",0,0,1,").concat(c*2,`,0 a`).concat(c,",").concat(c,",0,0,1,").concat(-c*2,`,0 `):VBe({cx:n,cy:s,innerRadius:i,outerRadius:o,startAngle:m,endAngle:y});var F="M ".concat(C.x,",").concat(C.y,` A`).concat(c,",").concat(c,",0,0,").concat(+(v<0),",").concat(k.x,",").concat(k.y,` A`).concat(o,",").concat(o,",0,").concat(+($>180),",").concat(+(v<0),",").concat(I.x,",").concat(I.y,` A`).concat(c,",").concat(c,",0,0,").concat(+(v<0),",").concat(A.x,",").concat(A.y,` `);if(i>0){var q=AL({cx:n,cy:s,radius:i,angle:m,sign:v,isExternal:!0,cornerRadius:c,cornerIsExternal:f}),W=q.circleTangency,K=q.lineTangency,Z=q.theta,re=AL({cx:n,cy:s,radius:i,angle:y,sign:-v,isExternal:!0,cornerRadius:c,cornerIsExternal:f}),he=re.circleTangency,ue=re.lineTangency,Ne=re.theta,se=f?Math.abs(m-y):Math.abs(m-y)-Z-Ne;if(se<0&&c===0)return"".concat(F,"L").concat(n,",").concat(s,"Z");F+="L".concat(ue.x,",").concat(ue.y,` A`).concat(c,",").concat(c,",0,0,").concat(+(v<0),",").concat(he.x,",").concat(he.y,` A`).concat(i,",").concat(i,",0,").concat(+(se>180),",").concat(+(v>0),",").concat(W.x,",").concat(W.y,` A`).concat(c,",").concat(c,",0,0,").concat(+(v<0),",").concat(K.x,",").concat(K.y,"Z")}else F+="L".concat(n,",").concat(s,"Z");return F},ARt={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},HBe=function(e){var n=NCe(NCe({},ARt),e),s=n.cx,i=n.cy,o=n.innerRadius,c=n.outerRadius,a=n.cornerRadius,f=n.forceCornerRadius,m=n.cornerIsExternal,y=n.startAngle,v=n.endAngle,w=n.className;if(c0&&Math.abs(y-v)<360?T=TRt({cx:s,cy:i,innerRadius:o,outerRadius:c,cornerRadius:Math.min(S,C/2),forceCornerRadius:f,cornerIsExternal:m,startAngle:y,endAngle:v}):T=VBe({cx:s,cy:i,innerRadius:o,outerRadius:c,startAngle:y,endAngle:v}),lt.createElement("path",qfe({},ki(n,!0),{className:k,d:T,role:"img"}))};function xE(t){"@babel/helpers - typeof";return xE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},xE(t)}function Vfe(){return Vfe=Object.assign?Object.assign.bind():function(t){for(var e=1;e0;)if(!n.equals(t[s],e[s],s,s,t,e,n))return!1;return!0}function ZRt(t,e){return Vj(t.getTime(),e.getTime())}function YRt(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function XRt(t,e){return t===e}function PCe(t,e,n){var s=t.size;if(s!==e.size)return!1;if(!s)return!0;for(var i=new Array(s),o=t.entries(),c,a,f=0;(c=o.next())&&!c.done;){for(var m=e.entries(),y=!1,v=0;(a=m.next())&&!a.done;){if(i[v]){v++;continue}var w=c.value,k=a.value;if(n.equals(w[0],k[0],f,v,t,e,n)&&n.equals(w[1],k[1],w[0],k[0],t,e,n)){y=i[v]=!0;break}v++}if(!y)return!1;f++}return!0}var QRt=Vj;function JRt(t,e,n){var s=ICe(t),i=s.length;if(ICe(e).length!==i)return!1;for(;i-- >0;)if(!ZBe(t,e,n,s[i]))return!1;return!0}function T5(t,e,n){var s=ACe(t),i=s.length;if(ACe(e).length!==i)return!1;for(var o,c,a;i-- >0;)if(o=s[i],!ZBe(t,e,n,o)||(c=ECe(t,o),a=ECe(e,o),(c||a)&&(!c||!a||c.configurable!==a.configurable||c.enumerable!==a.enumerable||c.writable!==a.writable)))return!1;return!0}function eFt(t,e){return Vj(t.valueOf(),e.valueOf())}function tFt(t,e){return t.source===e.source&&t.flags===e.flags}function LCe(t,e,n){var s=t.size;if(s!==e.size)return!1;if(!s)return!0;for(var i=new Array(s),o=t.values(),c,a;(c=o.next())&&!c.done;){for(var f=e.values(),m=!1,y=0;(a=f.next())&&!a.done;){if(!i[y]&&n.equals(c.value,a.value,c.value,a.value,t,e,n)){m=i[y]=!0;break}y++}if(!m)return!1}return!0}function rFt(t,e){var n=t.length;if(e.length!==n)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function nFt(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function ZBe(t,e,n,s){return(s===GRt||s===WRt||s===HRt)&&(t.$$typeof||e.$$typeof)?!0:VRt(e,s)&&n.equals(t[s],e[s],s,s,t,e,n)}var sFt="[object Arguments]",iFt="[object Boolean]",aFt="[object Date]",oFt="[object Error]",lFt="[object Map]",cFt="[object Number]",dFt="[object Object]",uFt="[object RegExp]",hFt="[object Set]",fFt="[object String]",pFt="[object URL]",mFt=Array.isArray,OCe=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,DCe=Object.assign,gFt=Object.prototype.toString.call.bind(Object.prototype.toString);function yFt(t){var e=t.areArraysEqual,n=t.areDatesEqual,s=t.areErrorsEqual,i=t.areFunctionsEqual,o=t.areMapsEqual,c=t.areNumbersEqual,a=t.areObjectsEqual,f=t.arePrimitiveWrappersEqual,m=t.areRegExpsEqual,y=t.areSetsEqual,v=t.areTypedArraysEqual,w=t.areUrlsEqual;return function(C,S,T){if(C===S)return!0;if(C==null||S==null)return!1;var I=typeof C;if(I!==typeof S)return!1;if(I!=="object")return I==="number"?c(C,S,T):I==="function"?i(C,S,T):!1;var A=C.constructor;if(A!==S.constructor)return!1;if(A===Object)return a(C,S,T);if(mFt(C))return e(C,S,T);if(OCe!=null&&OCe(C))return v(C,S,T);if(A===Date)return n(C,S,T);if(A===RegExp)return m(C,S,T);if(A===Map)return o(C,S,T);if(A===Set)return y(C,S,T);var D=gFt(C);return D===aFt?n(C,S,T):D===uFt?m(C,S,T):D===lFt?o(C,S,T):D===hFt?y(C,S,T):D===dFt?typeof C.then!="function"&&typeof S.then!="function"&&a(C,S,T):D===pFt?w(C,S,T):D===oFt?s(C,S,T):D===sFt?a(C,S,T):D===iFt||D===cFt||D===fFt?f(C,S,T):!1}}function xFt(t){var e=t.circular,n=t.createCustomConfig,s=t.strict,i={areArraysEqual:s?T5:KRt,areDatesEqual:ZRt,areErrorsEqual:YRt,areFunctionsEqual:XRt,areMapsEqual:s?TCe(PCe,T5):PCe,areNumbersEqual:QRt,areObjectsEqual:s?T5:JRt,arePrimitiveWrappersEqual:eFt,areRegExpsEqual:tFt,areSetsEqual:s?TCe(LCe,T5):LCe,areTypedArraysEqual:s?T5:rFt,areUrlsEqual:nFt};if(n&&(i=DCe({},i,n(i))),e){var o=IL(i.areArraysEqual),c=IL(i.areMapsEqual),a=IL(i.areObjectsEqual),f=IL(i.areSetsEqual);i=DCe({},i,{areArraysEqual:o,areMapsEqual:c,areObjectsEqual:a,areSetsEqual:f})}return i}function vFt(t){return function(e,n,s,i,o,c,a){return t(e,n,a)}}function _Ft(t){var e=t.circular,n=t.comparator,s=t.createState,i=t.equals,o=t.strict;if(s)return function(f,m){var y=s(),v=y.cache,w=v===void 0?e?new WeakMap:void 0:v,k=y.meta;return n(f,m,{cache:w,equals:i,meta:k,strict:o})};if(e)return function(f,m){return n(f,m,{cache:new WeakMap,equals:i,meta:void 0,strict:o})};var c={cache:void 0,equals:i,meta:void 0,strict:o};return function(f,m){return n(f,m,c)}}var bFt=B1();B1({strict:!0});B1({circular:!0});B1({circular:!0,strict:!0});B1({createInternalComparator:function(){return Vj}});B1({strict:!0,createInternalComparator:function(){return Vj}});B1({circular:!0,createInternalComparator:function(){return Vj}});B1({circular:!0,createInternalComparator:function(){return Vj},strict:!0});function B1(t){t===void 0&&(t={});var e=t.circular,n=e===void 0?!1:e,s=t.createInternalComparator,i=t.createState,o=t.strict,c=o===void 0?!1:o,a=xFt(t),f=yFt(a),m=s?s(f):vFt(f);return _Ft({circular:n,comparator:f,createState:i,equals:m,strict:c})}function wFt(t){typeof requestAnimationFrame<"u"&&requestAnimationFrame(t)}function RCe(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1,s=function i(o){n<0&&(n=o),o-n>e?(t(o),n=-1):wFt(i)};requestAnimationFrame(s)}function Wfe(t){"@babel/helpers - typeof";return Wfe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Wfe(t)}function jFt(t){return CFt(t)||SFt(t)||NFt(t)||kFt()}function kFt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function NFt(t,e){if(t){if(typeof t=="string")return FCe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return FCe(t,e)}}function FCe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,s=new Array(e);nt.length)&&(e=t.length);for(var n=0,s=new Array(e);n1?1:I<0?0:I},S=function(I){for(var A=I>1?1:I,D=A,$=0;$<8;++$){var F=v(D)-A,q=k(D);if(Math.abs(F-A)0&&arguments[0]!==void 0?arguments[0]:{},n=e.stiff,s=n===void 0?100:n,i=e.damping,o=i===void 0?8:i,c=e.dt,a=c===void 0?17:c,f=function(y,v,w){var k=-(y-v)*s,C=w*o,S=w+(k-C)*a/1e3,T=w*a/1e3+y;return Math.abs(T-v)t.length)&&(e=t.length);for(var n=0,s=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function szt(t,e){if(t==null)return{};var n={},s=Object.keys(t),i,o;for(o=0;o=0)&&(n[i]=t[i]);return n}function Kce(t){return lzt(t)||ozt(t)||azt(t)||izt()}function izt(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function azt(t,e){if(t){if(typeof t=="string")return Xfe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Xfe(t,e)}}function ozt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function lzt(t){if(Array.isArray(t))return Xfe(t)}function Xfe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,s=new Array(e);n"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Rre(t){return Rre=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Rre(t)}var Zy=function(t){fzt(n,t);var e=pzt(n);function n(s,i){var o;czt(this,n),o=e.call(this,s,i);var c=o.props,a=c.isActive,f=c.attributeName,m=c.from,y=c.to,v=c.steps,w=c.children,k=c.duration;if(o.handleStyleChange=o.handleStyleChange.bind(epe(o)),o.changeStyle=o.changeStyle.bind(epe(o)),!a||k<=0)return o.state={style:{}},typeof w=="function"&&(o.state={style:y}),Jfe(o);if(v&&v.length)o.state={style:v[0].style};else if(m){if(typeof w=="function")return o.state={style:m},Jfe(o);o.state={style:f?G5({},f,m):m}}else o.state={style:{}};return o}return uzt(n,[{key:"componentDidMount",value:function(){var i=this.props,o=i.isActive,c=i.canBegin;this.mounted=!0,!(!o||!c)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(i){var o=this.props,c=o.isActive,a=o.canBegin,f=o.attributeName,m=o.shouldReAnimate,y=o.to,v=o.from,w=this.state.style;if(a){if(!c){var k={style:f?G5({},f,y):y};this.state&&w&&(f&&w[f]!==y||!f&&w!==y)&&this.setState(k);return}if(!(bFt(i.to,y)&&i.canBegin&&i.isActive)){var C=!i.canBegin||!i.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var S=C||m?v:i.to;if(this.state&&w){var T={style:f?G5({},f,S):S};(f&&w[f]!==S||!f&&w!==S)&&this.setState(T)}this.runAnimation(Ep(Ep({},this.props),{},{from:S,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var i=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),i&&i()}},{key:"handleStyleChange",value:function(i){this.changeStyle(i)}},{key:"changeStyle",value:function(i){this.mounted&&this.setState({style:i})}},{key:"runJSAnimation",value:function(i){var o=this,c=i.from,a=i.to,f=i.duration,m=i.easing,y=i.begin,v=i.onAnimationEnd,w=i.onAnimationStart,k=tzt(c,a,VFt(m),f,this.changeStyle),C=function(){o.stopJSAnimation=k()};this.manager.start([w,y,C,f,v])}},{key:"runStepAnimation",value:function(i){var o=this,c=i.steps,a=i.begin,f=i.onAnimationStart,m=c[0],y=m.style,v=m.duration,w=v===void 0?0:v,k=function(S,T,I){if(I===0)return S;var A=T.duration,D=T.easing,$=D===void 0?"ease":D,F=T.style,q=T.properties,W=T.onAnimationEnd,K=I>0?c[I-1]:T,Z=q||Object.keys(F);if(typeof $=="function"||$==="spring")return[].concat(Kce(S),[o.runJSAnimation.bind(o,{from:K.style,to:F,duration:A,easing:$}),A]);var re=$Ce(Z,A,$),he=Ep(Ep(Ep({},K.style),F),{},{transition:re});return[].concat(Kce(S),[he,A,W]).filter(IFt)};return this.manager.start([f].concat(Kce(c.reduce(k,[y,Math.max(w,a)])),[i.onAnimationEnd]))}},{key:"runAnimation",value:function(i){this.manager||(this.manager=MFt());var o=i.begin,c=i.duration,a=i.attributeName,f=i.to,m=i.easing,y=i.onAnimationStart,v=i.onAnimationEnd,w=i.steps,k=i.children,C=this.manager;if(this.unSubscribe=C.subscribe(this.handleStyleChange),typeof m=="function"||typeof k=="function"||m==="spring"){this.runJSAnimation(i);return}if(w.length>1){this.runStepAnimation(i);return}var S=a?G5({},a,f):f,T=$Ce(Object.keys(S),c,m);C.start([y,o,Ep(Ep({},S),{},{transition:T}),c,v])}},{key:"render",value:function(){var i=this.props,o=i.children;i.begin;var c=i.duration;i.attributeName,i.easing;var a=i.isActive;i.steps,i.from,i.to,i.canBegin,i.onAnimationEnd,i.shouldReAnimate,i.onAnimationReStart;var f=nzt(i,rzt),m=P.Children.count(o),y=this.state.style;if(typeof o=="function")return o(y);if(!a||m===0||c<=0)return o;var v=function(k){var C=k.props,S=C.style,T=S===void 0?{}:S,I=C.className,A=P.cloneElement(k,Ep(Ep({},f),{},{style:Ep(Ep({},T),y),className:I}));return A};return m===1?v(P.Children.only(o)):lt.createElement("div",null,P.Children.map(o,function(w){return v(w)}))}}]),n}(P.PureComponent);Zy.displayName="Animate";Zy.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};Zy.propTypes={from:co.oneOfType([co.object,co.string]),to:co.oneOfType([co.object,co.string]),attributeName:co.string,duration:co.number,begin:co.number,easing:co.oneOfType([co.string,co.func]),steps:co.arrayOf(co.shape({duration:co.number.isRequired,style:co.object.isRequired,easing:co.oneOfType([co.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),co.func]),properties:co.arrayOf("string"),onAnimationEnd:co.func})),children:co.oneOfType([co.node,co.func]),isActive:co.bool,canBegin:co.bool,onAnimationEnd:co.func,shouldReAnimate:co.bool,onAnimationStart:co.func,onAnimationReStart:co.func};function bE(t){"@babel/helpers - typeof";return bE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},bE(t)}function Fre(){return Fre=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,s=new Array(e);n=0?1:-1,f=s>=0?1:-1,m=i>=0&&s>=0||i<0&&s<0?1:0,y;if(c>0&&o instanceof Array){for(var v=[0,0,0,0],w=0,k=4;wc?c:o[w];y="M".concat(e,",").concat(n+a*v[0]),v[0]>0&&(y+="A ".concat(v[0],",").concat(v[0],",0,0,").concat(m,",").concat(e+f*v[0],",").concat(n)),y+="L ".concat(e+s-f*v[1],",").concat(n),v[1]>0&&(y+="A ".concat(v[1],",").concat(v[1],",0,0,").concat(m,`, `).concat(e+s,",").concat(n+a*v[1])),y+="L ".concat(e+s,",").concat(n+i-a*v[2]),v[2]>0&&(y+="A ".concat(v[2],",").concat(v[2],",0,0,").concat(m,`, `).concat(e+s-f*v[2],",").concat(n+i)),y+="L ".concat(e+f*v[3],",").concat(n+i),v[3]>0&&(y+="A ".concat(v[3],",").concat(v[3],",0,0,").concat(m,`, `).concat(e,",").concat(n+i-a*v[3])),y+="Z"}else if(c>0&&o===+o&&o>0){var C=Math.min(c,o);y="M ".concat(e,",").concat(n+a*C,` A `).concat(C,",").concat(C,",0,0,").concat(m,",").concat(e+f*C,",").concat(n,` L `).concat(e+s-f*C,",").concat(n,` A `).concat(C,",").concat(C,",0,0,").concat(m,",").concat(e+s,",").concat(n+a*C,` L `).concat(e+s,",").concat(n+i-a*C,` A `).concat(C,",").concat(C,",0,0,").concat(m,",").concat(e+s-f*C,",").concat(n+i,` L `).concat(e+f*C,",").concat(n+i,` A `).concat(C,",").concat(C,",0,0,").concat(m,",").concat(e,",").concat(n+i-a*C," Z")}else y="M ".concat(e,",").concat(n," h ").concat(s," v ").concat(i," h ").concat(-s," Z");return y},kzt=function(e,n){if(!e||!n)return!1;var s=e.x,i=e.y,o=n.x,c=n.y,a=n.width,f=n.height;if(Math.abs(a)>0&&Math.abs(f)>0){var m=Math.min(o,o+a),y=Math.max(o,o+a),v=Math.min(c,c+f),w=Math.max(c,c+f);return s>=m&&s<=y&&i>=v&&i<=w}return!1},Nzt={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},s0e=function(e){var n=ZCe(ZCe({},Nzt),e),s=P.useRef(),i=P.useState(-1),o=gzt(i,2),c=o[0],a=o[1];P.useEffect(function(){if(s.current&&s.current.getTotalLength)try{var $=s.current.getTotalLength();$&&a($)}catch{}},[]);var f=n.x,m=n.y,y=n.width,v=n.height,w=n.radius,k=n.className,C=n.animationEasing,S=n.animationDuration,T=n.animationBegin,I=n.isAnimationActive,A=n.isUpdateAnimationActive;if(f!==+f||m!==+m||y!==+y||v!==+v||y===0||v===0)return null;var D=ta("recharts-rectangle",k);return A?lt.createElement(Zy,{canBegin:c>0,from:{width:y,height:v,x:f,y:m},to:{width:y,height:v,x:f,y:m},duration:S,animationEasing:C,isActive:A},function($){var F=$.width,q=$.height,W=$.x,K=$.y;return lt.createElement(Zy,{canBegin:c>0,from:"0px ".concat(c===-1?1:c,"px"),to:"".concat(c,"px 0px"),attributeName:"strokeDasharray",begin:T,duration:S,isActive:I,easing:C},lt.createElement("path",Fre({},ki(n,!0),{className:D,d:YCe(W,K,F,q,w),ref:s})))}):lt.createElement("path",Fre({},ki(n,!0),{className:D,d:YCe(f,m,y,v,w)}))},Szt=["points","className","baseLinePoints","connectNulls"];function xS(){return xS=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function Mzt(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}function XCe(t){return Izt(t)||Ezt(t)||Azt(t)||Tzt()}function Tzt(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Azt(t,e){if(t){if(typeof t=="string")return tpe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return tpe(t,e)}}function Ezt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Izt(t){if(Array.isArray(t))return tpe(t)}function tpe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,s=new Array(e);n0&&arguments[0]!==void 0?arguments[0]:[],n=[[]];return e.forEach(function(s){QCe(s)?n[n.length-1].push(s):n[n.length-1].length>0&&n.push([])}),QCe(e[0])&&n[n.length-1].push(e[0]),n[n.length-1].length<=0&&(n=n.slice(0,-1)),n},sA=function(e,n){var s=Pzt(e);n&&(s=[s.reduce(function(o,c){return[].concat(XCe(o),XCe(c))},[])]);var i=s.map(function(o){return o.reduce(function(c,a,f){return"".concat(c).concat(f===0?"M":"L").concat(a.x,",").concat(a.y)},"")}).join("");return s.length===1?"".concat(i,"Z"):i},Lzt=function(e,n,s){var i=sA(e,s);return"".concat(i.slice(-1)==="Z"?i.slice(0,-1):i,"L").concat(sA(n.reverse(),s).slice(1))},Ozt=function(e){var n=e.points,s=e.className,i=e.baseLinePoints,o=e.connectNulls,c=Czt(e,Szt);if(!n||!n.length)return null;var a=ta("recharts-polygon",s);if(i&&i.length){var f=c.stroke&&c.stroke!=="none",m=Lzt(n,i,o);return lt.createElement("g",{className:a},lt.createElement("path",xS({},ki(c,!0),{fill:m.slice(-1)==="Z"?c.fill:"none",stroke:"none",d:m})),f?lt.createElement("path",xS({},ki(c,!0),{fill:"none",d:sA(n,o)})):null,f?lt.createElement("path",xS({},ki(c,!0),{fill:"none",d:sA(i,o)})):null)}var y=sA(n,o);return lt.createElement("path",xS({},ki(c,!0),{fill:y.slice(-1)==="Z"?c.fill:"none",className:a,d:y}))};function rpe(){return rpe=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function Uzt(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}var qzt=function(e,n,s,i,o,c){return"M".concat(e,",").concat(o,"v").concat(i,"M").concat(c,",").concat(n,"h").concat(s)},Vzt=function(e){var n=e.x,s=n===void 0?0:n,i=e.y,o=i===void 0?0:i,c=e.top,a=c===void 0?0:c,f=e.left,m=f===void 0?0:f,y=e.width,v=y===void 0?0:y,w=e.height,k=w===void 0?0:w,C=e.className,S=$zt(e,Dzt),T=Rzt({x:s,y:o,top:a,left:m,width:v,height:k},S);return!Pn(s)||!Pn(o)||!Pn(v)||!Pn(k)||!Pn(a)||!Pn(m)?null:lt.createElement("path",npe({},ki(T,!0),{className:ta("recharts-cross",C),d:qzt(s,o,v,k,a,m)}))},Hzt=hie,Wzt=fBe,Gzt=Ig;function Kzt(t,e){return t&&t.length?Hzt(t,Gzt(e),Wzt):void 0}var Zzt=Kzt;const Yzt=Oa(Zzt);var Xzt=hie,Qzt=Ig,Jzt=pBe;function e7t(t,e){return t&&t.length?Xzt(t,Qzt(e),Jzt):void 0}var t7t=e7t;const r7t=Oa(t7t);var n7t=["cx","cy","angle","ticks","axisLine"],s7t=["ticks","tick","angle","tickFormatter","stroke"];function dC(t){"@babel/helpers - typeof";return dC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},dC(t)}function iA(){return iA=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function i7t(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}function a7t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r3e(t,e){for(var n=0;ni3e?c=i==="outer"?"start":"end":o<-i3e?c=i==="outer"?"end":"start":c="middle",c}},{key:"renderAxisLine",value:function(){var s=this.props,i=s.cx,o=s.cy,c=s.radius,a=s.axisLine,f=s.axisLineType,m=Rv(Rv({},ki(this.props,!1)),{},{fill:"none"},ki(a,!1));if(f==="circle")return lt.createElement(i0e,lw({className:"recharts-polar-angle-axis-line"},m,{cx:i,cy:o,r:c}));var y=this.props.ticks,v=y.map(function(w){return Ko(i,o,c,w.coordinate)});return lt.createElement(Ozt,lw({className:"recharts-polar-angle-axis-line"},m,{points:v}))}},{key:"renderTicks",value:function(){var s=this,i=this.props,o=i.ticks,c=i.tick,a=i.tickLine,f=i.tickFormatter,m=i.stroke,y=ki(this.props,!1),v=ki(c,!1),w=Rv(Rv({},y),{},{fill:"none"},ki(a,!1)),k=o.map(function(C,S){var T=s.getTickLineCoord(C),I=s.getTickTextAnchor(C),A=Rv(Rv(Rv({textAnchor:I},y),{},{stroke:"none",fill:m},v),{},{index:S,payload:C,x:T.x2,y:T.y2});return lt.createElement(vo,lw({className:ta("recharts-polar-angle-axis-tick",UBe(c)),key:"tick-".concat(C.coordinate)},Tj(s.props,C,S)),a&<.createElement("line",lw({className:"recharts-polar-angle-axis-tick-line"},w,T)),c&&e.renderTickItem(c,A,f?f(C.value,S):C.value))});return lt.createElement(vo,{className:"recharts-polar-angle-axis-ticks"},k)}},{key:"render",value:function(){var s=this.props,i=s.ticks,o=s.radius,c=s.axisLine;return o<=0||!i||!i.length?null:lt.createElement(vo,{className:ta("recharts-polar-angle-axis",this.props.className)},c&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(s,i,o){var c;return lt.isValidElement(s)?c=lt.cloneElement(s,i):Pi(s)?c=s(i):c=lt.createElement(Aj,lw({},i,{className:"recharts-polar-angle-axis-tick-value"}),o),c}}])}(P.PureComponent);bie(wie,"displayName","PolarAngleAxis");bie(wie,"axisType","angleAxis");bie(wie,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var b7t=c7e,w7t=b7t(Object.getPrototypeOf,Object),j7t=w7t,k7t=Jy,N7t=j7t,S7t=ex,C7t="[object Object]",M7t=Function.prototype,T7t=Object.prototype,a9e=M7t.toString,A7t=T7t.hasOwnProperty,E7t=a9e.call(Object);function I7t(t){if(!S7t(t)||k7t(t)!=C7t)return!1;var e=N7t(t);if(e===null)return!0;var n=A7t.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&a9e.call(n)==E7t}var P7t=I7t;const L7t=Oa(P7t);var O7t=Jy,D7t=ex,R7t="[object Boolean]";function F7t(t){return t===!0||t===!1||D7t(t)&&O7t(t)==R7t}var z7t=F7t;const B7t=Oa(z7t);function jE(t){"@babel/helpers - typeof";return jE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},jE(t)}function $re(){return $re=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,s=new Array(e);n0,from:{upperWidth:0,lowerWidth:0,height:w,x:f,y:m},to:{upperWidth:y,lowerWidth:v,height:w,x:f,y:m},duration:S,animationEasing:C,isActive:I},function(D){var $=D.upperWidth,F=D.lowerWidth,q=D.height,W=D.x,K=D.y;return lt.createElement(Zy,{canBegin:c>0,from:"0px ".concat(c===-1?1:c,"px"),to:"".concat(c,"px 0px"),attributeName:"strokeDasharray",begin:T,duration:S,easing:C},lt.createElement("path",$re({},ki(n,!0),{className:A,d:c3e(W,K,$,F,q),ref:s})))}):lt.createElement("g",null,lt.createElement("path",$re({},ki(n,!0),{className:A,d:c3e(f,m,y,v,w)})))},X7t=["option","shapeType","propTransformer","activeClassName","isActive"];function kE(t){"@babel/helpers - typeof";return kE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},kE(t)}function Q7t(t,e){if(t==null)return{};var n=J7t(t,e),s,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function J7t(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}function d3e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,s)}return n}function Ure(t){for(var e=1;e0?Vh(D,"paddingAngle",0):0;if(F){var W=i0(F.endAngle-F.startAngle,D.endAngle-D.startAngle),K=qo(qo({},D),{},{startAngle:A+q,endAngle:A+W(S)+q});T.push(K),A=K.endAngle}else{var Z=D.endAngle,re=D.startAngle,he=i0(0,Z-re),ue=he(S),Ne=qo(qo({},D),{},{startAngle:A+q,endAngle:A+ue+q});T.push(Ne),A=Ne.endAngle}}),lt.createElement(vo,null,s.renderSectorsStatically(T))})}},{key:"attachKeyboardHandlers",value:function(s){var i=this;s.onkeydown=function(o){if(!o.altKey)switch(o.key){case"ArrowLeft":{var c=++i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[c].focus(),i.setState({sectorToFocus:c});break}case"ArrowRight":{var a=--i.state.sectorToFocus<0?i.sectorRefs.length-1:i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[a].focus(),i.setState({sectorToFocus:a});break}case"Escape":{i.sectorRefs[i.state.sectorToFocus].blur(),i.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var s=this.props,i=s.sectors,o=s.isAnimationActive,c=this.state.prevSectors;return o&&i&&i.length&&(!c||!mie(c,i))?this.renderSectorsWithAnimation():this.renderSectorsStatically(i)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var s=this,i=this.props,o=i.hide,c=i.sectors,a=i.className,f=i.label,m=i.cx,y=i.cy,v=i.innerRadius,w=i.outerRadius,k=i.isAnimationActive,C=this.state.isAnimationFinished;if(o||!c||!c.length||!Pn(m)||!Pn(y)||!Pn(v)||!Pn(w))return null;var S=ta("recharts-pie",a);return lt.createElement(vo,{tabIndex:this.props.rootTabIndex,className:S,ref:function(I){s.pieRef=I}},this.renderSectors(),f&&this.renderLabels(c),td.renderCallByParent(this.props,null,!1),(!k||C)&&d1.renderCallByParent(this.props,c,!1))}}],[{key:"getDerivedStateFromProps",value:function(s,i){return i.prevIsAnimationActive!==s.isAnimationActive?{prevIsAnimationActive:s.isAnimationActive,prevAnimationId:s.animationId,curSectors:s.sectors,prevSectors:[],isAnimationFinished:!0}:s.isAnimationActive&&s.animationId!==i.prevAnimationId?{prevAnimationId:s.animationId,curSectors:s.sectors,prevSectors:i.curSectors,isAnimationFinished:!0}:s.sectors!==i.curSectors?{curSectors:s.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(s,i){return s>i?"start":s=360?A:A-1)*f,$=T-A*k-D,F=i.reduce(function(K,Z){var re=qd(Z,I,0);return K+(Pn(re)?re:0)},0),q;if(F>0){var W;q=i.map(function(K,Z){var re=qd(K,I,0),he=qd(K,y,Z),ue=(Pn(re)?re:0)/F,Ne;Z?Ne=W.endAngle+ju(S)*f*(re!==0?1:0):Ne=c;var se=Ne+ju(S)*((re!==0?k:0)+ue*$),xe=(Ne+se)/2,ie=(C.innerRadius+C.outerRadius)/2,me=[{name:he,value:re,payload:K,dataKey:I,type:w}],fe=Ko(C.cx,C.cy,ie,xe);return W=qo(qo(qo({percent:ue,cornerRadius:o,name:he,tooltipPayload:me,midAngle:xe,middleRadius:ie,tooltipPosition:fe},K),C),{},{value:qd(K,I),startAngle:Ne,endAngle:se,payload:K,paddingAngle:ju(S)*f}),W})}return qo(qo({},C),{},{sectors:q,data:i})});var _Bt=Math.ceil,bBt=Math.max;function wBt(t,e,n,s){for(var i=-1,o=bBt(_Bt((e-t)/(n||1)),0),c=Array(o);o--;)c[s?o:++i]=t,t+=n;return c}var jBt=wBt,kBt=M7e,p3e=1/0,NBt=17976931348623157e292;function SBt(t){if(!t)return t===0?t:0;if(t=kBt(t),t===p3e||t===-p3e){var e=t<0?-1:1;return e*NBt}return t===t?t:0}var d9e=SBt,CBt=jBt,MBt=sie,Zce=d9e;function TBt(t){return function(e,n,s){return s&&typeof s!="number"&&MBt(e,n,s)&&(n=s=void 0),e=Zce(e),n===void 0?(n=e,e=0):n=Zce(n),s=s===void 0?e0&&s.handleDrag(i.changedTouches[0])}),Mh(s,"handleDragEnd",function(){s.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var i=s.props,o=i.endIndex,c=i.onDragEnd,a=i.startIndex;c==null||c({endIndex:o,startIndex:a})}),s.detachDragEndListener()}),Mh(s,"handleLeaveWrapper",function(){(s.state.isTravellerMoving||s.state.isSlideMoving)&&(s.leaveTimer=window.setTimeout(s.handleDragEnd,s.props.leaveTimeOut))}),Mh(s,"handleEnterSlideOrTraveller",function(){s.setState({isTextActive:!0})}),Mh(s,"handleLeaveSlideOrTraveller",function(){s.setState({isTextActive:!1})}),Mh(s,"handleSlideDragStart",function(i){var o=v3e(i)?i.changedTouches[0]:i;s.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:o.pageX}),s.attachDragEndListener()}),s.travellerDragStartHandlers={startX:s.handleTravellerDragStart.bind(s,"startX"),endX:s.handleTravellerDragStart.bind(s,"endX")},s.state={},s}return qBt(e,t),zBt(e,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(s){var i=s.startX,o=s.endX,c=this.state.scaleValues,a=this.props,f=a.gap,m=a.data,y=m.length-1,v=Math.min(i,o),w=Math.max(i,o),k=e.getIndexInRange(c,v),C=e.getIndexInRange(c,w);return{startIndex:k-k%f,endIndex:C===y?y:C-C%f}}},{key:"getTextOfTick",value:function(s){var i=this.props,o=i.data,c=i.tickFormatter,a=i.dataKey,f=qd(o[s],a,s);return Pi(c)?c(f,s):f}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(s){var i=this.state,o=i.slideMoveStartX,c=i.startX,a=i.endX,f=this.props,m=f.x,y=f.width,v=f.travellerWidth,w=f.startIndex,k=f.endIndex,C=f.onChange,S=s.pageX-o;S>0?S=Math.min(S,m+y-v-a,m+y-v-c):S<0&&(S=Math.max(S,m-c,m-a));var T=this.getIndex({startX:c+S,endX:a+S});(T.startIndex!==w||T.endIndex!==k)&&C&&C(T),this.setState({startX:c+S,endX:a+S,slideMoveStartX:s.pageX})}},{key:"handleTravellerDragStart",value:function(s,i){var o=v3e(i)?i.changedTouches[0]:i;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:s,brushMoveStartX:o.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(s){var i=this.state,o=i.brushMoveStartX,c=i.movingTravellerId,a=i.endX,f=i.startX,m=this.state[c],y=this.props,v=y.x,w=y.width,k=y.travellerWidth,C=y.onChange,S=y.gap,T=y.data,I={startX:this.state.startX,endX:this.state.endX},A=s.pageX-o;A>0?A=Math.min(A,v+w-k-m):A<0&&(A=Math.max(A,v-m)),I[c]=m+A;var D=this.getIndex(I),$=D.startIndex,F=D.endIndex,q=function(){var K=T.length-1;return c==="startX"&&(a>f?$%S===0:F%S===0)||af?F%S===0:$%S===0)||a>f&&F===K};this.setState(Mh(Mh({},c,m+A),"brushMoveStartX",s.pageX),function(){C&&q()&&C(D)})}},{key:"handleTravellerMoveKeyboard",value:function(s,i){var o=this,c=this.state,a=c.scaleValues,f=c.startX,m=c.endX,y=this.state[i],v=a.indexOf(y);if(v!==-1){var w=v+s;if(!(w===-1||w>=a.length)){var k=a[w];i==="startX"&&k>=m||i==="endX"&&k<=f||this.setState(Mh({},i,k),function(){o.props.onChange(o.getIndex({startX:o.state.startX,endX:o.state.endX}))})}}}},{key:"renderBackground",value:function(){var s=this.props,i=s.x,o=s.y,c=s.width,a=s.height,f=s.fill,m=s.stroke;return lt.createElement("rect",{stroke:m,fill:f,x:i,y:o,width:c,height:a})}},{key:"renderPanorama",value:function(){var s=this.props,i=s.x,o=s.y,c=s.width,a=s.height,f=s.data,m=s.children,y=s.padding,v=P.Children.only(m);return v?lt.cloneElement(v,{x:i,y:o,width:c,height:a,margin:y,compact:!0,data:f}):null}},{key:"renderTravellerLayer",value:function(s,i){var o,c,a=this,f=this.props,m=f.y,y=f.travellerWidth,v=f.height,w=f.traveller,k=f.ariaLabel,C=f.data,S=f.startIndex,T=f.endIndex,I=Math.max(s,this.props.x),A=Yce(Yce({},ki(this.props,!1)),{},{x:I,y:m,width:y,height:v}),D=k||"Min value: ".concat((o=C[S])===null||o===void 0?void 0:o.name,", Max value: ").concat((c=C[T])===null||c===void 0?void 0:c.name);return lt.createElement(vo,{tabIndex:0,role:"slider","aria-label":D,"aria-valuenow":s,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[i],onTouchStart:this.travellerDragStartHandlers[i],onKeyDown:function(F){["ArrowLeft","ArrowRight"].includes(F.key)&&(F.preventDefault(),F.stopPropagation(),a.handleTravellerMoveKeyboard(F.key==="ArrowRight"?1:-1,i))},onFocus:function(){a.setState({isTravellerFocused:!0})},onBlur:function(){a.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},e.renderTraveller(w,A))}},{key:"renderSlide",value:function(s,i){var o=this.props,c=o.y,a=o.height,f=o.stroke,m=o.travellerWidth,y=Math.min(s,i)+m,v=Math.max(Math.abs(i-s)-m,0);return lt.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:f,fillOpacity:.2,x:y,y:c,width:v,height:a})}},{key:"renderText",value:function(){var s=this.props,i=s.startIndex,o=s.endIndex,c=s.y,a=s.height,f=s.travellerWidth,m=s.stroke,y=this.state,v=y.startX,w=y.endX,k=5,C={pointerEvents:"none",fill:m};return lt.createElement(vo,{className:"recharts-brush-texts"},lt.createElement(Aj,Hre({textAnchor:"end",verticalAnchor:"middle",x:Math.min(v,w)-k,y:c+a/2},C),this.getTextOfTick(i)),lt.createElement(Aj,Hre({textAnchor:"start",verticalAnchor:"middle",x:Math.max(v,w)+f+k,y:c+a/2},C),this.getTextOfTick(o)))}},{key:"render",value:function(){var s=this.props,i=s.data,o=s.className,c=s.children,a=s.x,f=s.y,m=s.width,y=s.height,v=s.alwaysShowText,w=this.state,k=w.startX,C=w.endX,S=w.isTextActive,T=w.isSlideMoving,I=w.isTravellerMoving,A=w.isTravellerFocused;if(!i||!i.length||!Pn(a)||!Pn(f)||!Pn(m)||!Pn(y)||m<=0||y<=0)return null;var D=ta("recharts-brush",o),$=lt.Children.count(c)===1,F=RBt("userSelect","none");return lt.createElement(vo,{className:D,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:F},this.renderBackground(),$&&this.renderPanorama(),this.renderSlide(k,C),this.renderTravellerLayer(k,"startX"),this.renderTravellerLayer(C,"endX"),(S||T||I||A||v)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(s){var i=s.x,o=s.y,c=s.width,a=s.height,f=s.stroke,m=Math.floor(o+a/2)-1;return lt.createElement(lt.Fragment,null,lt.createElement("rect",{x:i,y:o,width:c,height:a,fill:f,stroke:"none"}),lt.createElement("line",{x1:i+1,y1:m,x2:i+c-1,y2:m,fill:"none",stroke:"#fff"}),lt.createElement("line",{x1:i+1,y1:m+2,x2:i+c-1,y2:m+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(s,i){var o;return lt.isValidElement(s)?o=lt.cloneElement(s,i):Pi(s)?o=s(i):o=e.renderDefaultTraveller(i),o}},{key:"getDerivedStateFromProps",value:function(s,i){var o=s.data,c=s.width,a=s.x,f=s.travellerWidth,m=s.updateId,y=s.startIndex,v=s.endIndex;if(o!==i.prevData||m!==i.prevUpdateId)return Yce({prevData:o,prevTravellerWidth:f,prevUpdateId:m,prevX:a,prevWidth:c},o&&o.length?HBt({data:o,width:c,x:a,travellerWidth:f,startIndex:y,endIndex:v}):{scale:null,scaleValues:null});if(i.scale&&(c!==i.prevWidth||a!==i.prevX||f!==i.prevTravellerWidth)){i.scale.range([a,a+c-f]);var w=i.scale.domain().map(function(k){return i.scale(k)});return{prevData:o,prevTravellerWidth:f,prevUpdateId:m,prevX:a,prevWidth:c,startX:i.scale(s.startIndex),endX:i.scale(s.endIndex),scaleValues:w}}return null}},{key:"getIndexInRange",value:function(s,i){for(var o=s.length,c=0,a=o-1;a-c>1;){var f=Math.floor((c+a)/2);s[f]>i?a=f:c=f}return i>=s[a]?a:c}}])}(P.PureComponent);Mh(pC,"displayName","Brush");Mh(pC,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var WBt=Axe;function GBt(t,e){var n;return WBt(t,function(s,i,o){return n=e(s,i,o),!n}),!!n}var KBt=GBt,ZBt=t7e,YBt=Ig,XBt=KBt,QBt=yh,JBt=sie;function e9t(t,e,n){var s=QBt(t)?ZBt:XBt;return n&&JBt(t,e,n)&&(e=void 0),s(t,YBt(e))}var t9t=e9t;const r9t=Oa(t9t);var yg=function(e,n){var s=e.alwaysShow,i=e.ifOverflow;return s&&(i="extendDomain"),i===n},_3e=j7e;function n9t(t,e,n){e=="__proto__"&&_3e?_3e(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}var s9t=n9t,i9t=s9t,a9t=b7e,o9t=Ig;function l9t(t,e){var n={};return e=o9t(e),a9t(t,function(s,i,o){i9t(n,i,e(s,i,o))}),n}var c9t=l9t;const d9t=Oa(c9t);function u9t(t,e){for(var n=-1,s=t==null?0:t.length;++n=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function M9t(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}function T9t(t,e){var n=t.x,s=t.y,i=C9t(t,j9t),o="".concat(n),c=parseInt(o,10),a="".concat(s),f=parseInt(a,10),m="".concat(e.height||i.height),y=parseInt(m,10),v="".concat(e.width||i.width),w=parseInt(v,10);return A5(A5(A5(A5(A5({},e),i),c?{x:c}:{}),f?{y:f}:{}),{},{height:y,width:w,name:e.name,radius:e.radius})}function w3e(t){return lt.createElement(o9e,lpe({shapeType:"rectangle",propTransformer:T9t,activeClassName:"recharts-active-bar"},t))}var A9t=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(s,i){if(typeof e=="number")return e;var o=Pn(s)||rSt(s);return o?e(s,i):(o||Ij(),n)}},E9t=["value","background"],m9e;function mC(t){"@babel/helpers - typeof";return mC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},mC(t)}function I9t(t,e){if(t==null)return{};var n=P9t(t,e),s,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function P9t(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}function Gre(){return Gre=Object.assign?Object.assign.bind():function(t){for(var e=1;e0&&Math.abs(xe)0&&Math.abs(se)0&&(Ne=Math.min((je||0)-(se[Me-1]||0),Ne))}),Number.isFinite(Ne)){var xe=Ne/ue,ie=S.layout==="vertical"?s.height:s.width;if(S.padding==="gap"&&(W=xe*ie/2),S.padding==="no-gap"){var me=ku(e.barCategoryGap,xe*ie),fe=xe*ie/2;W=fe-me-(fe-me)/ie*me}}}i==="xAxis"?K=[s.left+(D.left||0)+(W||0),s.left+s.width-(D.right||0)-(W||0)]:i==="yAxis"?K=f==="horizontal"?[s.top+s.height-(D.bottom||0),s.top+(D.top||0)]:[s.top+(D.top||0)+(W||0),s.top+s.height-(D.bottom||0)-(W||0)]:K=S.range,F&&(K=[K[1],K[0]]);var ve=OBe(S,o,w),Ie=ve.scale,Se=ve.realScaleType;Ie.domain(I).range(K),DBe(Ie);var oe=RBe(Ie,qp(qp({},S),{},{realScaleType:Se}));i==="xAxis"?(he=T==="top"&&!$||T==="bottom"&&$,Z=s.left,re=v[q]-he*S.height):i==="yAxis"&&(he=T==="left"&&!$||T==="right"&&$,Z=v[q]-he*S.width,re=s.top);var ae=qp(qp(qp({},S),oe),{},{realScaleType:Se,x:Z,y:re,scale:Ie,width:i==="xAxis"?s.width:S.width,height:i==="yAxis"?s.height:S.height});return ae.bandSize=Ire(ae,oe),!S.hide&&i==="xAxis"?v[q]+=(he?-1:1)*ae.height:S.hide||(v[q]+=(he?-1:1)*ae.width),qp(qp({},k),{},Nie({},C,ae))},{})},v9e=function(e,n){var s=e.x,i=e.y,o=n.x,c=n.y;return{x:Math.min(s,o),y:Math.min(i,c),width:Math.abs(o-s),height:Math.abs(c-i)}},H9t=function(e){var n=e.x1,s=e.y1,i=e.x2,o=e.y2;return v9e({x:n,y:s},{x:i,y:o})},_9e=function(){function t(e){$9t(this,t),this.scale=e}return U9t(t,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(n){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=s.bandAware,o=s.position;if(n!==void 0){if(o)switch(o){case"start":return this.scale(n);case"middle":{var c=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+c}case"end":{var a=this.bandwidth?this.bandwidth():0;return this.scale(n)+a}default:return this.scale(n)}if(i){var f=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+f}return this.scale(n)}}},{key:"isInRange",value:function(n){var s=this.range(),i=s[0],o=s[s.length-1];return i<=o?n>=i&&n<=o:n>=o&&n<=i}}],[{key:"create",value:function(n){return new t(n)}}])}();Nie(_9e,"EPS",1e-4);var a0e=function(e){var n=Object.keys(e).reduce(function(s,i){return qp(qp({},s),{},Nie({},i,_9e.create(e[i])))},{});return qp(qp({},n),{},{apply:function(i){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},c=o.bandAware,a=o.position;return d9t(i,function(f,m){return n[m].apply(f,{bandAware:c,position:a})})},isInRange:function(i){return p9e(i,function(o,c){return n[c].isInRange(o)})}})};function W9t(t){return(t%180+180)%180}var G9t=function(e){var n=e.width,s=e.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=W9t(i),c=o*Math.PI/180,a=Math.atan(s/n),f=c>a&&c-1?i[o?e[c]:c]:void 0}}var Q9t=X9t,J9t=d9e;function e$t(t){var e=J9t(t),n=e%1;return e===e?n?e-n:e:0}var t$t=e$t,r$t=m7e,n$t=Ig,s$t=t$t,i$t=Math.max;function a$t(t,e,n){var s=t==null?0:t.length;if(!s)return-1;var i=n==null?0:s$t(n);return i<0&&(i=i$t(s+i,0)),r$t(t,n$t(e),i)}var o$t=a$t,l$t=Q9t,c$t=o$t,d$t=l$t(c$t),u$t=d$t;const h$t=Oa(u$t);var f$t=lNt(function(t){return{x:t.left,y:t.top,width:t.width,height:t.height}},function(t){return["l",t.left,"t",t.top,"w",t.width,"h",t.height].join("")}),o0e=P.createContext(void 0),l0e=P.createContext(void 0),b9e=P.createContext(void 0),w9e=P.createContext({}),j9e=P.createContext(void 0),k9e=P.createContext(0),N9e=P.createContext(0),C3e=function(e){var n=e.state,s=n.xAxisMap,i=n.yAxisMap,o=n.offset,c=e.clipPathId,a=e.children,f=e.width,m=e.height,y=f$t(o);return lt.createElement(o0e.Provider,{value:s},lt.createElement(l0e.Provider,{value:i},lt.createElement(w9e.Provider,{value:o},lt.createElement(b9e.Provider,{value:y},lt.createElement(j9e.Provider,{value:c},lt.createElement(k9e.Provider,{value:m},lt.createElement(N9e.Provider,{value:f},a)))))))},p$t=function(){return P.useContext(j9e)},S9e=function(e){var n=P.useContext(o0e);n==null&&Ij();var s=n[e];return s==null&&Ij(),s},m$t=function(){var e=P.useContext(o0e);return h0(e)},g$t=function(){var e=P.useContext(l0e),n=h$t(e,function(s){return p9e(s.domain,Number.isFinite)});return n||h0(e)},C9e=function(e){var n=P.useContext(l0e);n==null&&Ij();var s=n[e];return s==null&&Ij(),s},y$t=function(){var e=P.useContext(b9e);return e},x$t=function(){return P.useContext(w9e)},c0e=function(){return P.useContext(N9e)},d0e=function(){return P.useContext(k9e)};function gC(t){"@babel/helpers - typeof";return gC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gC(t)}function v$t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _$t(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,s=new Array(e);nt*i)return!1;var o=n();return t*(e-t*o/2-s)>=0&&t*(e+t*o/2-i)<=0}function tUt(t,e){return L9e(t,e+1)}function rUt(t,e,n,s,i){for(var o=(s||[]).slice(),c=e.start,a=e.end,f=0,m=1,y=c,v=function(){var C=s==null?void 0:s[f];if(C===void 0)return{v:L9e(s,m)};var S=f,T,I=function(){return T===void 0&&(T=n(C,S)),T},A=C.coordinate,D=f===0||Qre(t,A,I,y,a);D||(f=0,y=c,m+=1),D&&(y=A+t*(I()/2+i),f+=m)},w;m<=o.length;)if(w=v(),w)return w.v;return[]}function TE(t){"@babel/helpers - typeof";return TE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},TE(t)}function O3e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,s)}return n}function Bd(t){for(var e=1;e0?k.coordinate-T*t:k.coordinate})}else o[w]=k=Bd(Bd({},k),{},{tickCoord:k.coordinate});var I=Qre(t,k.tickCoord,S,a,f);I&&(f=k.tickCoord-t*(S()/2+i),o[w]=Bd(Bd({},k),{},{isShow:!0}))},y=c-1;y>=0;y--)m(y);return o}function oUt(t,e,n,s,i,o){var c=(s||[]).slice(),a=c.length,f=e.start,m=e.end;if(o){var y=s[a-1],v=n(y,a-1),w=t*(y.coordinate+t*v/2-m);c[a-1]=y=Bd(Bd({},y),{},{tickCoord:w>0?y.coordinate-w*t:y.coordinate});var k=Qre(t,y.tickCoord,function(){return v},f,m);k&&(m=y.tickCoord-t*(v/2+i),c[a-1]=Bd(Bd({},y),{},{isShow:!0}))}for(var C=o?a-1:a,S=function(A){var D=c[A],$,F=function(){return $===void 0&&($=n(D,A)),$};if(A===0){var q=t*(D.coordinate-t*F()/2-f);c[A]=D=Bd(Bd({},D),{},{tickCoord:q<0?D.coordinate-q*t:D.coordinate})}else c[A]=D=Bd(Bd({},D),{},{tickCoord:D.coordinate});var W=Qre(t,D.tickCoord,F,f,m);W&&(f=D.tickCoord+t*(F()/2+i),c[A]=Bd(Bd({},D),{},{isShow:!0}))},T=0;T=2?ju(i[1].coordinate-i[0].coordinate):1,I=eUt(o,T,k);return f==="equidistantPreserveStart"?rUt(T,I,S,i,c):(f==="preserveStart"||f==="preserveStartEnd"?w=oUt(T,I,S,i,c,f==="preserveStartEnd"):w=aUt(T,I,S,i,c),w.filter(function(A){return A.isShow}))}var lUt=["viewBox"],cUt=["viewBox"],dUt=["ticks"];function vC(t){"@babel/helpers - typeof";return vC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vC(t)}function _S(){return _S=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function uUt(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}function hUt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function R3e(t,e){for(var n=0;n0?f(this.props):f(k)),c<=0||a<=0||!C||!C.length?null:lt.createElement(vo,{className:ta("recharts-cartesian-axis",m),ref:function(T){s.layerReference=T}},o&&this.renderAxisLine(),this.renderTicks(C,this.state.fontSize,this.state.letterSpacing),td.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(s,i,o){var c,a=ta(i.className,"recharts-cartesian-axis-tick-value");return lt.isValidElement(s)?c=lt.cloneElement(s,Mc(Mc({},i),{},{className:a})):Pi(s)?c=s(Mc(Mc({},i),{},{className:a})):c=lt.createElement(Aj,_S({},i,{className:"recharts-cartesian-axis-tick-value"}),o),c}}])}(P.Component);p0e(i3,"displayName","CartesianAxis");p0e(i3,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var vUt=["x1","y1","x2","y2","key"],_Ut=["offset"];function Pj(t){"@babel/helpers - typeof";return Pj=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Pj(t)}function F3e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,s)}return n}function Ud(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function kUt(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}var NUt=function(e){var n=e.fill;if(!n||n==="none")return null;var s=e.fillOpacity,i=e.x,o=e.y,c=e.width,a=e.height,f=e.ry;return lt.createElement("rect",{x:i,y:o,ry:f,width:c,height:a,stroke:"none",fill:n,fillOpacity:s,className:"recharts-cartesian-grid-bg"})};function R9e(t,e){var n;if(lt.isValidElement(t))n=lt.cloneElement(t,e);else if(Pi(t))n=t(e);else{var s=e.x1,i=e.y1,o=e.x2,c=e.y2,a=e.key,f=z3e(e,vUt),m=ki(f,!1);m.offset;var y=z3e(m,_Ut);n=lt.createElement("line",ww({},y,{x1:s,y1:i,x2:o,y2:c,fill:"none",key:a}))}return n}function SUt(t){var e=t.x,n=t.width,s=t.horizontal,i=s===void 0?!0:s,o=t.horizontalPoints;if(!i||!o||!o.length)return null;var c=o.map(function(a,f){var m=Ud(Ud({},t),{},{x1:e,y1:a,x2:e+n,y2:a,key:"line-".concat(f),index:f});return R9e(i,m)});return lt.createElement("g",{className:"recharts-cartesian-grid-horizontal"},c)}function CUt(t){var e=t.y,n=t.height,s=t.vertical,i=s===void 0?!0:s,o=t.verticalPoints;if(!i||!o||!o.length)return null;var c=o.map(function(a,f){var m=Ud(Ud({},t),{},{x1:a,y1:e,x2:a,y2:e+n,key:"line-".concat(f),index:f});return R9e(i,m)});return lt.createElement("g",{className:"recharts-cartesian-grid-vertical"},c)}function MUt(t){var e=t.horizontalFill,n=t.fillOpacity,s=t.x,i=t.y,o=t.width,c=t.height,a=t.horizontalPoints,f=t.horizontal,m=f===void 0?!0:f;if(!m||!e||!e.length)return null;var y=a.map(function(w){return Math.round(w+i-i)}).sort(function(w,k){return w-k});i!==y[0]&&y.unshift(0);var v=y.map(function(w,k){var C=!y[k+1],S=C?i+c-w:y[k+1]-w;if(S<=0)return null;var T=k%e.length;return lt.createElement("rect",{key:"react-".concat(k),y:w,x:s,height:S,width:o,stroke:"none",fill:e[T],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return lt.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},v)}function TUt(t){var e=t.vertical,n=e===void 0?!0:e,s=t.verticalFill,i=t.fillOpacity,o=t.x,c=t.y,a=t.width,f=t.height,m=t.verticalPoints;if(!n||!s||!s.length)return null;var y=m.map(function(w){return Math.round(w+o-o)}).sort(function(w,k){return w-k});o!==y[0]&&y.unshift(0);var v=y.map(function(w,k){var C=!y[k+1],S=C?o+a-w:y[k+1]-w;if(S<=0)return null;var T=k%s.length;return lt.createElement("rect",{key:"react-".concat(k),x:w,y:c,width:S,height:f,stroke:"none",fill:s[T],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return lt.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},v)}var AUt=function(e,n){var s=e.xAxis,i=e.width,o=e.height,c=e.offset;return LBe(f0e(Ud(Ud(Ud({},i3.defaultProps),s),{},{ticks:Sy(s,!0),viewBox:{x:0,y:0,width:i,height:o}})),c.left,c.left+c.width,n)},EUt=function(e,n){var s=e.yAxis,i=e.width,o=e.height,c=e.offset;return LBe(f0e(Ud(Ud(Ud({},i3.defaultProps),s),{},{ticks:Sy(s,!0),viewBox:{x:0,y:0,width:i,height:o}})),c.top,c.top+c.height,n)},WN={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function F9e(t){var e,n,s,i,o,c,a=c0e(),f=d0e(),m=x$t(),y=Ud(Ud({},t),{},{stroke:(e=t.stroke)!==null&&e!==void 0?e:WN.stroke,fill:(n=t.fill)!==null&&n!==void 0?n:WN.fill,horizontal:(s=t.horizontal)!==null&&s!==void 0?s:WN.horizontal,horizontalFill:(i=t.horizontalFill)!==null&&i!==void 0?i:WN.horizontalFill,vertical:(o=t.vertical)!==null&&o!==void 0?o:WN.vertical,verticalFill:(c=t.verticalFill)!==null&&c!==void 0?c:WN.verticalFill,x:Pn(t.x)?t.x:m.left,y:Pn(t.y)?t.y:m.top,width:Pn(t.width)?t.width:m.width,height:Pn(t.height)?t.height:m.height}),v=y.x,w=y.y,k=y.width,C=y.height,S=y.syncWithTicks,T=y.horizontalValues,I=y.verticalValues,A=m$t(),D=g$t();if(!Pn(k)||k<=0||!Pn(C)||C<=0||!Pn(v)||v!==+v||!Pn(w)||w!==+w)return null;var $=y.verticalCoordinatesGenerator||AUt,F=y.horizontalCoordinatesGenerator||EUt,q=y.horizontalPoints,W=y.verticalPoints;if((!q||!q.length)&&Pi(F)){var K=T&&T.length,Z=F({yAxis:D?Ud(Ud({},D),{},{ticks:K?T:D.ticks}):void 0,width:a,height:f,offset:m},K?!0:S);om(Array.isArray(Z),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(Pj(Z),"]")),Array.isArray(Z)&&(q=Z)}if((!W||!W.length)&&Pi($)){var re=I&&I.length,he=$({xAxis:A?Ud(Ud({},A),{},{ticks:re?I:A.ticks}):void 0,width:a,height:f,offset:m},re?!0:S);om(Array.isArray(he),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(Pj(he),"]")),Array.isArray(he)&&(W=he)}return lt.createElement("g",{className:"recharts-cartesian-grid"},lt.createElement(NUt,{fill:y.fill,fillOpacity:y.fillOpacity,x:y.x,y:y.y,width:y.width,height:y.height,ry:y.ry}),lt.createElement(SUt,ww({},y,{offset:m,horizontalPoints:q,xAxis:A,yAxis:D})),lt.createElement(CUt,ww({},y,{offset:m,verticalPoints:W,xAxis:A,yAxis:D})),lt.createElement(MUt,ww({},y,{horizontalPoints:q})),lt.createElement(TUt,ww({},y,{verticalPoints:W})))}F9e.displayName="CartesianGrid";function _C(t){"@babel/helpers - typeof";return _C=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_C(t)}function IUt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function PUt(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,s=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function vqt(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}function _qt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function bqt(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,s=new Array(e);n0?c:e&&e.length&&Pn(i)&&Pn(o)?e.slice(i,o+1):[]};function Q9e(t){return t==="number"?[0,"auto"]:void 0}var Npe=function(e,n,s,i){var o=e.graphicalItems,c=e.tooltipAxis,a=Iie(n,e);return s<0||!o||!o.length||s>=a.length?null:o.reduce(function(f,m){var y,v=(y=m.props.data)!==null&&y!==void 0?y:n;v&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=s&&(v=v.slice(e.dataStartIndex,e.dataEndIndex+1));var w;if(c.dataKey&&!c.allowDuplicatedCategory){var k=v===void 0?a:v;w=Qhe(k,c.dataKey,i)}else w=v&&v[s]||a[s];return w?[].concat(jC(f),[zBe(m,w)]):f},[])},H3e=function(e,n,s,i){var o=i||{x:e.chartX,y:e.chartY},c=Pqt(o,s),a=e.orderedTooltipTicks,f=e.tooltipAxis,m=e.tooltipTicks,y=p8t(c,a,m,f);if(y>=0&&m){var v=m[y]&&m[y].value,w=Npe(e,n,y,v),k=Lqt(s,a,y,o);return{activeTooltipIndex:y,activeLabel:v,activePayload:w,activeCoordinate:k}}return null},Oqt=function(e,n){var s=n.axes,i=n.graphicalItems,o=n.axisType,c=n.axisIdKey,a=n.stackGroups,f=n.dataStartIndex,m=n.dataEndIndex,y=e.layout,v=e.children,w=e.stackOffset,k=PBe(y,o);return s.reduce(function(C,S){var T,I=S.type.defaultProps!==void 0?Hr(Hr({},S.type.defaultProps),S.props):S.props,A=I.type,D=I.dataKey,$=I.allowDataOverflow,F=I.allowDuplicatedCategory,q=I.scale,W=I.ticks,K=I.includeHidden,Z=I[c];if(C[Z])return C;var re=Iie(e.data,{graphicalItems:i.filter(function(oe){var ae,je=c in oe.props?oe.props[c]:(ae=oe.type.defaultProps)===null||ae===void 0?void 0:ae[c];return je===Z}),dataStartIndex:f,dataEndIndex:m}),he=re.length,ue,Ne,se;oqt(I.domain,$,A)&&(ue=Bfe(I.domain,null,$),k&&(A==="number"||q!=="auto")&&(se=rA(re,D,"category")));var xe=Q9e(A);if(!ue||ue.length===0){var ie,me=(ie=I.domain)!==null&&ie!==void 0?ie:xe;if(D){if(ue=rA(re,D,A),A==="category"&&k){var fe=sSt(ue);F&&fe?(Ne=ue,ue=Vre(0,he)):F||(ue=gCe(me,ue,S).reduce(function(oe,ae){return oe.indexOf(ae)>=0?oe:[].concat(jC(oe),[ae])},[]))}else if(A==="category")F?ue=ue.filter(function(oe){return oe!==""&&!pa(oe)}):ue=gCe(me,ue,S).reduce(function(oe,ae){return oe.indexOf(ae)>=0||ae===""||pa(ae)?oe:[].concat(jC(oe),[ae])},[]);else if(A==="number"){var ve=v8t(re,i.filter(function(oe){var ae,je,Me=c in oe.props?oe.props[c]:(ae=oe.type.defaultProps)===null||ae===void 0?void 0:ae[c],Ue="hide"in oe.props?oe.props.hide:(je=oe.type.defaultProps)===null||je===void 0?void 0:je.hide;return Me===Z&&(K||!Ue)}),D,o,y);ve&&(ue=ve)}k&&(A==="number"||q!=="auto")&&(se=rA(re,D,"category"))}else k?ue=Vre(0,he):a&&a[Z]&&a[Z].hasStack&&A==="number"?ue=w==="expand"?[0,1]:FBe(a[Z].stackGroups,f,m):ue=IBe(re,i.filter(function(oe){var ae=c in oe.props?oe.props[c]:oe.type.defaultProps[c],je="hide"in oe.props?oe.props.hide:oe.type.defaultProps.hide;return ae===Z&&(K||!je)}),A,y,!0);if(A==="number")ue=wpe(v,ue,Z,o,W),me&&(ue=Bfe(me,ue,$));else if(A==="category"&&me){var Ie=me,Se=ue.every(function(oe){return Ie.indexOf(oe)>=0});Se&&(ue=Ie)}}return Hr(Hr({},C),{},pi({},Z,Hr(Hr({},I),{},{axisType:o,domain:ue,categoricalDomain:se,duplicateDomain:Ne,originalDomain:(T=I.domain)!==null&&T!==void 0?T:xe,isCategorical:k,layout:y})))},{})},Dqt=function(e,n){var s=n.graphicalItems,i=n.Axis,o=n.axisType,c=n.axisIdKey,a=n.stackGroups,f=n.dataStartIndex,m=n.dataEndIndex,y=e.layout,v=e.children,w=Iie(e.data,{graphicalItems:s,dataStartIndex:f,dataEndIndex:m}),k=w.length,C=PBe(y,o),S=-1;return s.reduce(function(T,I){var A=I.type.defaultProps!==void 0?Hr(Hr({},I.type.defaultProps),I.props):I.props,D=A[c],$=Q9e("number");if(!T[D]){S++;var F;return C?F=Vre(0,k):a&&a[D]&&a[D].hasStack?(F=FBe(a[D].stackGroups,f,m),F=wpe(v,F,D,o)):(F=Bfe($,IBe(w,s.filter(function(q){var W,K,Z=c in q.props?q.props[c]:(W=q.type.defaultProps)===null||W===void 0?void 0:W[c],re="hide"in q.props?q.props.hide:(K=q.type.defaultProps)===null||K===void 0?void 0:K.hide;return Z===D&&!re}),"number",y),i.defaultProps.allowDataOverflow),F=wpe(v,F,D,o)),Hr(Hr({},T),{},pi({},D,Hr(Hr({axisType:o},i.defaultProps),{},{hide:!0,orientation:Vh(Eqt,"".concat(o,".").concat(S%2),null),domain:F,originalDomain:$,isCategorical:C,layout:y})))}return T},{})},Rqt=function(e,n){var s=n.axisType,i=s===void 0?"xAxis":s,o=n.AxisComp,c=n.graphicalItems,a=n.stackGroups,f=n.dataStartIndex,m=n.dataEndIndex,y=e.children,v="".concat(i,"Id"),w=Vf(y,o),k={};return w&&w.length?k=Oqt(e,{axes:w,graphicalItems:c,axisType:i,axisIdKey:v,stackGroups:a,dataStartIndex:f,dataEndIndex:m}):c&&c.length&&(k=Dqt(e,{Axis:o,graphicalItems:c,axisType:i,axisIdKey:v,stackGroups:a,dataStartIndex:f,dataEndIndex:m})),k},Fqt=function(e){var n=h0(e),s=Sy(n,!1,!0);return{tooltipTicks:s,orderedTooltipTicks:Exe(s,function(i){return i.coordinate}),tooltipAxis:n,tooltipAxisBandSize:Ire(n,s)}},W3e=function(e){var n=e.children,s=e.defaultShowTooltip,i=Eh(n,pC),o=0,c=0;return e.data&&e.data.length!==0&&(c=e.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(o=i.props.startIndex),i.props.endIndex>=0&&(c=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:o,dataEndIndex:c,activeTooltipIndex:-1,isTooltipActive:!!s}},zqt=function(e){return!e||!e.length?!1:e.some(function(n){var s=Oy(n&&n.type);return s&&s.indexOf("Bar")>=0})},G3e=function(e){return e==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:e==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:e==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},Bqt=function(e,n){var s=e.props,i=e.graphicalItems,o=e.xAxisMap,c=o===void 0?{}:o,a=e.yAxisMap,f=a===void 0?{}:a,m=s.width,y=s.height,v=s.children,w=s.margin||{},k=Eh(v,pC),C=Eh(v,u4),S=Object.keys(f).reduce(function(F,q){var W=f[q],K=W.orientation;return!W.mirror&&!W.hide?Hr(Hr({},F),{},pi({},K,F[K]+W.width)):F},{left:w.left||0,right:w.right||0}),T=Object.keys(c).reduce(function(F,q){var W=c[q],K=W.orientation;return!W.mirror&&!W.hide?Hr(Hr({},F),{},pi({},K,Vh(F,"".concat(K))+W.height)):F},{top:w.top||0,bottom:w.bottom||0}),I=Hr(Hr({},T),S),A=I.bottom;k&&(I.bottom+=k.props.height||pC.defaultProps.height),C&&n&&(I=y8t(I,i,s,n));var D=m-I.left-I.right,$=y-I.top-I.bottom;return Hr(Hr({brushBottom:A},I),{},{width:Math.max(D,0),height:Math.max($,0)})},$qt=function(e,n){if(n==="xAxis")return e[n].width;if(n==="yAxis")return e[n].height},J9e=function(e){var n=e.chartName,s=e.GraphicalChild,i=e.defaultTooltipEventType,o=i===void 0?"axis":i,c=e.validateTooltipEventTypes,a=c===void 0?["axis"]:c,f=e.axisComponents,m=e.legendContent,y=e.formatAxisMap,v=e.defaultProps,w=function(I,A){var D=A.graphicalItems,$=A.stackGroups,F=A.offset,q=A.updateId,W=A.dataStartIndex,K=A.dataEndIndex,Z=I.barSize,re=I.layout,he=I.barGap,ue=I.barCategoryGap,Ne=I.maxBarSize,se=G3e(re),xe=se.numericAxisName,ie=se.cateAxisName,me=zqt(D),fe=[];return D.forEach(function(ve,Ie){var Se=Iie(I.data,{graphicalItems:[ve],dataStartIndex:W,dataEndIndex:K}),oe=ve.type.defaultProps!==void 0?Hr(Hr({},ve.type.defaultProps),ve.props):ve.props,ae=oe.dataKey,je=oe.maxBarSize,Me=oe["".concat(xe,"Id")],Ue=oe["".concat(ie,"Id")],Re={},$e=f.reduce(function(Ke,Le){var ft=A["".concat(Le.axisType,"Map")],Nt=oe["".concat(Le.axisType,"Id")];ft&&ft[Nt]||Le.axisType==="zAxis"||Ij();var Mt=ft[Nt];return Hr(Hr({},Ke),{},pi(pi({},Le.axisType,Mt),"".concat(Le.axisType,"Ticks"),Sy(Mt)))},Re),Pe=$e[ie],Ae=$e["".concat(ie,"Ticks")],nt=$&&$[Me]&&$[Me].hasStack&&M8t(ve,$[Me].stackGroups),Te=Oy(ve.type).indexOf("Bar")>=0,Xe=Ire(Pe,Ae),ge=[],mt=me&&m8t({barSize:Z,stackGroups:$,totalSize:$qt($e,ie)});if(Te){var rt,We,Ce=pa(je)?Ne:je,et=(rt=(We=Ire(Pe,Ae,!0))!==null&&We!==void 0?We:Ce)!==null&&rt!==void 0?rt:0;ge=g8t({barGap:he,barCategoryGap:ue,bandSize:et!==Xe?et:Xe,sizeList:mt[Ue],maxBarSize:Ce}),et!==Xe&&(ge=ge.map(function(Ke){return Hr(Hr({},Ke),{},{position:Hr(Hr({},Ke.position),{},{offset:Ke.position.offset-et/2})})}))}var Fe=ve&&ve.type&&ve.type.getComposedData;Fe&&fe.push({props:Hr(Hr({},Fe(Hr(Hr({},$e),{},{displayedData:Se,props:I,dataKey:ae,item:ve,bandSize:Xe,barPosition:ge,offset:F,stackedData:nt,layout:re,dataStartIndex:W,dataEndIndex:K}))),{},pi(pi(pi({key:ve.key||"item-".concat(Ie)},xe,$e[xe]),ie,$e[ie]),"animationId",q)),childIndex:gSt(ve,I.children),item:ve})}),fe},k=function(I,A){var D=I.props,$=I.dataStartIndex,F=I.dataEndIndex,q=I.updateId;if(!dSe({props:D}))return null;var W=D.children,K=D.layout,Z=D.stackOffset,re=D.data,he=D.reverseStackOrder,ue=G3e(K),Ne=ue.numericAxisName,se=ue.cateAxisName,xe=Vf(W,s),ie=S8t(re,xe,"".concat(Ne,"Id"),"".concat(se,"Id"),Z,he),me=f.reduce(function(oe,ae){var je="".concat(ae.axisType,"Map");return Hr(Hr({},oe),{},pi({},je,Rqt(D,Hr(Hr({},ae),{},{graphicalItems:xe,stackGroups:ae.axisType===Ne&&ie,dataStartIndex:$,dataEndIndex:F}))))},{}),fe=Bqt(Hr(Hr({},me),{},{props:D,graphicalItems:xe}),A==null?void 0:A.legendBBox);Object.keys(me).forEach(function(oe){me[oe]=y(D,me[oe],fe,oe.replace("Map",""),n)});var ve=me["".concat(se,"Map")],Ie=Fqt(ve),Se=w(D,Hr(Hr({},me),{},{dataStartIndex:$,dataEndIndex:F,updateId:q,graphicalItems:xe,stackGroups:ie,offset:fe}));return Hr(Hr({formattedGraphicalItems:Se,graphicalItems:xe,offset:fe,stackGroups:ie},Ie),me)},C=function(T){function I(A){var D,$,F;return _qt(this,I),F=jqt(this,I,[A]),pi(F,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),pi(F,"accessibilityManager",new aqt),pi(F,"handleLegendBBoxUpdate",function(q){if(q){var W=F.state,K=W.dataStartIndex,Z=W.dataEndIndex,re=W.updateId;F.setState(Hr({legendBBox:q},k({props:F.props,dataStartIndex:K,dataEndIndex:Z,updateId:re},Hr(Hr({},F.state),{},{legendBBox:q}))))}}),pi(F,"handleReceiveSyncEvent",function(q,W,K){if(F.props.syncId===q){if(K===F.eventEmitterSymbol&&typeof F.props.syncMethod!="function")return;F.applySyncEvent(W)}}),pi(F,"handleBrushChange",function(q){var W=q.startIndex,K=q.endIndex;if(W!==F.state.dataStartIndex||K!==F.state.dataEndIndex){var Z=F.state.updateId;F.setState(function(){return Hr({dataStartIndex:W,dataEndIndex:K},k({props:F.props,dataStartIndex:W,dataEndIndex:K,updateId:Z},F.state))}),F.triggerSyncEvent({dataStartIndex:W,dataEndIndex:K})}}),pi(F,"handleMouseEnter",function(q){var W=F.getMouseInfo(q);if(W){var K=Hr(Hr({},W),{},{isTooltipActive:!0});F.setState(K),F.triggerSyncEvent(K);var Z=F.props.onMouseEnter;Pi(Z)&&Z(K,q)}}),pi(F,"triggeredAfterMouseMove",function(q){var W=F.getMouseInfo(q),K=W?Hr(Hr({},W),{},{isTooltipActive:!0}):{isTooltipActive:!1};F.setState(K),F.triggerSyncEvent(K);var Z=F.props.onMouseMove;Pi(Z)&&Z(K,q)}),pi(F,"handleItemMouseEnter",function(q){F.setState(function(){return{isTooltipActive:!0,activeItem:q,activePayload:q.tooltipPayload,activeCoordinate:q.tooltipPosition||{x:q.cx,y:q.cy}}})}),pi(F,"handleItemMouseLeave",function(){F.setState(function(){return{isTooltipActive:!1}})}),pi(F,"handleMouseMove",function(q){q.persist(),F.throttleTriggeredAfterMouseMove(q)}),pi(F,"handleMouseLeave",function(q){F.throttleTriggeredAfterMouseMove.cancel();var W={isTooltipActive:!1};F.setState(W),F.triggerSyncEvent(W);var K=F.props.onMouseLeave;Pi(K)&&K(W,q)}),pi(F,"handleOuterEvent",function(q){var W=mSt(q),K=Vh(F.props,"".concat(W));if(W&&Pi(K)){var Z,re;/.*touch.*/i.test(W)?re=F.getMouseInfo(q.changedTouches[0]):re=F.getMouseInfo(q),K((Z=re)!==null&&Z!==void 0?Z:{},q)}}),pi(F,"handleClick",function(q){var W=F.getMouseInfo(q);if(W){var K=Hr(Hr({},W),{},{isTooltipActive:!0});F.setState(K),F.triggerSyncEvent(K);var Z=F.props.onClick;Pi(Z)&&Z(K,q)}}),pi(F,"handleMouseDown",function(q){var W=F.props.onMouseDown;if(Pi(W)){var K=F.getMouseInfo(q);W(K,q)}}),pi(F,"handleMouseUp",function(q){var W=F.props.onMouseUp;if(Pi(W)){var K=F.getMouseInfo(q);W(K,q)}}),pi(F,"handleTouchMove",function(q){q.changedTouches!=null&&q.changedTouches.length>0&&F.throttleTriggeredAfterMouseMove(q.changedTouches[0])}),pi(F,"handleTouchStart",function(q){q.changedTouches!=null&&q.changedTouches.length>0&&F.handleMouseDown(q.changedTouches[0])}),pi(F,"handleTouchEnd",function(q){q.changedTouches!=null&&q.changedTouches.length>0&&F.handleMouseUp(q.changedTouches[0])}),pi(F,"handleDoubleClick",function(q){var W=F.props.onDoubleClick;if(Pi(W)){var K=F.getMouseInfo(q);W(K,q)}}),pi(F,"handleContextMenu",function(q){var W=F.props.onContextMenu;if(Pi(W)){var K=F.getMouseInfo(q);W(K,q)}}),pi(F,"triggerSyncEvent",function(q){F.props.syncId!==void 0&&Qce.emit(Jce,F.props.syncId,q,F.eventEmitterSymbol)}),pi(F,"applySyncEvent",function(q){var W=F.props,K=W.layout,Z=W.syncMethod,re=F.state.updateId,he=q.dataStartIndex,ue=q.dataEndIndex;if(q.dataStartIndex!==void 0||q.dataEndIndex!==void 0)F.setState(Hr({dataStartIndex:he,dataEndIndex:ue},k({props:F.props,dataStartIndex:he,dataEndIndex:ue,updateId:re},F.state)));else if(q.activeTooltipIndex!==void 0){var Ne=q.chartX,se=q.chartY,xe=q.activeTooltipIndex,ie=F.state,me=ie.offset,fe=ie.tooltipTicks;if(!me)return;if(typeof Z=="function")xe=Z(fe,q);else if(Z==="value"){xe=-1;for(var ve=0;ve=0){var nt,Te;if(Ne.dataKey&&!Ne.allowDuplicatedCategory){var Xe=typeof Ne.dataKey=="function"?Ae:"payload.".concat(Ne.dataKey.toString());nt=Qhe(ve,Xe,xe),Te=Ie&&Se&&Qhe(Se,Xe,xe)}else nt=ve==null?void 0:ve[se],Te=Ie&&Se&&Se[se];if(Ue||Me){var ge=q.props.activeIndex!==void 0?q.props.activeIndex:se;return[P.cloneElement(q,Hr(Hr(Hr({},Z.props),$e),{},{activeIndex:ge})),null,null]}if(!pa(nt))return[Pe].concat(jC(F.renderActivePoints({item:Z,activePoint:nt,basePoint:Te,childIndex:se,isRange:Ie})))}else{var mt,rt=(mt=F.getItemByXY(F.state.activeCoordinate))!==null&&mt!==void 0?mt:{graphicalItem:Pe},We=rt.graphicalItem,Ce=We.item,et=Ce===void 0?q:Ce,Fe=We.childIndex,Ke=Hr(Hr(Hr({},Z.props),$e),{},{activeIndex:Fe});return[P.cloneElement(et,Ke),null,null]}return Ie?[Pe,null,null]:[Pe,null]}),pi(F,"renderCustomized",function(q,W,K){return P.cloneElement(q,Hr(Hr({key:"recharts-customized-".concat(K)},F.props),F.state))}),pi(F,"renderMap",{CartesianGrid:{handler:LL,once:!0},ReferenceArea:{handler:F.renderReferenceElement},ReferenceLine:{handler:LL},ReferenceDot:{handler:F.renderReferenceElement},XAxis:{handler:LL},YAxis:{handler:LL},Brush:{handler:F.renderBrush,once:!0},Bar:{handler:F.renderGraphicChild},Line:{handler:F.renderGraphicChild},Area:{handler:F.renderGraphicChild},Radar:{handler:F.renderGraphicChild},RadialBar:{handler:F.renderGraphicChild},Scatter:{handler:F.renderGraphicChild},Pie:{handler:F.renderGraphicChild},Funnel:{handler:F.renderGraphicChild},Tooltip:{handler:F.renderCursor,once:!0},PolarGrid:{handler:F.renderPolarGrid,once:!0},PolarAngleAxis:{handler:F.renderPolarAxis},PolarRadiusAxis:{handler:F.renderPolarAxis},Customized:{handler:F.renderCustomized}}),F.clipPathId="".concat((D=A.id)!==null&&D!==void 0?D:_I("recharts"),"-clip"),F.throttleTriggeredAfterMouseMove=T7e(F.triggeredAfterMouseMove,($=A.throttleDelay)!==null&&$!==void 0?$:1e3/60),F.state={},F}return Sqt(I,T),wqt(I,[{key:"componentDidMount",value:function(){var D,$;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(D=this.props.margin.left)!==null&&D!==void 0?D:0,top:($=this.props.margin.top)!==null&&$!==void 0?$:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var D=this.props,$=D.children,F=D.data,q=D.height,W=D.layout,K=Eh($,Up);if(K){var Z=K.props.defaultIndex;if(!(typeof Z!="number"||Z<0||Z>this.state.tooltipTicks.length-1)){var re=this.state.tooltipTicks[Z]&&this.state.tooltipTicks[Z].value,he=Npe(this.state,F,Z,re),ue=this.state.tooltipTicks[Z].coordinate,Ne=(this.state.offset.top+q)/2,se=W==="horizontal",xe=se?{x:ue,y:Ne}:{y:ue,x:Ne},ie=this.state.formattedGraphicalItems.find(function(fe){var ve=fe.item;return ve.type.name==="Scatter"});ie&&(xe=Hr(Hr({},xe),ie.props.points[Z].tooltipPosition),he=ie.props.points[Z].tooltipPayload);var me={activeTooltipIndex:Z,isTooltipActive:!0,activeLabel:re,activePayload:he,activeCoordinate:xe};this.setState(me),this.renderCursor(K),this.accessibilityManager.setIndex(Z)}}}},{key:"getSnapshotBeforeUpdate",value:function(D,$){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==$.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==D.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==D.margin){var F,q;this.accessibilityManager.setDetails({offset:{left:(F=this.props.margin.left)!==null&&F!==void 0?F:0,top:(q=this.props.margin.top)!==null&&q!==void 0?q:0}})}return null}},{key:"componentDidUpdate",value:function(D){efe([Eh(D.children,Up)],[Eh(this.props.children,Up)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var D=Eh(this.props.children,Up);if(D&&typeof D.props.shared=="boolean"){var $=D.props.shared?"axis":"item";return a.indexOf($)>=0?$:o}return o}},{key:"getMouseInfo",value:function(D){if(!this.container)return null;var $=this.container,F=$.getBoundingClientRect(),q=UPt(F),W={chartX:Math.round(D.pageX-q.left),chartY:Math.round(D.pageY-q.top)},K=F.width/$.offsetWidth||1,Z=this.inRange(W.chartX,W.chartY,K);if(!Z)return null;var re=this.state,he=re.xAxisMap,ue=re.yAxisMap,Ne=this.getTooltipEventType(),se=H3e(this.state,this.props.data,this.props.layout,Z);if(Ne!=="axis"&&he&&ue){var xe=h0(he).scale,ie=h0(ue).scale,me=xe&&xe.invert?xe.invert(W.chartX):null,fe=ie&&ie.invert?ie.invert(W.chartY):null;return Hr(Hr({},W),{},{xValue:me,yValue:fe},se)}return se?Hr(Hr({},W),se):null}},{key:"inRange",value:function(D,$){var F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,q=this.props.layout,W=D/F,K=$/F;if(q==="horizontal"||q==="vertical"){var Z=this.state.offset,re=W>=Z.left&&W<=Z.left+Z.width&&K>=Z.top&&K<=Z.top+Z.height;return re?{x:W,y:K}:null}var he=this.state,ue=he.angleAxisMap,Ne=he.radiusAxisMap;if(ue&&Ne){var se=h0(ue);return vCe({x:W,y:K},se)}return null}},{key:"parseEventsOfWrapper",value:function(){var D=this.props.children,$=this.getTooltipEventType(),F=Eh(D,Up),q={};F&&$==="axis"&&(F.props.trigger==="click"?q={onClick:this.handleClick}:q={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var W=ire(this.props,this.handleOuterEvent);return Hr(Hr({},W),q)}},{key:"addListener",value:function(){Qce.on(Jce,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){Qce.removeListener(Jce,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(D,$,F){for(var q=this.state.formattedGraphicalItems,W=0,K=q.length;W");return t}const r$e=P.forwardRef(({id:t,className:e,children:n,config:s,...i},o)=>{const c=P.useId(),a=`chart-${t||c.replace(/:/g,"")}`;return r.jsx(e$e.Provider,{value:{config:s},children:r.jsxs("div",{"data-chart":a,ref:o,className:zt("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",e),...i,children:[r.jsx(Hqt,{id:a,config:s}),r.jsx(jfe,{children:n})]})})});r$e.displayName="Chart";const Hqt=({id:t,config:e})=>{const n=Object.entries(e).filter(([s,i])=>i.theme||i.color);return n.length?r.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(Vqt).map(([s,i])=>` ${i} [data-chart=${t}] { ${n.map(([o,c])=>{var f;const a=((f=c.theme)==null?void 0:f[s])||c.color;return a?` --color-${o}: ${a};`:null}).join(` `)} } `).join(` `)}}):null},n$e=P.forwardRef(({active:t,payload:e,className:n,indicator:s="dot",hideLabel:i=!1,hideIndicator:o=!1,label:c,labelFormatter:a,labelClassName:f,formatter:m,color:y,nameKey:v,labelKey:w},k)=>{const{config:C}=t$e(),S=P.useMemo(()=>{var F;if(i||!(e!=null&&e.length))return null;const[I]=e,A=`${w||I.dataKey||I.name||"value"}`,D=Spe(C,I,A),$=!w&&typeof c=="string"?((F=C[c])==null?void 0:F.label)||c:D==null?void 0:D.label;return a?r.jsx("div",{className:zt("font-medium",f),children:a($,e)}):$?r.jsx("div",{className:zt("font-medium",f),children:$}):null},[c,a,e,i,f,C,w]);if(!t||!(e!=null&&e.length))return null;const T=e.length===1&&s!=="dot";return r.jsxs("div",{ref:k,className:zt("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",n),children:[T?null:S,r.jsx("div",{className:"grid gap-1.5",children:e.map((I,A)=>{const D=`${v||I.name||I.dataKey||"value"}`,$=Spe(C,I,D),F=y||I.payload.fill||I.color;return r.jsx("div",{className:zt("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",s==="dot"&&"items-center"),children:m&&(I==null?void 0:I.value)!==void 0&&I.name?m(I.value,I.name,I,A,I.payload):r.jsxs(r.Fragment,{children:[$!=null&&$.icon?r.jsx($.icon,{}):!o&&r.jsx("div",{className:zt("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":s==="dot","w-1":s==="line","w-0 border-[1.5px] border-dashed bg-transparent":s==="dashed","my-0.5":T&&s==="dashed"}),style:{"--color-bg":F,"--color-border":F}}),r.jsxs("div",{className:zt("flex flex-1 justify-between leading-none",T?"items-end":"items-center"),children:[r.jsxs("div",{className:"grid gap-1.5",children:[T?S:null,r.jsx("span",{className:"text-muted-foreground",children:($==null?void 0:$.label)||I.name})]}),I.value&&r.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:I.value.toLocaleString()})]})]})},I.dataKey)})})]})});n$e.displayName="ChartTooltip";const Wqt=P.forwardRef(({className:t,hideIcon:e=!1,payload:n,verticalAlign:s="bottom",nameKey:i},o)=>{const{config:c}=t$e();return n!=null&&n.length?r.jsx("div",{ref:o,className:zt("flex items-center justify-center gap-4",s==="top"?"pb-3":"pt-3",t),children:n.map(a=>{const f=`${i||a.dataKey||"value"}`,m=Spe(c,a,f);return r.jsxs("div",{className:zt("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[m!=null&&m.icon&&!e?r.jsx(m.icon,{}):r.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:a.color}}),m==null?void 0:m.label]},a.value)})}):null});Wqt.displayName="ChartLegend";function Spe(t,e,n){if(typeof e!="object"||e===null)return;const s="payload"in e&&typeof e.payload=="object"&&e.payload!==null?e.payload:void 0;let i=n;return n in e&&typeof e[n]=="string"?i=e[n]:s&&n in s&&typeof s[n]=="string"&&(i=s[n]),i in t?t[i]:t[n]}const OL=["hsl(var(--primary))","hsl(var(--secondary))","hsl(210, 70%, 50%)","hsl(170, 60%, 45%)","hsl(280, 60%, 55%)","hsl(30, 70%, 50%)","hsl(340, 65%, 55%)","hsl(200, 65%, 50%)"];function s$e({stats:t,year:e}){const n=t.transactionsByMonth.some(i=>i.count>0),s=t.leadSourceBreakdown.length>0;return!n&&!s?r.jsx(Ye,{children:r.jsx(Je,{className:"py-12 text-center text-muted-foreground",children:"Add transactions to see your performance charts"})}):r.jsxs("div",{className:"grid gap-6",children:[n&&r.jsxs(Ye,{className:"overflow-hidden",children:[r.jsx(Ht,{children:r.jsx(Yt,{className:"text-base",children:"Transactions by Month"})}),r.jsx(Je,{className:"overflow-hidden",children:r.jsx(r$e,{config:{count:{label:"Transactions",color:"hsl(var(--primary))"}},className:"h-[250px]",children:r.jsx(jfe,{width:"100%",height:"100%",children:r.jsxs(Uqt,{data:t.transactionsByMonth,margin:{top:5,right:10,left:0,bottom:5},children:[r.jsx(F9e,{strokeDasharray:"3 3",className:"stroke-muted"}),r.jsx(Aie,{dataKey:"month",tick:{fontSize:11},className:"fill-muted-foreground",interval:0}),r.jsx(Eie,{allowDecimals:!1,tick:{fontSize:12},className:"fill-muted-foreground",width:30}),r.jsx(Up,{content:r.jsx(n$e,{})}),r.jsx(Hj,{dataKey:"count",fill:"hsl(var(--primary))",radius:[4,4,0,0],name:"Transactions"})]})})})})]}),s&&r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsx(Yt,{className:"text-base",children:"Lead Sources"})}),r.jsxs(Je,{children:[r.jsx("div",{className:"h-[250px]",children:r.jsx(jfe,{width:"100%",height:"100%",children:r.jsxs(qqt,{children:[r.jsx(rx,{data:t.leadSourceBreakdown,dataKey:"count",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,label:({name:i,percent:o})=>o>.05?`${i} (${(o*100).toFixed(0)}%)`:"",labelLine:!1,children:t.leadSourceBreakdown.map((i,o)=>r.jsx(iie,{fill:OL[o%OL.length]},`cell-${o}`))}),r.jsx(Up,{formatter:(i,o)=>[`${i} deals`,o]})]})})}),r.jsx("div",{className:"flex flex-wrap gap-2 mt-2 justify-center",children:t.leadSourceBreakdown.slice(0,6).map((i,o)=>r.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[r.jsx("div",{className:"w-3 h-3 rounded-sm",style:{backgroundColor:OL[o%OL.length]}}),r.jsx("span",{className:"text-muted-foreground",children:i.name})]},i.name))})]})]})]})}function Gqt(t){if(!t||!t.trim())return null;const e=t.trim(),n=["yyyy-MM-dd","M/d/yyyy","MM/dd/yyyy","M-d-yyyy","MM-dd-yyyy","MM/dd/yy","M/d/yy"];for(const s of n)try{const i=Yge(e,s,new Date);if(lhe(i))return un(i,"yyyy-MM-dd")}catch{}try{const s=new Date(e);if(lhe(s))return un(s,"yyyy-MM-dd")}catch{}return null}const Kqt=["property_address","city","state","zip","transaction_type","close_date","sale_price","commission_amount","lead_source","client_type","is_win","notes"];function Zqt({open:t,onOpenChange:e}){const[n,s]=P.useState([]),[i,o]=P.useState(!1),[c,a]=P.useState(0),{data:f}=hse(),{data:m}=Ag(),y=fse(),v=()=>{const I=Kqt.join(","),A=["123 Main St","Dallas","TX","75001","buyer","2024-06-15","450000","13500","Referral","Past Client","yes","Great transaction!"].join(","),D=`${I} ${A}`,$=new Blob([D],{type:"text/csv"}),F=URL.createObjectURL($),q=document.createElement("a");q.href=F,q.download="transaction-import-template.csv",q.click(),URL.revokeObjectURL(F)},w=I=>{const A=I.split(` `).filter($=>$.trim());if(A.length<2)return[];const D=A[0].split(",").map($=>$.trim().toLowerCase().replace(/['"]/g,""));return A.slice(1).map(($,F)=>{var me,fe,ve,Ie;const q=[];let W="",K=!1;for(const Se of $)Se==='"'?K=!K:Se===","&&!K?(q.push(W.trim()),W=""):W+=Se;q.push(W.trim());const Z=Se=>{var ae;const oe=D.indexOf(Se);return oe>=0?(ae=q[oe])==null?void 0:ae.replace(/^["']|["']$/g,"").trim():""},re=(me=Z("transaction_type"))==null?void 0:me.toLowerCase(),he=(fe=Z("sale_price"))==null?void 0:fe.replace(/[$,]/g,""),ue=(ve=Z("commission_amount"))==null?void 0:ve.replace(/[$,]/g,""),Ne=(Ie=Z("is_win"))==null?void 0:Ie.toLowerCase(),se=Z("close_date"),xe=Gqt(se);let ie;return Z("property_address")?["buyer","seller"].includes(re)?xe?(!he||isNaN(Number(he)))&&(ie="Invalid sale price"):ie=`Invalid date format: "${se}" - use MM/DD/YYYY or YYYY-MM-DD`:ie='Transaction type must be "buyer" or "seller"':ie="Missing property address",{property_address:Z("property_address"),city:Z("city"),state:Z("state"),zip:Z("zip"),transaction_type:re==="seller"?"seller":"buyer",close_date:xe||"",sale_price:Number(he)||0,commission_amount:ue?Number(ue):null,lead_source_name:Z("lead_source"),client_type_name:Z("client_type"),is_win:["yes","true","1"].includes(Ne),notes:Z("notes"),error:ie}})},k=I=>{var $;const A=($=I.target.files)==null?void 0:$[0];if(!A)return;const D=new FileReader;D.onload=F=>{var K;const q=(K=F.target)==null?void 0:K.result,W=w(q);s(W)},D.readAsText(A)},C=async()=>{const I=n.filter($=>!$.error);if(I.length===0){Ge.error("No valid transactions to import");return}o(!0),a(0);let A=0,D=0;for(let $=0;$K.name.toLowerCase()===F.lead_source_name.toLowerCase()),W=m==null?void 0:m.find(K=>K.name.toLowerCase()===F.client_type_name.toLowerCase());await y.mutateAsync({property_address:F.property_address,city:F.city||null,state:F.state||null,zip:F.zip||null,transaction_type:F.transaction_type,close_date:F.close_date,sale_price:F.sale_price,commission_amount:F.commission_amount,lead_source_id:(q==null?void 0:q.id)||null,client_type_id:(W==null?void 0:W.id)||null,contact_id:null,notes:F.notes||null,is_win:F.is_win}),A++}catch(q){D++,console.error("Failed to import transaction:",q)}a(Math.round(($+1)/I.length*100))}o(!1),A>0&&Ge.success(`Imported ${A} transaction${A>1?"s":""}`),D>0&&Ge.error(`Failed to import ${D} transaction${D>1?"s":""}`),s([]),e(!1)},S=n.filter(I=>!I.error).length,T=n.filter(I=>I.error).length;return r.jsx($r,{open:t,onOpenChange:e,children:r.jsxs(zr,{className:"max-w-2xl max-h-[90vh]",children:[r.jsxs(Zr,{children:[r.jsx(Kr,{children:"Import Transactions"}),r.jsx(ls,{children:"Upload a CSV file with your past transactions"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg bg-muted/50",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Download Template"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Get a CSV template with the correct format"})]}),r.jsxs(te,{variant:"outline",onClick:v,children:[r.jsx(Mo,{className:"h-4 w-4 mr-2"}),"Template"]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"csv-file",children:"Upload CSV File"}),r.jsx(yt,{id:"csv-file",type:"file",accept:".csv",onChange:k})]}),n.length>0&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(Rt,{variant:"outline",children:[n.length," rows found"]}),S>0&&r.jsxs(Rt,{className:"bg-green-500 text-white",children:[r.jsx(Ba,{className:"h-3 w-3 mr-1"}),S," valid"]}),T>0&&r.jsxs(Rt,{variant:"destructive",children:[r.jsx(Bl,{className:"h-3 w-3 mr-1"}),T," errors"]})]}),r.jsx(xl,{className:"h-[200px] border rounded-lg",children:r.jsxs("div",{className:"p-2 space-y-2",children:[n.slice(0,10).map((I,A)=>r.jsxs("div",{className:`p-2 rounded text-sm ${I.error?"bg-destructive/10":"bg-muted/50"}`,children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"font-medium",children:I.property_address||"(no address)"}),r.jsx(Rt,{variant:I.transaction_type==="buyer"?"default":"secondary",children:I.transaction_type})]}),r.jsxs("div",{className:"text-muted-foreground",children:[I.close_date," • $",I.sale_price.toLocaleString()]}),I.error&&r.jsx(vye,{variant:"destructive",className:"mt-1 py-1",children:r.jsx(_ye,{className:"text-xs",children:I.error})})]},A)),n.length>10&&r.jsxs("p",{className:"text-center text-sm text-muted-foreground",children:["...and ",n.length-10," more"]})]})}),i&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"w-full bg-muted rounded-full h-2",children:r.jsx("div",{className:"bg-primary h-2 rounded-full transition-all",style:{width:`${c}%`}})}),r.jsxs("p",{className:"text-sm text-center text-muted-foreground",children:["Importing... ",c,"%"]})]})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[r.jsx(te,{variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsxs(te,{onClick:C,disabled:S===0||i,children:[r.jsx(Ao,{className:"h-4 w-4 mr-2"}),"Import ",S," Transaction",S!==1?"s":""]})]})]})]})})}const Yqt=UC({transactions_goal:DT().min(0).optional(),volume_goal:DT().min(0).optional(),gci_goal:DT().min(0).optional()});function Xqt({open:t,onOpenChange:e,year:n,existingGoals:s}){const i=Pht(),{data:o}=pse(),c=(o==null?void 0:o.show_commission)??!0,a=ese({resolver:tse(Yqt),defaultValues:{transactions_goal:void 0,volume_goal:void 0,gci_goal:void 0}});P.useEffect(()=>{s?a.reset({transactions_goal:s.transactions_goal??void 0,volume_goal:s.volume_goal?Number(s.volume_goal):void 0,gci_goal:s.gci_goal?Number(s.gci_goal):void 0}):a.reset({transactions_goal:void 0,volume_goal:void 0,gci_goal:void 0})},[s,a,t]);const f=async m=>{await i.mutateAsync({year:n,transactions_goal:m.transactions_goal??null,volume_goal:m.volume_goal??null,gci_goal:c?m.gci_goal??null:null}),e(!1)};return r.jsx($r,{open:t,onOpenChange:e,children:r.jsxs(zr,{className:"max-w-md",children:[r.jsxs(Zr,{children:[r.jsxs(Kr,{children:[n," Goals"]}),r.jsx(ls,{children:"Set your annual targets to track your progress throughout the year."})]}),r.jsx(rse,{...a,children:r.jsxs("form",{onSubmit:a.handleSubmit(f),className:"space-y-4",children:[r.jsx(jl,{control:a.control,name:"transactions_goal",render:({field:m})=>r.jsxs(hl,{children:[r.jsx(fl,{children:"Transactions Goal"}),r.jsx(pl,{children:r.jsx(yt,{type:"number",placeholder:"e.g., 24",...m,value:m.value??"",onChange:y=>m.onChange(y.target.value?Number(y.target.value):void 0)})}),r.jsx(tee,{children:"Total number of deals you want to close"}),r.jsx(gu,{})]})}),r.jsx(jl,{control:a.control,name:"volume_goal",render:({field:m})=>r.jsxs(hl,{children:[r.jsx(fl,{children:"Volume Goal ($)"}),r.jsx(pl,{children:r.jsx(yt,{type:"number",placeholder:"e.g., 5000000",...m,value:m.value??"",onChange:y=>m.onChange(y.target.value?Number(y.target.value):void 0)})}),r.jsx(tee,{children:"Total sales volume you want to achieve"}),r.jsx(gu,{})]})}),c&&r.jsx(jl,{control:a.control,name:"gci_goal",render:({field:m})=>r.jsxs(hl,{children:[r.jsx(fl,{children:"GCI Goal ($)"}),r.jsx(pl,{children:r.jsx(yt,{type:"number",placeholder:"e.g., 150000",...m,value:m.value??"",onChange:y=>m.onChange(y.target.value?Number(y.target.value):void 0)})}),r.jsx(tee,{children:"Gross commission income target"}),r.jsx(gu,{})]})}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsx(te,{type:"submit",disabled:i.isPending,children:"Save Goals"})]})]})})]})})}const i$e=new Date().getFullYear(),Qqt=Array.from({length:10},(t,e)=>i$e-e);function Jqt(){var F;const[t,e]=P.useState(i$e),[n,s]=P.useState(!1),[i,o]=P.useState(!1),[c,a]=P.useState(!1),[f,m]=P.useState(!1),{data:y,isLoading:v}=oye(t),{yearStats:w,lifetimeStats:k,showCommission:C}=lDe(t),{data:S,isLoading:T}=oDe(t),{data:I}=pse(),A=Lht(),D=()=>{if(!y||y.length===0)return;const q=["Property Address","City","State","Zip","Transaction Type","Close Date","Sale Price",...C?["Commission"]:[],"Lead Source","Client Type","Contact Name","Is Win","Notes"],W=y.map(ue=>{var Ne,se;return[ue.property_address,ue.city||"",ue.state||"",ue.zip||"",ue.transaction_type,ue.close_date,ue.sale_price,...C?[ue.commission_amount||""]:[],((Ne=ue.lead_source)==null?void 0:Ne.name)||"",((se=ue.client_type)==null?void 0:se.name)||"",ue.contact?`${ue.contact.first_name} ${ue.contact.last_name||""}`.trim():"",ue.is_win?"Yes":"No",ue.notes||""]}),K=[q,...W].map(ue=>ue.map(Ne=>`"${String(Ne).replace(/"/g,'""')}"`).join(",")).join(` `),Z=new Blob([K],{type:"text/csv"}),re=URL.createObjectURL(Z),he=document.createElement("a");he.href=re,he.download=`transactions-${t}.csv`,he.click(),URL.revokeObjectURL(re)},$=!y||y.length===0;return r.jsxs(Or,{title:"Scorecard",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Scorecard"}),r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0.5 rounded border border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10",children:"Beta"})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Business Scorecard"}),r.jsx("p",{className:"text-muted-foreground",children:"Track your transactions, goals, and performance"})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs(_n,{value:String(t),onValueChange:q=>e(Number(q)),children:[r.jsx(xn,{className:"w-[120px]",children:r.jsx(bn,{})}),r.jsx(vn,{children:Qqt.map(q=>r.jsx(er,{value:String(q),children:q},q))})]}),r.jsx(te,{variant:"outline",size:"icon",onClick:()=>m(!f),children:r.jsx(id,{className:"h-4 w-4"})})]})]}),f&&r.jsxs(Ye,{children:[r.jsx(Ht,{className:"pb-3",children:r.jsx(Yt,{className:"text-lg",children:"Settings"})}),r.jsx(Je,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(Qe,{children:"Show Commission"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Display commission fields and include in stats"})]}),r.jsx(Zs,{checked:(I==null?void 0:I.show_commission)??!0,onCheckedChange:q=>A.mutate({show_commission:q})})]})})]}),$&&!v?r.jsx(Ye,{className:"py-12",children:r.jsxs(Je,{className:"text-center space-y-4",children:[r.jsx("div",{className:"w-16 h-16 mx-auto rounded-full bg-primary/10 flex items-center justify-center",children:r.jsx(xc,{className:"h-8 w-8 text-primary"})}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold",children:"Start Tracking Your Success"}),r.jsx("p",{className:"text-muted-foreground max-w-md mx-auto mt-1",children:"Add your past transactions to see your performance metrics, track your goals, and celebrate your wins."})]}),r.jsxs("div",{className:"flex flex-wrap justify-center gap-2 pt-2",children:[r.jsxs(te,{onClick:()=>s(!0),children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Add Your First Transaction"]}),r.jsxs(te,{variant:"outline",onClick:()=>o(!0),children:[r.jsx(Ao,{className:"h-4 w-4 mr-2"}),"Import CSV"]})]}),r.jsxs("div",{className:"pt-4 border-t mt-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Need help formatting your data?"}),r.jsx(te,{variant:"link",className:"h-auto p-0",asChild:!0,children:r.jsxs("a",{href:"/templates/transaction-import-template.csv",download:!0,children:[r.jsx(Mo,{className:"h-4 w-4 mr-2"}),"Download CSV Template"]})})]})]})}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(te,{onClick:()=>s(!0),children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Add Transaction"]}),r.jsxs(te,{variant:"outline",onClick:()=>a(!0),children:[r.jsx(Ey,{className:"h-4 w-4 mr-2"}),"Set Goals"]}),r.jsxs(te,{variant:"outline",onClick:()=>o(!0),children:[r.jsx(Ao,{className:"h-4 w-4 mr-2"}),"Import"]}),r.jsxs(te,{variant:"outline",onClick:D,disabled:$,children:[r.jsx(Mo,{className:"h-4 w-4 mr-2"}),"Export"]}),r.jsx(te,{variant:"ghost",size:"sm",asChild:!0,children:r.jsxs("a",{href:"/templates/transaction-import-template.csv",download:!0,children:[r.jsx(Mo,{className:"h-4 w-4 mr-2"}),"CSV Template"]})})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4",children:[r.jsx(Ye,{children:r.jsxs(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Hi,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Transactions"})]}),r.jsx("p",{className:"text-2xl font-bold",children:w.totalTransactions}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[k.totalTransactions," lifetime"]})]})}),r.jsx(Ye,{children:r.jsxs(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(hs,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Buyer/Seller"})]}),r.jsxs("p",{className:"text-2xl font-bold",children:[w.buyerCount,"/",w.sellerCount]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"B/S split"})]})}),r.jsx(Ye,{children:r.jsxs(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Cd,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Volume"})]}),r.jsx("p",{className:"text-2xl font-bold",children:jd(w.totalVolume,!0)}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[jd(k.totalVolume,!0)," lifetime"]})]})}),r.jsx(Ye,{children:r.jsxs(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Bf,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Avg Price"})]}),r.jsx("p",{className:"text-2xl font-bold",children:jd(w.averagePrice,!0)})]})}),r.jsx(Ye,{children:r.jsxs(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Cu,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Top Source"})]}),r.jsx("p",{className:"text-lg font-bold truncate",children:((F=w.topLeadSource)==null?void 0:F.name)||"-"}),w.topLeadSource&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:[w.topLeadSource.count," deals"]})]})}),C&&r.jsx(Ye,{children:r.jsxs(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Cd,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Commission"})]}),r.jsx("p",{className:"text-2xl font-bold",children:jd(w.totalCommission,!0)}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[jd(k.totalCommission,!0)," lifetime"]})]})})]}),S&&r.jsx(pze,{goals:S,stats:w,year:t,showCommission:C}),r.jsxs(La,{defaultValue:"transactions",className:"space-y-4",children:[r.jsxs(Ma,{children:[r.jsx(yn,{value:"transactions",children:"Transactions"}),r.jsx(yn,{value:"charts",children:"Charts"})]}),r.jsx($n,{value:"transactions",children:r.jsx(fze,{transactions:y||[],showCommission:C,isLoading:v})}),r.jsx($n,{value:"charts",children:r.jsx(s$e,{stats:w,year:t})})]})]})]}),r.jsx(hze,{open:n,onOpenChange:s}),r.jsx(Zqt,{open:i,onOpenChange:o}),r.jsx(Xqt,{open:c,onOpenChange:a,year:t,existingGoals:S})]})}function a$e({open:t,onOpenChange:e,listingId:n,listingSlug:s,listingTitle:i}){const{user:o}=Fr(),[c,a]=P.useState(null),[f,m]=P.useState(!1),[y,v]=P.useState(!1);P.useEffect(()=>{(async()=>{if(!(!t||!o)){m(!0);try{const{data:T,error:I}=await ee.from("listing_shares").select("id, share_token, click_count, lead_count").eq("listing_id",n).eq("sharing_agent_id",o.id).order("created_at",{ascending:!1}).limit(1).maybeSingle();if(I)throw I;if(T&&T.share_token)a(T);else if(T&&!T.share_token){const{data:A,error:D}=await ee.from("listing_shares").update({share_type:"referral_link"}).eq("id",T.id).select("id, share_token, click_count, lead_count").single();if(D)throw D;a(A)}else{const{data:A,error:D}=await ee.from("listing_shares").insert({listing_id:n,sharing_agent_id:o.id,share_type:"referral_link"}).select("id, share_token, click_count, lead_count").single();if(D)throw D;a(A)}}catch(T){console.error("Error creating share link:",T),Ge.error("Failed to generate share link")}finally{m(!1)}}})()},[t,o,n]);const w=c!=null&&c.share_token?`https://listings.relevelup.com/${s||n}?ref=${c.share_token}`:"",k=async()=>{try{await navigator.clipboard.writeText(w),v(!0),Ge.success("Link copied to clipboard!"),setTimeout(()=>v(!1),2e3)}catch{Ge.error("Failed to copy link")}},C=S=>{const T=encodeURIComponent(w),I=encodeURIComponent(`Check out this listing: ${i}`);switch(S){case"email":window.open(`mailto:?subject=${I}&body=${T}`);break;case"text":window.open(`sms:?body=${I}%20${T}`);break;case"facebook":window.open(`https://www.facebook.com/sharer/sharer.php?u=${T}`,"_blank");break}};return r.jsx($r,{open:t,onOpenChange:e,children:r.jsxs(zr,{className:"sm:max-w-md",children:[r.jsxs(Zr,{children:[r.jsxs(Kr,{className:"flex items-center gap-2",children:[r.jsx(Mi,{className:"h-5 w-5 text-amber-500"}),"Share & Earn Leads"]}),r.jsx(ls,{children:"Share this listing with your network. When someone submits a lead through your link, they'll become your contact!"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsx("div",{className:"bg-amber-50 dark:bg-amber-950/30 border border-amber-200 dark:border-amber-800 rounded-lg p-3",children:r.jsxs("p",{className:"text-sm text-amber-800 dark:text-amber-200",children:[r.jsx("strong",{children:"How it works:"})," The listing still shows the original agent's info, but any leads from your unique link go directly to you!"]})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Your Referral Link"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(yt,{value:f?"Generating...":w,readOnly:!0,className:"font-mono text-sm"}),r.jsx(te,{onClick:k,disabled:f||!w,variant:y?"default":"outline",children:y?r.jsx(Ba,{className:"h-4 w-4"}):r.jsx(Ul,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Share via"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(te,{variant:"outline",className:"flex-1",onClick:()=>C("email"),disabled:f,children:[r.jsx(di,{className:"h-4 w-4 mr-2"}),"Email"]}),r.jsxs(te,{variant:"outline",className:"flex-1",onClick:()=>C("text"),disabled:f,children:[r.jsx(Wl,{className:"h-4 w-4 mr-2"}),"Text"]}),r.jsxs(te,{variant:"outline",className:"flex-1",onClick:()=>C("facebook"),disabled:f,children:[r.jsx(Md,{className:"h-4 w-4 mr-2"}),"Facebook"]})]})]}),c&&(c.click_count>0||c.lead_count>0)&&r.jsxs("div",{className:"pt-4 border-t",children:[r.jsx(Qe,{className:"mb-2 block",children:"Your Share Performance"}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{className:"bg-muted rounded-lg p-3 text-center",children:[r.jsxs("div",{className:"flex items-center justify-center gap-1 text-muted-foreground mb-1",children:[r.jsx(Ml,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs",children:"Clicks"})]}),r.jsx("p",{className:"text-2xl font-bold",children:c.click_count})]}),r.jsxs("div",{className:"bg-primary/10 rounded-lg p-3 text-center",children:[r.jsxs("div",{className:"flex items-center justify-center gap-1 text-primary mb-1",children:[r.jsx(hs,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs",children:"Leads"})]}),r.jsx("p",{className:"text-2xl font-bold text-primary",children:c.lead_count})]})]})]})]})]})})}const eVt={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},tVt={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},rVt={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function tde({listing:t,onClick:e,onEdit:n,onDelete:s,showActions:i}){var S,T;const{user:o}=Fr(),{data:c}=tDe(t.id),a=eDe(),[f,m]=P.useState(!1),y=I=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(I),v=((S=t.photos)==null?void 0:S.find(I=>I.is_primary))||((T=t.photos)==null?void 0:T[0]),w=(o==null?void 0:o.id)===t.agent_id,k=async I=>{I.stopPropagation();try{const A=await a.mutateAsync(t.id);Ge.success(A.saved?"Listing saved!":"Listing removed from saved")}catch{Ge.error("Failed to save listing")}},C=I=>{if(I.stopPropagation(),o)m(!0);else{const A=`https://listings.relevelup.com/${t.slug||t.id}`;navigator.clipboard.writeText(A),Ge.success("Link copied to clipboard!")}};return r.jsxs(Ye,{className:"overflow-hidden hover:shadow-lg transition-shadow cursor-pointer group",onClick:e,children:[r.jsxs("div",{className:"relative aspect-[4/3] bg-muted",children:[v?r.jsx("img",{src:v.photo_url,alt:t.property_address||t.city,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:r.jsx(im,{className:"h-12 w-12"})}),r.jsx(Rt,{className:`absolute top-2 left-2 ${eVt[t.status]} text-white border-0`,children:tVt[t.status]}),t.is_featured&&r.jsx("div",{className:"absolute top-2 right-2 p-1.5 bg-amber-500 rounded-full",children:r.jsx(Ca,{className:"h-4 w-4 text-white fill-white"})}),r.jsxs("div",{className:"absolute bottom-2 right-2 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[r.jsx(te,{size:"icon",variant:"secondary",className:"h-8 w-8",onClick:k,children:r.jsx(ql,{className:`h-4 w-4 ${c?"fill-pink-500 text-pink-500":""}`})}),r.jsx(te,{size:"icon",variant:"secondary",className:"h-8 w-8",onClick:C,title:w?"Copy link":"Share & earn leads",children:w?r.jsx(Kd,{className:"h-4 w-4"}):r.jsx(Mi,{className:"h-4 w-4 text-amber-500"})})]})]}),r.jsx(a$e,{open:f,onOpenChange:m,listingId:t.id,listingSlug:t.slug||null,listingTitle:t.property_address||`${t.city}, ${t.state}`}),r.jsxs(Je,{className:"p-4 space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("p",{className:"text-xl font-bold text-primary",children:y(t.price)}),t.open_to_referrals&&r.jsxs(Rt,{variant:"outline",className:"text-xs",children:[r.jsx(hs,{className:"h-3 w-3 mr-1"}),"Referrals"]})]}),r.jsxs("div",{children:[t.property_address&&r.jsx("p",{className:"font-medium truncate",children:t.property_address}),r.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[r.jsx(yl,{className:"h-3 w-3"}),t.city,", ",t.state,t.neighborhood&&` • ${t.neighborhood}`]})]}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[t.bedrooms&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Of,{className:"h-4 w-4"}),t.bedrooms," bd"]}),t.bathrooms&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Lf,{className:"h-4 w-4"}),t.bathrooms," ba"]}),t.square_footage&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(im,{className:"h-4 w-4"}),t.square_footage.toLocaleString()," sqft"]})]}),r.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[r.jsx(Rt,{variant:"secondary",className:"text-xs",children:rVt[t.property_type]}),t.agent&&r.jsx("p",{className:"text-xs text-muted-foreground truncate max-w-[120px]",children:t.agent.name})]}),r.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ml,{className:"h-3 w-3"}),t.view_count]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Kd,{className:"h-3 w-3"}),t.share_count]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(ql,{className:"h-3 w-3"}),t.save_count]})]}),i&&(n||s)&&r.jsxs("div",{className:"flex gap-2",children:[n&&r.jsxs(te,{variant:"outline",size:"sm",className:"flex-1",onClick:I=>{I.stopPropagation(),n()},children:[r.jsx(Jl,{className:"h-4 w-4 mr-2"}),"Edit"]}),s&&r.jsx(te,{variant:"destructive",size:"sm",onClick:I=>{I.stopPropagation(),s()},children:r.jsx(Xn,{className:"h-4 w-4"})})]})]})]})}const nVt=[{value:"active",label:"Active"},{value:"coming_soon",label:"Coming Soon"},{value:"price_improvement",label:"Price Improvement"},{value:"under_contract",label:"Under Contract"},{value:"sold",label:"Sold"}],sVt=[{value:"single_family",label:"Single Family"},{value:"condo",label:"Condo"},{value:"townhouse",label:"Townhouse"},{value:"land",label:"Land"},{value:"multi_family",label:"Multi-Family"},{value:"luxury",label:"Luxury"},{value:"commercial",label:"Commercial"},{value:"other",label:"Other"}];function iVt({filters:t,onFiltersChange:e,onClose:n}){const s=()=>{e({sortBy:"newest"})};return r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between pb-3",children:[r.jsx(Yt,{className:"text-lg",children:"Filters"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(te,{variant:"ghost",size:"sm",onClick:s,children:"Clear All"}),r.jsx(te,{variant:"ghost",size:"icon",onClick:n,children:r.jsx(Ms,{className:"h-4 w-4"})})]})]}),r.jsxs(Je,{children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Status"}),r.jsxs(_n,{value:t.status||"all",onValueChange:i=>e({...t,status:i==="all"?void 0:i}),children:[r.jsx(xn,{children:r.jsx(bn,{placeholder:"All statuses"})}),r.jsxs(vn,{children:[r.jsx(er,{value:"all",children:"All Statuses"}),nVt.map(i=>r.jsx(er,{value:i.value,children:i.label},i.value))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Property Type"}),r.jsxs(_n,{value:t.propertyType||"all",onValueChange:i=>e({...t,propertyType:i==="all"?void 0:i}),children:[r.jsx(xn,{children:r.jsx(bn,{placeholder:"All types"})}),r.jsxs(vn,{children:[r.jsx(er,{value:"all",children:"All Types"}),sVt.map(i=>r.jsx(er,{value:i.value,children:i.label},i.value))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Min Price"}),r.jsx(yt,{type:"number",placeholder:"No minimum",value:t.minPrice||"",onChange:i=>e({...t,minPrice:i.target.value?Number(i.target.value):void 0})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Max Price"}),r.jsx(yt,{type:"number",placeholder:"No maximum",value:t.maxPrice||"",onChange:i=>e({...t,maxPrice:i.target.value?Number(i.target.value):void 0})})]})]}),r.jsxs("div",{className:"flex items-center justify-between mt-4 pt-4 border-t",children:[r.jsxs("div",{children:[r.jsx(Qe,{children:"Open to Referrals Only"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Show only listings accepting buyer referrals"})]}),r.jsx(Zs,{checked:t.openToReferrals||!1,onCheckedChange:i=>e({...t,openToReferrals:i||void 0})})]})]})]})}function aVt({leaderboard:t}){const e=s=>{switch(s){case 0:return r.jsx(qa,{className:"h-5 w-5 text-amber-500"});case 1:return r.jsx(Ty,{className:"h-5 w-5 text-gray-400"});case 2:return r.jsx(Cu,{className:"h-5 w-5 text-amber-700"});default:return r.jsx("span",{className:"text-sm font-medium text-muted-foreground w-5 text-center",children:s+1})}},n=(s,i)=>!s||s.length===0?r.jsx("div",{className:"py-8 text-center text-muted-foreground",children:"No data yet. Start sharing to climb the leaderboard!"}):r.jsx("div",{className:"space-y-2",children:s.map((o,c)=>r.jsxs("div",{className:`flex items-center gap-4 p-3 rounded-lg ${c===0?"bg-gradient-to-r from-amber-500/10 to-amber-500/5 border border-amber-500/20":"bg-muted/50"}`,children:[r.jsx("div",{className:"flex items-center justify-center w-8",children:e(c)}),r.jsx("div",{className:"flex-1 min-w-0",children:r.jsx("p",{className:"font-medium truncate",children:o.name})}),r.jsxs(Rt,{variant:c===0?"default":"secondary",children:[o.count," ",i]})]},o.agentId))});return r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(qa,{className:"h-5 w-5 text-amber-500"}),"Community Badges"]})}),r.jsx(Je,{children:r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"text-center p-4 rounded-lg bg-gradient-to-br from-emerald-500/10 to-emerald-500/5 border border-emerald-500/20",children:[r.jsx("div",{className:"w-12 h-12 mx-auto mb-2 rounded-full bg-emerald-500/20 flex items-center justify-center",children:r.jsx(Kd,{className:"h-6 w-6 text-emerald-500"})}),r.jsx("p",{className:"font-medium text-sm",children:"Listing Amplifier"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Share 10+ listings"})]}),r.jsxs("div",{className:"text-center p-4 rounded-lg bg-gradient-to-br from-sky-500/10 to-sky-500/5 border border-sky-500/20",children:[r.jsx("div",{className:"w-12 h-12 mx-auto mb-2 rounded-full bg-sky-500/20 flex items-center justify-center",children:r.jsx(Hi,{className:"h-6 w-6 text-sky-500"})}),r.jsx("p",{className:"font-medium text-sm",children:"Top Contributor"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Add 5+ listings"})]}),r.jsxs("div",{className:"text-center p-4 rounded-lg bg-gradient-to-br from-purple-500/10 to-purple-500/5 border border-purple-500/20",children:[r.jsx("div",{className:"w-12 h-12 mx-auto mb-2 rounded-full bg-purple-500/20 flex items-center justify-center",children:r.jsx(Ty,{className:"h-6 w-6 text-purple-500"})}),r.jsx("p",{className:"font-medium text-sm",children:"Referral Connector"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Send 3+ referrals"})]}),r.jsxs("div",{className:"text-center p-4 rounded-lg bg-gradient-to-br from-amber-500/10 to-amber-500/5 border border-amber-500/20",children:[r.jsx("div",{className:"w-12 h-12 mx-auto mb-2 rounded-full bg-amber-500/20 flex items-center justify-center",children:r.jsx(qa,{className:"h-6 w-6 text-amber-500"})}),r.jsx("p",{className:"font-medium text-sm",children:"Community MVP"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Top performer"})]})]})})]}),r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsx(Yt,{children:"Community Leaderboard"})}),r.jsx(Je,{children:r.jsxs(La,{defaultValue:"sharers",children:[r.jsxs(Ma,{className:"w-full",children:[r.jsxs(yn,{value:"sharers",className:"flex-1",children:[r.jsx(Kd,{className:"h-4 w-4 mr-2"}),"Top Sharers"]}),r.jsxs(yn,{value:"listers",className:"flex-1",children:[r.jsx(Hi,{className:"h-4 w-4 mr-2"}),"Top Contributors"]})]}),r.jsx($n,{value:"sharers",className:"mt-4",children:n(t==null?void 0:t.topSharers,"shares")}),r.jsx($n,{value:"listers",className:"mt-4",children:n(t==null?void 0:t.topListers,"listings")})]})})]})]})}function oVt(){var q,W,K,Z,re,he,ue,Ne;const t=es(),{data:e,isLoading:n}=YOe(),[s,i]=P.useState("feed"),[o,c]=P.useState(!1),[a,f]=P.useState(""),[m,y]=P.useState({sortBy:"newest"}),{data:v,isLoading:w}=XOe({...m,city:a||m.city}),{data:k,isLoading:C}=yht(),{data:S,isLoading:T}=aye(),{data:I,isLoading:A}=bht(),{data:D}=jht(),$=JOe(),F=async se=>{if(confirm("Are you sure you want to delete this listing? This action cannot be undone."))try{await $.mutateAsync(se),Ge.success("Listing deleted successfully")}catch{Ge.error("Failed to delete listing")}};return n?r.jsx(Or,{title:"Listing Exchange",description:"Community-powered listing collaboration",children:r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent rounded-full"})})}):e?r.jsx(Or,{title:"Listing Exchange",description:"Community-powered listing collaboration",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Listing Exchange"}),r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0.5 rounded border border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10",children:"Beta"})]}),r.jsxs(te,{onClick:()=>t("/innercircle/listings/new"),children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Add Listing"]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsx(Ye,{children:r.jsxs(Je,{className:"p-4 flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(Hi,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:(v==null?void 0:v.length)||0}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Active Listings"})]})]})}),r.jsx(Ye,{children:r.jsxs(Je,{className:"p-4 flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-pink-500/10 rounded-lg",children:r.jsx(ql,{className:"h-5 w-5 text-pink-500"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:(k==null?void 0:k.length)||0}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Saved"})]})]})}),r.jsx(Ye,{children:r.jsxs(Je,{className:"p-4 flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-emerald-500/10 rounded-lg",children:r.jsx(LS,{className:"h-5 w-5 text-emerald-500"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:(S==null?void 0:S.length)||0}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"My Listings"})]})]})}),r.jsx(Ye,{children:r.jsxs(Je,{className:"p-4 flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-sky-500/10 rounded-lg",children:r.jsx(hs,{className:"h-5 w-5 text-sky-500"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:(((q=I==null?void 0:I.sent)==null?void 0:q.length)||0)+(((W=I==null?void 0:I.received)==null?void 0:W.length)||0)}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Referrals"})]})]})})]}),r.jsxs(La,{value:s,onValueChange:i,children:[r.jsxs(Ma,{className:"w-full justify-start overflow-x-auto",children:[r.jsx(yn,{value:"feed",children:"Community Feed"}),r.jsx(yn,{value:"my-listings",children:"My Listings"}),r.jsx(yn,{value:"saved",children:"Saved"}),r.jsx(yn,{value:"referrals",children:"Referrals"}),r.jsx(yn,{value:"leaderboard",children:"Leaderboard"})]}),r.jsxs($n,{value:"feed",className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Ti,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(yt,{placeholder:"Search by city or neighborhood...",value:a,onChange:se=>f(se.target.value),className:"pl-9"})]}),r.jsxs(_n,{value:m.sortBy,onValueChange:se=>y({...m,sortBy:se}),children:[r.jsx(xn,{className:"w-[180px]",children:r.jsx(bn,{placeholder:"Sort by"})}),r.jsxs(vn,{children:[r.jsx(er,{value:"newest",children:"Newest First"}),r.jsx(er,{value:"updated",children:"Recently Updated"}),r.jsx(er,{value:"price_asc",children:"Price: Low to High"}),r.jsx(er,{value:"price_desc",children:"Price: High to Low"})]})]}),r.jsxs(te,{variant:"outline",onClick:()=>c(!o),children:[r.jsx(Uw,{className:"h-4 w-4 mr-2"}),"Filters"]})]}),o&&r.jsx(iVt,{filters:m,onFiltersChange:y,onClose:()=>c(!1)}),w?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(6)].map((se,xe)=>r.jsxs(Ye,{children:[r.jsx(Gr,{className:"h-48 w-full"}),r.jsxs(Je,{className:"p-4 space-y-2",children:[r.jsx(Gr,{className:"h-5 w-3/4"}),r.jsx(Gr,{className:"h-4 w-1/2"}),r.jsx(Gr,{className:"h-4 w-1/4"})]})]},xe))}):(v==null?void 0:v.length)===0?r.jsx(Ye,{children:r.jsxs(Je,{className:"py-12 text-center",children:[r.jsx(Hi,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No listings found"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Be the first to share a listing with the community!"}),r.jsxs(te,{onClick:()=>t("/innercircle/listings/new"),children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Add Listing"]})]})}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:v==null?void 0:v.map(se=>r.jsx(tde,{listing:se,onClick:()=>t(`/innercircle/listings/${se.id}`)},se.id))})]}),r.jsx($n,{value:"my-listings",className:"space-y-4",children:T?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(3)].map((se,xe)=>r.jsxs(Ye,{children:[r.jsx(Gr,{className:"h-48 w-full"}),r.jsxs(Je,{className:"p-4 space-y-2",children:[r.jsx(Gr,{className:"h-5 w-3/4"}),r.jsx(Gr,{className:"h-4 w-1/2"})]})]},xe))}):(S==null?void 0:S.length)===0?r.jsx(Ye,{children:r.jsxs(Je,{className:"py-12 text-center",children:[r.jsx(LS,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No listings yet"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Share your listings with the LevelUp community!"}),r.jsxs(te,{onClick:()=>t("/innercircle/listings/new"),children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Add Your First Listing"]})]})}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:S==null?void 0:S.map(se=>r.jsx(tde,{listing:se,showActions:!0,onClick:()=>t(`/innercircle/listings/${se.id}`),onEdit:()=>t(`/innercircle/listings/${se.id}/edit`),onDelete:()=>F(se.id)},se.id))})}),r.jsx($n,{value:"saved",className:"space-y-4",children:C?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(3)].map((se,xe)=>r.jsxs(Ye,{children:[r.jsx(Gr,{className:"h-48 w-full"}),r.jsxs(Je,{className:"p-4 space-y-2",children:[r.jsx(Gr,{className:"h-5 w-3/4"}),r.jsx(Gr,{className:"h-4 w-1/2"})]})]},xe))}):(k==null?void 0:k.length)===0?r.jsx(Ye,{children:r.jsxs(Je,{className:"py-12 text-center",children:[r.jsx(ql,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No saved listings"}),r.jsx("p",{className:"text-muted-foreground",children:"Save listings to quickly access them later"})]})}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:k==null?void 0:k.map(se=>r.jsx(tde,{listing:se.listing,onClick:()=>t(`/innercircle/listings/${se.listing.id}`)},se.id))})}),r.jsx($n,{value:"referrals",className:"space-y-6",children:r.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[r.jsxs("div",{children:[r.jsxs("h3",{className:"font-semibold mb-3 flex items-center gap-2",children:[r.jsx(Kd,{className:"h-4 w-4"}),"Referrals Sent (",((K=I==null?void 0:I.sent)==null?void 0:K.length)||0,")"]}),((Z=I==null?void 0:I.sent)==null?void 0:Z.length)===0?r.jsx(Ye,{children:r.jsx(Je,{className:"py-8 text-center text-muted-foreground",children:"No referrals sent yet"})}):r.jsx("div",{className:"space-y-3",children:(re=I==null?void 0:I.sent)==null?void 0:re.map(se=>{var xe,ie;return r.jsx(Ye,{children:r.jsx(Je,{className:"p-4",children:r.jsxs("div",{className:"flex justify-between items-start mb-2",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:se.buyer_name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:((xe=se.listing)==null?void 0:xe.property_address)||((ie=se.listing)==null?void 0:ie.city)})]}),r.jsx(Rt,{variant:se.status==="closed"?"default":"secondary",children:se.status.replace("_"," ")})]})})},se.id)})})]}),r.jsxs("div",{children:[r.jsxs("h3",{className:"font-semibold mb-3 flex items-center gap-2",children:[r.jsx(hs,{className:"h-4 w-4"}),"Referrals Received (",((he=I==null?void 0:I.received)==null?void 0:he.length)||0,")"]}),((ue=I==null?void 0:I.received)==null?void 0:ue.length)===0?r.jsx(Ye,{children:r.jsx(Je,{className:"py-8 text-center text-muted-foreground",children:"No referrals received yet"})}):r.jsx("div",{className:"space-y-3",children:(Ne=I==null?void 0:I.received)==null?void 0:Ne.map(se=>{var xe;return r.jsx(Ye,{children:r.jsxs(Je,{className:"p-4",children:[r.jsxs("div",{className:"flex justify-between items-start mb-2",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:se.buyer_name}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["From: ",(xe=se.sender)==null?void 0:xe.name]})]}),r.jsx(Rt,{variant:se.status==="closed"?"default":"secondary",children:se.status.replace("_"," ")})]}),r.jsx(te,{size:"sm",variant:"outline",className:"w-full mt-2",onClick:()=>t(`/innercircle/listings/${se.listing_id}`),children:"View Listing"})]})},se.id)})})]})]})}),r.jsx($n,{value:"leaderboard",children:r.jsx(aVt,{leaderboard:D})})]})]})}):r.jsx(Or,{title:"Listing Exchange",description:"Community-powered listing collaboration",children:r.jsx(Ye,{children:r.jsxs(Je,{className:"py-12 text-center",children:[r.jsx(Hi,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Coming Soon"}),r.jsx("p",{className:"text-muted-foreground",children:"Listing Exchange is currently in development. Check back soon!"})]})})})}function m0e(){const{user:t}=Fr();return rr({queryKey:["deal-pipeline-stages",t==null?void 0:t.id],queryFn:async()=>{if(!(t!=null&&t.id))return[];const{data:e,error:n}=await ee.from("deal_pipeline_stages").select("*").eq("owner_user_id",t.id).order("sort_order",{ascending:!0});if(n)throw n;return e},enabled:!!(t!=null&&t.id)})}function o$e(){const{user:t}=Fr(),e=Xr();return cr({mutationFn:async()=>{if(!(t!=null&&t.id))throw new Error("Not authenticated");const{error:n}=await ee.rpc("initialize_deal_pipeline_stages",{p_user_id:t.id});if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["deal-pipeline-stages"]})}})}function l$e(){const{user:t}=Fr();return rr({queryKey:["deal-pipeline-deals",t==null?void 0:t.id],queryFn:async()=>{if(!(t!=null&&t.id))return[];const{data:e,error:n}=await ee.from("deal_pipeline").select(` *, contact:innercircle_contacts(id, first_name, last_name, email, phone), listing:listings(id, property_address, city, state, price, status) `).eq("owner_user_id",t.id).order("updated_at",{ascending:!1});if(n)throw n;return e},enabled:!!(t!=null&&t.id)})}function c$e(){const{user:t}=Fr(),e=Xr();return cr({mutationFn:async n=>{if(!(t!=null&&t.id))throw new Error("Not authenticated");const{data:s,error:i}=await ee.from("deal_pipeline").insert({deal_name:n.deal_name,deal_type:n.deal_type,stage_id:n.stage_id||null,contact_id:n.contact_id||null,listing_id:n.listing_id||null,property_address:n.property_address||null,city:n.city||null,state:n.state||null,zip_code:n.zip_code||null,expected_price:n.expected_price||null,expected_commission:n.expected_commission||null,commission_percentage:n.commission_percentage||3,target_close_date:n.target_close_date||null,contract_date:n.contract_date||null,priority:n.priority||"medium",probability:n.probability||50,notes:n.notes||null,owner_user_id:t.id}).select().single();if(i)throw i;return await ee.from("deal_activities").insert([{deal_id:s.id,activity_type:"system",title:"Deal created",description:`Deal "${n.deal_name}" was created`}]),s},onSuccess:()=>{e.invalidateQueries({queryKey:["deal-pipeline-deals"]}),e.invalidateQueries({queryKey:["deal-pipeline-stats"]})}})}function d$e(){const t=Xr();return cr({mutationFn:async({id:e,...n})=>{const{data:s,error:i}=await ee.from("deal_pipeline").update(n).eq("id",e).select().single();if(i)throw i;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["deal-pipeline-deals"]}),t.invalidateQueries({queryKey:["deal-pipeline-stats"]})}})}function lVt(){const t=Xr();return cr({mutationFn:async({dealId:e,stageId:n,stageName:s})=>{const{data:i,error:o}=await ee.from("deal_pipeline").update({stage_id:n}).eq("id",e).select().single();if(o)throw o;return await ee.from("deal_activities").insert({deal_id:e,activity_type:"stage_change",title:`Moved to ${s}`,metadata:{new_stage_id:n,new_stage_name:s}}),i},onSuccess:()=>{t.invalidateQueries({queryKey:["deal-pipeline-deals"]}),t.invalidateQueries({queryKey:["deal-activities"]})}})}function cVt(){const t=Xr();return cr({mutationFn:async e=>{const{error:n}=await ee.from("deal_pipeline").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["deal-pipeline-deals"]}),t.invalidateQueries({queryKey:["deal-pipeline-stats"]})}})}function dVt(t){return rr({queryKey:["deal-activities",t],queryFn:async()=>{const{data:e,error:n}=await ee.from("deal_activities").select("*").eq("deal_id",t).order("created_at",{ascending:!1});if(n)throw n;return e},enabled:!!t})}function uVt(){const t=Xr();return cr({mutationFn:async e=>{const{data:n,error:s}=await ee.from("deal_activities").insert([{deal_id:e.deal_id,activity_type:e.activity_type,title:e.title,description:e.description||null}]).select().single();if(s)throw s;return n},onSuccess:(e,n)=>{t.invalidateQueries({queryKey:["deal-activities",n.deal_id]})}})}function hVt(t){return rr({queryKey:["deal-checklist",t],queryFn:async()=>{const{data:e,error:n}=await ee.from("deal_checklist_items").select("*").eq("deal_id",t).order("sort_order",{ascending:!0});if(n)throw n;return e},enabled:!!t})}function fVt(){const t=Xr();return cr({mutationFn:async({id:e,is_completed:n,deal_id:s})=>{const{data:i,error:o}=await ee.from("deal_checklist_items").update({is_completed:n,completed_at:n?new Date().toISOString():null}).eq("id",e).select().single();if(o)throw o;return i},onSuccess:(e,n)=>{t.invalidateQueries({queryKey:["deal-checklist",n.deal_id]})}})}function pVt(){const t=Xr();return cr({mutationFn:async e=>{const{data:n,error:s}=await ee.from("deal_checklist_items").insert([{deal_id:e.deal_id,title:e.title,description:e.description||null,due_date:e.due_date||null,sort_order:e.sort_order||0}]).select().single();if(s)throw s;return n},onSuccess:(e,n)=>{t.invalidateQueries({queryKey:["deal-checklist",n.deal_id]})}})}function mVt(){const{user:t}=Fr();return rr({queryKey:["deal-pipeline-stats",t==null?void 0:t.id],queryFn:async()=>{if(!(t!=null&&t.id))return null;const{data:e,error:n}=await ee.from("deal_pipeline").select("expected_price, expected_commission, stage_id, deal_pipeline_stages(is_won_stage, is_lost_stage)").eq("owner_user_id",t.id);if(n)throw n;const s=(e==null?void 0:e.filter(o=>{var c,a;return!((c=o.deal_pipeline_stages)!=null&&c.is_won_stage)&&!((a=o.deal_pipeline_stages)!=null&&a.is_lost_stage)}))||[],i=(e==null?void 0:e.filter(o=>{var c;return(c=o.deal_pipeline_stages)==null?void 0:c.is_won_stage}))||[];return{totalDeals:(e==null?void 0:e.length)||0,activeDeals:s.length,wonDeals:i.length,pipelineValue:s.reduce((o,c)=>o+(c.expected_price||0),0),expectedCommission:s.reduce((o,c)=>o+(c.expected_commission||0),0),wonValue:i.reduce((o,c)=>o+(c.expected_price||0),0)}},enabled:!!(t!=null&&t.id)})}function gVt(t){const{user:e}=Fr();return rr({queryKey:["deal-by-listing",t,e==null?void 0:e.id],queryFn:async()=>{if(!(e!=null&&e.id)||!t)return null;const{data:n,error:s}=await ee.from("deal_pipeline").select(` *, deal_pipeline_stages(id, name, color) `).eq("owner_user_id",e.id).eq("listing_id",t).maybeSingle();if(s)throw s;return n},enabled:!!(e!=null&&e.id)&&!!t})}function yVt(){const t=Xr();return cr({mutationFn:async({dealId:e,listingId:n})=>{const{data:s,error:i}=await ee.from("deal_pipeline").update({listing_id:n}).eq("id",e).select().single();if(i)throw i;return await ee.from("deal_activities").insert({deal_id:e,activity_type:"system",title:"Linked to Listing Exchange",description:"This deal is now synced with Listing Exchange",metadata:{listing_id:n}}),s},onSuccess:(e,n)=>{t.invalidateQueries({queryKey:["deal-pipeline-deals"]}),t.invalidateQueries({queryKey:["deal-by-listing",n.listingId]})}})}function xVt(){const t=Xr();return cr({mutationFn:async({dealId:e,listingId:n})=>{const{data:s,error:i}=await ee.from("deal_pipeline").update({listing_id:null}).eq("id",e).select().single();if(i)throw i;return{data:s,listingId:n}},onSuccess:e=>{t.invalidateQueries({queryKey:["deal-pipeline-deals"]}),t.invalidateQueries({queryKey:["deal-by-listing",e.listingId]})}})}function vVt({listing:t}){const e=es(),[n,s]=P.useState(""),[i,o]=P.useState(!1),{data:c,isLoading:a}=gVt(t.id),{data:f,isLoading:m}=m0e(),{data:y,isLoading:v}=l$e(),w=o$e(),k=yVt(),C=xVt(),S=c$e(),T=(y==null?void 0:y.filter(F=>!F.listing_id))||[],I=F=>{if(!(f!=null&&f.length))return null;switch(F){case"coming_soon":case"active":case"price_improvement":return f.find(q=>q.name==="Active");case"under_contract":return f.find(q=>q.name==="Under Contract");case"sold":return f.find(q=>q.is_won_stage);default:return f.find(q=>q.name==="Active")}},A=async()=>{o(!0);try{f!=null&&f.length||await w.mutateAsync();const F=I(t.status);await S.mutateAsync({deal_name:t.property_address?`${t.property_address}, ${t.city}`:`${t.city}, ${t.state}`,deal_type:"seller",stage_id:(F==null?void 0:F.id)||null,listing_id:t.id,property_address:t.property_address,city:t.city,state:t.state,expected_price:t.price,expected_commission:t.price*.03,commission_percentage:3,priority:"medium",probability:50}),Ge.success("Deal created and linked to listing!")}catch(F){console.error("Failed to create deal:",F),Ge.error("Failed to create deal")}finally{o(!1)}},D=async()=>{if(!n){Ge.error("Please select a deal");return}try{await k.mutateAsync({dealId:n,listingId:t.id}),Ge.success("Listing linked to deal!"),s("")}catch{Ge.error("Failed to link listing")}},$=async()=>{if(c)try{await C.mutateAsync({dealId:c.id,listingId:t.id}),Ge.success("Listing unlinked from deal")}catch{Ge.error("Failed to unlink listing")}};return a||m?r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsxs(Yt,{className:"flex items-center gap-2 text-base",children:[r.jsx(G0,{className:"h-4 w-4"}),"Deal Pipeline"]})}),r.jsx(Je,{children:r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(sn,{className:"h-5 w-5 animate-spin text-muted-foreground"})})})]}):c?r.jsxs(Ye,{className:"border-primary/20 bg-primary/5",children:[r.jsx(Ht,{className:"pb-2",children:r.jsxs(Yt,{className:"flex items-center gap-2 text-base",children:[r.jsx(Rf,{className:"h-4 w-4 text-primary"}),"Linked to Pipeline"]})}),r.jsxs(Je,{className:"space-y-3",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:c.deal_name}),r.jsx("div",{className:"flex items-center gap-2 mt-1",children:c.deal_pipeline_stages&&r.jsx(Rt,{variant:"secondary",className:"text-xs",style:{backgroundColor:`${c.deal_pipeline_stages.color}20`,color:c.deal_pipeline_stages.color},children:c.deal_pipeline_stages.name})})]})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Status changes sync automatically between the listing and pipeline."}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(te,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>e("/innercircle/pipeline"),children:["View Pipeline",r.jsx(Ho,{className:"h-3 w-3 ml-1"})]}),r.jsx(te,{variant:"ghost",size:"sm",onClick:$,disabled:C.isPending,children:C.isPending?r.jsx(sn,{className:"h-4 w-4 animate-spin"}):r.jsx(TT,{className:"h-4 w-4"})})]})]})]}):r.jsxs(Ye,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsxs(Yt,{className:"flex items-center gap-2 text-base",children:[r.jsx(G0,{className:"h-4 w-4"}),"Deal Pipeline"]})}),r.jsxs(Je,{className:"space-y-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Link this listing to your pipeline to track the deal and sync status changes."}),r.jsxs(te,{onClick:A,disabled:i||S.isPending,className:"w-full",size:"sm",children:[i||S.isPending?r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Create New Deal"]}),T.length>0&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"relative",children:[r.jsx("div",{className:"absolute inset-0 flex items-center",children:r.jsx("span",{className:"w-full border-t"})}),r.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:r.jsx("span",{className:"bg-card px-2 text-muted-foreground",children:"or"})})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(_n,{value:n,onValueChange:s,children:[r.jsx(xn,{className:"flex-1 text-sm",children:r.jsx(bn,{placeholder:"Link to existing deal..."})}),r.jsx(vn,{children:T.map(F=>r.jsx(er,{value:F.id,children:F.deal_name},F.id))})]}),r.jsx(te,{variant:"secondary",size:"icon",onClick:D,disabled:!n||k.isPending,children:k.isPending?r.jsx(sn,{className:"h-4 w-4 animate-spin"}):r.jsx(Rf,{className:"h-4 w-4"})})]})]})]})]})}const _Vt={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},bVt={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},K3e={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function wVt(){var Ne,se,xe,ie,me,fe,ve,Ie,Se;const{listingId:t}=dd(),e=es(),{user:n}=Fr(),{data:s,isLoading:i}=QOe(t||""),{data:o}=tDe(t||""),{data:c}=vht(t||""),a=eDe(),f=xht(),m=_ht(),y=JOe(),v=wht(),[w,k]=P.useState(!1),[C,S]=P.useState(!1),[T,I]=P.useState(!1),[A,D]=P.useState(null),[$,F]=P.useState({buyerName:"",buyerType:"",notes:""}),q=(n==null?void 0:n.id)===(s==null?void 0:s.agent_id),W=oe=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(oe),K=async oe=>{const ae=`https://listings.relevelup.com/${(s==null?void 0:s.slug)||(s==null?void 0:s.id)}`,je=`Check out this listing: ${(s==null?void 0:s.property_address)||(s==null?void 0:s.city)}`;m.mutate({listingId:s.id,shareType:oe});try{switch(oe){case"facebook":window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(ae)}`,"_blank");break;case"copy":await navigator.clipboard.writeText(ae),Ge.success("Link copied to clipboard!");break;case"text":window.open(`sms:?body=${encodeURIComponent(`${je} ${ae}`)}`);break;case"email":window.open(`mailto:?subject=${encodeURIComponent(je)}&body=${encodeURIComponent(`Check out this listing: ${ae}`)}`);break}}catch(Me){console.error("Share error:",Me),Ge.error("Failed to share")}},Z=async()=>{try{await y.mutateAsync(s.id),Ge.success("Listing deleted"),e("/innercircle/listings")}catch{Ge.error("Failed to delete listing")}},re=async()=>{if(!$.buyerName.trim()){Ge.error("Please enter buyer name");return}try{await v.mutateAsync({listingId:s.id,listingAgentId:s.agent_id,buyerName:$.buyerName,buyerType:$.buyerType||void 0,notes:$.notes||void 0}),Ge.success("Referral sent successfully!"),S(!1),F({buyerName:"",buyerType:"",notes:""})}catch{Ge.error("Failed to send referral")}},he=oe=>{var Pe,Ae;const ae=(s==null?void 0:s.property_address)||`${s==null?void 0:s.city}, ${s==null?void 0:s.state}`,je=W((s==null?void 0:s.price)||0),Me=s!=null&&s.bedrooms?`${s.bedrooms}BD`:"",Ue=s!=null&&s.bathrooms?`${s.bathrooms}BA`:"",Re=s!=null&&s.square_footage?`${s.square_footage.toLocaleString()}SF`:"",$e=[Me,Ue,Re].filter(Boolean).join(" | ");switch(oe){case"just_listed":return`🏡 JUST LISTED! ${ae} ${je} ${$e} ${(s==null?void 0:s.description)||"Schedule your showing today!"} #JustListed #RealEstate #HomeForSale #${(Pe=s==null?void 0:s.city)==null?void 0:Pe.replace(/\s/g,"")}`;case"price_improvement":return`📣 PRICE IMPROVEMENT! ${ae} Now ${je}! ${$e} Don't miss this opportunity! #PriceReduced #RealEstate #HomeForSale`;case"teaser":return`Looking for a ${K3e[(s==null?void 0:s.property_type)||"single_family"].toLowerCase()} in ${s==null?void 0:s.city}? 👀 I've got just the one for you! ${$e} DM me for details! 📩 #ComingSoon #RealEstate #${(Ae=s==null?void 0:s.city)==null?void 0:Ae.replace(/\s/g,"")}`;default:return""}};if(i)return r.jsx(Or,{title:"Listing",description:"",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Gr,{className:"h-10 w-32"}),r.jsx(Gr,{className:"h-[400px] w-full"}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsx(Gr,{className:"h-48"}),r.jsx(Gr,{className:"h-48"}),r.jsx(Gr,{className:"h-48"})]})]})});if(!s)return r.jsx(Or,{title:"Listing Not Found",description:"",children:r.jsx(Ye,{children:r.jsxs(Je,{className:"py-12 text-center",children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"This listing could not be found."}),r.jsx(te,{onClick:()=>e("/innercircle/listings"),children:"Back to Listings"})]})})});const ue=((Ne=s.photos)==null?void 0:Ne.find(oe=>oe.is_primary))||((se=s.photos)==null?void 0:se[0]);return r.jsxs(Or,{title:"",description:"",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs(te,{variant:"ghost",onClick:()=>e("/innercircle/listings"),children:[r.jsx(Va,{className:"h-4 w-4 mr-2"}),"Back to Listings"]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsx("div",{className:"md:col-span-2",children:r.jsx("div",{className:"aspect-[16/10] rounded-lg overflow-hidden bg-muted cursor-pointer",onClick:()=>ue&&D(ue.photo_url),children:ue?r.jsx("img",{src:ue.photo_url,alt:"Primary",className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:"No photos"})})}),r.jsx("div",{className:"grid grid-cols-2 gap-2",children:(xe=s.photos)==null?void 0:xe.slice(1,5).map((oe,ae)=>r.jsx("div",{className:"aspect-square rounded-lg overflow-hidden bg-muted cursor-pointer",onClick:()=>D(oe.photo_url),children:r.jsx("img",{src:oe.photo_url,alt:`Photo ${ae+2}`,className:"w-full h-full object-cover"})},oe.id))})]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"md:col-span-2 space-y-6",children:[r.jsx(Ye,{children:r.jsxs(Je,{className:"p-6",children:[r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4 mb-6",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(Rt,{className:`${_Vt[s.status]} text-white border-0`,children:bVt[s.status]}),s.is_featured&&r.jsxs(Rt,{variant:"outline",className:"border-amber-500 text-amber-500",children:[r.jsx(Ca,{className:"h-3 w-3 mr-1 fill-amber-500"}),"Featured"]}),s.open_to_referrals&&r.jsxs(Rt,{variant:"outline",children:[r.jsx(hs,{className:"h-3 w-3 mr-1"}),"Open to Referrals"]})]}),r.jsx("h1",{className:"text-3xl font-bold text-primary mb-2",children:W(s.price)}),s.property_address&&r.jsx("p",{className:"text-xl font-medium",children:s.property_address}),r.jsxs("p",{className:"text-muted-foreground flex items-center gap-1",children:[r.jsx(yl,{className:"h-4 w-4"}),s.city,", ",s.state,s.neighborhood&&` • ${s.neighborhood}`]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(te,{variant:"outline",size:"icon",onClick:()=>a.mutate(s.id),children:r.jsx(ql,{className:`h-4 w-4 ${o?"fill-pink-500 text-pink-500":""}`})}),r.jsx(te,{variant:"outline",size:"icon",onClick:()=>f.mutate(s.id),children:c?r.jsx(Ow,{className:"h-4 w-4"}):r.jsx(ag,{className:"h-4 w-4"})}),!q&&r.jsxs(te,{variant:"outline",className:"border-amber-500 text-amber-600 hover:bg-amber-50",onClick:()=>I(!0),children:[r.jsx(Mi,{className:"h-4 w-4 mr-2"}),"Share & Earn Leads"]}),r.jsxs(fm,{children:[r.jsx(pm,{asChild:!0,children:r.jsxs(te,{variant:"outline",children:[r.jsx(Kd,{className:"h-4 w-4 mr-2"}),"Share"]})}),r.jsxs(Xf,{children:[r.jsxs(uo,{onClick:()=>K("copy"),children:[r.jsx(Ul,{className:"h-4 w-4 mr-2"}),"Copy Link"]}),r.jsxs(uo,{onClick:()=>K("facebook"),children:[r.jsx(Md,{className:"h-4 w-4 mr-2"}),"Facebook"]}),r.jsxs(uo,{onClick:()=>K("text"),children:[r.jsx(Wl,{className:"h-4 w-4 mr-2"}),"Text"]}),r.jsxs(uo,{onClick:()=>K("email"),children:[r.jsx(di,{className:"h-4 w-4 mr-2"}),"Email"]})]})]}),q&&r.jsxs(r.Fragment,{children:[r.jsxs(te,{variant:"outline",onClick:()=>e(`/innercircle/listings/${s.id}/edit`),children:[r.jsx(Jl,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsx(te,{variant:"destructive",size:"icon",onClick:()=>k(!0),children:r.jsx(Xn,{className:"h-4 w-4"})})]})]})]}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4 py-4 border-y",children:[s.bedrooms&&r.jsxs("div",{className:"text-center",children:[r.jsx(Of,{className:"h-5 w-5 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"font-semibold",children:s.bedrooms}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Beds"})]}),s.bathrooms&&r.jsxs("div",{className:"text-center",children:[r.jsx(Lf,{className:"h-5 w-5 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"font-semibold",children:s.bathrooms}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Baths"})]}),s.square_footage&&r.jsxs("div",{className:"text-center",children:[r.jsx(im,{className:"h-5 w-5 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"font-semibold",children:s.square_footage.toLocaleString()}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Sq Ft"})]}),s.year_built&&r.jsxs("div",{className:"text-center",children:[r.jsx(li,{className:"h-5 w-5 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"font-semibold",children:s.year_built}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Built"})]})]}),r.jsxs("div",{className:"pt-4 space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(Rt,{variant:"secondary",children:[r.jsx(ra,{className:"h-3 w-3 mr-1"}),K3e[s.property_type]]}),s.lot_size&&r.jsxs(Rt,{variant:"secondary",children:["Lot: ",s.lot_size]}),s.has_hoa&&r.jsx(Rt,{variant:"secondary",children:"HOA"})]}),s.description&&r.jsxs("div",{children:[r.jsx("h3",{className:"font-medium mb-2",children:"Description"}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:s.description})]}),s.agent_notes&&s.agent_notes_public&&r.jsxs("div",{children:[r.jsx("h3",{className:"font-medium mb-2",children:"Agent Notes"}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:s.agent_notes})]}),s.mls_link&&r.jsx(te,{variant:"outline",asChild:!0,children:r.jsxs("a",{href:s.mls_link,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(Fs,{className:"h-4 w-4 mr-2"}),"View on MLS"]})})]}),r.jsxs("div",{className:"flex items-center gap-4 pt-4 mt-4 border-t text-sm text-muted-foreground",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ml,{className:"h-4 w-4"}),s.view_count," views"]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Kd,{className:"h-4 w-4"}),s.share_count," shares"]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(ql,{className:"h-4 w-4"}),s.save_count," saves"]})]})]})}),s.allow_sharing&&r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsx(Yt,{className:"text-lg",children:"Share Content"})}),r.jsx(Je,{className:"space-y-4",children:["just_listed","price_improvement","teaser"].map(oe=>r.jsxs("div",{className:"p-3 bg-muted rounded-lg",children:[r.jsxs("div",{className:"flex justify-between items-start mb-2",children:[r.jsxs("p",{className:"font-medium text-sm capitalize",children:[oe.replace("_"," ")," Caption"]}),r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>{navigator.clipboard.writeText(he(oe)),Ge.success("Caption copied!")},children:r.jsx(Ul,{className:"h-3 w-3"})})]}),r.jsx("p",{className:"text-xs text-muted-foreground whitespace-pre-wrap",children:he(oe)})]},oe))})]})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsx(Yt,{className:"text-lg",children:"Listing Agent"})}),r.jsxs(Je,{children:[r.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[r.jsx("div",{className:"w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center",children:r.jsx("span",{className:"text-lg font-semibold text-primary",children:((me=(ie=s.agent)==null?void 0:ie.name)==null?void 0:me.charAt(0))||"?"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((fe=s.agent)==null?void 0:fe.name)||"Unknown"}),((Ie=(ve=s.agent)==null?void 0:ve.brokerage)==null?void 0:Ie.name)&&r.jsx("p",{className:"text-sm text-muted-foreground",children:s.agent.brokerage.name})]})]}),!q&&r.jsx("div",{className:"space-y-2",children:((Se=s.agent)==null?void 0:Se.email)&&r.jsx(te,{variant:"outline",className:"w-full",asChild:!0,children:r.jsxs("a",{href:`mailto:${s.agent.email}`,children:[r.jsx(di,{className:"h-4 w-4 mr-2"}),"Email Agent"]})})})]})]}),q&&r.jsx(vVt,{listing:s}),!q&&s.open_to_referrals&&r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsxs(Yt,{className:"text-lg flex items-center gap-2",children:[r.jsx(hs,{className:"h-5 w-5"}),"Send a Buyer"]})}),r.jsxs(Je,{children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Have a buyer interested in this property? Send a referral to the listing agent."}),r.jsx(te,{className:"w-full",onClick:()=>S(!0),children:"Send Referral"})]})]})]})]})]}),r.jsx($r,{open:!!A,onOpenChange:()=>D(null),children:r.jsx(zr,{className:"max-w-4xl",children:r.jsx("img",{src:A||"",alt:"Full size",className:"w-full h-auto"})})}),r.jsx($r,{open:w,onOpenChange:k,children:r.jsxs(zr,{children:[r.jsxs(Zr,{children:[r.jsx(Kr,{children:"Delete Listing"}),r.jsx(ls,{children:"Are you sure you want to delete this listing? This action cannot be undone."})]}),r.jsxs(ni,{children:[r.jsx(te,{variant:"outline",onClick:()=>k(!1),children:"Cancel"}),r.jsx(te,{variant:"destructive",onClick:Z,disabled:y.isPending,children:y.isPending?"Deleting...":"Delete"})]})]})}),r.jsx($r,{open:C,onOpenChange:S,children:r.jsxs(zr,{children:[r.jsxs(Zr,{children:[r.jsx(Kr,{children:"Send Buyer Referral"}),r.jsx(ls,{children:"Submit buyer information to the listing agent"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Buyer Name *"}),r.jsx(yt,{value:$.buyerName,onChange:oe=>F({...$,buyerName:oe.target.value}),placeholder:"Enter buyer's name"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Buyer Type"}),r.jsxs(_n,{value:$.buyerType,onValueChange:oe=>F({...$,buyerType:oe}),children:[r.jsx(xn,{children:r.jsx(bn,{placeholder:"Select type"})}),r.jsxs(vn,{children:[r.jsx(er,{value:"first_time",children:"First-Time Buyer"}),r.jsx(er,{value:"investor",children:"Investor"}),r.jsx(er,{value:"relocating",children:"Relocating"}),r.jsx(er,{value:"upgrade",children:"Upgrading"}),r.jsx(er,{value:"downsize",children:"Downsizing"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Notes"}),r.jsx(ps,{value:$.notes,onChange:oe=>F({...$,notes:oe.target.value}),placeholder:"Any additional information..."})]})]}),r.jsxs(ni,{children:[r.jsx(te,{variant:"outline",onClick:()=>S(!1),children:"Cancel"}),r.jsx(te,{onClick:re,disabled:v.isPending,children:v.isPending?"Sending...":"Send Referral"})]})]})}),r.jsx(a$e,{open:T,onOpenChange:I,listingId:(s==null?void 0:s.id)||"",listingSlug:(s==null?void 0:s.slug)||null,listingTitle:(s==null?void 0:s.property_address)||`${s==null?void 0:s.city}, ${s==null?void 0:s.state}`})]})}function jVt({selectedVideoId:t,onVideoSelect:e,listingId:n}){const s=es(),{user:i}=Fr(),[o,c]=P.useState(!1),[a,f]=P.useState([]),[m,y]=P.useState(!1),[v,w]=P.useState(null),[k,C]=P.useState({});P.useEffect(()=>{t&&i?S():w(null)},[t,i]);const S=async()=>{if(!t)return;const{data:Z,error:re}=await ee.from("agent_videos").select("id, bunny_video_id, title, thumbnail_url, preview_url, playback_url, duration_seconds, status, created_at").eq("id",t).eq("is_deleted",!1).single();!re&&Z&&(w(Z),T(Z))},T=async Z=>{try{const{data:re,error:he}=await ee.functions.invoke("bunny-upload",{body:{action:"asset-urls",videoId:Z.bunny_video_id,isAgentVideo:!0}});!he&&(re!=null&&re.thumbnailUrl)&&C(ue=>({...ue,[Z.id]:{thumbnailUrl:re.thumbnailUrl}}))}catch(re){console.warn("Failed to get signed URL",re)}},I=async()=>{if(i){y(!0);try{const{data:Z,error:re}=await ee.from("agent_videos").select("id, bunny_video_id, title, thumbnail_url, preview_url, playback_url, duration_seconds, status, created_at").eq("owner_user_id",i.id).eq("is_deleted",!1).eq("status","ready").order("created_at",{ascending:!1});if(re)throw re;f(Z||[]),Z!=null&&Z.length&&A(Z)}catch(Z){console.error("Error fetching videos:",Z),Ge.error("Failed to load videos")}finally{y(!1)}}},A=async Z=>{const re=await Promise.allSettled(Z.map(async ue=>{const{data:Ne,error:se}=await ee.functions.invoke("bunny-upload",{body:{action:"asset-urls",videoId:ue.bunny_video_id,isAgentVideo:!0}});if(se)throw se;return{id:ue.id,thumbnailUrl:Ne==null?void 0:Ne.thumbnailUrl}})),he={};for(const ue of re)ue.status==="fulfilled"&&ue.value.thumbnailUrl&&(he[ue.value.id]={thumbnailUrl:ue.value.thumbnailUrl});C(ue=>({...ue,...he}))},D=()=>{c(!0),I()},$=Z=>{e(Z.id),w(Z),c(!1),Ge.success("Video selected")},F=()=>{e(null),w(null)},q=()=>{const Z=n?`/innercircle/listings/${n}/edit`:"/innercircle/listings/new";s(`/innercircle/video?returnUrl=${encodeURIComponent(Z)}`)},W=Z=>{if(!Z)return"0:00";const re=Math.floor(Z/60),he=Z%60;return`${re}:${he.toString().padStart(2,"0")}`},K=Z=>{var re;return((re=k[Z.id])==null?void 0:re.thumbnailUrl)||Z.thumbnail_url};return r.jsxs("div",{className:"space-y-3",children:[v?r.jsx(Ye,{className:"overflow-hidden",children:r.jsx(Je,{className:"p-0",children:r.jsxs("div",{className:"flex items-start gap-4 p-4",children:[r.jsxs("div",{className:"relative w-32 h-20 bg-muted rounded-lg overflow-hidden flex-shrink-0",children:[K(v)?r.jsx("img",{src:K(v),alt:v.title||"Video thumbnail",className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Gi,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx("div",{className:"absolute inset-0 bg-black/30 flex items-center justify-center",children:r.jsx(wc,{className:"h-6 w-6 text-white fill-white"})}),v.duration_seconds&&r.jsx("div",{className:"absolute bottom-1 right-1 bg-black/70 text-white text-[10px] px-1.5 py-0.5 rounded",children:W(v.duration_seconds)})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium text-sm truncate",children:v.title||"Untitled Video"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Property Video Tour"})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(te,{type:"button",variant:"outline",size:"sm",onClick:D,children:"Change"}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:F,className:"text-destructive hover:text-destructive",children:r.jsx(Ms,{className:"h-4 w-4"})})]})]})})}):r.jsx(Ye,{className:"border-dashed",children:r.jsx(Je,{className:"p-6",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Gi,{className:"h-10 w-10 mx-auto text-muted-foreground mb-3"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Add a video walkthrough to showcase this property"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 justify-center",children:[r.jsxs(te,{type:"button",variant:"outline",onClick:D,className:"gap-2",children:[r.jsx(US,{className:"h-4 w-4"}),"Select from Library"]}),r.jsxs(te,{type:"button",variant:"outline",onClick:q,className:"gap-2",children:[r.jsx(Rw,{className:"h-4 w-4"}),"Record New Video"]})]})]})})}),r.jsx($r,{open:o,onOpenChange:c,children:r.jsxs(zr,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsx(Zr,{children:r.jsxs(Kr,{className:"flex items-center gap-2",children:[r.jsx(US,{className:"h-5 w-5"}),"Select a Video"]})}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:m?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(sn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):a.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Gi,{className:"h-12 w-12 mx-auto text-muted-foreground mb-3"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"No videos in your library yet"}),r.jsxs(te,{onClick:q,className:"gap-2",children:[r.jsx(Rw,{className:"h-4 w-4"}),"Record Your First Video"]})]}):r.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3 p-1",children:a.map(Z=>r.jsxs("button",{type:"button",onClick:()=>$(Z),className:`group relative rounded-lg overflow-hidden border-2 transition-all text-left ${t===Z.id?"border-primary ring-2 ring-primary/20":"border-transparent hover:border-muted-foreground/30"}`,children:[r.jsxs("div",{className:"aspect-video bg-muted relative",children:[K(Z)?r.jsx("img",{src:K(Z),alt:Z.title||"Video",className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Gi,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/30 transition-colors flex items-center justify-center",children:r.jsx(wc,{className:"h-8 w-8 text-white opacity-0 group-hover:opacity-100 transition-opacity"})}),Z.duration_seconds&&r.jsx("div",{className:"absolute bottom-1 right-1 bg-black/70 text-white text-[10px] px-1.5 py-0.5 rounded",children:W(Z.duration_seconds)})]}),r.jsx("div",{className:"p-2 bg-card",children:r.jsx("p",{className:"text-xs font-medium truncate",children:Z.title||"Untitled Video"})})]},Z.id))})}),r.jsxs("div",{className:"flex justify-between items-center pt-4 border-t",children:[r.jsxs(te,{type:"button",variant:"ghost",onClick:q,className:"gap-2",children:[r.jsx(Rw,{className:"h-4 w-4"}),"Record New Video"]}),r.jsx(te,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"})]})]})})]})}const kVt=[{value:"active",label:"Active"},{value:"coming_soon",label:"Coming Soon"},{value:"price_improvement",label:"Price Improvement"},{value:"under_contract",label:"Under Contract"},{value:"sold",label:"Sold"}],NVt=[{value:"single_family",label:"Single Family"},{value:"condo",label:"Condo"},{value:"townhouse",label:"Townhouse"},{value:"land",label:"Land"},{value:"multi_family",label:"Multi-Family"},{value:"luxury",label:"Luxury"},{value:"commercial",label:"Commercial"},{value:"other",label:"Other"}];function Z3e(){var xe;const{listingId:t}=dd(),[e]=Ed(),n=e.get("brokerage"),s=es(),{user:i}=Fr(),o=!!t&&t!=="new",c=!!n&&!o,{data:a,isLoading:f}=QOe(o?t:""),m=hht(),y=fht(),v=pht(),w=mht(),k=ght(),{data:C=[]}=rr({queryKey:["brokerage-agents",n],queryFn:async()=>{if(!n)return[];const{data:ie,error:me}=await ee.from("profiles").select("id, name, email").eq("brokerage_id",n).order("name");if(me)throw me;return ie||[]},enabled:c}),[S,T]=P.useState(""),[I,A]=P.useState(!1),[D,$]=P.useState([]),[F,q]=P.useState([]),[W,K]=P.useState({property_address:"",city:"",state:"",neighborhood:"",price:"",property_type:"single_family",status:"active",bedrooms:"",bathrooms:"",square_footage:"",lot_size:"",year_built:"",has_hoa:!1,description:"",agent_notes:"",agent_notes_public:!1,mls_link:"",video_link:"",video_id:null,allow_sharing:!0,open_to_referrals:!0,open_to_social_promotion:!0,share_with_brokerage:!1,is_public:!0});P.useEffect(()=>{var ie,me,fe,ve,Ie;a&&o&&K({property_address:a.property_address||"",city:a.city||"",state:a.state||"",neighborhood:a.neighborhood||"",price:((ie=a.price)==null?void 0:ie.toString())||"",property_type:a.property_type,status:a.status,bedrooms:((me=a.bedrooms)==null?void 0:me.toString())||"",bathrooms:((fe=a.bathrooms)==null?void 0:fe.toString())||"",square_footage:((ve=a.square_footage)==null?void 0:ve.toString())||"",lot_size:a.lot_size||"",year_built:((Ie=a.year_built)==null?void 0:Ie.toString())||"",has_hoa:a.has_hoa,description:a.description||"",agent_notes:a.agent_notes||"",agent_notes_public:a.agent_notes_public,mls_link:a.mls_link||"",video_link:a.video_link||"",video_id:a.video_id||null,allow_sharing:a.allow_sharing,open_to_referrals:a.open_to_referrals,open_to_social_promotion:a.open_to_social_promotion,share_with_brokerage:a.share_with_brokerage??!1,is_public:a.is_public})},[a,o]);const Z=ie=>{if(!ie)return;const me=Array.from(ie);$(ve=>[...ve,...me]);const fe=me.map(ve=>URL.createObjectURL(ve));q(ve=>[...ve,...fe])},re=ie=>{URL.revokeObjectURL(F[ie]),$(me=>me.filter((fe,ve)=>ve!==ie)),q(me=>me.filter((fe,ve)=>ve!==ie))},he=async ie=>{var me;if(!(!ie||!a)){A(!0);try{for(const fe of Array.from(ie)){const ve=fe.name.split(".").pop(),Ie=`${i==null?void 0:i.id}/${a.id}/${Date.now()}.${ve}`,{error:Se}=await ee.storage.from("listing-photos").upload(Ie,fe);if(Se)throw Se;const{data:{publicUrl:oe}}=ee.storage.from("listing-photos").getPublicUrl(Ie);await w.mutateAsync({listingId:a.id,photoUrl:oe,isPrimary:!((me=a.photos)!=null&&me.length)})}Ge.success("Photos uploaded!")}catch(fe){console.error("Upload error:",fe),Ge.error("Failed to upload photos")}finally{A(!1)}}},ue=async ie=>{for(let me=0;me{if(a)try{await k.mutateAsync({photoId:ie,listingId:a.id}),Ge.success("Photo removed")}catch{Ge.error("Failed to remove photo")}},se=async ie=>{if(ie.preventDefault(),!W.city.trim()||!W.state.trim()||!W.price){Ge.error("Please fill in required fields (City, State, Price)");return}if(c&&!S){Ge.error("Please select an agent to assign this listing to");return}try{const me={property_address:W.property_address||null,city:W.city,state:W.state,neighborhood:W.neighborhood||null,price:Number(W.price),property_type:W.property_type,status:W.status,bedrooms:W.bedrooms?Number(W.bedrooms):null,bathrooms:W.bathrooms?Number(W.bathrooms):null,square_footage:W.square_footage?Number(W.square_footage):null,lot_size:W.lot_size||null,year_built:W.year_built?Number(W.year_built):null,has_hoa:W.has_hoa,description:W.description||null,agent_notes:W.agent_notes||null,agent_notes_public:W.agent_notes_public,mls_link:W.mls_link||null,video_link:W.video_link||null,video_id:W.video_id||null,allow_sharing:W.allow_sharing,open_to_referrals:W.open_to_referrals,open_to_social_promotion:W.open_to_social_promotion,share_with_brokerage:W.share_with_brokerage,is_public:W.is_public};if(o)await v.mutateAsync({id:t,...me}),Ge.success("Listing updated!"),s(`/innercircle/listings/${t}`);else{A(!0);let fe;if(c&&S?fe=await y.mutateAsync({agentId:S,...me}):fe=await m.mutateAsync(me),D.length>0)try{await ue(fe.id),F.forEach(ve=>URL.revokeObjectURL(ve)),$([]),q([])}catch(ve){console.error("Photo upload error:",ve),Ge.error("Listing created but some photos failed to upload")}A(!1),Ge.success("Listing created!"),s(c?"/my-brokerage":`/innercircle/listings/${fe.id}`)}}catch(me){console.error("Save error:",me),Ge.error("Failed to save listing"),A(!1)}};return o&&f?r.jsx(Or,{title:"Loading...",description:"",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Gr,{className:"h-10 w-32"}),r.jsx(Gr,{className:"h-[600px] w-full"})]})}):r.jsx(Or,{title:o?"Edit Listing":c?"Add Listing for Agent":"Add Listing",description:"",children:r.jsxs("form",{onSubmit:se,className:"space-y-6",children:[r.jsxs(te,{type:"button",variant:"ghost",onClick:()=>s(c?"/my-brokerage":"/innercircle/listings"),children:[r.jsx(Va,{className:"h-4 w-4 mr-2"}),c?"Back to Brokerage":"Back to Listings"]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"md:col-span-2 space-y-6",children:[c&&r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsx(Yt,{children:"Assign to Agent *"})}),r.jsxs(Je,{children:[r.jsxs(_n,{value:S,onValueChange:T,children:[r.jsx(xn,{children:r.jsx(bn,{placeholder:"Select an agent..."})}),r.jsx(vn,{children:C.map(ie=>r.jsx(er,{value:ie.id,children:ie.name||ie.email},ie.id))})]}),r.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"This listing will appear on the selected agent's Listing Exchange."})]})]}),r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsx(Yt,{children:"Property Details"})}),r.jsx(Je,{className:"space-y-4",children:r.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"sm:col-span-2 space-y-2",children:[r.jsx(Qe,{children:"Property Address"}),r.jsx(yt,{value:W.property_address,onChange:ie=>K({...W,property_address:ie.target.value}),placeholder:"123 Main St"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"City *"}),r.jsx(yt,{value:W.city,onChange:ie=>K({...W,city:ie.target.value}),placeholder:"City",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"State *"}),r.jsx(yt,{value:W.state,onChange:ie=>K({...W,state:ie.target.value}),placeholder:"State",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Neighborhood"}),r.jsx(yt,{value:W.neighborhood,onChange:ie=>K({...W,neighborhood:ie.target.value}),placeholder:"Neighborhood"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Price *"}),r.jsx(yt,{type:"number",value:W.price,onChange:ie=>K({...W,price:ie.target.value}),placeholder:"500000",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Property Type"}),r.jsxs(_n,{value:W.property_type,onValueChange:ie=>K({...W,property_type:ie}),children:[r.jsx(xn,{children:r.jsx(bn,{})}),r.jsx(vn,{children:NVt.map(ie=>r.jsx(er,{value:ie.value,children:ie.label},ie.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Status"}),r.jsxs(_n,{value:W.status,onValueChange:ie=>K({...W,status:ie}),children:[r.jsx(xn,{children:r.jsx(bn,{})}),r.jsx(vn,{children:kVt.map(ie=>r.jsx(er,{value:ie.value,children:ie.label},ie.value))})]})]})]})})]}),r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsx(Yt,{children:"Property Specs (Optional)"})}),r.jsx(Je,{children:r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Bedrooms"}),r.jsx(yt,{type:"number",value:W.bedrooms,onChange:ie=>K({...W,bedrooms:ie.target.value}),placeholder:"3"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Bathrooms"}),r.jsx(yt,{type:"number",step:"0.5",value:W.bathrooms,onChange:ie=>K({...W,bathrooms:ie.target.value}),placeholder:"2"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Sq Ft"}),r.jsx(yt,{type:"number",value:W.square_footage,onChange:ie=>K({...W,square_footage:ie.target.value}),placeholder:"2000"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Lot Size"}),r.jsx(yt,{value:W.lot_size,onChange:ie=>K({...W,lot_size:ie.target.value}),placeholder:"0.25 acres"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Year Built"}),r.jsx(yt,{type:"number",value:W.year_built,onChange:ie=>K({...W,year_built:ie.target.value}),placeholder:"2005"})]}),r.jsxs("div",{className:"flex items-center gap-2 pt-6",children:[r.jsx(Zs,{checked:W.has_hoa,onCheckedChange:ie=>K({...W,has_hoa:ie})}),r.jsx(Qe,{children:"Has HOA"})]})]})})]}),r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsx(Yt,{children:"Description & Links"})}),r.jsxs(Je,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Description"}),r.jsx(ps,{value:W.description,onChange:ie=>K({...W,description:ie.target.value}),placeholder:"Tell the story of this property...",rows:4})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Agent Notes"}),r.jsx(ps,{value:W.agent_notes,onChange:ie=>K({...W,agent_notes:ie.target.value}),placeholder:"Notes for other agents...",rows:2}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Zs,{checked:W.agent_notes_public,onCheckedChange:ie=>K({...W,agent_notes_public:ie})}),r.jsx(Qe,{className:"text-sm text-muted-foreground",children:"Make notes visible to other agents"})]})]}),r.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"MLS Link"}),r.jsx(yt,{value:W.mls_link,onChange:ie=>K({...W,mls_link:ie.target.value}),placeholder:"https://..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Video Link"}),r.jsx(yt,{value:W.video_link,onChange:ie=>K({...W,video_link:ie.target.value}),placeholder:"YouTube or Vimeo URL"})]})]})]})]}),r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(Gi,{className:"h-5 w-5"}),"Property Video"]})}),r.jsx(Je,{children:r.jsx(jVt,{selectedVideoId:W.video_id,onVideoSelect:ie=>K({...W,video_id:ie}),listingId:o?t:void 0})})]}),r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsx(Yt,{children:"Photos"})}),r.jsxs(Je,{children:[r.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-4 gap-4",children:[o&&((xe=a==null?void 0:a.photos)==null?void 0:xe.map(ie=>r.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-muted",children:[r.jsx("img",{src:ie.photo_url,alt:"",className:"w-full h-full object-cover"}),r.jsx("button",{type:"button",onClick:()=>Ne(ie.id),className:"absolute top-1 right-1 p-1 bg-destructive text-destructive-foreground rounded-full hover:bg-destructive/90",children:r.jsx(Ms,{className:"h-3 w-3"})}),ie.is_primary&&r.jsx("span",{className:"absolute bottom-1 left-1 text-[10px] bg-primary text-primary-foreground px-1.5 py-0.5 rounded",children:"Primary"})]},ie.id))),!o&&F.map((ie,me)=>r.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-muted",children:[r.jsx("img",{src:ie,alt:"",className:"w-full h-full object-cover"}),r.jsx("button",{type:"button",onClick:()=>re(me),className:"absolute top-1 right-1 p-1 bg-destructive text-destructive-foreground rounded-full hover:bg-destructive/90",children:r.jsx(Ms,{className:"h-3 w-3"})}),me===0&&r.jsx("span",{className:"absolute bottom-1 left-1 text-[10px] bg-primary text-primary-foreground px-1.5 py-0.5 rounded",children:"Primary"})]},me)),r.jsxs("label",{className:"aspect-square rounded-lg border-2 border-dashed border-muted-foreground/25 hover:border-muted-foreground/50 cursor-pointer flex flex-col items-center justify-center gap-2 text-muted-foreground",children:[I?r.jsx(sn,{className:"h-8 w-8 animate-spin"}):r.jsxs(r.Fragment,{children:[r.jsx(Ao,{className:"h-8 w-8"}),r.jsx("span",{className:"text-xs",children:"Upload"})]}),r.jsx("input",{type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:ie=>o?he(ie.target.files):Z(ie.target.files),disabled:I})]})]}),!o&&D.length>0&&r.jsxs("p",{className:"text-sm text-muted-foreground mt-4",children:[D.length," photo",D.length!==1?"s":""," will be uploaded when you save."]})]})]})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsx(Yt,{children:"Sharing & Collaboration"})}),r.jsxs(Je,{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Qe,{children:"Allow Sharing"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Other agents can share this listing"})]}),r.jsx(Zs,{checked:W.allow_sharing,onCheckedChange:ie=>K({...W,allow_sharing:ie})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Qe,{children:"Open to Referrals"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Accept buyer referrals"})]}),r.jsx(Zs,{checked:W.open_to_referrals,onCheckedChange:ie=>K({...W,open_to_referrals:ie})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Qe,{children:"Social Promotion"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Can be promoted on social media"})]}),r.jsx(Zs,{checked:W.open_to_social_promotion,onCheckedChange:ie=>K({...W,open_to_social_promotion:ie})})]}),r.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[r.jsxs("div",{children:[r.jsx(Qe,{children:"Share with Brokerage"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Visible to agents in your brokerage"})]}),r.jsx(Zs,{checked:W.share_with_brokerage,onCheckedChange:ie=>K({...W,share_with_brokerage:ie})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Qe,{children:"Make Public"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Publish on listings.relevelup.com to get leads"})]}),r.jsx(Zs,{checked:W.is_public,onCheckedChange:ie=>K({...W,is_public:ie})})]})]})]}),r.jsx(te,{type:"submit",className:"w-full",size:"lg",disabled:m.isPending||v.isPending,children:m.isPending||v.isPending?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),"Saving..."]}):o?"Update Listing":"Create Listing"})]})]})]})})}function SVt({maxDurationSeconds:t=30,onRecordingComplete:e,onError:n,onRecordingStateChange:s,className:i,teleprompterContent:o}){const c=P.useRef(null),a=P.useRef(null),f=P.useRef(null),m=P.useRef([]),y=P.useRef(null),v=P.useRef(null),w=P.useRef(null),k=P.useRef(null),C=yI(),[S,T]=P.useState(!0),[I,A]=P.useState(!0),[D,$]=P.useState(null),[F,q]=P.useState(!1),[W,K]=P.useState(!1),[Z,re]=P.useState(null),[he,ue]=P.useState(null),[Ne,se]=P.useState(0),[xe,ie]=P.useState("user"),[me,fe]=P.useState(0),[ve,Ie]=P.useState(!1),[Se,oe]=P.useState(!0),[ae,je]=P.useState(null),[Me,Ue]=P.useState(!1),Re=P.useCallback(Ke=>{T(Ke)},[]),$e=P.useRef(S),Pe=P.useCallback(async()=>{var Le;A(!0),je(null);const Ke=C&&S;console.log("[VideoRecorder] initCamera start",{isMobile:C,usePortraitMode:S,shouldBePortrait:Ke,facingMode:xe});try{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new Error("Camera not available in this browser or context. Try opening in a new tab.");f.current&&(console.log("[VideoRecorder] stopping existing stream"),f.current.getTracks().forEach(tr=>tr.stop()));const ft=C&&Ke?{facingMode:{ideal:xe},width:{ideal:720},height:{ideal:1280}}:{facingMode:{ideal:xe},width:{ideal:1280},height:{ideal:720}};console.log("[VideoRecorder] requesting getUserMedia",ft);const Nt=await navigator.mediaDevices.getUserMedia({video:ft,audio:{echoCancellation:!0,noiseSuppression:!0}});if(console.log("[VideoRecorder] getUserMedia success"),Nt.getVideoTracks().length===0)throw new Error("Camera stream started but no video track was provided.");f.current=Nt,$(!0);const It=Nt.getVideoTracks()[0].getSettings();if(console.log("[VideoRecorder] Camera initialized with dimensions:",It.width,"x",It.height),c.current){const tr=c.current;tr.srcObject=Nt,tr.muted=!0,tr.playsInline=!0,tr.autoplay=!0,tr.setAttribute("muted",""),tr.setAttribute("playsinline",""),tr.setAttribute("autoplay","");try{(Le=tr.load)==null||Le.call(tr)}catch(pn){console.warn("[VideoRecorder] videoEl.load failed",pn)}const Mr=async()=>{try{return await tr.play(),console.log("[VideoRecorder] preview play ok"),Ue(!1),setTimeout(()=>{console.debug("[VideoRecorder] preview metrics",{readyState:tr.readyState,videoWidth:tr.videoWidth,videoHeight:tr.videoHeight})},300),!0}catch(pn){return console.warn("[VideoRecorder] preview play blocked",pn),Ue(!0),!1}};await new Promise(pn=>{let fs=!1;const Qn=()=>{fs||(fs=!0,pn())},js=()=>{Mr().finally(Qn)};tr.onloadedmetadata=js,tr.onloadeddata=js,setTimeout(Qn,1500)})}try{v.current=new AudioContext;const tr=v.current.createMediaStreamSource(Nt);w.current=v.current.createAnalyser(),w.current.fftSize=256,tr.connect(w.current);const Mr=()=>{if(w.current){const pn=new Uint8Array(w.current.frequencyBinCount);w.current.getByteFrequencyData(pn);const fs=pn.reduce((Qn,js)=>Qn+js)/pn.length;fe(Math.min(100,fs/128*100))}k.current=requestAnimationFrame(Mr)};Mr()}catch(tr){console.warn("Audio context not available:",tr)}}catch(ft){console.error("Camera initialization error:",ft),$(!1);let Nt="Failed to access camera or microphone.";ft.name==="NotAllowedError"?Nt="Camera permission denied. Please allow camera access in your browser settings.":ft.name==="NotFoundError"?Nt="No camera found. Please connect a camera and try again.":ft.name==="NotReadableError"?Nt="Camera is in use by another application. Please close other apps using the camera.":ft.message&&(Nt=ft.message),je(Nt),n==null||n(Nt)}finally{A(!1)}},[xe,n,C,S]);P.useEffect(()=>{$e.current!==S&&D&&!F&&!he&&($e.current=S,Pe())},[S,D,F,he,Pe]),P.useEffect(()=>(Pe(),()=>{f.current&&f.current.getTracks().forEach(Ke=>Ke.stop()),y.current&&clearInterval(y.current),k.current&&cancelAnimationFrame(k.current),v.current&&v.current.close(),he&&URL.revokeObjectURL(he)}),[Pe,he]),P.useEffect(()=>{if(I||D!==!0||he)return;const Ke=f.current,Le=c.current;!Ke||!Le||(Le.srcObject!==Ke&&(Le.srcObject=Ke,Le.muted=!0,Le.playsInline=!0,Le.autoplay=!0,Le.setAttribute("muted",""),Le.setAttribute("playsinline",""),Le.setAttribute("autoplay","")),Le.play().then(()=>Ue(!1)).catch(ft=>{Ue(!0),console.warn("Live preview play blocked on mount:",ft)}))},[D,I,he]),P.useEffect(()=>{s==null||s(F)},[F,s]);const Ae=P.useCallback(async()=>{if(he)return;const Ke=c.current;if(Ke)try{await Ke.play(),Ue(!1)}catch(Le){Ue(!0),console.warn("Live preview still blocked (needs user gesture):",Le)}},[he]),nt=P.useCallback(()=>{a.current&&a.current.state!=="inactive"&&a.current.stop(),y.current&&(clearInterval(y.current),y.current=null),q(!1),K(!1)},[]),Te=P.useCallback(()=>{if(!f.current)return;Ae(),m.current=[],se(0);const Le=["video/webm;codecs=vp9,opus","video/webm;codecs=vp8,opus","video/webm;codecs=vp9","video/webm;codecs=vp8","video/webm","video/mp4"].find(Nt=>MediaRecorder.isTypeSupported(Nt)),ft=new MediaRecorder(f.current,Le?{mimeType:Le,videoBitsPerSecond:25e5}:{videoBitsPerSecond:25e5});ft.ondataavailable=Nt=>{Nt.data.size>0&&m.current.push(Nt.data)},ft.onstop=()=>{var tr;const Nt=ft.mimeType||Le||((tr=m.current[0])==null?void 0:tr.type)||"video/webm",Mt=new Blob(m.current,{type:Nt});re(Mt);const It=URL.createObjectURL(Mt);ue(It)},a.current=ft,ft.start(100),q(!0),y.current=setInterval(()=>{se(Nt=>Nt>=t-1?(nt(),t):Nt+1)},1e3)},[Ae,t,nt]),Xe=P.useCallback(()=>{a.current&&a.current.state==="recording"&&(a.current.pause(),K(!0),y.current&&clearInterval(y.current))},[]),ge=P.useCallback(()=>{a.current&&a.current.state==="paused"&&(a.current.resume(),K(!1),y.current=setInterval(()=>{se(Ke=>Ke>=t-1?(nt(),t):Ke+1)},1e3))},[t,nt]),mt=P.useCallback(()=>{he&&URL.revokeObjectURL(he),re(null),ue(null),se(0),Ie(!1),oe(!0),c.current&&f.current&&(c.current.srcObject=f.current,c.current.muted=!0,Ae())},[Ae,he]),rt=P.useCallback(()=>{ie(Ke=>Ke==="user"?"environment":"user")},[]),We=P.useCallback(()=>{Z&&e(Z,Ne)},[Z,Ne,e]),Ce=P.useCallback(()=>{c.current&&he&&(ve?c.current.pause():(oe(!1),c.current.muted=!1,c.current.play()),Ie(!ve))},[he,ve]);P.useEffect(()=>{if(!he)return;const Ke=c.current;if(!Ke)return;oe(!1),Ke.pause(),Ke.removeAttribute("src"),Ke.srcObject=null,Ke.load(),Ke.src=he,Ke.currentTime=0,Ke.playsInline=!0,Ke.muted=!1,Ke.onended=()=>Ie(!1);const Le=()=>{const ft=Ke.error,Nt=ft?`Recorded video failed to play (code ${ft.code}). Likely unsupported format/codec in this browser.`:"Recorded video failed to play.";console.warn("[VideoRecorder] recorded playback error",ft),n==null||n(Nt)};return Ke.addEventListener("error",Le),Ke.load(),()=>{Ke.removeEventListener("error",Le)}},[n,he]);const et=Ke=>{const Le=Math.floor(Ke/60),ft=Ke%60;return`${Le}:${ft.toString().padStart(2,"0")}`},Fe=C&&S?"aspect-[9/16]":"aspect-video";return I?r.jsx("div",{className:zt("flex items-center justify-center bg-black rounded-lg",Fe,i),children:r.jsxs("div",{className:"text-center text-white",children:[r.jsx(sn,{className:"h-12 w-12 animate-spin mx-auto mb-4"}),r.jsx("p",{children:"Initializing camera..."})]})}):D===!1?r.jsx("div",{className:zt("flex items-center justify-center bg-black rounded-lg",Fe,i),children:r.jsxs("div",{className:"text-center text-white p-8 max-w-md",children:[r.jsx(Bl,{className:"h-12 w-12 mx-auto mb-4 text-destructive"}),r.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Camera Access Required"}),r.jsx("p",{className:"text-gray-400 mb-4 text-sm",children:ae||"Please allow camera and microphone access to record videos."}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(te,{onClick:()=>Pe(),variant:"secondary",className:"w-full",children:[r.jsx(Dl,{className:"h-4 w-4 mr-2"}),"Try Again"]}),r.jsx("p",{className:"text-xs text-gray-500 mt-3",children:"💡 Tip: If you're viewing this in an embedded preview, try opening the app in a new browser tab for full camera access."})]})]})}):r.jsxs("div",{className:zt("flex flex-col gap-2",i),children:[C&&!F&&!he&&r.jsxs("div",{className:"flex items-center justify-center gap-3 py-2 bg-muted/50 rounded-lg",children:[r.jsx(GS,{className:zt("h-4 w-4",S?"text-muted-foreground":"text-primary")}),r.jsx(Qe,{htmlFor:"orientation-toggle",className:"text-sm text-muted-foreground",children:"Landscape"}),r.jsx(Zs,{id:"orientation-toggle",checked:S,onCheckedChange:Re}),r.jsx(Qe,{htmlFor:"orientation-toggle",className:"text-sm text-muted-foreground",children:"Portrait"}),r.jsx(Q0,{className:zt("h-4 w-4",S?"text-primary":"text-muted-foreground")})]}),r.jsxs("div",{className:zt("relative bg-black rounded-lg overflow-hidden"),onPointerDown:()=>{Ae()},children:[r.jsx("video",{ref:c,src:he??void 0,className:zt("w-full bg-black",S&&!he?"object-contain":"object-cover",Fe,xe==="user"&&!he&&"scale-x-[-1]"),playsInline:!0,controls:!!he,muted:he?Se:!0,autoPlay:!he},he??"live"),!he&&Me&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/40",children:r.jsx(te,{type:"button",variant:"secondary",onClick:()=>void Ae(),className:"bg-white/20 hover:bg-white/30 text-white",children:"Tap to enable preview"})}),o&&!he&&r.jsx("div",{className:"absolute inset-0 pointer-events-none",children:o}),F&&r.jsxs("div",{className:"absolute top-4 left-4 flex items-center gap-2 bg-black/50 px-3 py-1.5 rounded-full",children:[r.jsx("div",{className:zt("w-3 h-3 rounded-full",W?"bg-yellow-500":"bg-red-500 animate-pulse")}),r.jsxs("span",{className:"text-white text-sm font-medium",children:[et(Ne)," / ",et(t)]})]}),F&&r.jsx("div",{className:"absolute top-0 left-0 right-0",children:r.jsx(zc,{value:Ne/t*100,className:"h-1 rounded-none"})}),!he&&r.jsxs("div",{className:"absolute bottom-20 left-4 flex items-center gap-2 bg-black/50 px-3 py-1.5 rounded-full",children:[r.jsx(yT,{className:"h-4 w-4 text-white"}),r.jsx("div",{className:"w-20 h-2 bg-white/20 rounded-full overflow-hidden",children:r.jsx("div",{className:"h-full bg-green-500 transition-all duration-75",style:{width:`${me}%`}})})]}),r.jsx("div",{className:"absolute bottom-4 left-0 right-0 flex justify-center gap-3 px-4",children:he?r.jsxs(r.Fragment,{children:[r.jsxs(te,{variant:"secondary",size:"lg",className:"bg-white/20 hover:bg-white/30 text-white",onClick:mt,children:[r.jsx(Dl,{className:"h-5 w-5 mr-2"}),"Re-record"]}),r.jsx(te,{variant:"secondary",size:"icon",className:"h-12 w-12 rounded-full bg-white/20 hover:bg-white/30 text-white",onClick:Ce,children:ve?r.jsx(zf,{className:"h-5 w-5"}):r.jsx(wc,{className:"h-5 w-5"})}),r.jsxs(te,{size:"lg",className:"bg-green-500 hover:bg-green-600 text-white",onClick:We,children:[r.jsx(Ba,{className:"h-5 w-5 mr-2"}),"Use This Video"]})]}):r.jsxs(r.Fragment,{children:[r.jsx(te,{variant:"secondary",size:"icon",className:"h-12 w-12 rounded-full bg-white/20 hover:bg-white/30 text-white",onClick:rt,disabled:F,children:r.jsx(XS,{className:"h-5 w-5"})}),F?r.jsxs(r.Fragment,{children:[r.jsx(te,{size:"icon",className:"h-12 w-12 rounded-full bg-white/20 hover:bg-white/30 text-white",onClick:W?ge:Xe,children:W?r.jsx(wc,{className:"h-5 w-5"}):r.jsx(zf,{className:"h-5 w-5"})}),r.jsx(te,{size:"icon",className:"h-16 w-16 rounded-full bg-red-500 hover:bg-red-600 text-white",onClick:nt,children:r.jsx(im,{className:"h-6 w-6 fill-current"})})]}):r.jsx(te,{size:"icon",className:"h-16 w-16 rounded-full bg-red-500 hover:bg-red-600 text-white",onClick:Te,children:r.jsx(Gi,{className:"h-6 w-6"})}),r.jsx("div",{className:"h-12 w-12"})]})})]})]})}function CVt({text:t,isVisible:e,onToggleVisibility:n,isRecording:s=!1,className:i}){const o=P.useRef(null),c=P.useRef(null),a=P.useRef(0),f=P.useRef(0),[m,y]=P.useState(!1),[v,w]=P.useState(30),[k,C]=P.useState(24),[S,T]=P.useState(1.6),[I,A]=P.useState(.85),[D,$]=P.useState("top"),[F,q]=P.useState(!1),W=P.useCallback(he=>{if(!o.current)return;a.current===0&&(a.current=he);const ue=he-a.current;a.current=he,f.current+=v*ue/1e3;const Ne=Math.floor(f.current);Ne>0&&(o.current.scrollTop+=Ne,f.current-=Ne);const{scrollTop:se,scrollHeight:xe,clientHeight:ie}=o.current;if(se+ie>=xe){y(!1);return}c.current=requestAnimationFrame(W)},[v]);P.useEffect(()=>(m?(a.current=0,f.current=0,c.current=requestAnimationFrame(W)):c.current&&cancelAnimationFrame(c.current),()=>{c.current&&cancelAnimationFrame(c.current)}),[m,W]),P.useEffect(()=>{s&&e?(o.current&&(o.current.scrollTop=0),setTimeout(()=>{y(!0)},100)):s||y(!1)},[s,e]);const K=P.useCallback(()=>{o.current&&(o.current.scrollTop=0),y(!1)},[]),Z=P.useCallback(()=>{y(he=>!he)},[]);if(!e)return r.jsx("div",{className:zt("absolute top-4 right-4 pointer-events-auto z-10",i),children:r.jsxs(te,{variant:"secondary",size:"sm",onClick:n,className:"bg-black/50 hover:bg-black/70 text-white border-0",children:[r.jsx(Ml,{className:"h-4 w-4 mr-2"}),"Show Script"]})});const re={top:"top-0 pt-16",center:"top-1/2 -translate-y-1/2",bottom:"bottom-0 pb-24"};return r.jsxs("div",{className:zt("absolute inset-0 pointer-events-none",i),children:[r.jsx("div",{className:zt("absolute left-0 right-0 h-[60%] overflow-hidden pointer-events-auto",re[D]),style:{opacity:I},children:r.jsxs("div",{ref:o,className:zt("mx-auto max-w-2xl px-6 overflow-y-auto scrollbar-hide h-full",F&&"scale-x-[-1]"),style:{maskImage:"linear-gradient(to bottom, transparent, black 10%, black 90%, transparent)",WebkitMaskImage:"linear-gradient(to bottom, transparent, black 10%, black 90%, transparent)"},children:[r.jsx("p",{className:"text-white text-center font-medium drop-shadow-lg",style:{fontSize:`${k}px`,lineHeight:S,textShadow:"0 2px 4px rgba(0,0,0,0.8)"},children:t}),r.jsx("div",{className:"h-32"})]})}),r.jsxs("div",{className:"absolute top-4 right-4 flex items-center gap-2 pointer-events-auto",children:[r.jsxs(Zh,{children:[r.jsx(Yh,{asChild:!0,children:r.jsx(te,{variant:"secondary",size:"icon",className:"h-9 w-9 bg-black/50 hover:bg-black/70 text-white border-0",children:r.jsx(id,{className:"h-4 w-4"})})}),r.jsx(mh,{className:"w-72",side:"left",align:"start",children:r.jsxs("div",{className:"space-y-4",children:[r.jsx("h4",{className:"font-medium",children:"Teleprompter Settings"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{className:"text-xs",children:"Scroll Speed"}),r.jsx(pw,{value:[v],onValueChange:([he])=>w(he),min:1,max:100,step:1})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{className:"text-xs",children:"Font Size"}),r.jsx(pw,{value:[k],onValueChange:([he])=>C(he),min:16,max:48,step:2})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{className:"text-xs",children:"Line Spacing"}),r.jsx(pw,{value:[S*10],onValueChange:([he])=>T(he/10),min:12,max:24,step:1})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{className:"text-xs",children:"Opacity"}),r.jsx(pw,{value:[I*100],onValueChange:([he])=>A(he/100),min:30,max:100,step:5})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{className:"text-xs",children:"Position"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(te,{variant:D==="top"?"default":"outline",size:"sm",onClick:()=>$("top"),children:r.jsx(U0,{className:"h-4 w-4"})}),r.jsx(te,{variant:D==="center"?"default":"outline",size:"sm",onClick:()=>$("center"),children:r.jsx(Y0,{className:"h-4 w-4"})}),r.jsx(te,{variant:D==="bottom"?"default":"outline",size:"sm",onClick:()=>$("bottom"),children:r.jsx(uh,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Qe,{className:"text-xs",children:"Mirror Mode"}),r.jsx(Zs,{checked:F,onCheckedChange:q})]})]})})]}),r.jsx(te,{variant:"secondary",size:"icon",onClick:Z,className:"h-9 w-9 bg-black/50 hover:bg-black/70 text-white border-0",children:m?r.jsx(zf,{className:"h-4 w-4"}):r.jsx(wc,{className:"h-4 w-4"})}),r.jsx(te,{variant:"secondary",size:"icon",onClick:K,className:"h-9 w-9 bg-black/50 hover:bg-black/70 text-white border-0",children:r.jsx(XS,{className:"h-4 w-4"})}),r.jsxs(te,{variant:"secondary",size:"sm",onClick:n,className:"bg-black/50 hover:bg-black/70 text-white border-0",children:[r.jsx($w,{className:"h-4 w-4 mr-2"}),"Hide"]})]})]})}function MVt({onSelectScript:t,onCreateNew:e,selectedScriptId:n,className:s}){const{toast:i}=la(),[o,c]=P.useState(""),[a,f]=P.useState(null),[m,y]=P.useState("levelup"),{data:v,isLoading:w}=swt(),{data:k,isLoading:C}=iwt(),{data:S,isLoading:T}=awt(),I=owt(),A=P.useMemo(()=>k?k.filter(W=>{const K=!o||W.title.toLowerCase().includes(o.toLowerCase())||W.script_text.toLowerCase().includes(o.toLowerCase())||W.tags.some(re=>re.toLowerCase().includes(o.toLowerCase())),Z=!a||W.category_id===a;return K&&Z}):[],[k,o,a]),D=P.useMemo(()=>S?S.filter(W=>!o||W.title.toLowerCase().includes(o.toLowerCase())||W.script_text.toLowerCase().includes(o.toLowerCase())):[],[S,o]),$=W=>{t({title:W.title,text:W.script_text})},F=async W=>{try{await I.mutateAsync(W),i({title:"Script saved to My Scripts"})}catch{i({title:"Failed to save script",variant:"destructive"})}},q=w||C||T;return r.jsxs("div",{className:zt("flex flex-col h-full",s),children:[r.jsx("div",{className:"p-4 border-b",children:r.jsxs("div",{className:"relative",children:[r.jsx(Ti,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(yt,{placeholder:"Search scripts...",value:o,onChange:W=>c(W.target.value),className:"pl-9"})]})}),r.jsxs(La,{value:m,onValueChange:W=>y(W),className:"flex-1 flex flex-col",children:[r.jsxs(Ma,{className:"mx-4 mt-4 grid grid-cols-2",children:[r.jsxs(yn,{value:"levelup",children:[r.jsx(Ai,{className:"h-4 w-4 mr-2"}),"LevelUp Scripts"]}),r.jsxs(yn,{value:"my-scripts",children:[r.jsx(Jp,{className:"h-4 w-4 mr-2"}),"My Scripts"]})]}),r.jsxs($n,{value:"levelup",className:"flex-1 flex flex-col mt-0 p-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[r.jsx(Rt,{variant:a?"outline":"default",className:"cursor-pointer",onClick:()=>f(null),children:"All"}),v==null?void 0:v.map(W=>r.jsx(Rt,{variant:a===W.id?"default":"outline",className:"cursor-pointer",onClick:()=>f(W.id),children:W.name},W.id))]}),r.jsx(xl,{className:"flex-1 max-h-[50vh]",children:q?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(sn,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):A.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Ai,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No scripts found"})]}):r.jsx("div",{className:"space-y-2",children:A.map(W=>r.jsxs(Ye,{className:zt("cursor-pointer hover:bg-accent/50 transition-colors",n===W.id&&"ring-2 ring-primary"),onClick:()=>$(W),children:[r.jsx(Ht,{className:"p-3",children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx(Yt,{className:"text-sm font-medium truncate",children:W.title}),W.category&&r.jsx(Rt,{variant:"secondary",className:"mt-1 text-xs",children:W.category.name})]}),r.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[r.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:K=>{K.stopPropagation(),F(W)},children:r.jsx(Jp,{className:"h-4 w-4"})}),r.jsx(Ha,{className:"h-4 w-4 text-muted-foreground"})]})]})}),r.jsx(Je,{className:"p-3 pt-0",children:r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:W.script_text})})]},W.id))})})]}),r.jsxs($n,{value:"my-scripts",className:"flex-1 flex flex-col mt-0 p-4",children:[e&&r.jsxs(te,{variant:"outline",className:"mb-4",onClick:e,children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Create New Script"]}),r.jsx(xl,{className:"flex-1 max-h-[50vh]",children:T?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(sn,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):D.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Jp,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No saved scripts"}),r.jsx("p",{className:"text-sm mt-1",children:"Save LevelUp scripts or create your own"})]}):r.jsx("div",{className:"space-y-2",children:D.map(W=>r.jsxs(Ye,{className:zt("cursor-pointer hover:bg-accent/50 transition-colors",n===W.id&&"ring-2 ring-primary"),onClick:()=>$(W),children:[r.jsx(Ht,{className:"p-3",children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx(Yt,{className:"text-sm font-medium truncate",children:W.title}),r.jsx("div",{className:"flex items-center gap-2 mt-1",children:W.is_custom?r.jsx(Rt,{variant:"outline",className:"text-xs",children:"Custom"}):r.jsx(Rt,{variant:"secondary",className:"text-xs",children:"Saved"})})]}),r.jsx(Ha,{className:"h-4 w-4 text-muted-foreground ml-2"})]})}),r.jsx(Je,{className:"p-3 pt-0",children:r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:W.script_text})})]},W.id))})})]})]})]})}function TVt({selectedTemplate:t,onSelect:e,contactName:n,saving:s=!1}){return r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Qe,{className:"text-sm font-medium",children:"Share Page Template"}),s&&r.jsx(sn,{className:"h-3 w-3 animate-spin text-muted-foreground"})]}),r.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:phe.map(i=>{const o=t===i.id;return r.jsxs("button",{type:"button",onClick:()=>e(i.id),disabled:s,className:zt("relative rounded-lg border-2 p-3 text-left transition-all hover:shadow-sm disabled:opacity-50 disabled:cursor-not-allowed",o?"border-primary ring-1 ring-primary/20 bg-primary/5":"border-muted hover:border-muted-foreground/30"),children:[o&&r.jsx("div",{className:"absolute top-1.5 right-1.5 w-4 h-4 rounded-full bg-primary flex items-center justify-center",children:r.jsx(Ba,{className:"h-2.5 w-2.5 text-primary-foreground"})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"opacity-70",children:i.icon}),r.jsx("span",{className:"text-sm font-medium",children:i.name})]})]},i.id)})}),n&&t!=="default"&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:['Will show: "',UT(t).headerText(n),'"']})]})}function u$e({open:t,onOpenChange:e,video:n,contactName:s,onTemplateUpdated:i}){const[o,c]=P.useState(n.page_template||"default"),[a,f]=P.useState(!1),[m,y]=P.useState(!1),[v,w]=P.useState(n.page_template||"default"),[k,C]=P.useState([]),[S,T]=P.useState(n.contact_id&&s?{id:n.contact_id,name:s,email:null}:null),[I,A]=P.useState(!1),[D,$]=P.useState(!1),F=n.share_token?`https://video.relevelup.com/${n.share_token}`:"";P.useEffect(()=>{t&&k.length===0&&q()},[t]);const q=async()=>{$(!0);try{const{data:xe,error:ie}=await ee.from("innercircle_contacts").select("id, first_name, last_name, email").order("first_name",{ascending:!0}).limit(500);if(ie)throw ie;const me=(xe||[]).map(fe=>({id:fe.id,name:[fe.first_name,fe.last_name].filter(Boolean).join(" ")||"Unnamed",email:fe.email||null}));C(me)}catch(xe){console.error("Failed to fetch contacts:",xe)}finally{$(!1)}},W=async xe=>{T(xe),A(!1),f(!0);try{const{error:ie}=await ee.from("agent_videos").update({contact_id:(xe==null?void 0:xe.id)||null,recipient_name:(xe==null?void 0:xe.name)||null}).eq("id",n.id);if(ie)throw ie;Ge.success(xe?`Assigned to ${xe.name}`:"Contact removed"),i==null||i()}catch(ie){console.error("Failed to update contact:",ie),Ge.error("Failed to update contact")}finally{f(!1)}},K=async xe=>{c(xe),f(!0);try{const{error:ie}=await ee.from("agent_videos").update({page_template:xe}).eq("id",n.id);if(ie)throw ie;w(xe),Ge.success("Template saved!"),i==null||i()}catch(ie){console.error("Failed to save template:",ie),Ge.error("Failed to save template"),c(v)}finally{f(!1)}},Z=(S==null?void 0:S.name)||null,re=()=>{const xe=n.title||"Video Message",ie=n.share_token?`https://video.relevelup.com/thumb/${n.share_token}`:n.thumbnail_url||"";return``},he=async()=>{if(!n.thumbnail_url){Ge.error("Video thumbnail not available yet");return}const xe=re(),ie=`Watch: ${n.title||"Video Message"} ${F}`;try{const me=new Blob([xe],{type:"text/html"}),fe=new Blob([ie],{type:"text/plain"}),ve=new ClipboardItem({"text/html":me,"text/plain":fe});await navigator.clipboard.write([ve]),Ge.success("Copied! Paste into Gmail - the thumbnail will appear after sending.")}catch{await navigator.clipboard.writeText(ie+` `+xe),Ge.success("Copied! Paste into your email.")}},ue=async()=>{await navigator.clipboard.writeText(F),y(!0),Ge.success("Share link copied!"),setTimeout(()=>y(!1),2e3)},Ne=()=>{const ie=UT(o).headerText(Z),me=o==="default"?`Check out this video: ${F}`:`${ie} Check out this special video: ${F}`;window.open(`sms:?body=${encodeURIComponent(me)}`,"_self")},se=()=>{const xe=UT(o),ie=xe.headerText(Z),me=o==="default"?n.title||"Video Message":ie,fe=`${xe.subText} Watch the video: ${F}`,ve=S!=null&&S.email?encodeURIComponent(S.email):"";window.open(`mailto:${ve}?subject=${encodeURIComponent(me)}&body=${encodeURIComponent(fe)}`,"_self")};return r.jsx($r,{open:t,onOpenChange:e,children:r.jsxs(zr,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsxs(Zr,{children:[r.jsxs(Kr,{className:"flex items-center gap-2",children:[r.jsx(bo,{className:"h-5 w-5"}),"Share Video"]}),r.jsx(ls,{children:"Choose a themed page template and share your video"})]}),r.jsxs("div",{className:"space-y-6 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{className:"text-sm font-medium",children:"Personalize for Contact (Optional)"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(Zh,{open:I,onOpenChange:A,children:[r.jsx(Yh,{asChild:!0,children:r.jsxs(te,{variant:"outline",role:"combobox","aria-expanded":I,className:"flex-1 justify-between",disabled:a,children:[S?r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(jc,{className:"h-4 w-4 text-muted-foreground"}),S.name]}):r.jsx("span",{className:"text-muted-foreground",children:"Select a contact..."}),r.jsx(Fw,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(mh,{className:"w-[300px] p-0",align:"start",children:r.jsxs(gj,{children:[r.jsx(yj,{placeholder:"Search contacts..."}),r.jsxs(xj,{children:[r.jsx(vj,{children:D?"Loading...":"No contacts found."}),r.jsx(_j,{children:k.map(xe=>r.jsxs(bj,{value:xe.name,onSelect:()=>W(xe),children:[r.jsx(Ba,{className:zt("mr-2 h-4 w-4",(S==null?void 0:S.id)===xe.id?"opacity-100":"opacity-0")}),xe.name]},xe.id))})]})]})})]}),S&&r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>W(null),disabled:a,className:"shrink-0",children:r.jsx(Ms,{className:"h-4 w-4"})})]}),S&&o!=="default"&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:['Page will show: "',UT(o).headerText(S.name),'"']})]}),r.jsx(TVt,{selectedTemplate:o,onSelect:K,contactName:Z,saving:a}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Share Link"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(yt,{value:F,readOnly:!0,className:"font-mono text-sm"}),r.jsx(te,{onClick:ue,variant:m?"default":"outline",className:"shrink-0 gap-2",children:m?r.jsxs(r.Fragment,{children:[r.jsx(Ba,{className:"h-4 w-4"}),"Copied"]}):r.jsxs(r.Fragment,{children:[r.jsx(Ul,{className:"h-4 w-4"}),"Copy"]})})]})]}),n.thumbnail_url&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Share for Email"}),r.jsxs(te,{variant:"outline",className:"w-full gap-2",onClick:he,children:[r.jsx(Wo,{className:"h-4 w-4"}),"Copy with Thumbnail (for Gmail)"]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Paste into Gmail to embed a clickable video thumbnail"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Quick Share"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(te,{variant:"outline",className:"flex-1 gap-2",onClick:Ne,children:[r.jsx(Wl,{className:"h-4 w-4"}),"Text"]}),r.jsxs(te,{variant:"outline",className:"flex-1 gap-2",onClick:se,children:[r.jsx(di,{className:"h-4 w-4"}),"Email"]})]})]})]}),r.jsx(ni,{children:r.jsx(te,{variant:"outline",onClick:()=>e(!1),children:"Done"})})]})})}function AVt(){var We;const t=es(),[e]=Ed(),{toast:n}=la(),s=e.get("contact_id"),i=e.get("task_id"),{canRecord:o,remainingMb:c,usagePercent:a,isNearLimit:f}=uwt(),{data:m}=mm(),y=cze(),v=mwt(),[w,k]=P.useState("record"),[C,S]=P.useState(""),[T,I]=P.useState(!1),[A,D]=P.useState(!1),[$,F]=P.useState(!1),[q,W]=P.useState(null),[K,Z]=P.useState(0),[re,he]=P.useState(0),[ue,Ne]=P.useState(null),[se,xe]=P.useState(null),[ie,me]=P.useState(s||""),[fe,ve]=P.useState(""),[Ie,Se]=P.useState(""),[oe,ae]=P.useState(null),[je,Me]=P.useState(null),[Ue,Re]=P.useState(null),[$e,Pe]=P.useState(!1),Ae=P.useCallback(async(Ce,et)=>{W(Ce),k("uploading");try{const{videoId:Fe,uploadUrl:Ke}=await hwt(fe||"Quick Video Touch");Ne(Fe);const{apiKey:Le}=await fwt(Fe),ft=new XMLHttpRequest;ft.upload.onprogress=Mt=>{Mt.lengthComputable&&Z(Mt.loaded/Mt.total*100)},await new Promise((Mt,It)=>{ft.onload=()=>{ft.status>=200&&ft.status<300?Mt():It(new Error(`Upload failed: ${ft.status}`))},ft.onerror=()=>It(new Error("Upload failed")),ft.open("PUT",Ke),ft.setRequestHeader("AccessKey",Le),ft.send(Ce)}),k("processing");let Nt=0;for(;Nt<4;){await new Promise(It=>setTimeout(It,2e3));const Mt=await pwt(Fe);if(Nt=Mt.status,he(Mt.encodeProgress||0),Nt===4)xe({playbackUrl:Mt.directPlayUrl,thumbnailUrl:Mt.thumbnailUrl,previewUrl:Mt.previewUrl||null,duration:Mt.length||et,fileSizeMb:(Mt.storageSize||Ce.size)/(1024*1024)});else if(Nt===5||Nt===6)throw new Error("Video processing failed")}k("details")}catch(Fe){console.error("Upload error:",Fe),n({title:"Upload failed",description:"Please try recording again.",variant:"destructive"}),k("record")}},[fe,n]),nt=async()=>{if(!(!ue||!se))try{const Ce=ie&&ie!=="none"?ie:null,et=await y.mutateAsync({bunny_video_id:ue,contact_id:Ce,playback_url:se.playbackUrl,thumbnail_url:se.thumbnailUrl,preview_url:se.previewUrl,duration_seconds:se.duration,file_size_mb:se.fileSizeMb,title:fe||"Quick Video Touch",notes:Ie,task_id:i||null,status:"ready"});ae(et.id),Me(et.share_token||null),Ce&&await v.mutateAsync({contactId:Ce,videoId:et.id,notes:Ie}),n({title:"Video saved successfully!"}),k("share")}catch(Ce){console.error("Save video error:",Ce),n({title:"Failed to save video",description:(Ce==null?void 0:Ce.message)||"Please try again.",variant:"destructive"})}},Te=(Ce,et)=>{navigator.clipboard.writeText(et),Re(Ce),setTimeout(()=>Re(null),2e3),n({title:"Copied to clipboard!"})},Xe=()=>je?`https://video.relevelup.com/${je}`:(se==null?void 0:se.playbackUrl)||"",ge=()=>{const Ce=m==null?void 0:m.find(ft=>ft.id===ie),et=Ce?`${Ce.first_name}`:"",Fe=(Ce==null?void 0:Ce.phone)||"",Ke=(Ce==null?void 0:Ce.email)||"",Le=Xe();return{text:`Hey${et?` ${et}`:""}! I recorded a quick video for you: ${Le}`,link:Le,contactPhone:Fe,contactEmail:Ke}},mt=()=>{const{text:Ce,contactPhone:et}=ge(),Fe=et?`sms:${et}?body=${encodeURIComponent(Ce)}`:`sms:?body=${encodeURIComponent(Ce)}`;window.open(Fe,"_self")},rt=()=>{const{link:Ce,contactEmail:et}=ge(),Fe="Check out this video",Ke=`I recorded a quick video for you: ${Ce}`,Le=et?`mailto:${et}?subject=${encodeURIComponent(Fe)}&body=${encodeURIComponent(Ke)}`:`mailto:?subject=${encodeURIComponent(Fe)}&body=${encodeURIComponent(Ke)}`;window.open(Le,"_self")};return o?r.jsx(Or,{title:"Quick Video Touch",children:r.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>t(-1),children:r.jsx(Va,{className:"h-5 w-5"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Quick Video Touch"}),r.jsx("p",{className:"text-muted-foreground",children:"Record a personal video message"})]})]}),f&&r.jsxs("div",{className:"text-right",children:[r.jsxs("p",{className:"text-sm text-warning",children:["Storage: ",a.toFixed(0),"% used"]}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[c.toFixed(0)," MB remaining"]})]})]}),w==="record"&&r.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[r.jsxs("div",{className:"lg:col-span-2",children:[r.jsx(SVt,{maxDurationSeconds:30,onRecordingComplete:Ae,onRecordingStateChange:F,className:"w-full",teleprompterContent:T&&C&&r.jsx(CVt,{text:C,isVisible:T,onToggleVisibility:()=>I(!1),isRecording:$})}),!T&&C&&r.jsxs(te,{variant:"outline",className:"mt-4",onClick:()=>I(!0),children:[r.jsx(Ai,{className:"h-4 w-4 mr-2"}),"Show Teleprompter"]})]}),r.jsxs(Ye,{className:"lg:col-span-1",children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Yt,{className:"text-lg",children:"Teleprompter Script"})}),r.jsxs(Je,{className:"space-y-4",children:[r.jsx(ps,{placeholder:"Type or paste your script here...",value:C,onChange:Ce=>S(Ce.target.value),rows:6}),r.jsxs(qne,{open:A,onOpenChange:D,children:[r.jsx(yge,{asChild:!0,children:r.jsxs(te,{variant:"outline",className:"w-full",children:[r.jsx(Ai,{className:"h-4 w-4 mr-2"}),"Browse Scripts"]})}),r.jsxs(tI,{side:"right",className:"w-[400px] sm:w-[540px] p-0",children:[r.jsx(Vne,{className:"p-4 border-b",children:r.jsx(Hne,{children:"Select a Script"})}),r.jsx(MVt,{onSelectScript:Ce=>{S(Ce.text),D(!1),I(!0)},className:"h-[calc(100vh-80px)]"})]})]}),C&&r.jsx(te,{className:"w-full",onClick:()=>I(!0),children:"Use Script"})]})]})]}),w==="uploading"&&r.jsx(Ye,{className:"max-w-md mx-auto",children:r.jsxs(Je,{className:"pt-6 text-center",children:[r.jsx(Ao,{className:"h-12 w-12 mx-auto mb-4 text-primary animate-pulse"}),r.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Uploading Video..."}),r.jsx(zc,{value:K,className:"mb-2"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[K.toFixed(0),"%"]})]})}),w==="processing"&&r.jsx(Ye,{className:"max-w-md mx-auto",children:r.jsxs(Je,{className:"pt-6 text-center",children:[r.jsx(sn,{className:"h-12 w-12 mx-auto mb-4 text-primary animate-spin"}),r.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Processing Video..."}),r.jsx(zc,{value:re,className:"mb-2"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[re.toFixed(0),"%"]})]})}),w==="details"&&r.jsxs(Ye,{className:"max-w-lg mx-auto",children:[r.jsx(Ht,{children:r.jsx(Yt,{children:"Video Details"})}),r.jsxs(Je,{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Qe,{children:"Title"}),r.jsx(yt,{value:fe,onChange:Ce=>ve(Ce.target.value),placeholder:"Quick Video Touch"})]}),r.jsxs("div",{children:[r.jsx(Qe,{children:"Attach to Contact (Optional)"}),r.jsxs(_n,{value:ie,onValueChange:me,children:[r.jsx(xn,{children:r.jsx(bn,{placeholder:"No contact - use anywhere"})}),r.jsxs(vn,{children:[r.jsx(er,{value:"none",children:r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[r.jsx(bo,{className:"h-4 w-4"}),"No contact - use anywhere"]})}),m==null?void 0:m.map(Ce=>r.jsx(er,{value:Ce.id,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(jc,{className:"h-4 w-4"}),Ce.first_name," ",Ce.last_name]})},Ce.id))]})]})]}),r.jsxs("div",{children:[r.jsx(Qe,{children:"Notes"}),r.jsx(ps,{value:Ie,onChange:Ce=>Se(Ce.target.value),placeholder:"Add notes about this video...",rows:3})]}),r.jsxs(te,{className:"w-full",onClick:nt,disabled:y.isPending,children:[y.isPending&&r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),"Save Video"]})]})]}),w==="share"&&r.jsxs(Ye,{className:"max-w-lg mx-auto",children:[r.jsx(Ht,{children:r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(Ba,{className:"h-5 w-5 text-green-500"}),"Video Saved!"]})}),r.jsxs(Je,{className:"space-y-4",children:[r.jsx("p",{className:"text-muted-foreground",children:"Share your video with one click:"}),r.jsxs("div",{className:"grid gap-3",children:[r.jsxs(te,{variant:"outline",className:"justify-start",onClick:mt,children:[r.jsx(Wl,{className:"h-4 w-4 mr-2"}),"Text Contact Video"]}),r.jsxs(te,{variant:"outline",className:"justify-start",onClick:rt,children:[r.jsx(di,{className:"h-4 w-4 mr-2"}),"Email Contact Video"]}),r.jsxs(te,{variant:"outline",className:"justify-start",onClick:()=>Te("link",ge().link),children:[r.jsx(bo,{className:"h-4 w-4 mr-2"}),"Copy Video Link",Ue==="link"&&r.jsx(Ba,{className:"h-4 w-4 ml-auto text-green-500"})]}),r.jsxs(te,{variant:"outline",className:"justify-start",onClick:()=>Pe(!0),children:[r.jsx(Gd,{className:"h-4 w-4 mr-2"}),"Send with Page Template"]})]}),r.jsxs("div",{className:"flex gap-3 pt-4",children:[r.jsx(te,{variant:"outline",onClick:()=>t("/innercircle/video-library"),children:"View Library"}),r.jsx(te,{onClick:()=>{k("record"),W(null),Ne(null),xe(null)},children:"Record Another"})]})]})]}),oe&&je&&r.jsx(u$e,{open:$e,onOpenChange:Pe,video:{id:oe,share_token:je,title:fe||null,contact_id:ie||null,thumbnail_url:(se==null?void 0:se.thumbnailUrl)||null},contactName:((We=m==null?void 0:m.find(Ce=>Ce.id===ie))==null?void 0:We.first_name)||null})]})}):r.jsx(Or,{title:"Quick Video Touch",children:r.jsxs("div",{className:"max-w-2xl mx-auto text-center py-12",children:[r.jsx(Ph,{className:"h-16 w-16 text-destructive mx-auto mb-4"}),r.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Storage Limit Reached"}),r.jsx("p",{className:"text-muted-foreground mb-6",children:"You've reached your video storage limit. Delete videos from your library to record more."}),r.jsx(te,{onClick:()=>t("/innercircle/video-library"),children:"Open Video Library"})]})})}function EVt({open:t,onOpenChange:e}){const{data:n}=mm(),{data:s}=oxe(),i=cze(),o=P.useRef(null),[c,a]=P.useState(null),[f,m]=P.useState(""),[y,v]=P.useState(""),[w,k]=P.useState(""),[C,S]=P.useState(!1),[T,I]=P.useState(0),[A,D]=P.useState("idle"),$=(s==null?void 0:s.total_storage_mb)||0,q=((s==null?void 0:s.max_storage_mb)||1024)-$,W=he=>{var se;const ue=(se=he.target.files)==null?void 0:se[0];if(!ue)return;if(!ue.type.startsWith("video/")){Ge.error("Please select a video file");return}const Ne=ue.size/(1024*1024);if(Ne>500){Ge.error("Video file must be less than 500MB");return}if(Ne>q){Ge.error(`Not enough storage. You have ${q.toFixed(1)} MB remaining.`);return}a(ue),f||m(ue.name.replace(/\.[^/.]+$/,""))},K=async()=>{if(!c){Ge.error("Please select a video file");return}S(!0),I(0),D("creating");try{const{data:he,error:ue}=await ee.functions.invoke("bunny-upload",{body:{action:"create",title:f||c.name,isAgentVideo:!0}});if(ue)throw new Error(ue.message);const{videoId:Ne,libraryId:se}=he;D("uploading");const{data:xe,error:ie}=await ee.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:Ne,isAgentVideo:!0}});if(ie)throw new Error(ie.message);await new Promise((ve,Ie)=>{const Se=new XMLHttpRequest;Se.upload.addEventListener("progress",oe=>{if(oe.lengthComputable){const ae=Math.round(oe.loaded/oe.total*100);I(ae)}}),Se.addEventListener("load",()=>{Se.status>=200&&Se.status<300?ve():Ie(new Error(`Upload failed with status ${Se.status}`))}),Se.addEventListener("error",()=>Ie(new Error("Upload failed"))),Se.open("PUT",xe.uploadUrl),Se.setRequestHeader("AccessKey",xe.apiKey),Se.send(c)}),D("processing");const me=c.size/(1024*1024),fe=`https://iframe.mediadelivery.net/embed/${se}/${Ne}`;await i.mutateAsync({bunny_video_id:Ne,playback_url:fe,file_size_mb:me,title:f||c.name,notes:y||void 0,contact_id:w||void 0,status:"processing",touch_type:"video_upload"}),Ge.success("Video uploaded successfully! Processing may take a few minutes."),Z()}catch(he){console.error("Upload error:",he),Ge.error(he instanceof Error?he.message:"Failed to upload video")}finally{S(!1),D("idle")}},Z=()=>{C||(a(null),m(""),v(""),k(""),I(0),D("idle"),e(!1))},re=()=>{switch(A){case"creating":return"Preparing upload...";case"uploading":return`Uploading... ${T}%`;case"processing":return"Saving video...";default:return""}};return r.jsx($r,{open:t,onOpenChange:Z,children:r.jsxs(zr,{className:"sm:max-w-md",children:[r.jsxs(Zr,{children:[r.jsx(Kr,{children:"Upload Video"}),r.jsx(ls,{children:"Upload a video file from your device to your video library."})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Video File"}),c?r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted rounded-lg",children:[r.jsx(Gi,{className:"h-8 w-8 text-primary flex-shrink-0"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:c.name}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[(c.size/(1024*1024)).toFixed(1)," MB"]})]}),!C&&r.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:he=>{he.stopPropagation(),a(null)},children:r.jsx(Ms,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"border-2 border-dashed border-muted-foreground/25 rounded-lg p-8 text-center cursor-pointer hover:border-primary/50 transition-colors",onClick:()=>{var he;return(he=o.current)==null?void 0:he.click()},children:[r.jsx(Ao,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Click to select a video file"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"MP4, MOV, WebM (max 500MB)"})]}),r.jsx("input",{ref:o,type:"file",accept:"video/*",className:"hidden",onChange:W,disabled:C})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"title",children:"Title"}),r.jsx(yt,{id:"title",value:f,onChange:he=>m(he.target.value),placeholder:"Enter video title",disabled:C})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Associate with Contact (optional)"}),r.jsxs(_n,{value:w||"__none__",onValueChange:he=>k(he==="__none__"?"":he),disabled:C,children:[r.jsx(xn,{children:r.jsx(bn,{placeholder:"Select a contact"})}),r.jsxs(vn,{children:[r.jsx(er,{value:"__none__",children:"No contact"}),n==null?void 0:n.map(he=>r.jsxs(er,{value:he.id,children:[he.first_name," ",he.last_name||""]},he.id))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"notes",children:"Notes (optional)"}),r.jsx(ps,{id:"notes",value:y,onChange:he=>v(he.target.value),placeholder:"Add any notes about this video",rows:2,disabled:C})]}),C&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(sn,{className:"h-4 w-4 animate-spin"}),r.jsx("span",{children:re()})]}),r.jsx(zc,{value:A==="uploading"?T:A==="processing"?100:10})]})]}),r.jsxs(ni,{children:[r.jsx(te,{variant:"outline",onClick:Z,disabled:C,children:"Cancel"}),r.jsx(te,{onClick:K,disabled:!c||C,children:C?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Ao,{className:"h-4 w-4 mr-2"}),"Upload Video"]})})]})]})})}function IVt({previewSrc:t,thumbnailSrc:e,alt:n,isHovered:s}){const[i,o]=P.useState(!1),[c,a]=P.useState(!1),f=s&&t&&!i,m=e&&!c;return!m&&!f?r.jsx("div",{className:"w-full h-full flex items-center justify-center absolute inset-0 bg-muted",children:r.jsx(Gi,{className:"h-12 w-12 text-muted-foreground"})}):r.jsxs(r.Fragment,{children:[m&&r.jsx("img",{src:e,alt:n,loading:"lazy",className:`w-full h-full object-cover absolute inset-0 transition-opacity duration-200 ${f?"opacity-0":"opacity-100"}`,onError:()=>a(!0)}),f&&r.jsx("img",{src:t,alt:n,className:"w-full h-full object-cover absolute inset-0",onError:()=>o(!0)})]})}function PVt({video:t,previewSrc:e,thumbnailSrc:n,onOpen:s,onDelete:i,onNavigateToContact:o,onGetEmbedCode:c,onCopyEmailHtml:a,onShareWithTemplate:f,getContactName:m,getShareUrl:y,copyToClipboard:v,formatDuration:w}){const[k,C]=P.useState(!1);return r.jsxs(Ye,{className:"overflow-hidden group cursor-pointer",onClick:s,onMouseEnter:()=>C(!0),onMouseLeave:()=>C(!1),children:[r.jsxs("div",{className:"relative aspect-video bg-muted overflow-hidden",children:[r.jsx(IVt,{previewSrc:e,thumbnailSrc:n,alt:t.title||"Video preview",isHovered:k}),r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity",children:r.jsx("div",{className:"w-12 h-12 rounded-full bg-white/90 flex items-center justify-center",children:r.jsx(wc,{className:"h-6 w-6 text-primary ml-1"})})}),r.jsx("div",{className:"absolute bottom-2 right-2 bg-black/70 text-white text-xs px-1.5 py-0.5 rounded",children:w(t.duration_seconds)}),t.status!=="ready"&&r.jsx(Rt,{variant:t.status==="processing"?"secondary":"destructive",className:"absolute top-2 left-2",children:t.status})]}),r.jsx(Je,{className:"p-3",children:r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("h3",{className:"font-medium truncate",children:t.title||"Untitled Video"}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground mt-1",children:[r.jsx(jc,{className:"h-3 w-3"}),r.jsx("span",{className:"truncate",children:m(t.contact_id)})]}),r.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground mt-0.5",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Xi,{className:"h-3 w-3"}),r.jsx("span",{children:un(new Date(t.created_at),"MMM d, yyyy")})]}),(t.view_count??0)>0&&r.jsxs("div",{className:"flex items-center gap-1 text-primary",children:[r.jsx(Ml,{className:"h-3 w-3"}),r.jsxs("span",{children:[t.view_count," ",t.view_count===1?"view":"views"]})]})]})]}),r.jsxs(fm,{children:[r.jsx(pm,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:S=>S.stopPropagation(),children:r.jsx(gy,{className:"h-4 w-4"})})}),r.jsxs(Xf,{align:"end",className:"bg-popover",children:[r.jsxs(uo,{onClick:S=>{S.stopPropagation(),s()},children:[r.jsx(Ml,{className:"h-4 w-4 mr-2"}),"Watch"]}),r.jsx(H4,{}),r.jsxs(uo,{onClick:S=>{S.stopPropagation(),f()},children:[r.jsx(Gd,{className:"h-4 w-4 mr-2"}),"Share with Template"]}),r.jsxs(uo,{onClick:S=>{S.stopPropagation(),v(y(t),"Share link")},children:[r.jsx(bo,{className:"h-4 w-4 mr-2"}),"Copy Share Link"]}),r.jsxs(uo,{onClick:S=>{S.stopPropagation(),c()},children:[r.jsx(zw,{className:"h-4 w-4 mr-2"}),"Get Embed Code"]}),r.jsxs(uo,{onClick:S=>{S.stopPropagation(),a()},children:[r.jsx(di,{className:"h-4 w-4 mr-2"}),"Copy HTML for Email"]}),r.jsx(H4,{}),t.contact_id&&r.jsxs(uo,{onClick:S=>{S.stopPropagation(),o()},children:[r.jsx(jc,{className:"h-4 w-4 mr-2"}),"View Contact"]}),r.jsxs(uo,{onClick:S=>{S.stopPropagation(),i()},className:"text-destructive",children:[r.jsx(Xn,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})]})})]})}function LVt(){const t=es(),{data:e,isLoading:n}=lwt(),{data:s}=oxe(),{data:i}=mm(),o=dwt(),[c,a]=P.useState(""),[f,m]=P.useState(null),[y,v]=P.useState(!1),[w,k]=P.useState(!1),[C,S]=P.useState(!1),[T,I]=P.useState(!1),[A,D]=P.useState(!1),[$,F]=P.useState({}),q=ae=>{if(!ae)return"Unassigned";const je=i==null?void 0:i.find(Me=>Me.id===ae);return je?`${je.first_name} ${je.last_name||""}`.trim():"Unknown"},W=ae=>{if(!ae)return"0:00";const je=Math.floor(ae/60),Me=ae%60;return`${je}:${Me.toString().padStart(2,"0")}`},K=e==null?void 0:e.filter(ae=>{if(!c)return!0;const je=q(ae.contact_id).toLowerCase(),Me=(ae.title||"").toLowerCase(),Ue=(ae.notes||"").toLowerCase();return je.includes(c.toLowerCase())||Me.includes(c.toLowerCase())||Ue.includes(c.toLowerCase())});P.useEffect(()=>{(async()=>{if(!(e!=null&&e.length))return;const je=e.filter(Ue=>(Ue==null?void 0:Ue.bunny_video_id)&&!$[Ue.id]);if(!je.length)return;const Me=await Promise.allSettled(je.map(async Ue=>{const{data:Re,error:$e}=await ee.functions.invoke("bunny-upload",{body:{action:"asset-urls",videoId:Ue.bunny_video_id,isAgentVideo:!0}});if($e)throw $e;return{id:Ue.id,previewUrl:Re==null?void 0:Re.previewUrl,thumbnailUrl:Re==null?void 0:Re.thumbnailUrl}}));F(Ue=>{const Re={...Ue};for(const $e of Me)$e.status==="fulfilled"&&(Re[$e.value.id]={previewUrl:$e.value.previewUrl,thumbnailUrl:$e.value.thumbnailUrl});return Re})})().catch(je=>console.warn("Failed to load signed Bunny asset URLs",je))},[e,$]);const Z=(s==null?void 0:s.total_storage_mb)||0,re=(s==null?void 0:s.max_storage_mb)||1024,he=Z/re*100,ue=he>=80,Ne=he>=100,se=async(ae,je)=>{await navigator.clipboard.writeText(ae),Ge.success(`${je} copied to clipboard`)},xe=ae=>ae.share_token?`https://video.relevelup.com/${ae.share_token}`:ae.playback_url||"",ie=ae=>{const je=xe(ae),Me=i==null?void 0:i.find(nt=>nt.id===ae.contact_id),Ue=q(ae.contact_id),Re=Ue!=="Unassigned"?Ue.split(" ")[0]:"",$e=(Me==null?void 0:Me.phone)||"",Pe=`Hey${Re?` ${Re}`:""}! I recorded a quick video message for you. Check it out: ${je}`,Ae=$e?`sms:${$e}?body=${encodeURIComponent(Pe)}`:`sms:?body=${encodeURIComponent(Pe)}`;window.open(Ae,"_self")},me=ae=>{const je=i==null?void 0:i.find(Ae=>Ae.id===ae.contact_id),Me=(je==null?void 0:je.email)||"",Ue=xe(ae),Re="Check out this video",$e=`I recorded a quick video for you: ${Ue}`,Pe=Me?`mailto:${Me}?subject=${encodeURIComponent(Re)}&body=${encodeURIComponent($e)}`:`mailto:?subject=${encodeURIComponent(Re)}&body=${encodeURIComponent($e)}`;window.open(Pe,"_self")},fe=ae=>{var Re;const je=xe(ae),Me=ae.title||"Video Message",Ue=ae.share_token?`https://video.relevelup.com/thumb/${ae.share_token}`:((Re=$[ae.id])==null?void 0:Re.thumbnailUrl)||ae.thumbnail_url||"";return``},ve=async ae=>{if(!ae.thumbnail_url&&!ae.share_token){Ge.error("Video thumbnail not available yet");return}const je=fe(ae),Me=xe(ae),Ue=`Watch: ${ae.title||"Video Message"} ${Me}`;try{const Re=new Blob([je],{type:"text/html"}),$e=new Blob([Ue],{type:"text/plain"}),Pe=new ClipboardItem({"text/html":Re,"text/plain":$e});await navigator.clipboard.write([Pe]),Ge.success("Copied! Paste into Gmail - the thumbnail will appear after sending.")}catch{await navigator.clipboard.writeText(Ue+` `+je),Ge.success("Copied! Paste into your email.")}},Ie=async ae=>{try{Ge.loading("Preparing download...",{id:"download"});const{data:je,error:Me}=await ee.functions.invoke("bunny-upload",{body:{action:"download-url",videoId:ae.bunny_video_id,isAgentVideo:!0}});if(Me||!(je!=null&&je.downloadUrl))throw new Error((Me==null?void 0:Me.message)||"Failed to get download URL");const Re=`${((ae.title||"video").toString().trim()||"video").replace(/[\\/:*?"<>|]+/g,"-")}.mp4`,$e=await fetch(je.downloadUrl);if(!$e.ok)throw new Error("Failed to fetch video file");const Pe=await $e.blob(),Ae=URL.createObjectURL(Pe),nt=document.createElement("a");nt.href=Ae,nt.download=Re,nt.rel="noreferrer",document.body.appendChild(nt),nt.click(),nt.remove(),URL.revokeObjectURL(Ae),Ge.success("Download started",{id:"download"})}catch(je){console.error("Download error:",je),Ge.error("Could not force download (your browser may block it).",{id:"download"})}},Se=ae=>{m(ae),v(!0)},oe=async()=>{if(f)try{await o.mutateAsync({id:f.id,bunnyVideoId:f.bunny_video_id,hardDelete:!0}),k(!1),m(null),Ge.success("Video deleted successfully")}catch{Ge.error("Failed to delete video")}};return r.jsx(Or,{title:"Video Library",description:"Manage your video touches",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Video Library"}),r.jsx("p",{className:"text-muted-foreground",children:"Manage and share your video touches"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(te,{variant:"outline",onClick:()=>S(!0),children:[r.jsx(Ao,{className:"h-4 w-4 mr-2"}),"Upload Video"]}),r.jsxs(te,{onClick:()=>t("/innercircle/video/record"),children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Record New Video"]})]})]}),r.jsx(Ye,{className:ue?"border-amber-500":Ne?"border-destructive":"",children:r.jsxs(Je,{className:"py-4",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(cT,{className:`h-5 w-5 ${Ne?"text-destructive":ue?"text-amber-500":"text-muted-foreground"}`}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center justify-between mb-1",children:[r.jsx("span",{className:"text-sm font-medium",children:"Storage Used"}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:[Z.toFixed(1)," MB / ",re>=1024?`${(re/1024).toFixed(0)} GB`:`${re} MB`]})]}),r.jsx(zc,{value:Math.min(he,100),className:`h-2 ${Ne?"[&>div]:bg-destructive":ue?"[&>div]:bg-amber-500":""}`})]}),ue&&!Ne&&r.jsxs(Rt,{variant:"outline",className:"border-amber-500 text-amber-600",children:[r.jsx(Bl,{className:"h-3 w-3 mr-1"}),"Near Limit"]}),Ne&&r.jsxs(Rt,{variant:"destructive",children:[r.jsx(Bl,{className:"h-3 w-3 mr-1"}),"At Limit"]})]}),Ne&&r.jsx("p",{className:"text-sm text-destructive mt-2",children:"You've reached your storage limit. Delete videos to record more."})]})}),r.jsxs("div",{className:"relative",children:[r.jsx(Ti,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(yt,{placeholder:"Search videos by contact, title, or notes...",value:c,onChange:ae=>a(ae.target.value),className:"pl-10"})]}),n?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent rounded-full"})}):(K==null?void 0:K.length)===0?r.jsx(Ye,{children:r.jsxs(Je,{className:"py-12 text-center",children:[r.jsx(Gi,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"font-semibold mb-2",children:"No videos yet"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Record your first video touch to get started"}),r.jsxs(te,{onClick:()=>t("/innercircle/video/record"),children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Record Video"]})]})}):r.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-4",children:K==null?void 0:K.map(ae=>{var je,Me;return r.jsx(PVt,{video:ae,previewSrc:(je=$[ae.id])==null?void 0:je.previewUrl,thumbnailSrc:(Me=$[ae.id])==null?void 0:Me.thumbnailUrl,onOpen:()=>Se(ae),onDelete:()=>{m(ae),k(!0)},onNavigateToContact:()=>t(`/innercircle/contacts/${ae.contact_id}`),onGetEmbedCode:()=>{m(ae),I(!0)},onCopyEmailHtml:()=>ve(ae),onShareWithTemplate:()=>{m(ae),D(!0)},getContactName:q,getShareUrl:xe,copyToClipboard:se,formatDuration:W},ae.id)})}),r.jsx($r,{open:y,onOpenChange:v,children:r.jsxs(zr,{className:"max-w-2xl",children:[r.jsxs(Zr,{children:[r.jsx(Kr,{children:(f==null?void 0:f.title)||"Video Preview"}),r.jsx(ls,{children:(f==null?void 0:f.contact_id)&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(jc,{className:"h-3 w-3"}),q(f.contact_id)]})})]}),f&&r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"relative w-full",style:{paddingBottom:"56.25%"},children:f.playback_url?(()=>{let ae=f.playback_url;return ae.includes("iframe.mediadelivery.net/play/")&&(ae=ae.replace("/play/","/embed/"),ae+=(ae.includes("?")?"&":"?")+"autoplay=false&responsive=true"),ae.includes("iframe.mediadelivery.net")?r.jsx("iframe",{src:ae,title:f.title||"Video preview",className:"absolute top-0 left-0 w-full h-full rounded-lg",style:{border:0},allow:"accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0}):r.jsx("video",{src:f.playback_url,controls:!0,playsInline:!0,preload:"metadata",poster:f.thumbnail_url||void 0,className:"absolute top-0 left-0 w-full h-full rounded-lg object-cover",onError:()=>Ge.error("Video preview failed to load")},f.playback_url)})():r.jsxs("div",{className:"absolute inset-0 flex items-center justify-center bg-muted rounded-lg",children:[r.jsx(Gi,{className:"h-12 w-12 text-muted-foreground"}),r.jsx("p",{className:"text-muted-foreground ml-2",children:"Video not available"})]})}),r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsxs(te,{variant:"outline",onClick:()=>ie(f),children:[r.jsx(Wl,{className:"h-4 w-4 mr-2"}),"Text Contact Video"]}),r.jsxs(te,{variant:"outline",onClick:()=>me(f),children:[r.jsx(di,{className:"h-4 w-4 mr-2"}),"Email Contact Video"]}),r.jsxs(te,{variant:"outline",onClick:()=>se(xe(f),"Share link"),children:[r.jsx(Ul,{className:"h-4 w-4 mr-2"}),"Copy Share Link"]}),r.jsxs(te,{variant:"outline",onClick:()=>ve(f),children:[r.jsx(di,{className:"h-4 w-4 mr-2"}),"Copy HTML for Email"]}),r.jsxs(te,{variant:"outline",onClick:()=>Ie(f),children:[r.jsx(Mo,{className:"h-4 w-4 mr-2"}),"Download Video"]}),r.jsxs(te,{variant:"outline",onClick:()=>{v(!1),D(!0)},children:[r.jsx(Gd,{className:"h-4 w-4 mr-2"}),"Send with Page Template"]})]}),r.jsx("div",{className:"flex justify-end pt-2 border-t",children:r.jsxs(te,{variant:"destructive",onClick:()=>{v(!1),k(!0)},children:[r.jsx(Xn,{className:"h-4 w-4 mr-2"}),"Delete Video"]})})]})]})}),r.jsx($r,{open:w,onOpenChange:k,children:r.jsxs(zr,{children:[r.jsxs(Zr,{children:[r.jsx(Kr,{children:"Delete Video"}),r.jsx(ls,{children:"Are you sure you want to delete this video? This action cannot be undone."})]}),r.jsxs(ni,{children:[r.jsx(te,{variant:"outline",onClick:()=>k(!1),children:"Cancel"}),r.jsx(te,{variant:"destructive",onClick:oe,disabled:o.isPending,children:o.isPending?"Deleting...":"Delete"})]})]})}),r.jsx(EVt,{open:C,onOpenChange:S}),r.jsx($r,{open:T,onOpenChange:I,children:r.jsxs(zr,{className:"sm:max-w-lg",children:[r.jsxs(Zr,{children:[r.jsx(Kr,{children:"Embed Video"}),r.jsx(ls,{children:"Copy this code to embed the video on your website."})]}),f&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Embed Code"}),r.jsx(ps,{readOnly:!0,rows:5,value:``,className:"font-mono text-xs"})]}),r.jsx("div",{className:"flex gap-2",children:r.jsxs(te,{className:"flex-1",onClick:()=>{const ae=``;se(ae,"Embed code")},children:[r.jsx(Ul,{className:"h-4 w-4 mr-2"}),"Copy Embed Code"]})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Paste this code into your website's HTML where you want the video to appear. The video will automatically resize to fit its container."})]})]})}),f&&r.jsx(u$e,{open:A,onOpenChange:D,video:f,contactName:q(f.contact_id)})]})})}function h$e({stages:t,currentStageId:e,onStageSelect:n,disabled:s}){const[i,o]=P.useState(!1),c=t.find(f=>f.id===e),a=f=>{f.id!==e&&n(f.id,f.name),o(!1)};return r.jsxs(fm,{open:i,onOpenChange:o,children:[r.jsx(pm,{asChild:!0,children:r.jsxs(te,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5",disabled:s,onClick:f=>f.stopPropagation(),children:[c&&r.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:c.color}}),r.jsx("span",{className:"max-w-[80px] truncate",children:(c==null?void 0:c.name)||"Move"}),r.jsx(Ha,{className:"h-3 w-3 shrink-0"})]})}),r.jsx(Xf,{align:"end",className:"w-48 z-50 bg-popover",onClick:f=>f.stopPropagation(),children:t.map(f=>{const m=f.icon&&oAe[f.icon]||Mu,y=f.id===e;return r.jsxs(uo,{onClick:()=>a(f),className:zt("flex items-center gap-2 cursor-pointer",y&&"bg-accent"),children:[r.jsx("div",{className:"w-5 h-5 rounded flex items-center justify-center shrink-0",style:{backgroundColor:`${f.color}20`},children:r.jsx(m,{className:"h-3 w-3",style:{color:f.color}})}),r.jsx("span",{className:"flex-1",children:f.name}),y&&r.jsx(Ba,{className:"h-4 w-4 text-primary"})]},f.id)})})]})}const OVt={buyer:{label:"Buyer",color:"bg-blue-500/10 text-blue-600 border-blue-200"},seller:{label:"Seller",color:"bg-emerald-500/10 text-emerald-600 border-emerald-200"},dual:{label:"Dual",color:"bg-purple-500/10 text-purple-600 border-purple-200"},referral:{label:"Referral",color:"bg-orange-500/10 text-orange-600 border-orange-200"},lease:{label:"Lease",color:"bg-cyan-500/10 text-cyan-600 border-cyan-200"}},DVt={low:{color:"bg-slate-100 text-slate-600",dot:"bg-slate-400"},medium:{color:"bg-amber-100 text-amber-700",dot:"bg-amber-500"},high:{color:"bg-orange-100 text-orange-700",dot:"bg-orange-500"},urgent:{color:"bg-red-100 text-red-700",dot:"bg-red-500"}};function f$e({deal:t,onClick:e,isDragging:n,stages:s,onStageChange:i,showStagePicker:o=!1}){var k,C;const c=yI(),a=OVt[t.deal_type],f=DVt[t.priority],m=P.useMemo(()=>t.target_close_date?G4(new Date(t.target_close_date),new Date):null,[t.target_close_date]),y=m!==null&&m<0,v=m!==null&&m<=7&&m>=0,w=S=>S?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(S):null;return r.jsx(Ye,{className:zt("cursor-pointer transition-all duration-200 hover:shadow-md hover:border-primary/30 group",n&&"opacity-50 rotate-2 shadow-xl",y&&"border-red-200 bg-red-50/30"),onClick:e,children:r.jsxs(Je,{className:"p-3 space-y-2.5",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsx("div",{className:"flex-1 min-w-0",children:r.jsx("h4",{className:"font-medium text-sm leading-tight line-clamp-2 group-hover:text-primary transition-colors",children:t.deal_name})}),r.jsx(Rt,{variant:"outline",className:zt("text-[10px] px-1.5 py-0 shrink-0",a.color),children:a.label})]}),t.contact&&r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx(Li,{className:"h-5 w-5",children:r.jsxs(Oi,{className:"text-[10px] bg-primary/10 text-primary",children:[(k=t.contact.first_name)==null?void 0:k[0],(C=t.contact.last_name)==null?void 0:C[0]]})}),r.jsxs("span",{className:"truncate",children:[t.contact.first_name," ",t.contact.last_name]})]}),t.listing&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[r.jsx(Rf,{className:"h-3 w-3 text-primary shrink-0"}),r.jsx("span",{className:"text-primary truncate",children:"Linked to Listing Exchange"})]}),!t.listing&&(t.property_address||t.city)&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx(Hi,{className:"h-3 w-3 shrink-0"}),r.jsx("span",{className:"truncate",children:t.property_address||`${t.city}, ${t.state}`})]}),t.expected_price&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[r.jsx(Cd,{className:"h-3 w-3 text-emerald-500 shrink-0"}),r.jsx("span",{className:"font-semibold text-foreground",children:w(t.expected_price)}),t.expected_commission&&r.jsxs("span",{className:"text-muted-foreground",children:["• ",w(t.expected_commission)," GCI"]})]}),r.jsxs("div",{className:"flex items-center justify-between pt-1 border-t border-border/50",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("div",{className:zt("flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px]",f.color),children:[r.jsx("div",{className:zt("w-1.5 h-1.5 rounded-full",f.dot)}),r.jsx("span",{className:"capitalize",children:t.priority})]}),r.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[t.probability,"%"]})]}),o&&c&&s&&i?r.jsx(h$e,{stages:s,currentStageId:t.stage_id||"",onStageSelect:(S,T)=>i(t.id,S,T)}):t.target_close_date?r.jsxs("div",{className:zt("flex items-center gap-1 text-[10px]",y&&"text-red-600",v&&!y&&"text-amber-600",!y&&!v&&"text-muted-foreground"),children:[y?r.jsx(Bl,{className:"h-3 w-3"}):r.jsx(li,{className:"h-3 w-3"}),r.jsx("span",{children:y?`${Math.abs(m)}d overdue`:v?`${m}d left`:un(new Date(t.target_close_date),"MMM d")})]}):null]})]})})}function RVt({stage:t,deals:e,onDealClick:n,onAddDeal:s,onDragStart:i,onDragOver:o,onDrop:c,isDragOver:a}){const f=P.useRef(null),m=e.reduce((k,C)=>k+(C.expected_price||0),0),y=e.reduce((k,C)=>k+(C.expected_commission||0),0),v=k=>k>=1e6?`$${(k/1e6).toFixed(1)}M`:k>=1e3?`$${(k/1e3).toFixed(0)}K`:`$${k.toFixed(0)}`,w=t.icon&&oAe[t.icon]||Mu;return r.jsxs("div",{ref:f,className:zt("flex flex-col h-full min-w-[280px] max-w-[320px] bg-muted/30 rounded-xl border border-border/50 transition-all duration-200",a&&"border-primary/50 bg-primary/5 ring-2 ring-primary/20"),onDragOver:k=>o(k,t.id),onDrop:k=>c(k,t.id),children:[r.jsxs("div",{className:"p-3 border-b border-border/50 shrink-0",style:{borderTopColor:t.color,borderTopWidth:3},children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{backgroundColor:`${t.color}20`},children:r.jsx(w,{className:"h-4 w-4",style:{color:t.color}})}),r.jsx("div",{children:r.jsx("h3",{className:"font-semibold text-sm",children:t.name})})]}),r.jsx(Rt,{variant:"secondary",className:"text-xs font-medium px-2",children:e.length})]}),m>0&&r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("span",{className:"font-medium text-foreground",children:v(m)}),r.jsx("span",{children:"•"}),r.jsxs("span",{children:[v(y)," GCI"]})]})]}),r.jsx(xl,{className:"flex-1 p-2",children:r.jsxs("div",{className:"space-y-2",children:[e.map(k=>r.jsx("div",{draggable:!0,onDragStart:C=>{C.dataTransfer.effectAllowed="move",i(k.id,t.id)},children:r.jsx(f$e,{deal:k,onClick:()=>n(k)})},k.id)),e.length===0&&r.jsxs("div",{className:"py-8 px-4 text-center text-muted-foreground text-sm",children:[r.jsx("p",{className:"mb-2",children:"No deals yet"}),r.jsx("p",{className:"text-xs",children:"Drag deals here or add new"})]})]})}),r.jsx("div",{className:"p-2 border-t border-border/50 shrink-0",children:r.jsxs(te,{variant:"ghost",size:"sm",className:"w-full justify-start text-muted-foreground hover:text-foreground",onClick:()=>s(t.id),children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Add Deal"]})})]})}function FVt({stats:t,isLoading:e}){const n=i=>i>=1e6?`$${(i/1e6).toFixed(1)}M`:i>=1e3?`$${(i/1e3).toFixed(0)}K`:`$${i.toLocaleString()}`,s=[{label:"Active Deals",value:(t==null?void 0:t.activeDeals)||0,icon:Ey,color:"text-blue-500",bgColor:"bg-blue-500/10"},{label:"Pipeline Value",value:n((t==null?void 0:t.pipelineValue)||0),icon:xc,color:"text-purple-500",bgColor:"bg-purple-500/10"},{label:"Expected GCI",value:n((t==null?void 0:t.expectedCommission)||0),icon:Cd,color:"text-emerald-500",bgColor:"bg-emerald-500/10"},{label:"Won Deals",value:(t==null?void 0:t.wonDeals)||0,icon:qa,color:"text-amber-500",bgColor:"bg-amber-500/10"}];return e?r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[1,2,3,4].map(i=>r.jsx(Ye,{className:"animate-pulse",children:r.jsx(Je,{className:"p-4",children:r.jsx("div",{className:"h-10 bg-muted rounded"})})},i))}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:s.map(i=>r.jsx(Ye,{className:"border-border/50 hover:shadow-sm transition-shadow",children:r.jsx(Je,{className:"p-4",children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:zt("p-2 rounded-lg",i.bgColor),children:r.jsx(i.icon,{className:zt("h-5 w-5",i.color)})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-xs text-muted-foreground",children:i.label}),r.jsx("p",{className:"text-xl font-bold",children:i.value})]})]})})},i.label))})}const zVt=[{value:"buyer",label:"Buyer"},{value:"seller",label:"Seller"},{value:"dual",label:"Dual Agency"},{value:"referral",label:"Referral"},{value:"lease",label:"Lease"}],BVt=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"urgent",label:"Urgent"}];function $Vt({open:t,onOpenChange:e,deal:n,defaultStageId:s}){const{data:i}=m0e(),{data:o}=mm(),{data:c}=aye(),a=c$e(),f=d$e(),[m,y]=P.useState(""),[v,w]=P.useState(!1),k=(c==null?void 0:c.filter($=>((n==null?void 0:n.listing_id)===$.id,!0)))||[],[C,S]=P.useState({deal_name:"",deal_type:"buyer",stage_id:"",contact_id:"",listing_id:"",property_address:"",city:"",state:"",zip_code:"",expected_price:"",commission_percentage:"3",target_close_date:void 0,contract_date:void 0,priority:"medium",probability:"50",notes:""});P.useEffect(()=>{var $,F,q;t&&(n?(S({deal_name:n.deal_name,deal_type:n.deal_type,stage_id:n.stage_id||"",contact_id:n.contact_id||"",listing_id:n.listing_id||"",property_address:n.property_address||"",city:n.city||"",state:n.state||"",zip_code:n.zip_code||"",expected_price:(($=n.expected_price)==null?void 0:$.toString())||"",commission_percentage:((F=n.commission_percentage)==null?void 0:F.toString())||"3",target_close_date:n.target_close_date?new Date(n.target_close_date):void 0,contract_date:n.contract_date?new Date(n.contract_date):void 0,priority:n.priority,probability:n.probability.toString(),notes:n.notes||""}),n.contact&&y(`${n.contact.first_name} ${n.contact.last_name}`)):(S({deal_name:"",deal_type:"buyer",stage_id:s||((q=i==null?void 0:i[0])==null?void 0:q.id)||"",contact_id:"",listing_id:"",property_address:"",city:"",state:"",zip_code:"",expected_price:"",commission_percentage:"3",target_close_date:void 0,contract_date:void 0,priority:"medium",probability:"50",notes:""}),y("")))},[t,n,s,i]);const T=o==null?void 0:o.filter($=>{var q,W,K;const F=m.toLowerCase();return((q=$.first_name)==null?void 0:q.toLowerCase().includes(F))||((W=$.last_name)==null?void 0:W.toLowerCase().includes(F))||((K=$.email)==null?void 0:K.toLowerCase().includes(F))}).slice(0,5),I=()=>{const $=parseFloat(C.expected_price)||0,F=parseFloat(C.commission_percentage)||0;return $*(F/100)},A=async $=>{var F,q;if($.preventDefault(),!C.deal_name.trim()){Ge.error("Please enter a deal name");return}try{const W={deal_name:C.deal_name,deal_type:C.deal_type,stage_id:C.stage_id||null,contact_id:C.contact_id||null,listing_id:C.listing_id||null,property_address:C.property_address||null,city:C.city||null,state:C.state||null,zip_code:C.zip_code||null,expected_price:C.expected_price?parseFloat(C.expected_price):null,expected_commission:I()||null,commission_percentage:C.commission_percentage?parseFloat(C.commission_percentage):3,target_close_date:((F=C.target_close_date)==null?void 0:F.toISOString().split("T")[0])||null,contract_date:((q=C.contract_date)==null?void 0:q.toISOString().split("T")[0])||null,priority:C.priority,probability:parseInt(C.probability)||50,notes:C.notes||null};n?(await f.mutateAsync({id:n.id,...W}),Ge.success("Deal updated successfully")):(await a.mutateAsync(W),Ge.success("Deal created successfully")),e(!1)}catch{Ge.error("Failed to save deal")}},D=a.isPending||f.isPending;return r.jsx($r,{open:t,onOpenChange:e,children:r.jsxs(zr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(Zr,{children:[r.jsx(Kr,{children:n?"Edit Deal":"Add New Deal"}),r.jsx(ls,{children:n?"Update the deal details below.":"Enter the details for your new deal."})]}),r.jsxs("form",{onSubmit:A,className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"col-span-2 space-y-2",children:[r.jsx(Qe,{htmlFor:"deal_name",children:"Deal Name *"}),r.jsx(yt,{id:"deal_name",value:C.deal_name,onChange:$=>S(F=>({...F,deal_name:$.target.value})),placeholder:"e.g., Smith Family - 123 Main St"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Deal Type"}),r.jsxs(_n,{value:C.deal_type,onValueChange:$=>S(F=>({...F,deal_type:$})),children:[r.jsx(xn,{children:r.jsx(bn,{})}),r.jsx(vn,{children:zVt.map($=>r.jsx(er,{value:$.value,children:$.label},$.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Stage"}),r.jsxs(_n,{value:C.stage_id,onValueChange:$=>S(F=>({...F,stage_id:$})),children:[r.jsx(xn,{children:r.jsx(bn,{placeholder:"Select stage"})}),r.jsx(vn,{children:i==null?void 0:i.map($=>r.jsx(er,{value:$.id,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:$.color}}),$.name]})},$.id))})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Link to Contact"}),r.jsxs("div",{className:"relative",children:[r.jsx(Ti,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(yt,{value:m,onChange:$=>{y($.target.value),w(!0),$.target.value||S(F=>({...F,contact_id:""}))},onFocus:()=>w(!0),placeholder:"Search contacts...",className:"pl-9"}),v&&m&&T&&T.length>0&&r.jsx("div",{className:"absolute z-10 w-full mt-1 bg-background border rounded-lg shadow-lg max-h-48 overflow-y-auto",children:T.map($=>r.jsxs("button",{type:"button",className:"w-full px-3 py-2 text-left hover:bg-muted flex items-center gap-2",onClick:()=>{S(F=>({...F,contact_id:$.id})),y(`${$.first_name} ${$.last_name}`),w(!1)},children:[r.jsx(jc,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:[$.first_name," ",$.last_name]}),$.email&&r.jsx("span",{className:"text-xs text-muted-foreground ml-auto",children:$.email})]},$.id))})]})]}),k.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Qe,{className:"flex items-center gap-2",children:[r.jsx(Rf,{className:"h-4 w-4"}),"Link to Listing Exchange"]}),r.jsxs(_n,{value:C.listing_id,onValueChange:$=>{const F=k.find(q=>q.id===$);S(F?q=>{var W;return{...q,listing_id:$,deal_type:"seller",property_address:F.property_address||q.property_address,city:F.city||q.city,state:F.state||q.state,expected_price:((W=F.price)==null?void 0:W.toString())||q.expected_price}}:q=>({...q,listing_id:$}))},children:[r.jsx(xn,{children:r.jsx(bn,{placeholder:"Select a listing to sync status..."})}),r.jsxs(vn,{children:[r.jsx(er,{value:"",children:"None"}),k.map($=>r.jsx(er,{value:$.id,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{children:$.property_address||`${$.city}, ${$.state}`}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["$",($.price/1e3).toFixed(0),"K"]})]})},$.id))]})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Status changes will sync automatically between the deal and listing."})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h4",{className:"font-medium text-sm",children:"Property Details"}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"col-span-2 space-y-2",children:[r.jsx(Qe,{htmlFor:"property_address",children:"Address"}),r.jsx(yt,{id:"property_address",value:C.property_address,onChange:$=>S(F=>({...F,property_address:$.target.value})),placeholder:"123 Main Street"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"city",children:"City"}),r.jsx(yt,{id:"city",value:C.city,onChange:$=>S(F=>({...F,city:$.target.value}))})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"state",children:"State"}),r.jsx(yt,{id:"state",value:C.state,onChange:$=>S(F=>({...F,state:$.target.value})),maxLength:2,placeholder:"TX"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"zip_code",children:"ZIP"}),r.jsx(yt,{id:"zip_code",value:C.zip_code,onChange:$=>S(F=>({...F,zip_code:$.target.value}))})]})]})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h4",{className:"font-medium text-sm",children:"Financial Details"}),r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"expected_price",children:"Expected Price"}),r.jsxs("div",{className:"relative",children:[r.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"$"}),r.jsx(yt,{id:"expected_price",type:"number",value:C.expected_price,onChange:$=>S(F=>({...F,expected_price:$.target.value})),className:"pl-7",placeholder:"500000"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"commission_percentage",children:"Commission %"}),r.jsxs("div",{className:"relative",children:[r.jsx(yt,{id:"commission_percentage",type:"number",step:"0.1",value:C.commission_percentage,onChange:$=>S(F=>({...F,commission_percentage:$.target.value})),className:"pr-7"}),r.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"%"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Expected GCI"}),r.jsx(yt,{value:I()?`$${I().toLocaleString()}`:"-",disabled:!0,className:"bg-muted"})]})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h4",{className:"font-medium text-sm",children:"Dates & Status"}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Target Close Date"}),r.jsxs(Zh,{children:[r.jsx(Yh,{asChild:!0,children:r.jsxs(te,{variant:"outline",className:zt("w-full justify-start text-left font-normal",!C.target_close_date&&"text-muted-foreground"),children:[r.jsx(li,{className:"mr-2 h-4 w-4"}),C.target_close_date?un(C.target_close_date,"PPP"):"Pick a date"]})}),r.jsx(mh,{className:"w-auto p-0",align:"start",children:r.jsx(wj,{mode:"single",selected:C.target_close_date,onSelect:$=>S(F=>({...F,target_close_date:$})),initialFocus:!0,className:"pointer-events-auto"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Contract Date"}),r.jsxs(Zh,{children:[r.jsx(Yh,{asChild:!0,children:r.jsxs(te,{variant:"outline",className:zt("w-full justify-start text-left font-normal",!C.contract_date&&"text-muted-foreground"),children:[r.jsx(li,{className:"mr-2 h-4 w-4"}),C.contract_date?un(C.contract_date,"PPP"):"Pick a date"]})}),r.jsx(mh,{className:"w-auto p-0",align:"start",children:r.jsx(wj,{mode:"single",selected:C.contract_date,onSelect:$=>S(F=>({...F,contract_date:$})),initialFocus:!0,className:"pointer-events-auto"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Priority"}),r.jsxs(_n,{value:C.priority,onValueChange:$=>S(F=>({...F,priority:$})),children:[r.jsx(xn,{children:r.jsx(bn,{})}),r.jsx(vn,{children:BVt.map($=>r.jsx(er,{value:$.value,children:$.label},$.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Win Probability"}),r.jsxs("div",{className:"relative",children:[r.jsx(yt,{type:"number",min:"0",max:"100",value:C.probability,onChange:$=>S(F=>({...F,probability:$.target.value})),className:"pr-7"}),r.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"%"})]})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"notes",children:"Notes"}),r.jsx(ps,{id:"notes",value:C.notes,onChange:$=>S(F=>({...F,notes:$.target.value})),placeholder:"Add any additional notes about this deal...",rows:3})]}),r.jsxs("div",{className:"flex justify-end gap-3 pt-4 border-t",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsxs(te,{type:"submit",disabled:D,children:[D&&r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),n?"Update Deal":"Create Deal"]})]})]})]})})}const UVt={buyer:{label:"Buyer",color:"bg-blue-500/10 text-blue-600 border-blue-200"},seller:{label:"Seller",color:"bg-emerald-500/10 text-emerald-600 border-emerald-200"},dual:{label:"Dual",color:"bg-purple-500/10 text-purple-600 border-purple-200"},referral:{label:"Referral",color:"bg-orange-500/10 text-orange-600 border-orange-200"},lease:{label:"Lease",color:"bg-cyan-500/10 text-cyan-600 border-cyan-200"}},qVt={note:Wl,call:Wa,email:di,meeting:li,stage_change:Fs,task_completed:io,document:Hi,system:Xi};function VVt({deal:t,open:e,onOpenChange:n,onEdit:s,onAddToScorecard:i,isWonStage:o}){var ue,Ne;const{data:c,isLoading:a}=dVt((t==null?void 0:t.id)||""),{data:f,isLoading:m}=hVt((t==null?void 0:t.id)||""),y=uVt(),v=pVt(),w=fVt(),k=cVt(),[C,S]=P.useState(""),[T,I]=P.useState(""),[A,D]=P.useState(!1);if(!t)return null;const $=UVt[t.deal_type],F=se=>se?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(se):"-",q=async()=>{if(C.trim())try{await y.mutateAsync({deal_id:t.id,activity_type:"note",title:"Note added",description:C}),S(""),Ge.success("Note added")}catch{Ge.error("Failed to add note")}},W=async()=>{if(T.trim())try{await v.mutateAsync({deal_id:t.id,title:T,sort_order:((f==null?void 0:f.length)||0)+1}),I(""),Ge.success("Task added")}catch{Ge.error("Failed to add task")}},K=async(se,xe)=>{try{await w.mutateAsync({id:se,is_completed:xe,deal_id:t.id})}catch{Ge.error("Failed to update task")}},Z=async()=>{try{await k.mutateAsync(t.id),Ge.success("Deal deleted"),n(!1)}catch{Ge.error("Failed to delete deal")}},re=(f==null?void 0:f.filter(se=>se.is_completed).length)||0,he=(f==null?void 0:f.length)||0;return r.jsxs(r.Fragment,{children:[r.jsx(qne,{open:e,onOpenChange:n,children:r.jsxs(tI,{className:"w-full sm:max-w-xl p-0 flex flex-col",children:[r.jsx(Vne,{className:"p-6 pb-4 border-b shrink-0",children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(Rt,{variant:"outline",className:zt("text-xs",$.color),children:$.label}),r.jsxs(Rt,{variant:"secondary",className:"text-xs capitalize",children:[t.priority," priority"]})]}),r.jsx(Hne,{className:"text-xl",children:t.deal_name})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(te,{variant:"outline",size:"icon",onClick:()=>s(t),children:r.jsx(Jl,{className:"h-4 w-4"})}),r.jsx(te,{variant:"outline",size:"icon",className:"text-destructive hover:bg-destructive/10",onClick:()=>D(!0),children:r.jsx(Xn,{className:"h-4 w-4"})})]})]})}),r.jsx(xl,{className:"flex-1",children:r.jsxs("div",{className:"p-6 space-y-6",children:[t.contact&&r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/50 rounded-lg",children:[r.jsx(Li,{className:"h-10 w-10",children:r.jsxs(Oi,{className:"bg-primary/10 text-primary",children:[(ue=t.contact.first_name)==null?void 0:ue[0],(Ne=t.contact.last_name)==null?void 0:Ne[0]]})}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("p",{className:"font-medium",children:[t.contact.first_name," ",t.contact.last_name]}),t.contact.email&&r.jsx("p",{className:"text-sm text-muted-foreground",children:t.contact.email})]}),r.jsxs("div",{className:"flex gap-2",children:[t.contact.phone&&r.jsx(te,{variant:"outline",size:"icon",asChild:!0,children:r.jsx("a",{href:`tel:${t.contact.phone}`,children:r.jsx(Wa,{className:"h-4 w-4"})})}),t.contact.email&&r.jsx(te,{variant:"outline",size:"icon",asChild:!0,children:r.jsx("a",{href:`mailto:${t.contact.email}`,children:r.jsx(di,{className:"h-4 w-4"})})})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[(t.property_address||t.city)&&r.jsxs("div",{className:"col-span-2 flex items-start gap-2 text-sm",children:[r.jsx(Hi,{className:"h-4 w-4 text-muted-foreground mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:t.property_address||"Address TBD"}),r.jsx("p",{className:"text-muted-foreground",children:[t.city,t.state,t.zip_code].filter(Boolean).join(", ")})]})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3",children:[r.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Expected Price"}),r.jsx("p",{className:"text-lg font-bold",children:F(t.expected_price)})]}),r.jsxs("div",{className:"bg-emerald-500/10 rounded-lg p-3",children:[r.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Expected GCI"}),r.jsx("p",{className:"text-lg font-bold text-emerald-600",children:F(t.expected_commission)})]}),o&&!t.scorecard_transaction_id&&i&&r.jsxs(te,{onClick:()=>i(t),className:"w-full bg-green-600 hover:bg-green-700",children:[r.jsx(qa,{className:"h-4 w-4 mr-2"}),"Add to Scorecard"]}),t.scorecard_transaction_id&&r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground bg-muted/50 rounded-lg p-3",children:[r.jsx(io,{className:"h-4 w-4 text-green-600"}),r.jsx("span",{children:"Synced to Scorecard"})]}),t.target_close_date&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(li,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Close: ",un(new Date(t.target_close_date),"MMM d, yyyy")]})]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Cd,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:[t.probability,"% probability"]})]})]}),t.notes&&r.jsxs("div",{className:"text-sm",children:[r.jsx("p",{className:"font-medium mb-1",children:"Notes"}),r.jsx("p",{className:"text-muted-foreground",children:t.notes})]}),r.jsxs(La,{defaultValue:"tasks",className:"w-full",children:[r.jsxs(Ma,{className:"w-full grid grid-cols-2",children:[r.jsxs(yn,{value:"tasks",className:"gap-1",children:[r.jsx(io,{className:"h-4 w-4"}),"Tasks ",he>0&&`(${re}/${he})`]}),r.jsxs(yn,{value:"activity",className:"gap-1",children:[r.jsx(Xi,{className:"h-4 w-4"}),"Activity"]})]}),r.jsxs($n,{value:"tasks",className:"mt-4 space-y-3",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsx(yt,{placeholder:"Add a new task...",value:T,onChange:se=>I(se.target.value),onKeyDown:se=>se.key==="Enter"&&W()}),r.jsx(te,{onClick:W,disabled:!T.trim(),children:r.jsx(Sn,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"space-y-2",children:[f==null?void 0:f.map(se=>r.jsxs("div",{className:zt("flex items-center gap-3 p-3 rounded-lg border transition-colors",se.is_completed?"bg-muted/50 border-border":"bg-background"),children:[r.jsx(_c,{checked:se.is_completed,onCheckedChange:xe=>K(se.id,!!xe)}),r.jsx("span",{className:zt("flex-1 text-sm",se.is_completed&&"line-through text-muted-foreground"),children:se.title}),se.due_date&&r.jsx("span",{className:"text-xs text-muted-foreground",children:un(new Date(se.due_date),"MMM d")})]},se.id)),(f==null?void 0:f.length)===0&&r.jsx("p",{className:"text-center text-muted-foreground text-sm py-4",children:"No tasks yet. Add one above!"})]})]}),r.jsxs($n,{value:"activity",className:"mt-4 space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ps,{placeholder:"Add a note...",value:C,onChange:se=>S(se.target.value),rows:2}),r.jsxs(te,{onClick:q,disabled:!C.trim(),size:"sm",className:"w-full",children:[r.jsx(To,{className:"h-4 w-4 mr-2"}),"Add Note"]})]}),r.jsxs("div",{className:"space-y-3",children:[c==null?void 0:c.map(se=>{const xe=qVt[se.activity_type]||Xi;return r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-full bg-muted flex items-center justify-center shrink-0",children:r.jsx(xe,{className:"h-4 w-4 text-muted-foreground"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium",children:se.title}),se.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:se.description}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:Yd(new Date(se.created_at),{addSuffix:!0})})]})]},se.id)}),(c==null?void 0:c.length)===0&&r.jsx("p",{className:"text-center text-muted-foreground text-sm py-4",children:"No activity yet"})]})]})]})]})})]})}),r.jsx(ih,{open:A,onOpenChange:D,children:r.jsxs(yu,{children:[r.jsxs(xu,{children:[r.jsx(_u,{children:"Delete Deal?"}),r.jsxs(bu,{children:['This will permanently delete "',t.deal_name,'" and all associated data. This action cannot be undone.']})]}),r.jsxs(vu,{children:[r.jsx(wu,{children:"Cancel"}),r.jsx(Hd,{onClick:Z,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}function HVt({open:t,onOpenChange:e,deal:n,onComplete:s}){const i=fse(),o=d$e(),{data:c}=hse(),{data:a}=Ag(),[f,m]=P.useState({property_address:"",city:"",state:"",zip:"",transaction_type:"buyer",close_date:un(new Date,"yyyy-MM-dd"),sale_price:0,commission_amount:0,lead_source_id:"",client_type_id:"",notes:""});P.useEffect(()=>{if(n&&t){const w=n.deal_type==="seller"?"seller":"buyer",k=n.expected_price||0,C=n.commission_percentage||3,S=n.expected_commission||k*C/100;m({property_address:n.property_address||n.deal_name||"",city:n.city||"",state:n.state||"",zip:n.zip_code||"",transaction_type:w,close_date:n.actual_close_date||n.target_close_date||un(new Date,"yyyy-MM-dd"),sale_price:k,commission_amount:S,lead_source_id:"",client_type_id:"",notes:n.notes||""})}},[n,t]);const y=async w=>{if(w.preventDefault(),!!n)try{const k=await i.mutateAsync({property_address:f.property_address,city:f.city||null,state:f.state||null,zip:f.zip||null,transaction_type:f.transaction_type,close_date:f.close_date,sale_price:f.sale_price,commission_amount:f.commission_amount||null,lead_source_id:f.lead_source_id||null,client_type_id:f.client_type_id||null,contact_id:n.contact_id||null,notes:f.notes||null,is_win:!0});await o.mutateAsync({id:n.id,scorecard_transaction_id:k.id,actual_close_date:f.close_date}),Ge.success("Deal added to Scorecard! 🎉"),e(!1),s==null||s()}catch(k){console.error("Error syncing to scorecard:",k),Ge.error("Failed to add to scorecard")}},v=w=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(w);return r.jsx($r,{open:t,onOpenChange:e,children:r.jsxs(zr,{className:"sm:max-w-[550px] max-h-[90vh] overflow-y-auto",children:[r.jsxs(Zr,{className:"space-y-3",children:[r.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-green-100 dark:bg-green-900/20",children:r.jsx(qa,{className:"h-6 w-6 text-green-600 dark:text-green-400"})}),r.jsx(Kr,{className:"text-center text-xl",children:"Congratulations on Closing! 🎉"}),r.jsx(ls,{className:"text-center",children:"Review and confirm the details before adding this deal to your Scorecard."})]}),r.jsxs("form",{onSubmit:y,className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Qe,{htmlFor:"property_address",className:"flex items-center gap-2",children:[r.jsx(Hi,{className:"h-4 w-4 text-muted-foreground"}),"Property Address *"]}),r.jsx(yt,{id:"property_address",value:f.property_address,onChange:w=>m(k=>({...k,property_address:w.target.value})),placeholder:"123 Main St",required:!0})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"city",children:"City"}),r.jsx(yt,{id:"city",value:f.city,onChange:w=>m(k=>({...k,city:w.target.value})),placeholder:"City"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"state",children:"State"}),r.jsx(yt,{id:"state",value:f.state,onChange:w=>m(k=>({...k,state:w.target.value})),placeholder:"TX",maxLength:2})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"zip",children:"Zip"}),r.jsx(yt,{id:"zip",value:f.zip,onChange:w=>m(k=>({...k,zip:w.target.value})),placeholder:"75001"})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Transaction Type *"}),r.jsxs(_n,{value:f.transaction_type,onValueChange:w=>m(k=>({...k,transaction_type:w})),children:[r.jsx(xn,{children:r.jsx(bn,{})}),r.jsxs(vn,{children:[r.jsx(er,{value:"buyer",children:"Buyer"}),r.jsx(er,{value:"seller",children:"Seller"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Qe,{htmlFor:"close_date",className:"flex items-center gap-2",children:[r.jsx(li,{className:"h-4 w-4 text-muted-foreground"}),"Close Date *"]}),r.jsx(yt,{id:"close_date",type:"date",value:f.close_date,onChange:w=>m(k=>({...k,close_date:w.target.value})),required:!0})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Qe,{htmlFor:"sale_price",className:"flex items-center gap-2",children:[r.jsx(Cd,{className:"h-4 w-4 text-muted-foreground"}),"Sale Price *"]}),r.jsx(yt,{id:"sale_price",type:"number",value:f.sale_price||"",onChange:w=>m(k=>({...k,sale_price:Number(w.target.value)})),placeholder:"450000",required:!0,min:0}),f.sale_price>0&&r.jsx("p",{className:"text-xs text-muted-foreground",children:v(f.sale_price)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Qe,{htmlFor:"commission_amount",className:"flex items-center gap-2",children:[r.jsx(ZS,{className:"h-4 w-4 text-muted-foreground"}),"GCI (Commission)"]}),r.jsx(yt,{id:"commission_amount",type:"number",value:f.commission_amount||"",onChange:w=>m(k=>({...k,commission_amount:Number(w.target.value)})),placeholder:"13500",min:0}),f.commission_amount>0&&r.jsx("p",{className:"text-xs text-muted-foreground",children:v(f.commission_amount)})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Lead Source"}),r.jsxs(_n,{value:f.lead_source_id,onValueChange:w=>m(k=>({...k,lead_source_id:w})),children:[r.jsx(xn,{children:r.jsx(bn,{placeholder:"Select source"})}),r.jsx(vn,{children:c==null?void 0:c.map(w=>r.jsx(er,{value:w.id,children:w.name},w.id))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Client Type"}),r.jsxs(_n,{value:f.client_type_id,onValueChange:w=>m(k=>({...k,client_type_id:w})),children:[r.jsx(xn,{children:r.jsx(bn,{placeholder:"Select type"})}),r.jsx(vn,{children:a==null?void 0:a.map(w=>r.jsx(er,{value:w.id,children:w.name},w.id))})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"notes",children:"Notes"}),r.jsx(ps,{id:"notes",value:f.notes,onChange:w=>m(k=>({...k,notes:w.target.value})),placeholder:"Any additional notes about this transaction...",rows:2})]}),r.jsxs(ni,{className:"gap-2 sm:gap-0 pt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>e(!1),children:"Skip for now"}),r.jsx(te,{type:"submit",disabled:i.isPending||o.isPending,className:"bg-green-600 hover:bg-green-700",children:i.isPending?"Adding...":r.jsxs(r.Fragment,{children:["Add to Scorecard",r.jsx(Ho,{className:"ml-2 h-4 w-4"})]})})]})]})]})})}const WVt={buyer:{label:"Buyer",color:"bg-blue-500/10 text-blue-600 border-blue-200"},seller:{label:"Seller",color:"bg-emerald-500/10 text-emerald-600 border-emerald-200"},dual:{label:"Dual",color:"bg-purple-500/10 text-purple-600 border-purple-200"},referral:{label:"Referral",color:"bg-orange-500/10 text-orange-600 border-orange-200"},lease:{label:"Lease",color:"bg-cyan-500/10 text-cyan-600 border-cyan-200"}},Y3e={urgent:0,high:1,medium:2,low:3};function GVt({deals:t,stages:e,onDealClick:n,onStageChange:s}){const[i,o]=P.useState("target_close_date"),[c,a]=P.useState("asc"),f=k=>{i===k?a(C=>C==="asc"?"desc":"asc"):(o(k),a("asc"))},m=P.useMemo(()=>[...t].sort((k,C)=>{var T,I;let S=0;switch(i){case"deal_name":S=k.deal_name.localeCompare(C.deal_name);break;case"stage":{const A=((T=e.find($=>$.id===k.stage_id))==null?void 0:T.sort_order)||0,D=((I=e.find($=>$.id===C.stage_id))==null?void 0:I.sort_order)||0;S=A-D;break}case"expected_price":S=(k.expected_price||0)-(C.expected_price||0);break;case"expected_commission":S=(k.expected_commission||0)-(C.expected_commission||0);break;case"target_close_date":{const A=k.target_close_date?new Date(k.target_close_date).getTime():1/0,D=C.target_close_date?new Date(C.target_close_date).getTime():1/0;S=A-D;break}case"priority":S=Y3e[k.priority]-Y3e[C.priority];break}return c==="asc"?S:-S}),[t,e,i,c]),y=k=>k?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(k):"—",v=k=>k?e.find(C=>C.id===k):null,w=({field:k,children:C})=>r.jsxs(te,{variant:"ghost",size:"sm",className:"h-8 -ml-3 font-medium",onClick:()=>f(k),children:[C,i===k?c==="asc"?r.jsx($0,{className:"ml-2 h-4 w-4"}):r.jsx(ES,{className:"ml-2 h-4 w-4"}):r.jsx(B0,{className:"ml-2 h-4 w-4 opacity-50"})]});return t.length===0?r.jsx("div",{className:"text-center py-16",children:r.jsx("p",{className:"text-muted-foreground",children:"No deals to display"})}):r.jsx("div",{className:"border rounded-lg overflow-hidden",children:r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{className:"bg-muted/50",children:[r.jsx(At,{className:"w-[250px]",children:r.jsx(w,{field:"deal_name",children:"Deal Name"})}),r.jsx(At,{className:"w-[150px]",children:r.jsx(w,{field:"stage",children:"Stage"})}),r.jsx(At,{className:"w-[100px]",children:"Type"}),r.jsx(At,{className:"w-[120px]",children:r.jsx(w,{field:"expected_price",children:"Price"})}),r.jsx(At,{className:"w-[120px]",children:r.jsx(w,{field:"expected_commission",children:"GCI"})}),r.jsx(At,{className:"w-[130px]",children:r.jsx(w,{field:"target_close_date",children:"Close Date"})}),r.jsx(At,{className:"w-[100px]",children:r.jsx(w,{field:"priority",children:"Priority"})})]})}),r.jsx(qs,{children:m.map(k=>{v(k.stage_id);const C=WVt[k.deal_type],S=k.target_close_date?G4(new Date(k.target_close_date),new Date):null,T=S!==null&&S<0,I=S!==null&&S<=7&&S>=0;return r.jsxs(Er,{className:zt("cursor-pointer hover:bg-muted/50 transition-colors",T&&"bg-red-50/50"),onClick:()=>n(k),children:[r.jsx(_t,{className:"font-medium",children:r.jsxs("div",{children:[r.jsx("p",{className:"truncate max-w-[230px]",children:k.deal_name}),k.contact&&r.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[k.contact.first_name," ",k.contact.last_name]})]})}),r.jsx(_t,{onClick:A=>A.stopPropagation(),children:r.jsx(h$e,{stages:e,currentStageId:k.stage_id||"",onStageSelect:(A,D)=>s(k.id,A,D)})}),r.jsx(_t,{children:r.jsx(Rt,{variant:"outline",className:zt("text-xs",C.color),children:C.label})}),r.jsx(_t,{children:r.jsx("span",{className:"font-medium",children:y(k.expected_price)})}),r.jsx(_t,{children:r.jsx("span",{className:"text-emerald-600",children:y(k.expected_commission)})}),r.jsx(_t,{children:k.target_close_date?r.jsxs("div",{className:zt("flex items-center gap-1 text-sm",T&&"text-red-600",I&&!T&&"text-amber-600"),children:[T&&r.jsx(Bl,{className:"h-3.5 w-3.5"}),r.jsx("span",{children:un(new Date(k.target_close_date),"MMM d, yyyy")})]}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(_t,{children:r.jsx(Rt,{variant:"outline",className:zt("text-xs capitalize",k.priority==="urgent"&&"border-red-200 bg-red-50 text-red-700",k.priority==="high"&&"border-orange-200 bg-orange-50 text-orange-700",k.priority==="medium"&&"border-amber-200 bg-amber-50 text-amber-700",k.priority==="low"&&"border-slate-200 bg-slate-50 text-slate-600"),children:k.priority})})]},k.id)})})]})})}function KVt(){var oe;const t=yI(),{data:e,isLoading:n}=m0e(),{data:s,isLoading:i,refetch:o}=l$e(),{data:c,isLoading:a}=mVt(),f=o$e(),m=lVt(),[y,v]=P.useState("board"),[w,k]=P.useState(!1),[C,S]=P.useState(!1),[T,I]=P.useState(null),[A,D]=P.useState(null),[$,F]=P.useState(null),[q,W]=P.useState(null),[K,Z]=P.useState(!1),[re,he]=P.useState(null);P.useEffect(()=>{!n&&e&&e.length===0&&f.mutate()},[n,e]);const ue=ae=>{I(ae),S(!0)},Ne=ae=>{D(ae||null),I(null),k(!0)},se=ae=>{I(ae),S(!1),k(!0)},xe=(ae,je)=>{F(ae)},ie=(ae,je)=>{ae.preventDefault(),ae.dataTransfer.dropEffect="move",W(je)},me=async(ae,je)=>{if(ae.preventDefault(),W(null),!$)return;const Me=s==null?void 0:s.find(Re=>Re.id===$),Ue=e==null?void 0:e.find(Re=>Re.id===je);if(!Me||!Ue||Me.stage_id===je){F(null);return}try{if(await m.mutateAsync({dealId:$,stageId:je,stageName:Ue.name}),Ge.success(`Moved to ${Ue.name}`),Ue.is_won_stage&&!Me.scorecard_transaction_id){const Re={...Me,stage_id:je};he(Re),Z(!0)}}catch{Ge.error("Failed to move deal")}F(null)},fe=P.useCallback(async(ae,je,Me)=>{const Ue=s==null?void 0:s.find($e=>$e.id===ae),Re=e==null?void 0:e.find($e=>$e.id===je);if(!(!Ue||!Re||Ue.stage_id===je))try{if(await m.mutateAsync({dealId:ae,stageId:je,stageName:Me}),Ge.success(`Moved to ${Me}`),Re.is_won_stage&&!Ue.scorecard_transaction_id){const $e={...Ue,stage_id:je};he($e),Z(!0)}}catch{Ge.error("Failed to move deal")}},[s,e,m]),ve=ae=>(s==null?void 0:s.filter(je=>je.stage_id===ae))||[],Ie=n||i,Se=t?"list":y;return r.jsxs(Or,{children:[r.jsxs("div",{className:"flex flex-col h-[calc(100vh-4rem)]",children:[r.jsxs("div",{className:"shrink-0 p-4 md:p-6 pb-0 space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Deal Pipeline"}),r.jsx("p",{className:"text-muted-foreground text-sm",children:"Track and manage your active deals"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(te,{variant:"outline",size:"icon",onClick:()=>o(),className:"shrink-0",children:r.jsx(Dl,{className:"h-4 w-4"})}),!t&&r.jsx(KE,{children:r.jsxs("div",{className:"flex bg-muted rounded-lg p-1 gap-0.5",children:[r.jsxs(fg,{children:[r.jsx(pg,{asChild:!0,children:r.jsxs(te,{variant:y==="board"?"secondary":"ghost",size:"sm",onClick:()=>v("board"),className:"px-3 gap-1.5",children:[r.jsx(lg,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline text-xs",children:"Board"})]})}),r.jsx(am,{children:"Kanban board view"})]}),r.jsxs(fg,{children:[r.jsx(pg,{asChild:!0,children:r.jsxs(te,{variant:y==="list"?"secondary":"ghost",size:"sm",onClick:()=>v("list"),className:"px-3 gap-1.5",children:[r.jsx(rm,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline text-xs",children:"List"})]})}),r.jsx(am,{children:"Grouped list view"})]}),r.jsxs(fg,{children:[r.jsx(pg,{asChild:!0,children:r.jsxs(te,{variant:y==="table"?"secondary":"ghost",size:"sm",onClick:()=>v("table"),className:"px-3 gap-1.5",children:[r.jsx(NT,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline text-xs",children:"Table"})]})}),r.jsx(am,{children:"Sortable table view"})]})]})}),r.jsxs(te,{onClick:()=>Ne(),children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Add Deal"]})]})]}),r.jsx(FVt,{stats:c||null,isLoading:a})]}),r.jsx("div",{className:"flex-1 min-h-0 p-4 md:p-6 pt-4",children:Ie?r.jsx("div",{className:"flex gap-4 h-full",children:[1,2,3,4].map(ae=>r.jsx("div",{className:"min-w-[280px] max-w-[320px] flex-shrink-0",children:r.jsx(Gr,{className:"h-full rounded-xl"})},ae))}):Se==="board"?r.jsxs(xl,{className:"h-full -mx-4 md:-mx-6 px-4 md:px-6",children:[r.jsx("div",{className:"flex gap-4 h-full pb-4",children:e==null?void 0:e.map(ae=>r.jsx(RVt,{stage:ae,deals:ve(ae.id),onDealClick:ue,onAddDeal:Ne,onDragStart:xe,onDragOver:ie,onDrop:me,isDragOver:q===ae.id},ae.id))}),r.jsx(wge,{orientation:"horizontal"})]}):Se==="table"?r.jsx(xl,{className:"h-full",children:r.jsx(GVt,{deals:s||[],stages:e||[],onDealClick:ue,onStageChange:fe})}):r.jsx(xl,{className:"h-full",children:r.jsxs("div",{className:"space-y-6",children:[e==null?void 0:e.map(ae=>{const je=ve(ae.id);return je.length===0?null:r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:ae.color}}),r.jsx("h3",{className:"font-semibold",children:ae.name}),r.jsxs("span",{className:"text-muted-foreground text-sm",children:["(",je.length,")"]})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3",children:je.map(Me=>r.jsx(f$e,{deal:Me,onClick:()=>ue(Me),stages:e,onStageChange:fe,showStagePicker:!0},Me.id))})]},ae.id)}),(s==null?void 0:s.length)===0&&r.jsxs("div",{className:"text-center py-16",children:[r.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-muted rounded-full flex items-center justify-center",children:r.jsx(lg,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx("h3",{className:"font-semibold text-lg mb-2",children:"No deals yet"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Start tracking your opportunities by adding your first deal"}),r.jsxs(te,{onClick:()=>Ne(),children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Add Your First Deal"]})]})]})})})]}),r.jsx($Vt,{open:w,onOpenChange:k,deal:T,defaultStageId:A}),r.jsx(VVt,{deal:T,open:C,onOpenChange:S,onEdit:se,isWonStage:T?(oe=e==null?void 0:e.find(ae=>ae.id===T.stage_id))==null?void 0:oe.is_won_stage:!1,onAddToScorecard:ae=>{he(ae),Z(!0),S(!1)}}),r.jsx(HVt,{open:K,onOpenChange:Z,deal:re,onComplete:()=>{o(),he(null)}})]})}const p$e=new Date().getFullYear(),ZVt=Array.from({length:5},(t,e)=>p$e-e);function YVt(){const[t,e]=P.useState(p$e),n=es(),{data:s,isLoading:i}=Oht();return i?r.jsx(Or,{title:"Scorecard Admin",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Gr,{className:"h-8 w-64"}),r.jsx("div",{className:"grid grid-cols-4 gap-4",children:[1,2,3,4].map(o=>r.jsx(Gr,{className:"h-24"},o))}),r.jsx(Gr,{className:"h-96"})]})}):r.jsx(Or,{title:"Scorecard Admin",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Scorecard Admin"}),r.jsx("p",{className:"text-muted-foreground",children:"View agent performance and scorecards"})]}),r.jsxs(_n,{value:String(t),onValueChange:o=>e(Number(o)),children:[r.jsx(xn,{className:"w-[120px]",children:r.jsx(bn,{})}),r.jsx(vn,{children:ZVt.map(o=>r.jsx(er,{value:String(o),children:o},o))})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsx(Ye,{children:r.jsxs(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(hs,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Agents Tracking"})]}),r.jsx("p",{className:"text-2xl font-bold",children:(s==null?void 0:s.length)||0})]})}),r.jsx(Ye,{children:r.jsxs(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(xc,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Total Agents"})]}),r.jsx("p",{className:"text-2xl font-bold",children:(s==null?void 0:s.length)||0}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"with transactions"})]})})]}),r.jsxs(Ye,{children:[r.jsxs(Ht,{children:[r.jsx(Yt,{children:"Agents with Scorecards"}),r.jsx(An,{children:"Click to view individual agent scorecards"})]}),r.jsx(Je,{children:!s||s.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(xc,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No agents have added transactions yet"})]}):r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"Agent"}),r.jsx(At,{children:"Email"}),r.jsx(At,{className:"text-right",children:"Actions"})]})}),r.jsx(qs,{children:s.map(o=>r.jsxs(Er,{children:[r.jsx(_t,{className:"font-medium",children:o.name}),r.jsx(_t,{className:"text-muted-foreground",children:o.email}),r.jsx(_t,{className:"text-right",children:r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>n(`/admin/scorecard/${o.id}`),children:[r.jsx(Ml,{className:"h-4 w-4 mr-2"}),"View Scorecard"]})})]},o.id))})]})})]})]})})}const m$e=new Date().getFullYear(),XVt=Array.from({length:10},(t,e)=>m$e-e);function QVt(){var w;const{userId:t}=dd(),e=es(),[n,s]=P.useState(m$e),{data:i,isLoading:o}=rr({queryKey:["agent-profile",t],queryFn:async()=>{const{data:k,error:C}=await ee.from("profiles").select("id, name, email").eq("id",t).single();if(C)throw C;return k},enabled:!!t}),{data:c,isLoading:a}=oye(n,t),{yearStats:f,lifetimeStats:m,showCommission:y}=lDe(n,t),{data:v}=oDe(n,t);return o?r.jsx(Or,{title:"Agent Scorecard",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Gr,{className:"h-8 w-64"}),r.jsx("div",{className:"grid grid-cols-4 gap-4",children:[1,2,3,4].map(k=>r.jsx(Gr,{className:"h-24"},k))})]})}):r.jsx(Or,{title:`${i==null?void 0:i.name}'s Scorecard`,children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>e("/admin/scorecard"),children:r.jsx(Va,{className:"h-5 w-5"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:i==null?void 0:i.name}),r.jsx("p",{className:"text-muted-foreground",children:i==null?void 0:i.email})]})]}),r.jsxs(_n,{value:String(n),onValueChange:k=>s(Number(k)),children:[r.jsx(xn,{className:"w-[120px]",children:r.jsx(bn,{})}),r.jsx(vn,{children:XVt.map(k=>r.jsx(er,{value:String(k),children:k},k))})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 gap-4",children:[r.jsx(Ye,{children:r.jsxs(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Hi,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Transactions"})]}),r.jsx("p",{className:"text-2xl font-bold",children:f.totalTransactions}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[m.totalTransactions," lifetime"]})]})}),r.jsx(Ye,{children:r.jsxs(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(hs,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Buyer/Seller"})]}),r.jsxs("p",{className:"text-2xl font-bold",children:[f.buyerCount,"/",f.sellerCount]})]})}),r.jsx(Ye,{children:r.jsxs(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Cd,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Volume"})]}),r.jsx("p",{className:"text-2xl font-bold",children:jd(f.totalVolume,!0)})]})}),r.jsx(Ye,{children:r.jsxs(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Bf,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Avg Price"})]}),r.jsx("p",{className:"text-2xl font-bold",children:jd(f.averagePrice,!0)})]})}),r.jsx(Ye,{children:r.jsxs(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Cu,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Top Source"})]}),r.jsx("p",{className:"text-lg font-bold truncate",children:((w=f.topLeadSource)==null?void 0:w.name)||"-"})]})})]}),v&&r.jsx(pze,{goals:v,stats:f,year:n,showCommission:y}),r.jsxs(La,{defaultValue:"transactions",className:"space-y-4",children:[r.jsxs(Ma,{children:[r.jsx(yn,{value:"transactions",children:"Transactions"}),r.jsx(yn,{value:"charts",children:"Charts"})]}),r.jsx($n,{value:"transactions",children:r.jsx(fze,{transactions:c||[],showCommission:y,isLoading:a})}),r.jsx($n,{value:"charts",children:r.jsx(s$e,{stats:f,year:n})})]})]})})}function JVt(){const t=Xr(),[e,n]=P.useState(""),[s,i]=P.useState("all");KPe();const{data:o,refetch:c}=rr({queryKey:["listing-exchange-flag"],queryFn:async()=>{const{data:A}=await ee.from("feature_flags").select("enabled").eq("key","listing_exchange_enabled").single();return(A==null?void 0:A.enabled)??!1}}),{data:a,isLoading:f}=rr({queryKey:["admin-listings"],queryFn:async()=>{const{data:A,error:D}=await ee.from("listings").select(` *, agent:profiles!listings_agent_id_fkey(id, name, email), photos:listing_photos(id, photo_url, is_primary) `).order("created_at",{ascending:!1});if(D)throw D;return A}}),{data:m}=rr({queryKey:["admin-listing-stats"],queryFn:async()=>{const{data:A}=await ee.from("listings").select("id, is_approved, status"),{data:D}=await ee.from("listing_shares").select("id"),{data:$}=await ee.from("listing_views").select("id");return{total:(A==null?void 0:A.length)||0,pending:(A==null?void 0:A.filter(F=>!F.is_approved).length)||0,active:(A==null?void 0:A.filter(F=>F.status==="active").length)||0,totalShares:(D==null?void 0:D.length)||0,totalViews:($==null?void 0:$.length)||0}}}),y=cr({mutationFn:async({id:A,approved:D})=>{const{error:$}=await ee.from("listings").update({is_approved:D}).eq("id",A);if($)throw $},onSuccess:(A,{approved:D})=>{t.invalidateQueries({queryKey:["admin-listings"]}),t.invalidateQueries({queryKey:["admin-listing-stats"]}),Ge.success(D?"Listing approved":"Listing unapproved")}}),v=cr({mutationFn:async({id:A,featured:D})=>{const{error:$}=await ee.from("listings").update({is_featured:D}).eq("id",A);if($)throw $},onSuccess:(A,{featured:D})=>{t.invalidateQueries({queryKey:["admin-listings"]}),Ge.success(D?"Listing featured":"Listing unfeatured")}}),w=cr({mutationFn:async A=>{const{error:D}=await ee.from("listings").delete().eq("id",A);if(D)throw D},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-listings"]}),t.invalidateQueries({queryKey:["admin-listing-stats"]}),Ge.success("Listing deleted")}}),k=cr({mutationFn:async A=>{const{error:D}=await ee.from("feature_flags").update({enabled:A}).eq("key","listing_exchange_enabled");if(D)throw D},onSuccess:()=>{c(),Ge.success("Feature flag updated")}}),C=o??!1,S=a==null?void 0:a.filter(A=>{var F,q,W,K;const D=((F=A.city)==null?void 0:F.toLowerCase().includes(e.toLowerCase()))||((W=(q=A.agent)==null?void 0:q.name)==null?void 0:W.toLowerCase().includes(e.toLowerCase()))||((K=A.property_address)==null?void 0:K.toLowerCase().includes(e.toLowerCase())),$=s==="all"||s==="pending"&&!A.is_approved||s==="approved"&&A.is_approved;return D&&$}),T=A=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(A),I=A=>{const D={active:"bg-green-500/10 text-green-600 border-green-200",coming_soon:"bg-blue-500/10 text-blue-600 border-blue-200",price_improvement:"bg-amber-500/10 text-amber-600 border-amber-200",under_contract:"bg-purple-500/10 text-purple-600 border-purple-200",sold:"bg-gray-500/10 text-gray-600 border-gray-200"};return D[A]||D.active};return r.jsx(Or,{title:"Listing Exchange Admin",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Listing Exchange"}),r.jsx("p",{className:"text-muted-foreground",children:"Manage community listings"})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:"Feature visible to agents"}),r.jsx(Zs,{checked:C,onCheckedChange:A=>k.mutate(A)})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[r.jsx(Ye,{children:r.jsxs(Je,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ra,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Total Listings"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:(m==null?void 0:m.total)||0})]})}),r.jsx(Ye,{children:r.jsxs(Je,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Bf,{className:"h-4 w-4 text-green-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Active"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:(m==null?void 0:m.active)||0})]})}),r.jsx(Ye,{children:r.jsxs(Je,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(hs,{className:"h-4 w-4 text-amber-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Pending Review"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:(m==null?void 0:m.pending)||0})]})}),r.jsx(Ye,{children:r.jsxs(Je,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ml,{className:"h-4 w-4 text-blue-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Total Views"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:(m==null?void 0:m.totalViews)||0})]})}),r.jsx(Ye,{children:r.jsxs(Je,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Kd,{className:"h-4 w-4 text-purple-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Total Shares"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:(m==null?void 0:m.totalShares)||0})]})})]}),r.jsx(Ye,{children:r.jsx(Je,{className:"p-4",children:r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Ti,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(yt,{placeholder:"Search by city, address, or agent...",value:e,onChange:A=>n(A.target.value),className:"pl-9"})]}),r.jsx(La,{value:s,onValueChange:A=>i(A),children:r.jsxs(Ma,{children:[r.jsx(yn,{value:"all",children:"All"}),r.jsx(yn,{value:"pending",children:"Pending"}),r.jsx(yn,{value:"approved",children:"Approved"})]})})]})})}),r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsxs(Yt,{children:["Listings (",(S==null?void 0:S.length)||0,")"]})}),r.jsx(Je,{children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"Property"}),r.jsx(At,{children:"Agent"}),r.jsx(At,{children:"Price"}),r.jsx(At,{children:"Status"}),r.jsx(At,{className:"text-center",children:"Approved"}),r.jsx(At,{className:"text-center",children:"Featured"}),r.jsx(At,{children:"Views"}),r.jsx(At,{children:"Shares"}),r.jsx(At,{children:"Date"}),r.jsx(At,{})]})}),r.jsx(qs,{children:f?r.jsx(Er,{children:r.jsx(_t,{colSpan:10,className:"text-center py-8 text-muted-foreground",children:"Loading..."})}):(S==null?void 0:S.length)===0?r.jsx(Er,{children:r.jsx(_t,{colSpan:10,className:"text-center py-8 text-muted-foreground",children:"No listings found"})}):S==null?void 0:S.map(A=>{var D,$,F,q,W;return r.jsxs(Er,{children:[r.jsx(_t,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[($=(D=A.photos)==null?void 0:D[0])!=null&&$.photo_url?r.jsx("img",{src:A.photos[0].photo_url,alt:"",className:"w-12 h-12 object-cover rounded"}):r.jsx("div",{className:"w-12 h-12 bg-muted rounded flex items-center justify-center",children:r.jsx(ra,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:A.property_address||`${A.city}, ${A.state}`}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(F=A.property_type)==null?void 0:F.replace("_"," ")})]})]})}),r.jsx(_t,{children:r.jsx("p",{className:"text-sm",children:((q=A.agent)==null?void 0:q.name)||"Unknown"})}),r.jsx(_t,{className:"font-medium",children:T(A.price)}),r.jsx(_t,{children:r.jsx(Rt,{variant:"outline",className:I(A.status),children:(W=A.status)==null?void 0:W.replace("_"," ")})}),r.jsx(_t,{className:"text-center",children:r.jsx(Zs,{checked:A.is_approved??!1,onCheckedChange:K=>y.mutate({id:A.id,approved:K})})}),r.jsx(_t,{className:"text-center",children:r.jsx(Zs,{checked:A.is_featured??!1,onCheckedChange:K=>v.mutate({id:A.id,featured:K})})}),r.jsx(_t,{children:A.view_count||0}),r.jsx(_t,{children:A.share_count||0}),r.jsx(_t,{className:"text-sm text-muted-foreground",children:un(new Date(A.created_at),"MMM d, yyyy")}),r.jsx(_t,{children:r.jsxs(fm,{children:[r.jsx(pm,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",children:r.jsx(Zm,{className:"h-4 w-4"})})}),r.jsxs(Xf,{align:"end",children:[r.jsxs(uo,{onClick:()=>window.open(`/innercircle/listings/${A.id}`,"_blank"),children:[r.jsx(Ml,{className:"h-4 w-4 mr-2"}),"View Listing"]}),r.jsxs(uo,{onClick:()=>v.mutate({id:A.id,featured:!A.is_featured}),children:[r.jsx(Ca,{className:"h-4 w-4 mr-2"}),A.is_featured?"Unfeature":"Feature"]}),r.jsxs(uo,{className:"text-destructive",onClick:()=>{confirm("Are you sure you want to delete this listing?")&&w.mutate(A.id)},children:[r.jsx(Ms,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})})]},A.id)})})]})})})]})]})})}const eHt=()=>{var v,w;const[t,e]=P.useState(""),[n,s]=P.useState(null),{data:i,isLoading:o}=rr({queryKey:["membership-reviews"],queryFn:async()=>{const{data:k,error:C}=await ee.from("membership_reviews").select("*").order("created_at",{ascending:!1});if(C)throw C;const S=(k==null?void 0:k.map(A=>A.user_id))||[],{data:T}=await ee.from("profiles").select("id, name, email").in("id",S);return k==null?void 0:k.map(A=>({...A,profiles:(T==null?void 0:T.find(D=>D.id===A.user_id))||null}))}}),c=i==null?void 0:i.filter(k=>{var S,T,I,A,D;const C=t.toLowerCase();return((T=(S=k.profiles)==null?void 0:S.name)==null?void 0:T.toLowerCase().includes(C))||((A=(I=k.profiles)==null?void 0:I.email)==null?void 0:A.toLowerCase().includes(C))||((D=k.review_text)==null?void 0:D.toLowerCase().includes(C))}),a=i!=null&&i.length?(i.reduce((k,C)=>k+C.rating,0)/i.length).toFixed(1):"0.0",f=i==null?void 0:i.reduce((k,C)=>(k[C.rating]=(k[C.rating]||0)+1,k),{}),m=(i==null?void 0:i.filter(k=>k.posted_to_google).length)||0,y=k=>r.jsx("div",{className:"flex gap-0.5",children:[1,2,3,4,5].map(C=>r.jsx(Ca,{className:zt("h-4 w-4",k>=C?"fill-yellow-400 text-yellow-400":"text-muted-foreground")},C))});return r.jsx(Or,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ou,{title:"Membership Reviews",description:"View and manage feedback from LevelUp members"}),r.jsxs("div",{className:"grid gap-4 md:grid-cols-4",children:[r.jsx(Ye,{children:r.jsxs(Ht,{className:"pb-2",children:[r.jsx(An,{children:"Total Reviews"}),r.jsx(Yt,{className:"text-3xl",children:(i==null?void 0:i.length)||0})]})}),r.jsx(Ye,{children:r.jsxs(Ht,{className:"pb-2",children:[r.jsx(An,{children:"Average Rating"}),r.jsxs(Yt,{className:"flex items-center gap-2 text-3xl",children:[a,r.jsx(Ca,{className:"h-6 w-6 fill-yellow-400 text-yellow-400"})]})]})}),r.jsx(Ye,{children:r.jsxs(Ht,{className:"pb-2",children:[r.jsx(An,{children:"5-Star Reviews"}),r.jsx(Yt,{className:"text-3xl",children:(f==null?void 0:f[5])||0})]})}),r.jsx(Ye,{children:r.jsxs(Ht,{className:"pb-2",children:[r.jsx(An,{children:"Posted to Google"}),r.jsxs(Yt,{className:"flex items-center gap-2 text-3xl",children:[m,r.jsx(Fs,{className:"h-5 w-5 text-muted-foreground"})]})]})})]}),r.jsxs("div",{className:"relative max-w-sm",children:[r.jsx(Ti,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx(yt,{placeholder:"Search by name, email, or review...",value:t,onChange:k=>e(k.target.value),className:"pl-9"})]}),r.jsx(Ye,{children:r.jsx(Je,{className:"p-0",children:r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"Member"}),r.jsx(At,{children:"Rating"}),r.jsx(At,{className:"hidden md:table-cell",children:"Review"}),r.jsx(At,{children:"Google"}),r.jsx(At,{children:"Date"})]})}),r.jsx(qs,{children:o?r.jsx(Er,{children:r.jsx(_t,{colSpan:5,className:"text-center py-8",children:"Loading reviews..."})}):(c==null?void 0:c.length)===0?r.jsx(Er,{children:r.jsx(_t,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No reviews found"})}):c==null?void 0:c.map(k=>{var C,S;return r.jsxs(Er,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>s(k),children:[r.jsx(_t,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:((C=k.profiles)==null?void 0:C.name)||"Unknown"}),r.jsx("div",{className:"text-sm text-muted-foreground",children:(S=k.profiles)==null?void 0:S.email})]})}),r.jsx(_t,{children:y(k.rating)}),r.jsx(_t,{className:"hidden md:table-cell max-w-xs",children:r.jsx("p",{className:"truncate text-sm text-muted-foreground",children:k.review_text||"-"})}),r.jsx(_t,{children:k.posted_to_google?r.jsx(Rt,{variant:"secondary",className:"bg-green-100 text-green-800",children:"Posted"}):r.jsx(Rt,{variant:"outline",children:"No"})}),r.jsx(_t,{className:"text-sm text-muted-foreground",children:un(new Date(k.created_at),"MMM d, yyyy")})]},k.id)})})]})})}),r.jsx($r,{open:!!n,onOpenChange:()=>s(null),children:r.jsxs(zr,{className:"max-w-lg",children:[r.jsx(Zr,{children:r.jsx(Kr,{children:"Review Details"})}),n&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-start gap-4 p-4 bg-muted/50 rounded-lg",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"font-semibold text-lg",children:((v=n.profiles)==null?void 0:v.name)||"Unknown Member"}),((w=n.profiles)==null?void 0:w.email)&&r.jsxs("a",{href:`mailto:${n.profiles.email}`,className:"flex items-center gap-1 text-sm text-muted-foreground hover:text-primary",children:[r.jsx(di,{className:"h-3 w-3"}),n.profiles.email]})]}),r.jsxs("div",{className:"text-right",children:[y(n.rating),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[n.rating," out of 5 stars"]})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Review"}),r.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:n.review_text||"No written review provided."})]}),r.jsxs("div",{className:"flex items-center justify-between pt-4 border-t",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(li,{className:"h-4 w-4"}),un(new Date(n.created_at),"MMMM d, yyyy 'at' h:mm a")]}),n.posted_to_google?r.jsxs(Rt,{variant:"secondary",className:"bg-green-100 text-green-800",children:[r.jsx(Fs,{className:"h-3 w-3 mr-1"}),"Posted to Google"]}):r.jsx(Rt,{variant:"outline",children:"Not posted to Google"})]})]})]})})]})})},tHt=[{value:"0",label:"Sunday"},{value:"1",label:"Monday"},{value:"2",label:"Tuesday"},{value:"3",label:"Wednesday"},{value:"4",label:"Thursday"},{value:"5",label:"Friday"},{value:"6",label:"Saturday"}],rHt=Array.from({length:24},(t,e)=>({value:String(e),label:e===0?"12:00 AM":e<12?`${e}:00 AM`:e===12?"12:00 PM":`${e-12}:00 PM`}));function nHt(){const t=Xr(),{user:e}=Fr(),[n,s]=P.useState(!1),[i,o]=P.useState(!1),[c,a]=P.useState(!1),{data:f,isLoading:m}=rr({queryKey:["weekly-digest-settings"],queryFn:async()=>{const{data:K,error:Z}=await ee.from("weekly_digest_settings").select("*").single();if(Z)throw Z;return K}}),{data:y,isLoading:v}=rr({queryKey:["weekly-digest-logs"],queryFn:async()=>{const{data:K,error:Z}=await ee.from("weekly_digest_logs").select("*").order("sent_at",{ascending:!1}).limit(100);if(Z)throw Z;return K}}),{data:w}=rr({queryKey:["digest-subscriber-count"],queryFn:async()=>{const{count:K,error:Z}=await ee.from("profiles").select("id",{count:"exact",head:!0}).eq("digest_opt_out",!1).not("email","is",null);if(Z)throw Z;return K||0}}),{data:k,refetch:C}=rr({queryKey:["digest-queue-status"],queryFn:async()=>{const K=new Date;K.setUTCHours(0,0,0,0);const[Z,re,he,ue]=await Promise.all([ee.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","pending").gte("created_at",K.toISOString()),ee.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","processing").gte("created_at",K.toISOString()),ee.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","sent").gte("created_at",K.toISOString()),ee.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","failed").gte("created_at",K.toISOString())]);return{pending:Z.count||0,processing:re.count||0,sent:he.count||0,failed:ue.count||0,total:(Z.count||0)+(re.count||0)+(he.count||0)+(ue.count||0)}},refetchInterval:5e3});P.useEffect(()=>{if(k&&(k.pending>0||k.processing>0)){const K=setInterval(()=>{C(),t.invalidateQueries({queryKey:["weekly-digest-logs"]}),t.invalidateQueries({queryKey:["digest-today-failed-count"]}),t.invalidateQueries({queryKey:["digest-today-missing-count"]})},5e3);return()=>clearInterval(K)}},[k,C,t]);const{data:S=0}=rr({queryKey:["digest-today-failed-count"],queryFn:async()=>{const K=new Date;K.setUTCHours(0,0,0,0);const{count:Z,error:re}=await ee.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("delivery_status","failed").gte("sent_at",K.toISOString());if(re)throw re;return Z||0}}),T=cr({mutationFn:async K=>{const{error:Z}=await ee.from("weekly_digest_settings").update(K).eq("id",f==null?void 0:f.id);if(Z)throw Z},onSuccess:()=>{t.invalidateQueries({queryKey:["weekly-digest-settings"]}),Ge.success("Settings updated")},onError:K=>{Ge.error("Failed to update settings: "+K.message)}}),I=async()=>{s(!0);try{const{data:K,error:Z}=await ee.functions.invoke("send-weekly-digest",{body:{manual:!0}});if(Z)throw Z;K.queued?Ge.success(`${K.queued.toLocaleString()} emails queued! They'll be sent automatically (~80/minute).`):K.sent!==void 0&&Ge.success(`Digest sent! ${K.sent} emails delivered, ${K.failed} failed`),C(),t.invalidateQueries({queryKey:["weekly-digest-logs"]})}catch(K){Ge.error("Failed to send digest: "+K.message)}finally{s(!1)}},A=async()=>{var K,Z,re,he,ue,Ne;if(!(e!=null&&e.email)){Ge.error("No email found for your account");return}o(!0);try{const{data:se,error:xe}=await ee.functions.invoke("send-weekly-digest",{body:{preview:!0,previewEmail:e.email}});if(xe)throw xe;const ie=se==null?void 0:se.resendId,me=se==null?void 0:se.resendDetails,fe=me==null?void 0:me.status,ve=((K=me==null?void 0:me.body)==null?void 0:K.status)||((re=(Z=me==null?void 0:me.body)==null?void 0:Z.data)==null?void 0:re.status),Ie=((ue=(he=me==null?void 0:me.body)==null?void 0:he.error)==null?void 0:ue.message)||((Ne=me==null?void 0:me.body)==null?void 0:Ne.message);Ge.success(ie?`Preview accepted by email provider (id: ${ie})${fe?`, status check: ${fe}`:""}${ve?`, provider: ${ve}`:""}${Ie?` (${Ie})`:""}. Check spam/promotions—delivery can take a few minutes.`:"Preview accepted by email provider. Check spam/promotions—delivery can take a few minutes.")}catch(se){Ge.error("Failed to send preview: "+se.message)}finally{o(!1)}},D=async()=>{a(!0);try{const{data:K,error:Z}=await ee.functions.invoke("send-weekly-digest",{body:{retryFailed:!0}});if(Z)throw Z;K.queued===0||K.sent===0&&K.failed===0&&!K.queued?Ge.info("No failed emails to retry"):K.queued?Ge.success(`${K.queued} emails queued for retry!`):Ge.success(`Retry complete! ${K.sent} emails delivered, ${K.failed} failed`),C(),t.invalidateQueries({queryKey:["weekly-digest-logs"]}),t.invalidateQueries({queryKey:["digest-today-failed-count"]}),t.invalidateQueries({queryKey:["digest-today-missing-count"]})}catch(K){Ge.error("Failed to retry: "+K.message)}finally{a(!1)}},$=k!=null&&k.total?Math.round((k.sent+k.failed)/k.total*100):0,F=((k==null?void 0:k.pending)||0)>0||((k==null?void 0:k.processing)||0)>0,{data:q}=rr({queryKey:["digest-delivery-stats"],queryFn:async()=>{var Ne,se;const K=new Date;K.setUTCHours(0,0,0,0);const[Z,re,he,ue]=await Promise.all([ee.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("delivery_status","sent").gte("sent_at",K.toISOString()),ee.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("delivery_status","failed").gte("sent_at",K.toISOString()),ee.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("has_agent_os_activity",!0).gte("sent_at",K.toISOString()),ee.from("weekly_digest_logs").select("sent_at").order("sent_at",{ascending:!1}).limit(1)]);return{totalSent:Z.count||0,totalFailed:re.count||0,agentOsEngaged:he.count||0,lastSent:((se=(Ne=ue.data)==null?void 0:Ne[0])==null?void 0:se.sent_at)||null}},refetchInterval:F?5e3:!1}),W={totalSent:(q==null?void 0:q.totalSent)||0,totalFailed:(q==null?void 0:q.totalFailed)||0,lastSent:q==null?void 0:q.lastSent,agentOsEngaged:(q==null?void 0:q.agentOsEngaged)||0};return m?r.jsx(Or,{title:"Weekly Digest",description:"Manage automated weekly email digests",children:r.jsxs("div",{className:"animate-pulse space-y-4",children:[r.jsx("div",{className:"h-32 bg-muted rounded-lg"}),r.jsx("div",{className:"h-64 bg-muted rounded-lg"})]})}):r.jsx(Or,{title:"Weekly Digest",description:"Configure and manage automated weekly email digests for members",children:r.jsxs(La,{defaultValue:"settings",className:"space-y-6",children:[r.jsxs(Ma,{children:[r.jsxs(yn,{value:"settings",className:"flex items-center gap-2",children:[r.jsx(id,{className:"h-4 w-4"}),"Settings"]}),r.jsxs(yn,{value:"stats",className:"flex items-center gap-2",children:[r.jsx(xc,{className:"h-4 w-4"}),"Delivery Stats"]})]}),r.jsxs($n,{value:"settings",className:"space-y-6",children:[F&&k&&r.jsx(Ye,{className:"border-primary/50 bg-primary/5",children:r.jsxs(Je,{className:"pt-6",children:[r.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[r.jsx(sn,{className:"h-5 w-5 animate-spin text-primary"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"font-medium",children:"Sending emails..."}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[k.sent.toLocaleString()," sent, ",k.pending.toLocaleString()," pending",k.failed>0&&`, ${k.failed} failed`]})]}),r.jsxs("span",{className:"text-sm font-medium",children:[$,"%"]})]}),r.jsx(zc,{value:$,className:"h-2"}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["Processing ~80 emails per minute. Estimated time remaining: ~",Math.ceil(k.pending/80)," min"]})]})}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[r.jsx(Ye,{children:r.jsx(Je,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"p-3 rounded-full bg-primary/10",children:r.jsx(hs,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:w}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Subscribers"})]})]})})}),r.jsx(Ye,{children:r.jsx(Je,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"p-3 rounded-full bg-emerald-500/10",children:r.jsx(io,{className:"h-5 w-5 text-emerald-500"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:W.totalSent}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Delivered"})]})]})})}),r.jsx(Ye,{children:r.jsx(Je,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"p-3 rounded-full bg-destructive/10",children:r.jsx(Lc,{className:"h-5 w-5 text-destructive"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:W.totalFailed}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Failed"})]})]})})}),r.jsx(Ye,{children:r.jsx(Je,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"p-3 rounded-full bg-primary/10",children:r.jsx(Xi,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:W.lastSent?un(new Date(W.lastSent),"MMM d"):"Never"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Last Sent"})]})]})})})]}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[r.jsxs(Ye,{children:[r.jsxs(Ht,{children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(Xi,{className:"h-5 w-5"}),"Schedule"]}),r.jsx(An,{children:"Configure when the digest is sent"})]}),r.jsxs(Je,{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Qe,{children:"Enable Weekly Digest"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Send automated weekly emails to members"})]}),r.jsx(Zs,{checked:f==null?void 0:f.is_enabled,onCheckedChange:K=>T.mutate({is_enabled:K})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Cron Frequency"}),r.jsxs(_n,{value:(f==null?void 0:f.cron_frequency)||"daily",onValueChange:K=>T.mutate({cron_frequency:K}),children:[r.jsx(xn,{children:r.jsx(bn,{})}),r.jsxs(vn,{children:[r.jsx(er,{value:"daily",children:"Daily (runs once at selected time)"}),r.jsx(er,{value:"hourly",children:"Hourly (checks every hour)"})]})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(f==null?void 0:f.cron_frequency)==="hourly"?"Cron runs every hour; digest sends when day & hour match.":"Cron runs once daily at the selected hour (UTC)."})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Day of Week"}),r.jsxs(_n,{value:String(f==null?void 0:f.send_day),onValueChange:K=>T.mutate({send_day:parseInt(K)}),children:[r.jsx(xn,{children:r.jsx(bn,{})}),r.jsx(vn,{children:tHt.map(K=>r.jsx(er,{value:K.value,children:K.label},K.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Time (UTC)"}),r.jsxs(_n,{value:String(f==null?void 0:f.send_hour),onValueChange:K=>T.mutate({send_hour:parseInt(K)}),disabled:(f==null?void 0:f.cron_frequency)==="daily",children:[r.jsx(xn,{children:r.jsx(bn,{})}),r.jsx(vn,{children:rHt.map(K=>r.jsx(er,{value:K.value,children:K.label},K.value))})]})]})]}),r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(te,{onClick:A,disabled:i,variant:"outline",className:"flex-1",children:[r.jsx(Ml,{className:"h-4 w-4 mr-2"}),i?"Sending...":"Send Preview to Me"]}),r.jsxs(te,{onClick:I,disabled:n,className:"flex-1",children:[r.jsx(To,{className:"h-4 w-4 mr-2"}),n?"Sending...":"Send to All"]})]}),S>0&&r.jsxs(te,{onClick:D,disabled:c,variant:"outline",className:"w-full",children:[r.jsx(Dl,{className:`h-4 w-4 mr-2 ${c?"animate-spin":""}`}),c?"Retrying...":`Retry ${S} Failed`]})]})]})]}),r.jsxs(Ye,{children:[r.jsxs(Ht,{children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(Ai,{className:"h-5 w-5"}),"Content Sections"]}),r.jsx(An,{children:"Choose what to include in the digest"})]}),r.jsxs(Je,{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ai,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(Qe,{children:"New Resources"})]}),r.jsx(Zs,{checked:f==null?void 0:f.include_new_resources,onCheckedChange:K=>T.mutate({include_new_resources:K})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(hs,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(Qe,{children:"Community Highlights"})]}),r.jsx(Zs,{checked:f==null?void 0:f.include_community_posts,onCheckedChange:K=>T.mutate({include_community_posts:K})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(xc,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(Qe,{children:"Agent OS Stats"})]}),r.jsx(Zs,{checked:f==null?void 0:f.include_agent_os_stats,onCheckedChange:K=>T.mutate({include_agent_os_stats:K})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(li,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(Qe,{children:"Upcoming Events"})]}),r.jsx(Zs,{checked:f==null?void 0:f.include_upcoming_events,onCheckedChange:K=>T.mutate({include_upcoming_events:K})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ey,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(Qe,{children:"Goals Progress"})]}),r.jsx(Zs,{checked:f==null?void 0:f.include_goals_progress,onCheckedChange:K=>T.mutate({include_goals_progress:K})})]})]})]})]}),r.jsxs(Ye,{children:[r.jsxs(Ht,{children:[r.jsx(Yt,{children:"Custom Introduction"}),r.jsx(An,{children:"Personalize the intro message (optional)"})]}),r.jsx(Je,{children:r.jsx(ps,{placeholder:"Here's what's new this week to help you grow your business...",value:(f==null?void 0:f.custom_intro_text)||"",onChange:K=>T.mutate({custom_intro_text:K.target.value||null}),rows:3})})]})]}),r.jsx($n,{value:"stats",children:r.jsxs(Ye,{children:[r.jsxs(Ht,{children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(di,{className:"h-5 w-5"}),"Delivery History"]}),r.jsx(An,{children:"Recent digest emails sent to members"})]}),r.jsx(Je,{children:v?r.jsx("div",{className:"animate-pulse space-y-2",children:[1,2,3,4,5].map(K=>r.jsx("div",{className:"h-12 bg-muted rounded"},K))}):y&&y.length>0?r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"Email"}),r.jsx(At,{children:"Sent At"}),r.jsx(At,{children:"Status"}),r.jsx(At,{children:"Resources"}),r.jsx(At,{children:"Agent OS"})]})}),r.jsx(qs,{children:y.map(K=>r.jsxs(Er,{children:[r.jsx(_t,{className:"font-medium",children:K.email_sent_to}),r.jsx(_t,{children:un(new Date(K.sent_at),"MMM d, yyyy h:mm a")}),r.jsx(_t,{children:r.jsx(Rt,{variant:K.delivery_status==="sent"?"default":"destructive",children:K.delivery_status})}),r.jsx(_t,{children:K.resources_count}),r.jsx(_t,{children:K.has_agent_os_activity?r.jsx(Rt,{variant:"secondary",children:"Active"}):r.jsx(Rt,{variant:"outline",children:"Not Started"})})]},K.id))})]}):r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(di,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No digests sent yet"}),r.jsx("p",{className:"text-sm",children:"Send your first digest to see delivery stats"})]})})]})})]})})}const sHt={first_event:"bg-emerald-100 text-emerald-800 dark:bg-emerald-900 dark:text-emerald-200",streak_3:"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200",streak_5:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",events_5:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",events_10:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",events_25:"bg-amber-100 text-amber-800 dark:bg-amber-900 dark:text-amber-200"};function iHt(){var oe,ae,je;const t=Xr(),[e,n]=P.useState(""),[s,i]=P.useState(null),[o,c]=P.useState(!1),[a,f]=P.useState(!1),[m,y]=P.useState(""),[v,w]=P.useState(""),[k,C]=P.useState(!0),[S,T]=P.useState(!1),[I,A]=P.useState(""),[D,$]=P.useState(null),{data:F,isLoading:q}=rr({queryKey:["admin-agent-points"],queryFn:async()=>{const{data:Me,error:Ue}=await ee.from("agent_attendance_stats").select("*").order("total_points",{ascending:!1});if(Ue)throw Ue;const Re=(Me==null?void 0:Me.map(Ae=>Ae.user_id))||[],{data:$e}=await ee.from("profiles").select("id, name, email").in("id",Re),Pe=new Map(($e==null?void 0:$e.map(Ae=>[Ae.id,{name:Ae.name,email:Ae.email}]))||[]);return Me==null?void 0:Me.map(Ae=>({...Ae,profile:Pe.get(Ae.user_id)||null}))}}),{data:W}=rr({queryKey:["all-profiles-for-points",F],queryFn:async()=>{const{data:Me,error:Ue}=await ee.from("profiles").select("id, name, email").order("name");if(Ue)throw Ue;return Me}}),Z=((W==null?void 0:W.filter(Me=>!(F!=null&&F.some(Ue=>Ue.user_id===Me.id))))||[]).filter(Me=>{var Re,$e;if(!I)return!0;const Ue=I.toLowerCase();return((Re=Me.name)==null?void 0:Re.toLowerCase().includes(Ue))||(($e=Me.email)==null?void 0:$e.toLowerCase().includes(Ue))}),{data:re,isLoading:he}=rr({queryKey:["agent-point-history",s==null?void 0:s.user_id],queryFn:async()=>{if(!(s!=null&&s.user_id))return[];const{data:Me,error:Ue}=await ee.from("agent_points").select("*").eq("user_id",s.user_id).order("created_at",{ascending:!1});if(Ue)throw Ue;return Me},enabled:!!(s!=null&&s.user_id)&&a}),{data:ue}=rr({queryKey:["agent-badges",s==null?void 0:s.user_id],queryFn:async()=>{if(!(s!=null&&s.user_id))return[];const{data:Me,error:Ue}=await ee.from("agent_badges").select("*").eq("user_id",s.user_id).order("earned_at",{ascending:!1});if(Ue)throw Ue;return Me},enabled:!!(s!=null&&s.user_id)}),Ne=cr({mutationFn:async({userId:Me,points:Ue,reason:Re})=>{const{error:$e}=await ee.from("agent_points").insert({user_id:Me,points:Ue,reason:Re});if($e)throw $e;const{data:Pe}=await ee.from("agent_attendance_stats").select("total_points, spendable_points").eq("user_id",Me).maybeSingle(),Ae=((Pe==null?void 0:Pe.total_points)||0)+Ue,nt=((Pe==null?void 0:Pe.spendable_points)||0)+Ue,{error:Te}=await ee.from("agent_attendance_stats").upsert({user_id:Me,total_points:Math.max(0,Ae),spendable_points:Math.max(0,nt),updated_at:new Date().toISOString()},{onConflict:"user_id"});if(Te)throw Te},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-agent-points"]}),t.invalidateQueries({queryKey:["agent-point-history"]}),c(!1),y(""),w(""),Ge.success(k?"Points awarded successfully!":"Points deducted successfully!")},onError:Me=>{console.error("Error modifying points:",Me),Ge.error("Failed to modify points")}}),se=()=>{if(!s||!m||!v){Ge.error("Please fill in all fields");return}const Me=parseInt(m);if(isNaN(Me)||Me<=0){Ge.error("Please enter a valid positive number");return}Ne.mutate({userId:s.user_id,points:k?Me:-Me,reason:v})},xe=()=>{if(!D||!m||!v){Ge.error("Please fill in all fields");return}const Me=parseInt(m);if(isNaN(Me)||Me<=0){Ge.error("Please enter a valid positive number");return}Ne.mutate({userId:D.id,points:Me,reason:v},{onSuccess:()=>{T(!1),$(null),A("")}})},ie=(Me,Ue)=>{i(Me),C(Ue),c(!0)},me=Me=>{i(Me),f(!0)},fe=F==null?void 0:F.filter(Me=>{var Pe,Ae,nt,Te;const Ue=((Ae=(Pe=Me.profile)==null?void 0:Pe.name)==null?void 0:Ae.toLowerCase())||"",Re=((Te=(nt=Me.profile)==null?void 0:nt.email)==null?void 0:Te.toLowerCase())||"",$e=e.toLowerCase();return Ue.includes($e)||Re.includes($e)}),ve=(F==null?void 0:F.reduce((Me,Ue)=>Me+Ue.total_points,0))||0,Ie=(F==null?void 0:F.length)||0,Se=Ie>0?Math.round(ve/Ie):0;return q?r.jsx(Or,{title:"Agent Points",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Gr,{className:"h-8 w-64"}),r.jsx("div",{className:"grid grid-cols-3 gap-4",children:[1,2,3].map(Me=>r.jsx(Gr,{className:"h-24"},Me))}),r.jsx(Gr,{className:"h-96"})]})}):r.jsx(Or,{title:"Agent Points",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Agent Points Management"}),r.jsx("p",{className:"text-muted-foreground",children:"Track, view, and manage agent gamification points"})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsx(Ye,{children:r.jsxs(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(hs,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Total Agents"})]}),r.jsx("p",{className:"text-2xl font-bold",children:Ie}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"with points tracked"})]})}),r.jsx(Ye,{children:r.jsxs(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(qa,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Total Points"})]}),r.jsx("p",{className:"text-2xl font-bold",children:ve.toLocaleString()}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"awarded across all agents"})]})}),r.jsx(Ye,{children:r.jsxs(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Bf,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Average Points"})]}),r.jsx("p",{className:"text-2xl font-bold",children:Se}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"per agent"})]})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 items-start sm:items-center justify-between",children:[r.jsxs("div",{className:"relative max-w-sm w-full",children:[r.jsx(Ti,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(yt,{placeholder:"Search agents...",value:e,onChange:Me=>n(Me.target.value),className:"pl-10"})]}),r.jsxs(te,{onClick:()=>T(!0),children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Award Points to New Agent"]})]}),r.jsxs(Ye,{children:[r.jsxs(Ht,{children:[r.jsx(Yt,{children:"Agent Leaderboard"}),r.jsx(An,{children:"All agents with their points, events, and streaks"})]}),r.jsx(Je,{children:!fe||fe.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(qa,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No agents with points yet"})]}):r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{className:"w-12",children:"#"}),r.jsx(At,{children:"Agent"}),r.jsx(At,{className:"text-center",children:"Total Points"}),r.jsx(At,{className:"text-center",children:"Spendable"}),r.jsx(At,{className:"text-center",children:"Events"}),r.jsx(At,{className:"text-center",children:"Streak"}),r.jsx(At,{className:"text-right",children:"Actions"})]})}),r.jsx(qs,{children:fe.map((Me,Ue)=>{var Re,$e,Pe,Ae;return r.jsxs(Er,{children:[r.jsx(_t,{className:"font-medium",children:Ue<3?r.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center ${Ue===0?"bg-yellow-100 text-yellow-700":Ue===1?"bg-gray-100 text-gray-600":"bg-amber-100 text-amber-700"}`,children:Ue+1}):r.jsx("span",{className:"text-muted-foreground",children:Ue+1})}),r.jsx(_t,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Li,{className:"h-8 w-8",children:r.jsx(Oi,{children:(($e=(Re=Me.profile)==null?void 0:Re.name)==null?void 0:$e.charAt(0))||"?"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((Pe=Me.profile)==null?void 0:Pe.name)||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(Ae=Me.profile)==null?void 0:Ae.email})]})]})}),r.jsx(_t,{className:"text-center",children:r.jsxs(Rt,{variant:"secondary",className:"font-bold",children:[r.jsx(Ca,{className:"h-3 w-3 mr-1"}),Me.total_points]})}),r.jsx(_t,{className:"text-center",children:r.jsxs(Rt,{variant:"outline",className:"font-bold text-primary",children:[r.jsx(Qa,{className:"h-3 w-3 mr-1"}),Me.spendable_points||0]})}),r.jsx(_t,{className:"text-center",children:r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[r.jsx(li,{className:"h-3 w-3 text-muted-foreground"}),Me.total_events_attended]})}),r.jsx(_t,{className:"text-center",children:r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[r.jsx(Df,{className:"h-3 w-3 text-orange-500"}),Me.current_streak]})}),r.jsx(_t,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>ie(Me,!0),title:"Award points",children:r.jsx(Sn,{className:"h-4 w-4 text-green-600"})}),r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>ie(Me,!1),title:"Deduct points",children:r.jsx(Y0,{className:"h-4 w-4 text-red-600"})}),r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>me(Me),title:"View history",children:r.jsx(FS,{className:"h-4 w-4"})})]})})]},Me.user_id)})})]})})]}),r.jsx($r,{open:o,onOpenChange:c,children:r.jsxs(zr,{children:[r.jsxs(Zr,{children:[r.jsx(Kr,{children:k?"Award Points":"Deduct Points"}),r.jsxs(ls,{children:[k?"Award":"Deduct"," points ",k?"to":"from"," ",((oe=s==null?void 0:s.profile)==null?void 0:oe.name)||"this agent"]})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"points",children:"Points Amount"}),r.jsx(yt,{id:"points",type:"number",min:"1",placeholder:"Enter points...",value:m,onChange:Me=>y(Me.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"reason",children:"Reason"}),r.jsx(ps,{id:"reason",placeholder:"Enter reason for this adjustment...",value:v,onChange:Me=>w(Me.target.value)})]})]}),r.jsxs(ni,{children:[r.jsx(te,{variant:"outline",onClick:()=>c(!1),children:"Cancel"}),r.jsx(te,{onClick:se,disabled:Ne.isPending,className:k?"bg-green-600 hover:bg-green-700":"bg-red-600 hover:bg-red-700",children:Ne.isPending?"Saving...":k?"Award Points":"Deduct Points"})]})]})}),r.jsx($r,{open:a,onOpenChange:f,children:r.jsxs(zr,{className:"max-w-2xl",children:[r.jsxs(Zr,{children:[r.jsxs(Kr,{children:["Point History: ",(ae=s==null?void 0:s.profile)==null?void 0:ae.name]}),r.jsx(ls,{children:"View all point transactions and badges for this agent"})]}),r.jsxs(La,{defaultValue:"history",className:"w-full",children:[r.jsxs(Ma,{className:"grid w-full grid-cols-2",children:[r.jsx(yn,{value:"history",children:"Point History"}),r.jsx(yn,{value:"badges",children:"Badges"})]}),r.jsx($n,{value:"history",className:"mt-4",children:he?r.jsx("div",{className:"space-y-2",children:[1,2,3].map(Me=>r.jsx(Gr,{className:"h-12"},Me))}):!re||re.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(FS,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No point history yet"})]}):r.jsx("div",{className:"max-h-80 overflow-y-auto space-y-2",children:re.map(Me=>r.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"font-medium",children:Me.reason}),r.jsx("p",{className:"text-xs text-muted-foreground",children:un(new Date(Me.created_at),"MMM d, yyyy h:mm a")})]}),r.jsxs(Rt,{variant:Me.points>=0?"default":"destructive",className:Me.points>=0?"bg-green-100 text-green-800":"",children:[Me.points>=0?"+":"",Me.points]})]},Me.id))})}),r.jsx($n,{value:"badges",className:"mt-4",children:!ue||ue.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Cu,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No badges earned yet"})]}):r.jsx("div",{className:"grid grid-cols-2 gap-3",children:ue.map(Me=>r.jsxs("div",{className:`p-3 rounded-lg ${sHt[Me.badge_type]||"bg-gray-100"}`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Cu,{className:"h-5 w-5"}),r.jsx("span",{className:"font-medium",children:Me.badge_name})]}),Me.badge_description&&r.jsx("p",{className:"text-xs mt-1 opacity-80",children:Me.badge_description}),r.jsxs("p",{className:"text-xs mt-1 opacity-60",children:["Earned ",un(new Date(Me.earned_at),"MMM d, yyyy")]})]},Me.id))})})]})]})}),r.jsx($r,{open:S,onOpenChange:Me=>{T(Me),Me||($(null),A(""),y(""),w(""))},children:r.jsxs(zr,{className:"max-w-md",children:[r.jsxs(Zr,{children:[r.jsx(Kr,{children:"Award Points to New Agent"}),r.jsx(ls,{children:"Select an agent who doesn't have points yet and award them points"})]}),r.jsx("div",{className:"space-y-4 py-4",children:D?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/50 rounded-lg",children:[r.jsx(Li,{className:"h-10 w-10",children:r.jsx(Oi,{children:((je=D.name)==null?void 0:je.charAt(0))||"?"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"font-medium",children:D.name||"Unknown"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:D.email})]}),r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>$(null),children:"Change"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"new-points",children:"Points Amount"}),r.jsx(yt,{id:"new-points",type:"number",min:"1",placeholder:"Enter points...",value:m,onChange:Me=>y(Me.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"new-reason",children:"Reason"}),r.jsx(ps,{id:"new-reason",placeholder:"Enter reason for awarding points...",value:v,onChange:Me=>w(Me.target.value)})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Search Agent"}),r.jsxs("div",{className:"relative",children:[r.jsx(Ti,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(yt,{placeholder:"Search by name or email...",value:I,onChange:Me=>A(Me.target.value),className:"pl-10"})]})]}),r.jsx("div",{className:"max-h-60 overflow-y-auto border rounded-lg",children:Z.length===0?r.jsxs("div",{className:"text-center py-4 text-muted-foreground",children:[r.jsx(hs,{className:"h-6 w-6 mx-auto mb-2 opacity-50"}),r.jsx("p",{className:"text-sm",children:I?"No matching agents found":"All agents already have points"})]}):Z.slice(0,20).map(Me=>{var Ue;return r.jsxs("button",{onClick:()=>$(Me),className:"w-full flex items-center gap-3 p-3 hover:bg-muted/50 transition-colors border-b last:border-b-0 text-left",children:[r.jsx(Li,{className:"h-8 w-8",children:r.jsx(Oi,{children:((Ue=Me.name)==null?void 0:Ue.charAt(0))||"?"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium truncate",children:Me.name||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:Me.email})]})]},Me.id)})})]})}),r.jsxs(ni,{children:[r.jsx(te,{variant:"outline",onClick:()=>T(!1),children:"Cancel"}),D&&r.jsxs(te,{onClick:xe,disabled:Ne.isPending,className:"bg-green-600 hover:bg-green-700",children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Award Points"]})]})]})})]})})}const p4={pending_payment:"Pending Payment",order_submitted:"Order Submitted",awaiting_proof_approval:"Awaiting Proof Approval",proof_approved:"Proof Approved",processing:"Processing",in_production:"In Production",shipped:"Shipped",completed:"Completed",cancelled:"Cancelled",refunded:"Refunded"},g0e={pending_payment:"bg-yellow-100 text-yellow-800",order_submitted:"bg-blue-100 text-blue-800",awaiting_proof_approval:"bg-orange-100 text-orange-800",proof_approved:"bg-green-100 text-green-800",processing:"bg-purple-100 text-purple-800",in_production:"bg-indigo-100 text-indigo-800",shipped:"bg-cyan-100 text-cyan-800",completed:"bg-green-200 text-green-900",cancelled:"bg-red-100 text-red-800",refunded:"bg-gray-100 text-gray-800"};function y0e(t=!0){return rr({queryKey:["marketplace-categories",t],queryFn:async()=>{let e=ee.from("marketplace_categories").select("*").order("sort_order",{ascending:!0});t&&(e=e.eq("is_active",!0));const{data:n,error:s}=await e;if(s)throw s;return n}})}function aHt(){const t=Xr();return cr({mutationFn:async e=>{const{data:n,error:s}=await ee.from("marketplace_categories").insert([e]).select().single();if(s)throw s;return n},onSuccess:()=>{t.invalidateQueries({queryKey:["marketplace-categories"]}),Ge.success("Category created successfully")},onError:e=>{Ge.error("Failed to create category: "+e.message)}})}function oHt(){const t=Xr();return cr({mutationFn:async({id:e,...n})=>{const{data:s,error:i}=await ee.from("marketplace_categories").update(n).eq("id",e).select().single();if(i)throw i;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["marketplace-categories"]}),Ge.success("Category updated successfully")},onError:e=>{Ge.error("Failed to update category: "+e.message)}})}function lHt(){const t=Xr();return cr({mutationFn:async e=>{const{error:n}=await ee.from("marketplace_categories").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["marketplace-categories"]}),Ge.success("Category deleted successfully")},onError:e=>{Ge.error("Failed to delete category: "+e.message)}})}function g$e(t,e=!0){return rr({queryKey:["marketplace-products",t,e],queryFn:async()=>{let n=ee.from("marketplace_products").select(` *, category:marketplace_categories(*), images:marketplace_product_images(*), video:marketplace_product_videos(*), variants:marketplace_product_variants(*) `).order("sort_order",{ascending:!0});t&&(n=n.eq("category_id",t)),e&&(n=n.eq("is_active",!0));const{data:s,error:i}=await n;if(i)throw i;return s}})}function cHt(t){return rr({queryKey:["marketplace-product",t],queryFn:async()=>{const{data:e,error:n}=await ee.from("marketplace_products").select(` *, category:marketplace_categories(*), images:marketplace_product_images(*), video:marketplace_product_videos(*), variants:marketplace_product_variants(*) `).eq("id",t).single();if(n)throw n;return e},enabled:!!t})}function dHt(){const t=Xr();return cr({mutationFn:async e=>{const{data:n,error:s}=await ee.from("marketplace_products").insert([e]).select().single();if(s)throw s;return n},onSuccess:()=>{t.invalidateQueries({queryKey:["marketplace-products"]}),Ge.success("Product created successfully")},onError:e=>{Ge.error("Failed to create product: "+e.message)}})}function uHt(){const t=Xr();return cr({mutationFn:async({id:e,...n})=>{const{data:s,error:i}=await ee.from("marketplace_products").update(n).eq("id",e).select().single();if(i)throw i;return s},onSuccess:(e,n)=>{t.invalidateQueries({queryKey:["marketplace-products"]}),t.invalidateQueries({queryKey:["marketplace-product",n.id]}),Ge.success("Product updated successfully")},onError:e=>{Ge.error("Failed to update product: "+e.message)}})}function hHt(){const t=Xr();return cr({mutationFn:async e=>{const{error:n}=await ee.from("marketplace_products").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["marketplace-products"]}),Ge.success("Product deleted successfully")},onError:e=>{Ge.error("Failed to delete product: "+e.message)}})}function fHt(){const t=Xr();return cr({mutationFn:async e=>{const{data:n,error:s}=await ee.from("marketplace_product_images").insert([e]).select().single();if(s)throw s;return n},onSuccess:(e,n)=>{t.invalidateQueries({queryKey:["marketplace-products"]}),t.invalidateQueries({queryKey:["marketplace-product",n.product_id]})}})}function pHt(){const t=Xr();return cr({mutationFn:async({id:e,productId:n})=>{const{error:s}=await ee.from("marketplace_product_images").delete().eq("id",e);if(s)throw s;return n},onSuccess:e=>{t.invalidateQueries({queryKey:["marketplace-products"]}),t.invalidateQueries({queryKey:["marketplace-product",e]}),Ge.success("Image deleted successfully")},onError:e=>{Ge.error("Failed to delete image: "+e.message)}})}function mHt(){const t=Xr();return cr({mutationFn:async({imageId:e,productId:n})=>{const{error:s}=await ee.from("marketplace_product_images").update({is_primary:!1}).eq("product_id",n);if(s)throw s;const{error:i}=await ee.from("marketplace_product_images").update({is_primary:!0}).eq("id",e);if(i)throw i;return n},onSuccess:e=>{t.invalidateQueries({queryKey:["marketplace-products"]}),t.invalidateQueries({queryKey:["marketplace-product",e]}),Ge.success("Primary image updated")},onError:e=>{Ge.error("Failed to set primary image: "+e.message)}})}function gHt(){const t=Xr();return cr({mutationFn:async e=>{const{data:n,error:s}=await ee.from("marketplace_product_variants").insert([e]).select().single();if(s)throw s;return n},onSuccess:(e,n)=>{t.invalidateQueries({queryKey:["marketplace-products"]}),t.invalidateQueries({queryKey:["marketplace-product",n.product_id]}),Ge.success("Variant added successfully")}})}function yHt(){const t=Xr();return cr({mutationFn:async({id:e,productId:n})=>{const{error:s}=await ee.from("marketplace_product_variants").delete().eq("id",e);if(s)throw s;return n},onSuccess:e=>{t.invalidateQueries({queryKey:["marketplace-products"]}),t.invalidateQueries({queryKey:["marketplace-product",e]}),Ge.success("Variant deleted successfully")}})}function xHt(){const t=Xr();return cr({mutationFn:async({productId:e,videoUrl:n})=>{await ee.from("marketplace_product_videos").delete().eq("product_id",e);const{data:s,error:i}=await ee.from("marketplace_product_videos").insert({product_id:e,video_url:n}).select().single();if(i)throw i;return s},onSuccess:(e,n)=>{t.invalidateQueries({queryKey:["marketplace-products"]}),t.invalidateQueries({queryKey:["marketplace-product",n.productId]}),Ge.success("Video updated successfully")}})}function vHt(t){const{isAdmin:e}=Fr();return rr({queryKey:["marketplace-orders",t,e],queryFn:async()=>{let n=ee.from("marketplace_orders").select(` *, items:marketplace_order_items(*), status_history:marketplace_order_status_history(*) `).order("created_at",{ascending:!1});const{data:s,error:i}=await n;if(i)throw i;if(e&&s){const o=[...new Set(s.map(f=>f.user_id))],{data:c}=await ee.from("profiles").select("id, name, email").in("id",o),a=new Map((c==null?void 0:c.map(f=>[f.id,f]))||[]);return s.map(f=>({...f,user:a.get(f.user_id)}))}return s}})}function _Ht(){const{user:t}=Fr();return rr({queryKey:["my-marketplace-orders",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await ee.from("marketplace_orders").select(` *, items:marketplace_order_items(*), status_history:marketplace_order_status_history(*) `).eq("user_id",t.id).order("created_at",{ascending:!1});if(n)throw n;return e},enabled:!!(t!=null&&t.id)})}function bHt(t){return rr({queryKey:["marketplace-order",t],queryFn:async()=>{const{data:e,error:n}=await ee.from("marketplace_orders").select(` *, items:marketplace_order_items(*), status_history:marketplace_order_status_history(*) `).eq("id",t).single();if(n)throw n;return e},enabled:!!t})}function wHt(){const t=Xr(),{user:e}=Fr();return cr({mutationFn:async({orderId:n,status:s,notes:i,trackingNumber:o,trackingUrl:c,previousStatus:a})=>{const f={status:s};o!==void 0&&(f.tracking_number=o),c!==void 0&&(f.tracking_url=c);const{error:m}=await ee.from("marketplace_orders").update(f).eq("id",n);if(m)throw m;const{error:y}=await ee.from("marketplace_order_status_history").insert({order_id:n,status:s,notes:i,created_by:e==null?void 0:e.id});if(y)throw y;if(["shipped","in_production","processing","completed"].includes(s)&&s!==a)try{await ee.functions.invoke("marketplace-order-notify",{body:{orderId:n,notificationType:s==="shipped"?"shipped":"status_update",newStatus:s,trackingNumber:o,trackingUrl:c}})}catch(w){console.error("Failed to send notification email:",w)}},onSuccess:(n,s)=>{t.invalidateQueries({queryKey:["marketplace-orders"]}),t.invalidateQueries({queryKey:["marketplace-order",s.orderId]}),t.invalidateQueries({queryKey:["my-marketplace-orders"]}),Ge.success("Order status updated")},onError:n=>{Ge.error("Failed to update order: "+n.message)}})}function jHt(){const t=Xr();return cr({mutationFn:async({itemId:e,proofUrl:n,proofNotes:s,orderId:i})=>{const{error:o}=await ee.from("marketplace_order_items").update({proof_url:n,proof_notes:s,proof_status:"pending"}).eq("id",e);if(o)throw o;await ee.from("marketplace_orders").update({status:"awaiting_proof_approval"}).eq("id",i);try{await ee.functions.invoke("marketplace-order-notify",{body:{orderId:i,notificationType:"proof_ready"}})}catch(c){console.error("Failed to send proof notification:",c)}return i},onSuccess:e=>{t.invalidateQueries({queryKey:["marketplace-orders"]}),t.invalidateQueries({queryKey:["marketplace-order",e]}),t.invalidateQueries({queryKey:["my-marketplace-orders"]}),Ge.success("Proof uploaded & customer notified")}})}function kHt(){const t=Xr();return cr({mutationFn:async({itemId:e,orderId:n})=>{const{error:s}=await ee.from("marketplace_order_items").update({proof_status:"approved"}).eq("id",e);if(s)throw s;return n},onSuccess:e=>{t.invalidateQueries({queryKey:["marketplace-orders"]}),t.invalidateQueries({queryKey:["marketplace-order",e]}),t.invalidateQueries({queryKey:["my-marketplace-orders"]}),Ge.success("Proof approved")}})}function NHt(){const t=Xr();return cr({mutationFn:async({itemId:e,orderId:n,reason:s})=>{const{error:i}=await ee.from("marketplace_order_items").update({proof_status:"rejected",proof_notes:s}).eq("id",e);if(i)throw i;return n},onSuccess:e=>{t.invalidateQueries({queryKey:["marketplace-orders"]}),t.invalidateQueries({queryKey:["marketplace-order",e]}),t.invalidateQueries({queryKey:["my-marketplace-orders"]}),Ge.success("Proof rejected - please upload a new proof")}})}function SHt(){const{data:t,isLoading:e}=y0e(!1),n=aHt(),s=oHt(),i=lHt(),[o,c]=P.useState(!1),[a,f]=P.useState(null),[m,y]=P.useState({name:"",description:"",image_url:"",sort_order:0,is_active:!0}),v=()=>{y({name:"",description:"",image_url:"",sort_order:0,is_active:!0}),f(null)},w=S=>{f(S),y({name:S.name,description:S.description||"",image_url:S.image_url||"",sort_order:S.sort_order,is_active:S.is_active}),c(!0)},k=async S=>{S.preventDefault(),a?await s.mutateAsync({id:a.id,...m}):await n.mutateAsync(m),c(!1),v()},C=async S=>{confirm("Are you sure you want to delete this category?")&&await i.mutateAsync(S)};return e?r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsx(Gr,{className:"h-8 w-48"})}),r.jsx(Je,{children:r.jsx("div",{className:"space-y-4",children:[1,2,3].map(S=>r.jsx(Gr,{className:"h-12 w-full"},S))})})]}):r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsx(Yt,{children:"Categories"}),r.jsxs($r,{open:o,onOpenChange:S=>{c(S),S||v()},children:[r.jsx(Lo,{asChild:!0,children:r.jsxs(te,{children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Add Category"]})}),r.jsxs(zr,{children:[r.jsx(Zr,{children:r.jsx(Kr,{children:a?"Edit Category":"Add Category"})}),r.jsxs("form",{onSubmit:k,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"name",children:"Name"}),r.jsx(yt,{id:"name",value:m.name,onChange:S=>y({...m,name:S.target.value}),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",value:m.description,onChange:S=>y({...m,description:S.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"image_url",children:"Image URL"}),r.jsx(yt,{id:"image_url",value:m.image_url,onChange:S=>y({...m,image_url:S.target.value}),placeholder:"https://..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"sort_order",children:"Sort Order"}),r.jsx(yt,{id:"sort_order",type:"number",value:m.sort_order,onChange:S=>y({...m,sort_order:parseInt(S.target.value)||0})})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Zs,{id:"is_active",checked:m.is_active,onCheckedChange:S=>y({...m,is_active:S})}),r.jsx(Qe,{htmlFor:"is_active",children:"Active"})]}),r.jsx(te,{type:"submit",className:"w-full",disabled:n.isPending||s.isPending,children:a?"Update Category":"Create Category"})]})]})]})]}),r.jsx(Je,{children:t&&t.length>0?r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"Name"}),r.jsx(At,{children:"Description"}),r.jsx(At,{children:"Sort Order"}),r.jsx(At,{children:"Status"}),r.jsx(At,{className:"text-right",children:"Actions"})]})}),r.jsx(qs,{children:t.map(S=>r.jsxs(Er,{children:[r.jsx(_t,{className:"font-medium",children:S.name}),r.jsx(_t,{className:"max-w-xs truncate",children:S.description}),r.jsx(_t,{children:S.sort_order}),r.jsx(_t,{children:r.jsx("span",{className:`px-2 py-1 rounded-full text-xs ${S.is_active?"bg-green-100 text-green-800":"bg-gray-100 text-gray-800"}`,children:S.is_active?"Active":"Inactive"})}),r.jsx(_t,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>w(S),children:r.jsx(ma,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>C(S.id),disabled:i.isPending,children:r.jsx(Xn,{className:"h-4 w-4 text-destructive"})})]})})]},S.id))})]}):r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No categories yet. Create your first category to get started."})})]})}function CHt(){var Se,oe;const{data:t,isLoading:e}=g$e(void 0,!1),{data:n}=y0e(!1),s=dHt(),i=uHt(),o=hHt(),c=fHt(),a=pHt(),f=mHt(),m=gHt(),y=yHt(),v=xHt(),[w,k]=P.useState(!1),[C,S]=P.useState(!1),[T,I]=P.useState(!1),[A,D]=P.useState(null),[$,F]=P.useState(null),[q,W]=P.useState(!1),[K,Z]=P.useState({name:"",description:"",base_price:0,shipping_fee:0,category_id:"",allow_artwork_upload:!1,requires_proof_approval:!1,is_active:!0,sort_order:0}),[re,he]=P.useState({name:"",price_adjustment:0}),[ue,Ne]=P.useState(""),se=()=>{Z({name:"",description:"",base_price:0,shipping_fee:0,category_id:"",allow_artwork_upload:!1,requires_proof_approval:!1,is_active:!0,sort_order:0}),D(null)},xe=ae=>{D(ae),Z({name:ae.name,description:ae.description||"",base_price:Number(ae.base_price),shipping_fee:Number(ae.shipping_fee),category_id:ae.category_id||"",allow_artwork_upload:ae.allow_artwork_upload,requires_proof_approval:ae.requires_proof_approval,is_active:ae.is_active,sort_order:ae.sort_order}),k(!0)},ie=async ae=>{ae.preventDefault();const je={...K,category_id:K.category_id||null};A?await i.mutateAsync({id:A.id,...je}):await s.mutateAsync(je),k(!1),se()},me=async ae=>{confirm("Are you sure you want to delete this product?")&&await o.mutateAsync(ae)},fe=async ae=>{if(!$||!ae.target.files||ae.target.files.length===0)return;W(!0);const je=ae.target.files[0],Me=je.name.split(".").pop(),Ue=`products/${$.id}/${Date.now()}.${Me}`;try{const{error:Re}=await ee.storage.from("marketplace").upload(Ue,je);if(Re)throw Re;const{data:{publicUrl:$e}}=ee.storage.from("marketplace").getPublicUrl(Ue);await c.mutateAsync({product_id:$.id,image_url:$e,is_primary:!$.images||$.images.length===0}),Ge.success("Image uploaded successfully")}catch(Re){Ge.error("Failed to upload image: "+Re.message)}finally{W(!1)}},ve=async ae=>{ae.preventDefault(),$&&(await m.mutateAsync({product_id:$.id,name:re.name,price_adjustment:re.price_adjustment}),he({name:"",price_adjustment:0}))},Ie=async()=>{!$||!ue||(await v.mutateAsync({productId:$.id,videoUrl:ue}),Ne(""))};return e?r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsx(Gr,{className:"h-8 w-48"})}),r.jsx(Je,{children:r.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[1,2,3].map(ae=>r.jsx(Gr,{className:"h-64 w-full"},ae))})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsx(Yt,{children:"Products"}),r.jsxs($r,{open:w,onOpenChange:ae=>{k(ae),ae||se()},children:[r.jsx(Lo,{asChild:!0,children:r.jsxs(te,{children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Add Product"]})}),r.jsxs(zr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Zr,{children:r.jsx(Kr,{children:A?"Edit Product":"Add Product"})}),r.jsxs("form",{onSubmit:ie,className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"name",children:"Product Name"}),r.jsx(yt,{id:"name",value:K.name,onChange:ae=>Z({...K,name:ae.target.value}),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"category",children:"Category"}),r.jsxs(_n,{value:K.category_id,onValueChange:ae=>Z({...K,category_id:ae}),children:[r.jsx(xn,{children:r.jsx(bn,{placeholder:"Select category"})}),r.jsx(vn,{children:n==null?void 0:n.map(ae=>r.jsx(er,{value:ae.id,children:ae.name},ae.id))})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",value:K.description,onChange:ae=>Z({...K,description:ae.target.value}),rows:4})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"base_price",children:"Base Price ($)"}),r.jsx(yt,{id:"base_price",type:"number",step:"0.01",min:"0",value:K.base_price,onChange:ae=>Z({...K,base_price:parseFloat(ae.target.value)||0}),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"shipping_fee",children:"Shipping Fee ($)"}),r.jsx(yt,{id:"shipping_fee",type:"number",step:"0.01",min:"0",value:K.shipping_fee,onChange:ae=>Z({...K,shipping_fee:parseFloat(ae.target.value)||0})})]})]}),r.jsx("div",{className:"grid grid-cols-2 gap-4",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"sort_order",children:"Sort Order"}),r.jsx(yt,{id:"sort_order",type:"number",value:K.sort_order,onChange:ae=>Z({...K,sort_order:parseInt(ae.target.value)||0})})]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Zs,{id:"allow_artwork_upload",checked:K.allow_artwork_upload,onCheckedChange:ae=>Z({...K,allow_artwork_upload:ae})}),r.jsx(Qe,{htmlFor:"allow_artwork_upload",children:"Allow customer to upload artwork"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Zs,{id:"requires_proof_approval",checked:K.requires_proof_approval,onCheckedChange:ae=>Z({...K,requires_proof_approval:ae})}),r.jsx(Qe,{htmlFor:"requires_proof_approval",children:"Requires proof approval"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Zs,{id:"is_active",checked:K.is_active,onCheckedChange:ae=>Z({...K,is_active:ae})}),r.jsx(Qe,{htmlFor:"is_active",children:"Active"})]})]}),r.jsx(te,{type:"submit",className:"w-full",disabled:s.isPending||i.isPending,children:A?"Update Product":"Create Product"})]})]})]})]}),r.jsx(Je,{children:t&&t.length>0?r.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:t.map(ae=>{var je,Me;return r.jsxs(Ye,{className:"overflow-hidden",children:[r.jsxs("div",{className:"aspect-video bg-muted relative",children:[ae.images&&ae.images.length>0?r.jsx("img",{src:((je=ae.images.find(Ue=>Ue.is_primary))==null?void 0:je.image_url)||ae.images[0].image_url,alt:ae.name,className:"w-full h-full object-cover"}):r.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:"No image"}),!ae.is_active&&r.jsx(Rt,{variant:"secondary",className:"absolute top-2 right-2",children:"Inactive"})]}),r.jsxs(Je,{className:"p-4",children:[r.jsx("h3",{className:"font-semibold mb-1",children:ae.name}),r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:((Me=ae.category)==null?void 0:Me.name)||"No category"}),r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("span",{className:"font-bold",children:["$",Number(ae.base_price).toFixed(2)]}),Number(ae.shipping_fee)>0&&r.jsxs("span",{className:"text-sm text-muted-foreground",children:["+$",Number(ae.shipping_fee).toFixed(2)," shipping"]})]}),r.jsxs("div",{className:"flex flex-wrap gap-1 mb-3",children:[ae.allow_artwork_upload&&r.jsx(Rt,{variant:"outline",className:"text-xs",children:"Artwork Upload"}),ae.requires_proof_approval&&r.jsx(Rt,{variant:"outline",className:"text-xs",children:"Proof Required"}),ae.variants&&ae.variants.length>0&&r.jsxs(Rt,{variant:"outline",className:"text-xs",children:[ae.variants.length," Variants"]})]}),r.jsxs("div",{className:"flex gap-2 flex-wrap",children:[r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>xe(ae),children:[r.jsx(ma,{className:"h-3 w-3 mr-1"}),"Edit"]}),r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>{F(ae),S(!0)},children:[r.jsx(zS,{className:"h-3 w-3 mr-1"}),"Images"]}),r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>{F(ae),I(!0)},children:[r.jsx(Gw,{className:"h-3 w-3 mr-1"}),"Variants"]}),r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>me(ae.id),children:r.jsx(Xn,{className:"h-3 w-3 text-destructive"})})]})]})]},ae.id)})}):r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No products yet. Create your first product to get started."})})]}),r.jsx($r,{open:C,onOpenChange:S,children:r.jsxs(zr,{className:"max-w-2xl",children:[r.jsx(Zr,{children:r.jsxs(Kr,{children:["Manage Images - ",$==null?void 0:$.name]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"grid grid-cols-3 gap-4",children:(Se=$==null?void 0:$.images)==null?void 0:Se.map(ae=>r.jsxs("div",{className:"relative group",children:[r.jsx("img",{src:ae.image_url,alt:"",className:"w-full aspect-square object-cover rounded-lg"}),ae.is_primary&&r.jsx(Rt,{className:"absolute top-2 left-2",variant:"default",children:"Primary"}),r.jsxs("div",{className:"absolute top-2 right-2 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[!ae.is_primary&&r.jsx(te,{variant:"secondary",size:"icon",onClick:async()=>{var je;await f.mutateAsync({imageId:ae.id,productId:$.id}),F({...$,images:(je=$.images)==null?void 0:je.map(Me=>({...Me,is_primary:Me.id===ae.id}))})},disabled:f.isPending,title:"Set as primary",children:r.jsx(Ca,{className:"h-4 w-4"})}),r.jsx(te,{variant:"destructive",size:"icon",onClick:async()=>{var Me;await a.mutateAsync({id:ae.id,productId:$.id});const je=t==null?void 0:t.find(Ue=>Ue.id===$.id);je&&F({...je,images:(Me=je.images)==null?void 0:Me.filter(Ue=>Ue.id!==ae.id)})},disabled:a.isPending,children:r.jsx(Xn,{className:"h-4 w-4"})})]})]},ae.id))}),r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-6 text-center",children:[r.jsx("input",{type:"file",accept:"image/*",onChange:fe,className:"hidden",id:"image-upload",disabled:q}),r.jsxs("label",{htmlFor:"image-upload",className:"cursor-pointer",children:[r.jsx(zS,{className:"h-8 w-8 mx-auto mb-2 text-muted-foreground"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:q?"Uploading...":"Click to upload an image"})]})]}),r.jsxs("div",{className:"border-t pt-4 mt-4",children:[r.jsx(Qe,{children:"Product Video (optional)"}),r.jsxs("div",{className:"flex gap-2 mt-2",children:[r.jsx(yt,{placeholder:"Enter video URL (YouTube, Vimeo, etc.)",value:ue,onChange:ae=>Ne(ae.target.value)}),r.jsxs(te,{onClick:Ie,disabled:!ue,children:[r.jsx(Gi,{className:"h-4 w-4 mr-2"}),"Set Video"]})]}),($==null?void 0:$.video)&&r.jsxs("p",{className:"text-sm text-muted-foreground mt-2",children:["Current video: ",$.video.video_url]})]})]})]})}),r.jsx($r,{open:T,onOpenChange:I,children:r.jsxs(zr,{children:[r.jsx(Zr,{children:r.jsxs(Kr,{children:["Manage Variants - ",$==null?void 0:$.name]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("form",{onSubmit:ve,className:"flex gap-2",children:[r.jsx(yt,{placeholder:"Variant name (e.g., 500 count)",value:re.name,onChange:ae=>he({...re,name:ae.target.value}),required:!0}),r.jsx(yt,{type:"number",step:"0.01",placeholder:"Price adj.",value:re.price_adjustment,onChange:ae=>he({...re,price_adjustment:parseFloat(ae.target.value)||0}),className:"w-32"}),r.jsx(te,{type:"submit",children:"Add"})]}),r.jsxs("div",{className:"space-y-2",children:[(oe=$==null?void 0:$.variants)==null?void 0:oe.map(ae=>r.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted rounded-lg",children:[r.jsxs("div",{children:[r.jsx("span",{className:"font-medium",children:ae.name}),r.jsxs("span",{className:"text-sm text-muted-foreground ml-2",children:[Number(ae.price_adjustment)>=0?"+":"","$",Number(ae.price_adjustment).toFixed(2)]})]}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>y.mutateAsync({id:ae.id,productId:$.id}),children:r.jsx(Xn,{className:"h-4 w-4 text-destructive"})})]},ae.id)),(!($!=null&&$.variants)||$.variants.length===0)&&r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:'No variants yet. Add variants like "250 count", "500 count", etc.'})]})]})]})})]})}const MHt=["pending_payment","order_submitted","awaiting_proof_approval","proof_approved","processing","in_production","shipped","completed","cancelled","refunded"];function THt(){var S,T,I;const{data:t,isLoading:e}=vHt(),n=wHt(),s=jHt(),[i,o]=P.useState(null),[c,a]=P.useState(!1),[f,m]=P.useState({status:"",notes:"",trackingNumber:"",trackingUrl:""}),[y,v]=P.useState(!1),w=A=>{o(A),m({status:A.status,notes:"",trackingNumber:A.tracking_number||"",trackingUrl:A.tracking_url||""}),a(!0)},k=async()=>{i&&(await n.mutateAsync({orderId:i.id,status:f.status,notes:f.notes,trackingNumber:f.trackingNumber,trackingUrl:f.trackingUrl,previousStatus:i.status}),a(!1))},C=async(A,D)=>{if(!i||!A.target.files||A.target.files.length===0)return;v(!0);const $=A.target.files[0],F=$.name.split(".").pop(),q=`proofs/${i.id}/${D}/${Date.now()}.${F}`;try{const{error:W}=await ee.storage.from("marketplace").upload(q,$);if(W)throw W;const{data:{publicUrl:K}}=ee.storage.from("marketplace").getPublicUrl(q);await s.mutateAsync({itemId:D,proofUrl:K,orderId:i.id}),Ge.success("Proof uploaded successfully")}catch(W){Ge.error("Failed to upload proof: "+W.message)}finally{v(!1)}};return e?r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsx(Gr,{className:"h-8 w-48"})}),r.jsx(Je,{children:r.jsx("div",{className:"space-y-4",children:[1,2,3].map(A=>r.jsx(Gr,{className:"h-16 w-full"},A))})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsx(Yt,{children:"Orders"})}),r.jsx(Je,{children:t&&t.length>0?r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"Order #"}),r.jsx(At,{children:"Customer"}),r.jsx(At,{children:"Date"}),r.jsx(At,{children:"Total"}),r.jsx(At,{children:"Status"}),r.jsx(At,{className:"text-right",children:"Actions"})]})}),r.jsx(qs,{children:t.map(A=>{var D,$;return r.jsxs(Er,{children:[r.jsx(_t,{className:"font-mono",children:A.order_number}),r.jsx(_t,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((D=A.user)==null?void 0:D.name)||"Unknown"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:($=A.user)==null?void 0:$.email})]})}),r.jsx(_t,{children:un(new Date(A.created_at),"MMM d, yyyy")}),r.jsxs(_t,{className:"font-bold",children:["$",Number(A.total).toFixed(2)]}),r.jsx(_t,{children:r.jsx(Rt,{className:g0e[A.status],children:p4[A.status]})}),r.jsx(_t,{className:"text-right",children:r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>w(A),children:[r.jsx(Ml,{className:"h-4 w-4 mr-1"}),"View"]})})]},A.id)})})]}):r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No orders yet."})})]}),r.jsx($r,{open:c,onOpenChange:a,children:r.jsxs(zr,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Zr,{children:r.jsxs(Kr,{children:["Order ",i==null?void 0:i.order_number]})}),i&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-2",children:"Customer"}),r.jsx("p",{children:(S=i.user)==null?void 0:S.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:(T=i.user)==null?void 0:T.email})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-2",children:"Shipping Address"}),r.jsx("p",{children:i.shipping_name}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[i.shipping_address,r.jsx("br",{}),i.shipping_city,", ",i.shipping_state," ",i.shipping_zip]})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-2",children:"Order Items"}),r.jsx("div",{className:"space-y-3",children:(I=i.items)==null?void 0:I.map(A=>r.jsxs("div",{className:"border rounded-lg p-4",children:[r.jsxs("div",{className:"flex justify-between items-start mb-2",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:A.product_name}),A.variant_name&&r.jsx("p",{className:"text-sm text-muted-foreground",children:A.variant_name})]}),r.jsxs("p",{className:"font-bold",children:["$",Number(A.unit_price).toFixed(2)," x ",A.quantity]})]}),A.artwork_url&&r.jsxs("div",{className:"mt-2",children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:"Customer Artwork:"}),r.jsx("a",{href:A.artwork_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline text-sm",children:"View Artwork"})]}),r.jsx("div",{className:"mt-3 pt-3 border-t",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"Proof Status: "}),r.jsx(Rt,{variant:A.proof_status==="approved"?"default":"secondary",children:A.proof_status||"No proof yet"})]}),A.proof_url?r.jsx("a",{href:A.proof_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline text-sm",children:"View Proof"}):r.jsxs("div",{children:[r.jsx("input",{type:"file",accept:"image/*,.pdf",onChange:D=>C(D,A.id),className:"hidden",id:`proof-${A.id}`,disabled:y}),r.jsx("label",{htmlFor:`proof-${A.id}`,children:r.jsx(te,{variant:"outline",size:"sm",asChild:!0,children:r.jsxs("span",{children:[r.jsx(Ao,{className:"h-4 w-4 mr-1"}),y?"Uploading...":"Upload Proof"]})})})]})]})})]},A.id))})]}),r.jsxs("div",{className:"border-t pt-4",children:[r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{children:"Subtotal"}),r.jsxs("span",{children:["$",Number(i.subtotal).toFixed(2)]})]}),r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{children:"Shipping"}),r.jsxs("span",{children:["$",Number(i.shipping_total).toFixed(2)]})]}),r.jsxs("div",{className:"flex justify-between font-bold text-lg mt-2",children:[r.jsx("span",{children:"Total"}),r.jsxs("span",{children:["$",Number(i.total).toFixed(2)]})]})]}),r.jsxs("div",{className:"border-t pt-4",children:[r.jsx("h4",{className:"font-medium mb-3",children:"Update Order Status"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Status"}),r.jsxs(_n,{value:f.status,onValueChange:A=>m({...f,status:A}),children:[r.jsx(xn,{children:r.jsx(bn,{})}),r.jsx(vn,{children:MHt.map(A=>r.jsx(er,{value:A,children:p4[A]},A))})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Tracking Number"}),r.jsx(yt,{value:f.trackingNumber,onChange:A=>m({...f,trackingNumber:A.target.value}),placeholder:"Enter tracking number"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Tracking URL"}),r.jsx(yt,{value:f.trackingUrl,onChange:A=>m({...f,trackingUrl:A.target.value}),placeholder:"https://..."})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Notes (optional)"}),r.jsx(ps,{value:f.notes,onChange:A=>m({...f,notes:A.target.value}),placeholder:"Add a note about this status change..."})]}),r.jsxs(te,{onClick:k,disabled:n.isPending,className:"w-full",children:[r.jsx(Tl,{className:"h-4 w-4 mr-2"}),"Update Status"]})]})]}),i.status_history&&i.status_history.length>0&&r.jsxs("div",{className:"border-t pt-4",children:[r.jsx("h4",{className:"font-medium mb-3",children:"Status History"}),r.jsx("div",{className:"space-y-2",children:i.status_history.map(A=>r.jsxs("div",{className:"flex justify-between text-sm p-2 bg-muted rounded",children:[r.jsxs("div",{children:[r.jsx(Rt,{variant:"outline",children:p4[A.status]}),A.notes&&r.jsx("p",{className:"text-muted-foreground mt-1",children:A.notes})]}),r.jsx("span",{className:"text-muted-foreground",children:un(new Date(A.created_at),"MMM d, h:mm a")})]},A.id))})]})]})]})})]})}function AHt(){const[t,e]=P.useState("products"),n=es();return r.jsx(Or,{title:"Marketplace Management",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Marketplace Management"}),r.jsx("p",{className:"text-muted-foreground",children:"Manage products, categories, and orders"})]}),r.jsxs(te,{variant:"outline",onClick:()=>n("/marketplace"),children:[r.jsx(Fs,{className:"h-4 w-4 mr-2"}),"View Store"]})]}),r.jsxs(La,{value:t,onValueChange:e,children:[r.jsxs(Ma,{className:"grid w-full grid-cols-3",children:[r.jsxs(yn,{value:"products",className:"flex items-center gap-2",children:[r.jsx(Tl,{className:"h-4 w-4"}),"Products"]}),r.jsxs(yn,{value:"categories",className:"flex items-center gap-2",children:[r.jsx(My,{className:"h-4 w-4"}),"Categories"]}),r.jsxs(yn,{value:"orders",className:"flex items-center gap-2",children:[r.jsx(sh,{className:"h-4 w-4"}),"Orders"]})]}),r.jsx($n,{value:"products",children:r.jsx(CHt,{})}),r.jsx($n,{value:"categories",children:r.jsx(SHt,{})}),r.jsx($n,{value:"orders",children:r.jsx(THt,{})})]})]})})}function y$e(){return rr({queryKey:["reward-categories"],queryFn:async()=>{const{data:t,error:e}=await ee.from("reward_store_categories").select("*").order("sort_order",{ascending:!0});if(e)throw e;return t}})}function EHt(t){return rr({queryKey:["reward-items",t],queryFn:async()=>{let e=ee.from("reward_store_items").select(` *, category:reward_store_categories(*) `).order("created_at",{ascending:!1});const{data:n,error:s}=await e;if(s)throw s;return n}})}function IHt(t){return rr({queryKey:["active-reward-items",t],queryFn:async()=>{let e=ee.from("reward_store_items").select(` *, category:reward_store_categories(*) `).eq("is_active",!0).order("created_at",{ascending:!1});t&&(e=e.eq("category_id",t));const{data:n,error:s}=await e;if(s)throw s;return n}})}function PHt(t){return rr({queryKey:["user-purchases",t],queryFn:async()=>{if(!t)return[];const{data:e,error:n}=await ee.from("reward_store_purchases").select(` *, item:reward_store_items(*) `).eq("user_id",t).order("purchased_at",{ascending:!1});if(n)throw n;return e},enabled:!!t})}function LHt(){return rr({queryKey:["all-reward-purchases"],queryFn:async()=>{const{data:t,error:e}=await ee.from("reward_store_purchases").select(` *, item:reward_store_items(*) `).order("purchased_at",{ascending:!1});if(e)throw e;if(!t||t.length===0)return[];const n=[...new Set(t.map(c=>c.user_id))],{data:s,error:i}=await ee.from("profiles").select("id, name, email").in("id",n);if(i)throw i;const o=new Map((s==null?void 0:s.map(c=>[c.id,c]))||[]);return t.map(c=>({...c,user:o.get(c.user_id)||null}))}})}function OHt(t){return rr({queryKey:["spendable-points",t],queryFn:async()=>{if(!t)return 0;const{data:e,error:n}=await ee.from("agent_attendance_stats").select("spendable_points").eq("user_id",t).single();if(n&&n.code!=="PGRST116")throw n;return(e==null?void 0:e.spendable_points)||0},enabled:!!t})}function DHt(){const t=Xr();return cr({mutationFn:async e=>{const{data:n,error:s}=await ee.rpc("purchase_reward_item",{p_item_id:e});if(s)throw s;const i=n;if(!i.success)throw new Error(i.error||"Purchase failed");return i},onSuccess:()=>{t.invalidateQueries({queryKey:["user-purchases"]}),t.invalidateQueries({queryKey:["spendable-points"]}),t.invalidateQueries({queryKey:["active-reward-items"]}),t.invalidateQueries({queryKey:["reward-items"]})}})}function RHt(){const t=Xr();return cr({mutationFn:async e=>{const{data:n,error:s}=await ee.from("reward_store_categories").insert([e]).select().single();if(s)throw s;return n},onSuccess:()=>{t.invalidateQueries({queryKey:["reward-categories"]})}})}function FHt(){const t=Xr();return cr({mutationFn:async({id:e,...n})=>{const{data:s,error:i}=await ee.from("reward_store_categories").update(n).eq("id",e).select().single();if(i)throw i;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["reward-categories"]})}})}function zHt(){const t=Xr();return cr({mutationFn:async e=>{const{error:n}=await ee.from("reward_store_categories").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["reward-categories"]})}})}function BHt(){const t=Xr();return cr({mutationFn:async e=>{const{data:n,error:s}=await ee.from("reward_store_items").insert([e]).select().single();if(s)throw s;return n},onSuccess:()=>{t.invalidateQueries({queryKey:["reward-items"]}),t.invalidateQueries({queryKey:["active-reward-items"]})}})}function $Ht(){const t=Xr();return cr({mutationFn:async({id:e,...n})=>{const{data:s,error:i}=await ee.from("reward_store_items").update(n).eq("id",e).select().single();if(i)throw i;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["reward-items"]}),t.invalidateQueries({queryKey:["active-reward-items"]})}})}function UHt(){const t=Xr();return cr({mutationFn:async e=>{const{error:n}=await ee.from("reward_store_items").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["reward-items"]}),t.invalidateQueries({queryKey:["active-reward-items"]})}})}function qHt(t){const e=t.match(/\/storage\/v1\/object\/public\/([^/]+)\/(.+)$/);return e?{bucket:e[1],path:e[2]}:null}async function rde(t,e){const n=qHt(t);if(n)try{const{data:s,error:i}=await ee.storage.from(n.bucket).download(n.path);if(i){console.error("Error downloading file:",i),Ge.error("Failed to download file");return}const o=URL.createObjectURL(s),c=document.createElement("a");c.href=o,c.download=e||n.path.split("/").pop()||"download",document.body.appendChild(c),c.click(),document.body.removeChild(c),setTimeout(()=>URL.revokeObjectURL(o),100)}catch(s){console.error("Download error:",s),Ge.error("Failed to download file")}else try{const i=await(await fetch(t)).blob(),o=URL.createObjectURL(i),c=document.createElement("a");c.href=o,c.download=e||t.split("/").pop()||"download",document.body.appendChild(c),c.click(),document.body.removeChild(c),setTimeout(()=>URL.revokeObjectURL(o),100)}catch(s){console.error("External download error:",s),Ge.error("Failed to download file")}}function x$e(){return rr({queryKey:["point-reward-settings"],queryFn:async()=>{const{data:t,error:e}=await ee.from("point_reward_settings").select("*").order("action_name");if(e)throw e;return t}})}function VHt(){const t=Xr();return cr({mutationFn:async({id:e,points:n,is_active:s})=>{const i={points:n};s!==void 0&&(i.is_active=s);const{data:o,error:c}=await ee.from("point_reward_settings").update(i).eq("id",e).select().single();if(c)throw c;return o},onSuccess:()=>{t.invalidateQueries({queryKey:["point-reward-settings"]})}})}function HHt(){const{user:t}=Fr(),[e,n]=P.useState("items"),[s,i]=P.useState(!1),[o,c]=P.useState(null),[a,f]=P.useState(""),[m,y]=P.useState(""),[v,w]=P.useState(""),[k,C]=P.useState(null),[S,T]=P.useState(!1),[I,A]=P.useState(null),[D,$]=P.useState(""),[F,q]=P.useState(""),[W,K]=P.useState(null),[Z,re]=P.useState(""),[he,ue]=P.useState("file"),[Ne,se]=P.useState(""),[xe,ie]=P.useState(""),[me,fe]=P.useState(""),[ve,Ie]=P.useState(!0),[Se,oe]=P.useState(null),[ae,je]=P.useState(!1),[Me,Ue]=P.useState(!1),Re=P.useRef(null),$e=P.useRef(null),{data:Pe,isLoading:Ae}=y$e(),{data:nt,isLoading:Te}=EHt(),{data:Xe,isLoading:ge}=LHt(),{data:mt,isLoading:rt}=x$e(),We=RHt(),Ce=FHt(),et=zHt(),Fe=BHt(),Ke=$Ht(),Le=UHt(),ft=VHt(),[Nt,Mt]=P.useState({}),It=wr=>{wr?(c(wr),f(wr.name),y(wr.description||""),w(wr.icon||"")):(c(null),f(""),y(""),w("")),i(!0)},tr=async()=>{if(!a.trim()){Ge.error("Please enter a category name");return}try{o?(await Ce.mutateAsync({id:o.id,name:a,description:m||null,icon:v||null}),Ge.success("Category updated successfully")):(await We.mutateAsync({name:a,description:m||null,icon:v||null,sort_order:((Pe==null?void 0:Pe.length)||0)+1}),Ge.success("Category created successfully")),i(!1)}catch(wr){console.error("Error saving category:",wr),Ge.error("Failed to save category")}},Mr=async()=>{if(k)try{await et.mutateAsync(k),Ge.success("Category deleted successfully"),C(null)}catch(wr){console.error("Error deleting category:",wr),Ge.error("Failed to delete category")}},pn=wr=>{var Ts;wr?(A(wr),$(wr.name),q(wr.description||""),K(wr.category_id),re(wr.points_cost.toString()),ue(wr.item_type),se(wr.file_url||""),ie(wr.preview_image_url||""),fe(((Ts=wr.max_quantity)==null?void 0:Ts.toString())||""),Ie(wr.is_active)):(A(null),$(""),q(""),K(null),re(""),ue("file"),se(""),ie(""),fe(""),Ie(!0)),T(!0)},fs=async(wr,Ts)=>{Ts==="file"?je(!0):Ue(!0);try{const ii=wr.name.split(".").pop(),mi=`${Date.now()}-${Math.random().toString(36).substring(7)}.${ii}`,Ta=`${Ts==="file"?"items":"previews"}/${mi}`,{error:ga}=await ee.storage.from("reward-store").upload(Ta,wr);if(ga)throw ga;const{data:{publicUrl:vl}}=ee.storage.from("reward-store").getPublicUrl(Ta);Ts==="file"?se(vl):ie(vl),Ge.success("File uploaded successfully")}catch(ii){console.error("Error uploading file:",ii),Ge.error("Failed to upload file")}finally{Ts==="file"?je(!1):Ue(!1)}},Qn=async()=>{if(!D.trim()){Ge.error("Please enter an item name");return}if(!Z||parseInt(Z)<0){Ge.error("Please enter a valid points cost");return}try{const wr={name:D,description:F||null,category_id:W,points_cost:parseInt(Z),item_type:he,file_url:Ne||null,preview_image_url:xe||null,max_quantity:me?parseInt(me):null,current_quantity:me?parseInt(me):null,is_active:ve,created_by:t==null?void 0:t.id};I?(await Ke.mutateAsync({id:I.id,...wr,current_quantity:I.max_quantity!==(me?parseInt(me):null)?me?parseInt(me):null:I.current_quantity}),Ge.success("Item updated successfully")):(await Fe.mutateAsync(wr),Ge.success("Item created successfully")),T(!1)}catch(wr){console.error("Error saving item:",wr),Ge.error("Failed to save item")}},js=async()=>{if(Se)try{await Le.mutateAsync(Se),Ge.success("Item deleted successfully"),oe(null)}catch(wr){console.error("Error deleting item:",wr),Ge.error("Failed to delete item")}},Qs=async(wr,Ts)=>{const ii=Nt[wr];if(ii===void 0||ii===Ts.toString())return;const mi=parseInt(ii);if(isNaN(mi)||mi<0){Ge.error("Please enter a valid positive number");return}try{await ft.mutateAsync({id:wr,points:mi}),Ge.success("Points updated successfully"),Mt(Ta=>{const ga={...Ta};return delete ga[wr],ga})}catch(Ta){console.error("Error updating points:",Ta),Ge.error("Failed to update points")}};return Ae||Te||ge||rt?r.jsx(Or,{title:"Reward Store",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Gr,{className:"h-8 w-64"}),r.jsx(Gr,{className:"h-96"})]})}):r.jsxs(Or,{title:"Reward Store",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Reward Store Management"}),r.jsx("p",{className:"text-muted-foreground",children:"Manage store items that agents can purchase with their points"})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsx(Ye,{children:r.jsxs(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Tl,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Total Items"})]}),r.jsx("p",{className:"text-2xl font-bold",children:(nt==null?void 0:nt.length)||0}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[(nt==null?void 0:nt.filter(wr=>wr.is_active).length)||0," active"]})]})}),r.jsx(Ye,{children:r.jsxs(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(My,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Categories"})]}),r.jsx("p",{className:"text-2xl font-bold",children:(Pe==null?void 0:Pe.length)||0})]})}),r.jsx(Ye,{children:r.jsxs(Je,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Ca,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Avg. Cost"})]}),r.jsxs("p",{className:"text-2xl font-bold",children:[nt&&nt.length>0?Math.round(nt.reduce((wr,Ts)=>wr+Ts.points_cost,0)/nt.length):0," pts"]})]})})]}),r.jsxs(La,{value:e,onValueChange:n,children:[r.jsxs(Ma,{children:[r.jsx(yn,{value:"items",children:"Items"}),r.jsx(yn,{value:"categories",children:"Categories"}),r.jsx(yn,{value:"purchases",children:"Purchases"}),r.jsx(yn,{value:"point-settings",children:"Point Settings"})]}),r.jsx($n,{value:"items",className:"mt-4",children:r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Yt,{children:"Store Items"}),r.jsx(An,{children:"Manage rewards that agents can purchase"})]}),r.jsxs(te,{onClick:()=>pn(),children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Add Item"]})]}),r.jsx(Je,{children:!nt||nt.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Qa,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No items yet. Add your first reward item!"})]}):r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"Item"}),r.jsx(At,{children:"Category"}),r.jsx(At,{className:"text-center",children:"Cost"}),r.jsx(At,{className:"text-center",children:"Type"}),r.jsx(At,{className:"text-center",children:"Quantity"}),r.jsx(At,{className:"text-center",children:"Status"}),r.jsx(At,{className:"text-right",children:"Actions"})]})}),r.jsx(qs,{children:nt.map(wr=>r.jsxs(Er,{children:[r.jsx(_t,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[wr.preview_image_url?r.jsx("img",{src:wr.preview_image_url,alt:wr.name,className:"h-10 w-10 rounded object-cover"}):r.jsx("div",{className:"h-10 w-10 rounded bg-muted flex items-center justify-center",children:r.jsx(Qa,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:wr.name}),r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1",children:wr.description||"No description"})]})]})}),r.jsx(_t,{children:wr.category?r.jsx(Rt,{variant:"outline",children:wr.category.name}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(_t,{className:"text-center",children:r.jsxs(Rt,{variant:"secondary",className:"font-bold",children:[r.jsx(Ca,{className:"h-3 w-3 mr-1"}),wr.points_cost]})}),r.jsx(_t,{className:"text-center",children:r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[wr.item_type==="file"?r.jsx(Ai,{className:"h-4 w-4 text-muted-foreground"}):r.jsx(bo,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-xs capitalize",children:wr.item_type})]})}),r.jsx(_t,{className:"text-center",children:wr.max_quantity!==null?r.jsxs("span",{className:wr.current_quantity===0?"text-red-500":"",children:[wr.current_quantity,"/",wr.max_quantity]}):r.jsx("span",{className:"text-muted-foreground",children:"Unlimited"})}),r.jsx(_t,{className:"text-center",children:r.jsx(Rt,{variant:wr.is_active?"default":"secondary",children:wr.is_active?"Active":"Inactive"})}),r.jsx(_t,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>pn(wr),children:r.jsx(ma,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>oe(wr.id),children:r.jsx(Xn,{className:"h-4 w-4 text-destructive"})})]})})]},wr.id))})]})})]})}),r.jsx($n,{value:"categories",className:"mt-4",children:r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Yt,{children:"Categories"}),r.jsx(An,{children:"Organize your store items into categories"})]}),r.jsxs(te,{onClick:()=>It(),children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Add Category"]})]}),r.jsx(Je,{children:!Pe||Pe.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(My,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No categories yet. Add your first category!"})]}):r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"Name"}),r.jsx(At,{children:"Description"}),r.jsx(At,{className:"text-center",children:"Items"}),r.jsx(At,{className:"text-right",children:"Actions"})]})}),r.jsx(qs,{children:Pe.map(wr=>r.jsxs(Er,{children:[r.jsxs(_t,{className:"font-medium",children:[wr.icon&&r.jsx("span",{className:"mr-2",children:wr.icon}),wr.name]}),r.jsx(_t,{className:"text-muted-foreground",children:wr.description||"—"}),r.jsx(_t,{className:"text-center",children:(nt==null?void 0:nt.filter(Ts=>Ts.category_id===wr.id).length)||0}),r.jsx(_t,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>It(wr),children:r.jsx(ma,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>C(wr.id),children:r.jsx(Xn,{className:"h-4 w-4 text-destructive"})})]})})]},wr.id))})]})})]})}),r.jsx($n,{value:"purchases",className:"mt-4",children:r.jsxs(Ye,{children:[r.jsxs(Ht,{children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(sh,{className:"h-5 w-5"}),"Purchase History"]}),r.jsx(An,{children:"View all reward redemptions by agents"})]}),r.jsx(Je,{children:!Xe||Xe.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(sh,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No purchases yet."})]}):r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"Date"}),r.jsx(At,{children:"Agent"}),r.jsx(At,{children:"Item"}),r.jsx(At,{className:"text-center",children:"Points Spent"})]})}),r.jsx(qs,{children:Xe.map(wr=>{var Ts,ii,mi,Ta;return r.jsxs(Er,{children:[r.jsx(_t,{className:"text-muted-foreground",children:un(new Date(wr.purchased_at),"MMM d, yyyy 'at' h:mm a")}),r.jsx(_t,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"h-8 w-8 rounded-full bg-muted flex items-center justify-center",children:r.jsx(jc,{className:"h-4 w-4 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((Ts=wr.user)==null?void 0:Ts.name)||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:((ii=wr.user)==null?void 0:ii.email)||"—"})]})]})}),r.jsx(_t,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[(mi=wr.item)!=null&&mi.preview_image_url?r.jsx("img",{src:wr.item.preview_image_url,alt:wr.item.name,className:"h-8 w-8 rounded object-cover"}):r.jsx("div",{className:"h-8 w-8 rounded bg-muted flex items-center justify-center",children:r.jsx(Qa,{className:"h-4 w-4 text-muted-foreground"})}),r.jsx("span",{children:((Ta=wr.item)==null?void 0:Ta.name)||"Deleted item"})]})}),r.jsx(_t,{className:"text-center",children:r.jsxs(Rt,{variant:"secondary",className:"font-bold",children:[r.jsx(Ca,{className:"h-3 w-3 mr-1"}),wr.points_spent]})})]},wr.id)})})]})})]})})]})]}),r.jsx($r,{open:s,onOpenChange:i,children:r.jsxs(zr,{children:[r.jsxs(Zr,{children:[r.jsx(Kr,{children:o?"Edit Category":"Add Category"}),r.jsx(ls,{children:o?"Update the category details":"Create a new category for your store items"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"categoryName",children:"Name"}),r.jsx(yt,{id:"categoryName",value:a,onChange:wr=>f(wr.target.value),placeholder:"e.g., Templates, Resources"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"categoryDescription",children:"Description"}),r.jsx(ps,{id:"categoryDescription",value:m,onChange:wr=>y(wr.target.value),placeholder:"Optional description..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"categoryIcon",children:"Icon (emoji)"}),r.jsx(yt,{id:"categoryIcon",value:v,onChange:wr=>w(wr.target.value),placeholder:"e.g., 📄, 🎁"})]})]}),r.jsxs(ni,{children:[r.jsx(te,{variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(te,{onClick:tr,disabled:We.isPending||Ce.isPending,children:We.isPending||Ce.isPending?"Saving...":"Save"})]})]})}),r.jsx($r,{open:S,onOpenChange:T,children:r.jsxs(zr,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsxs(Zr,{children:[r.jsx(Kr,{children:I?"Edit Item":"Add Item"}),r.jsx(ls,{children:I?"Update the item details":"Create a new reward item for agents to purchase"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"itemName",children:"Name *"}),r.jsx(yt,{id:"itemName",value:D,onChange:wr=>$(wr.target.value),placeholder:"e.g., Premium Template Pack"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"itemDescription",children:"Description"}),r.jsx(ps,{id:"itemDescription",value:F,onChange:wr=>q(wr.target.value),placeholder:"Describe the item..."})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"itemCategory",children:"Category"}),r.jsxs(_n,{value:W||"none",onValueChange:wr=>K(wr==="none"?null:wr),children:[r.jsx(xn,{children:r.jsx(bn,{placeholder:"Select category"})}),r.jsxs(vn,{children:[r.jsx(er,{value:"none",children:"No category"}),Pe==null?void 0:Pe.map(wr=>r.jsxs(er,{value:wr.id,children:[wr.icon&&`${wr.icon} `,wr.name]},wr.id))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"itemPointsCost",children:"Points Cost *"}),r.jsx(yt,{id:"itemPointsCost",type:"number",min:"0",value:Z,onChange:wr=>re(wr.target.value),placeholder:"e.g., 100"})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"itemType",children:"Type"}),r.jsxs(_n,{value:he,onValueChange:ue,children:[r.jsx(xn,{children:r.jsx(bn,{})}),r.jsxs(vn,{children:[r.jsx(er,{value:"file",children:"File Download"}),r.jsx(er,{value:"link",children:"External Link"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"itemMaxQuantity",children:"Max Quantity"}),r.jsx(yt,{id:"itemMaxQuantity",type:"number",min:"1",value:me,onChange:wr=>fe(wr.target.value),placeholder:"Leave empty for unlimited"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"File / Link URL"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(yt,{value:Ne,onChange:wr=>se(wr.target.value),placeholder:he==="file"?"Upload a file or paste URL":"Paste external link"}),he==="file"&&r.jsxs(r.Fragment,{children:[r.jsx(te,{type:"button",variant:"outline",size:"icon",onClick:()=>{var wr;return(wr=Re.current)==null?void 0:wr.click()},disabled:ae,children:r.jsx(Ao,{className:"h-4 w-4"})}),r.jsx("input",{ref:Re,type:"file",className:"hidden",onChange:wr=>{var ii;const Ts=(ii=wr.target.files)==null?void 0:ii[0];Ts&&fs(Ts,"file")}})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{children:"Preview Image"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(yt,{value:xe,onChange:wr=>ie(wr.target.value),placeholder:"Upload an image or paste URL"}),r.jsx(te,{type:"button",variant:"outline",size:"icon",onClick:()=>{var wr;return(wr=$e.current)==null?void 0:wr.click()},disabled:Me,children:r.jsx(Wo,{className:"h-4 w-4"})}),r.jsx("input",{ref:$e,type:"file",accept:"image/*",className:"hidden",onChange:wr=>{var ii;const Ts=(ii=wr.target.files)==null?void 0:ii[0];Ts&&fs(Ts,"preview")}})]}),xe&&r.jsx("img",{src:xe,alt:"Preview",className:"mt-2 h-24 rounded object-cover"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Zs,{id:"itemIsActive",checked:ve,onCheckedChange:Ie}),r.jsx(Qe,{htmlFor:"itemIsActive",children:"Active (visible to agents)"})]})]}),r.jsxs(ni,{children:[r.jsx(te,{variant:"outline",onClick:()=>T(!1),children:"Cancel"}),r.jsx(te,{onClick:Qn,disabled:Fe.isPending||Ke.isPending,children:Fe.isPending||Ke.isPending?"Saving...":"Save"})]})]})}),r.jsx(ih,{open:!!k,onOpenChange:()=>C(null),children:r.jsxs(yu,{children:[r.jsxs(xu,{children:[r.jsx(_u,{children:"Delete Category"}),r.jsx(bu,{children:"Are you sure you want to delete this category? Items in this category will become uncategorized."})]}),r.jsxs(vu,{children:[r.jsx(wu,{children:"Cancel"}),r.jsx(Hd,{onClick:Mr,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),r.jsx(ih,{open:!!Se,onOpenChange:()=>oe(null),children:r.jsxs(yu,{children:[r.jsxs(xu,{children:[r.jsx(_u,{children:"Delete Item"}),r.jsx(bu,{children:"Are you sure you want to delete this item? This action cannot be undone."})]}),r.jsxs(vu,{children:[r.jsx(wu,{children:"Cancel"}),r.jsx(Hd,{onClick:js,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),e==="point-settings"&&r.jsxs(Ye,{className:"mt-4",children:[r.jsx(Ht,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(id,{className:"h-5 w-5"}),r.jsxs("div",{children:[r.jsx(Yt,{children:"Point Reward Settings"}),r.jsx(An,{children:"Configure how many points agents earn for various actions. Adjust these values to run double-points promotions."})]})]})}),r.jsx(Je,{children:!mt||mt.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(id,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No point settings configured."})]}):r.jsxs($s,{children:[r.jsx(Us,{children:r.jsxs(Er,{children:[r.jsx(At,{children:"Action"}),r.jsx(At,{children:"Description"}),r.jsx(At,{className:"text-center w-32",children:"Points"}),r.jsx(At,{className:"text-right w-24",children:"Save"})]})}),r.jsx(qs,{children:mt.map(wr=>r.jsxs(Er,{children:[r.jsx(_t,{children:r.jsx("p",{className:"font-medium",children:wr.action_name})}),r.jsx(_t,{children:r.jsx("p",{className:"text-sm text-muted-foreground",children:wr.description})}),r.jsx(_t,{className:"text-center",children:r.jsx(yt,{type:"number",min:"0",className:"w-20 mx-auto text-center",value:Nt[wr.id]??wr.points.toString(),onChange:Ts=>Mt(ii=>({...ii,[wr.id]:Ts.target.value}))})}),r.jsx(_t,{className:"text-right",children:r.jsx(te,{size:"sm",variant:"outline",disabled:Nt[wr.id]===void 0||Nt[wr.id]===wr.points.toString()||ft.isPending,onClick:()=>Qs(wr.id,wr.points),children:r.jsx(dg,{className:"h-4 w-4"})})})]},wr.id))})]})})]})]})}function WHt(){const t=Xr(),[e,n]=P.useState(!1),{data:s,isLoading:i}=rr({queryKey:["social-accounts"],queryFn:async()=>{const{data:m,error:y}=await ee.from("social_accounts").select("*").order("created_at",{ascending:!1});if(y)throw y;return m}}),o=cr({mutationFn:async m=>{const{error:y}=await ee.from("social_accounts").delete().eq("id",m);if(y)throw y},onSuccess:()=>{t.invalidateQueries({queryKey:["social-accounts"]}),Ge.success("Account disconnected successfully")},onError:()=>{Ge.error("Failed to disconnect account")}}),c=async()=>{n(!0);try{const{data:m,error:y}=await ee.functions.invoke("meta-oauth",{body:{action:"get_auth_url"}});if(y)throw y;if(m!=null&&m.authUrl)window.location.href=m.authUrl;else throw new Error("Failed to get authorization URL")}catch(m){console.error("Meta OAuth error:",m),Ge.error("Failed to start connection. Make sure Meta App credentials are configured."),n(!1)}},a=(s==null?void 0:s.filter(m=>m.platform==="facebook"))||[],f=(s==null?void 0:s.filter(m=>m.platform==="instagram"))||[];return r.jsx(Or,{children:r.jsxs("div",{className:"space-y-6 p-4 md:p-8",children:[r.jsx(Ou,{title:"Integrations",description:"Connect your social media accounts to post directly from the dashboard"}),r.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-blue-500/10 p-2",children:r.jsx(Md,{className:"h-6 w-6 text-blue-600"})}),r.jsxs("div",{children:[r.jsx(Yt,{className:"text-lg",children:"Facebook"}),r.jsx(An,{children:"Connect Facebook Pages to post content"})]})]})}),r.jsxs(Je,{className:"space-y-4",children:[a.length>0?r.jsx("div",{className:"space-y-3",children:a.map(m=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(Li,{className:"h-10 w-10",children:[r.jsx(Io,{src:m.profile_picture_url||""}),r.jsx(Oi,{children:r.jsx(Md,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:m.page_name||m.platform_username||"Facebook Page"}),r.jsx(Rt,{variant:m.is_active?"default":"secondary",className:"text-xs",children:m.is_active?"Connected":"Inactive"})]})]}),r.jsxs(ih,{children:[r.jsx(C0,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Xn,{className:"h-4 w-4"})})}),r.jsxs(yu,{children:[r.jsxs(xu,{children:[r.jsx(_u,{children:"Disconnect Facebook?"}),r.jsx(bu,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(vu,{children:[r.jsx(wu,{children:"Cancel"}),r.jsx(Hd,{onClick:()=>o.mutate(m.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},m.id))}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No Facebook accounts connected"}),r.jsxs(te,{onClick:c,disabled:e,className:"w-full gap-2",variant:"outline",children:[e?r.jsx(Dl,{className:"h-4 w-4 animate-spin"}):r.jsx(Sn,{className:"h-4 w-4"}),"Connect Facebook Page"]})]})]}),r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-gradient-to-br from-purple-500/10 via-pink-500/10 to-orange-500/10 p-2",children:r.jsx(Wd,{className:"h-6 w-6 text-pink-600"})}),r.jsxs("div",{children:[r.jsx(Yt,{className:"text-lg",children:"Instagram"}),r.jsx(An,{children:"Connect Instagram Business accounts"})]})]})}),r.jsxs(Je,{className:"space-y-4",children:[f.length>0?r.jsx("div",{className:"space-y-3",children:f.map(m=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(Li,{className:"h-10 w-10",children:[r.jsx(Io,{src:m.profile_picture_url||""}),r.jsx(Oi,{children:r.jsx(Wd,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium",children:["@",m.platform_username||"Instagram Account"]}),r.jsx(Rt,{variant:m.is_active?"default":"secondary",className:"text-xs",children:m.is_active?"Connected":"Inactive"})]})]}),r.jsxs(ih,{children:[r.jsx(C0,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Xn,{className:"h-4 w-4"})})}),r.jsxs(yu,{children:[r.jsxs(xu,{children:[r.jsx(_u,{children:"Disconnect Instagram?"}),r.jsx(bu,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(vu,{children:[r.jsx(wu,{children:"Cancel"}),r.jsx(Hd,{onClick:()=>o.mutate(m.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},m.id))}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No Instagram accounts connected"}),r.jsxs(te,{onClick:c,disabled:e,className:"w-full gap-2",variant:"outline",children:[e?r.jsx(Dl,{className:"h-4 w-4 animate-spin"}):r.jsx(Sn,{className:"h-4 w-4"}),"Connect Instagram Business"]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Note: Instagram Business accounts must be connected to a Facebook Page"})]})]})]}),r.jsxs(Ye,{children:[r.jsxs(Ht,{children:[r.jsx(Yt,{className:"text-lg",children:"Setup Instructions"}),r.jsx(An,{children:"Follow these steps to set up Meta integration"})]}),r.jsxs(Je,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-3 text-sm",children:[r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-primary/10 text-xs font-medium",children:"1"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Create a Meta App"}),r.jsx("p",{className:"text-muted-foreground",children:"Go to developers.facebook.com and create a new app"})]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-primary/10 text-xs font-medium",children:"2"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Add Facebook Login Product"}),r.jsx("p",{className:"text-muted-foreground",children:"Enable Facebook Login and configure OAuth redirect URLs"})]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-primary/10 text-xs font-medium",children:"3"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Configure API Keys"}),r.jsx("p",{className:"text-muted-foreground",children:"Add META_APP_ID and META_APP_SECRET to your environment"})]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-primary/10 text-xs font-medium",children:"4"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Request Permissions"}),r.jsx("p",{className:"text-muted-foreground",children:"Request pages_manage_posts, pages_read_engagement, instagram_basic, and instagram_content_publish"})]})]})]}),r.jsx(te,{variant:"outline",className:"gap-2",asChild:!0,children:r.jsxs("a",{href:"https://developers.facebook.com/apps",target:"_blank",rel:"noopener noreferrer",children:[r.jsx(Fs,{className:"h-4 w-4"}),"Open Meta Developer Console"]})})]})]})]})})}const GHt={new_events:{label:"New Events",icon:"📅"},new_templates:{label:"New Templates",icon:"📄"},new_toolbox:{label:"New Toolbox Resources",icon:"🧰"},new_social_swag:{label:"New Social Swag",icon:"🎨"},new_newsletters:{label:"New Newsletters",icon:"📰"},new_community_posts:{label:"New Community Posts",icon:"💬"}};function E5(t,e=18,n=10){return t.length<=e+n+3?t:`${t.slice(0,e)}…${t.slice(-n)}`}function KHt(){var he,ue,Ne,se,xe;const t=Xr(),[e,n]=P.useState("Test Push"),[s,i]=P.useState("Testing web push notification"),[o,c]=P.useState("/community"),[a,f]=P.useState(!1),[m,y]=P.useState(!1),[v,w]=P.useState({isSupported:typeof window<"u"&&"serviceWorker"in navigator&&"PushManager"in window}),[k,C]=P.useState(null),[S,T]=P.useState(null),{data:I,isLoading:A}=rr({queryKey:["push-notification-settings"],queryFn:async()=>{const{data:ie,error:me}=await ee.from("push_notification_settings").select("*").order("setting_key");if(me)throw me;return ie}}),{data:D,isLoading:$}=rr({queryKey:["push-subscription-stats"],queryFn:async()=>{const{count:ie,error:me}=await ee.from("push_subscriptions").select("*",{count:"exact",head:!0});if(me)throw me;return{totalSubscriptions:ie||0}}}),F=cr({mutationFn:async({settingKey:ie,isEnabled:me})=>{const{error:fe}=await ee.from("push_notification_settings").update({is_enabled:me}).eq("setting_key",ie);if(fe)throw fe},onSuccess:()=>{t.invalidateQueries({queryKey:["push-notification-settings"]}),Ge.success("Notification setting updated")},onError:ie=>{Ge.error("Failed to update setting: "+ie.message)}}),q=P.useMemo(()=>{var ie,me;return v.isSupported?`perm=${v.permission??"unknown"} · controller=${v.controllerPresent?"yes":"no"} · sw=${((ie=v.serviceWorker)==null?void 0:ie.activeState)??"unknown"} · sub=${(me=v.subscription)!=null&&me.endpoint?"yes":"no"}`:"Push not supported in this browser."},[v]);P.useEffect(()=>{let ie=!0;const me=async()=>{var Se,oe,ae,je,Me,Ue,Re;const ve="serviceWorker"in navigator&&"PushManager"in window,Ie={isSupported:ve,permission:typeof Notification<"u"?Notification.permission:void 0,controllerPresent:!!((Se=navigator.serviceWorker)!=null&&Se.controller)};if(!ve){ie&&w(Ie);return}try{const{data:$e,error:Pe}=await ee.functions.invoke("get-vapid-public-key",{body:{}});if(Pe)throw Pe;Ie.vapidPublicKey=$e==null?void 0:$e.vapidPublicKey;const nt=(await navigator.serviceWorker.getRegistrations()).find(Te=>{var ge,mt,rt;return(((ge=Te.active)==null?void 0:ge.scriptURL)||((mt=Te.waiting)==null?void 0:mt.scriptURL)||((rt=Te.installing)==null?void 0:rt.scriptURL)||"").includes("/sw.js")});if(nt){Ie.pushWorkerScriptUrl=((oe=nt.active)==null?void 0:oe.scriptURL)||((ae=nt.waiting)==null?void 0:ae.scriptURL)||((je=nt.installing)==null?void 0:je.scriptURL),Ie.serviceWorker={scope:nt.scope,activeState:(Me=nt.active)==null?void 0:Me.state};const Te=await nt.pushManager.getSubscription();if(Te){const Xe=Te.toJSON();Ie.subscription={endpoint:Xe.endpoint,p256dh:(Ue=Xe.keys)==null?void 0:Ue.p256dh,auth:(Re=Xe.keys)==null?void 0:Re.auth}}}}catch($e){Ie.error=($e==null?void 0:$e.message)||String($e)}ie&&w(Ie)};me();const fe=window.setInterval(me,4e3);return()=>{ie=!1,window.clearInterval(fe)}},[]);const W=async()=>{if(typeof Notification>"u"){Ge.error("Notifications API not available in this browser.");return}try{if(Notification.permission!=="granted"&&await Notification.requestPermission()!=="granted"){Ge.error("Notification permission not granted.");return}new Notification("Local notification test",{body:"If you see this, OS/browser notifications can display."}),Ge.success("Triggered a local notification (not push).")}catch(ie){Ge.error(`Local notification failed: ${(ie==null?void 0:ie.message)||String(ie)}`)}},K=async()=>{f(!0),C(null);try{const{data:ie,error:me}=await ee.functions.invoke("send-push-notification",{body:{title:e,body:s,url:o}});if(me)throw me;C({sent:ie==null?void 0:ie.sent,failed:ie==null?void 0:ie.failed,expiredCleaned:ie==null?void 0:ie.expiredCleaned,vapidPublicKey:ie==null?void 0:ie.vapidPublicKey}),(ie==null?void 0:ie.sent)>0?Ge.success(`Test notification sent to ${ie.sent} subscriber(s)`):(ie==null?void 0:ie.failed)>0?Ge.warning(`Notification failed for ${ie.failed} subscriber(s). ${ie.expired||0} expired subscriptions cleaned up.`):Ge.info("No active subscriptions to send to")}catch(ie){console.error("Error sending test notification:",ie),C({error:(ie==null?void 0:ie.message)||String(ie)}),Ge.error("Failed to send test notification: "+(ie.message||"Unknown error"))}finally{f(!1)}},Z=async()=>{y(!0),T(null);try{const{data:ie,error:me}=await ee.functions.invoke("generate-vapid-keys",{body:{}});if(me)throw me;const fe=ie==null?void 0:ie.publicKey,ve=ie==null?void 0:ie.privateKey;if(!fe||!ve)throw new Error("generate-vapid-keys did not return keys");T({publicKey:fe,privateKey:ve}),Ge.success("Generated new VAPID keys. Update backend secrets, then clear + re-subscribe.")}catch(ie){console.error("Error generating VAPID keys:",ie),Ge.error("Failed to generate VAPID keys: "+((ie==null?void 0:ie.message)||"Unknown error"))}finally{y(!1)}},re=cr({mutationFn:async()=>{const{error:ie}=await ee.from("push_subscriptions").delete().neq("id","00000000-0000-0000-0000-000000000000");if(ie)throw ie},onSuccess:()=>{Ge.success("All subscriptions cleared. Users will need to re-enable notifications."),t.invalidateQueries({queryKey:["push-subscription-stats"]})},onError:ie=>{Ge.error("Failed to clear subscriptions: "+ie.message)}});return r.jsx(Or,{title:"Notification Settings",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ou,{title:"Notification Settings",description:"Manage push notifications and test the notification system"}),r.jsxs(Ye,{children:[r.jsxs(Ht,{children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(hs,{className:"h-5 w-5"}),"Push Notification Subscribers"]}),r.jsx(An,{children:"Current active push notification subscriptions"})]}),r.jsx(Je,{children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"text-4xl font-bold",children:$?"...":(D==null?void 0:D.totalSubscriptions)||0}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"active subscriptions"})]})})]}),r.jsxs(Ye,{children:[r.jsxs(Ht,{children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(id,{className:"h-5 w-5"}),"Notification Types"]}),r.jsx(An,{children:"Control which types of push notifications are sent to users"})]}),r.jsx(Je,{children:A?r.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading settings..."}):r.jsx("div",{className:"space-y-4",children:I==null?void 0:I.map(ie=>{const me=GHt[ie.setting_key]||{label:ie.setting_key,icon:"🔔"};return r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"text-2xl",children:me.icon}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:me.label}),r.jsx("div",{className:"text-sm text-muted-foreground",children:ie.description})]})]}),r.jsx(Zs,{checked:ie.is_enabled,onCheckedChange:fe=>F.mutate({settingKey:ie.setting_key,isEnabled:fe}),disabled:F.isPending})]},ie.id)})})})]}),r.jsxs(Ye,{children:[r.jsxs(Ht,{children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(ag,{className:"h-5 w-5"}),"Send Test Notification"]}),r.jsx(An,{children:"Send a test push notification to all subscribed users"})]}),r.jsxs(Je,{className:"space-y-4",children:[r.jsxs("div",{className:"rounded-md border bg-muted/30 p-3 text-sm",children:[r.jsx("div",{className:"font-medium",children:"Client push debug"}),r.jsx("div",{className:"mt-1 text-muted-foreground",children:q}),v.error&&r.jsx("div",{className:"mt-2 text-destructive",children:v.error}),r.jsxs("div",{className:"mt-2 grid gap-2 sm:grid-cols-2",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Backend VAPID public key"}),r.jsx("div",{className:"break-all rounded-md border bg-background p-2 font-mono text-xs",children:v.vapidPublicKey?E5(v.vapidPublicKey):"(not loaded)"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Service worker"}),r.jsxs("div",{className:"rounded-md border bg-background p-2 font-mono text-xs",children:[r.jsxs("div",{children:["scope: ",(he=v.serviceWorker)!=null&&he.scope?E5(v.serviceWorker.scope,24,8):"none"]}),r.jsxs("div",{children:["active: ",((ue=v.serviceWorker)==null?void 0:ue.activeState)??"none"]})]})]}),r.jsxs("div",{className:"space-y-1 sm:col-span-2",children:[r.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Current browser subscription"}),r.jsxs("div",{className:"rounded-md border bg-background p-2 font-mono text-xs",children:[r.jsxs("div",{children:["endpoint: ",(Ne=v.subscription)!=null&&Ne.endpoint?E5(v.subscription.endpoint,40,12):"none"]}),r.jsxs("div",{children:["p256dh: ",(se=v.subscription)!=null&&se.p256dh?E5(v.subscription.p256dh,22,10):"none"]}),r.jsxs("div",{children:["auth: ",(xe=v.subscription)!=null&&xe.auth?E5(v.subscription.auth,22,10):"none"]})]})]})]}),r.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[r.jsx(te,{variant:"outline",onClick:W,children:"Local notification test"}),r.jsx(te,{variant:"outline",onClick:()=>window.location.reload(),children:"Reload page"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"test-title",children:"Notification Title"}),r.jsx(yt,{id:"test-title",value:e,onChange:ie=>n(ie.target.value),placeholder:"Enter notification title"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"test-body",children:"Notification Body"}),r.jsx(ps,{id:"test-body",value:s,onChange:ie=>i(ie.target.value),placeholder:"Enter notification message",rows:3})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"test-url",children:"Click URL (optional)"}),r.jsx(yt,{id:"test-url",value:o,onChange:ie=>c(ie.target.value),placeholder:"/community or full URL"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Where users will be taken when they click the notification"})]}),r.jsxs(te,{onClick:K,disabled:a||!e||!s,className:"w-full sm:w-auto",children:[r.jsx(To,{className:"h-4 w-4 mr-2"}),a?"Sending...":"Send Test Notification"]}),k&&r.jsxs("div",{className:"rounded-md border bg-muted/30 p-3 text-sm",children:[r.jsx("div",{className:"font-medium",children:"Last send debug"}),k.error?r.jsxs("div",{className:"mt-1 text-destructive",children:["Error: ",k.error]}):r.jsxs("div",{className:"mt-1 space-y-1 text-muted-foreground",children:[r.jsxs("div",{children:["Result: ",k.sent??0," sent, ",k.failed??0," failed, ",k.expiredCleaned??0," expired cleaned"]}),k.vapidPublicKey?r.jsxs("div",{className:"break-all",children:["Backend VAPID public key: ",r.jsx("span",{className:"font-mono",children:k.vapidPublicKey})]}):r.jsx("div",{children:"Backend VAPID public key: (not returned)"})]})]})]})]}),r.jsxs(Ye,{children:[r.jsxs(Ht,{children:[r.jsxs(Yt,{className:"flex items-center gap-2 text-destructive",children:[r.jsx(Xn,{className:"h-5 w-5"}),"Subscription Maintenance"]}),r.jsx(An,{children:"Clear all push subscriptions if VAPID keys were changed or subscriptions are invalid"})]}),r.jsxs(Je,{className:"space-y-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"If you've recently updated the VAPID keys, existing subscriptions will no longer work. Use this to clear all subscriptions so users can re-subscribe with the new keys."}),r.jsxs(te,{variant:"destructive",onClick:()=>re.mutate(),disabled:re.isPending,children:[r.jsx(Xn,{className:"h-4 w-4 mr-2"}),re.isPending?"Clearing...":"Clear All Subscriptions"]}),r.jsxs("div",{className:"rounded-md border bg-muted/30 p-3 text-sm",children:[r.jsx("div",{className:"font-medium",children:"VAPID key rotation helper"}),r.jsx("div",{className:"mt-1 text-muted-foreground",children:"If you suspect the backend public/private keys don’t match, generate a fresh pair, update backend secrets, then clear subscriptions and have users re-enable push."}),r.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:r.jsx(te,{variant:"outline",onClick:Z,disabled:m,children:m?"Generating…":"Generate VAPID keys"})}),S&&r.jsxs("div",{className:"mt-3 space-y-2",children:[r.jsxs("div",{className:"text-muted-foreground",children:["Copy these into backend secrets ",r.jsx("span",{className:"font-mono",children:"VAPID_PUBLIC_KEY"})," and ",r.jsx("span",{className:"font-mono",children:"VAPID_PRIVATE_KEY"}),"."]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Public key"}),r.jsx("div",{className:"break-all rounded-md border bg-background p-2 font-mono text-xs",children:S.publicKey})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Private key (keep secret)"}),r.jsx("div",{className:"break-all rounded-md border bg-background p-2 font-mono text-xs",children:S.privateKey})]})]})]})]})]})]})})}function ZHt(){const[t]=Ed(),e=es(),[n,s]=P.useState("loading"),[i,o]=P.useState("Processing connection...");return P.useEffect(()=>{(async()=>{const a=t.get("code"),f=t.get("error"),m=t.get("error_description"),y=t.get("state");if(f){s("error"),o(m||"Authorization was denied"),Ge.error("Failed to connect: "+(m||f));return}if(!a){s("error"),o("No authorization code received"),Ge.error("Failed to connect: No authorization code");return}try{const{data:v,error:w}=await ee.functions.invoke("meta-oauth",{body:{action:"exchange_code",code:a,state:y}});if(w)throw w;if(v!=null&&v.success)s("success"),o(v.message||"Accounts connected successfully!"),Ge.success(v.message||"Social accounts connected!");else throw new Error((v==null?void 0:v.error)||"Failed to connect accounts")}catch(v){console.error("Callback error:",v),s("error"),o(v.message||"Failed to complete connection"),Ge.error(v.message||"Failed to connect accounts")}})()},[t]),r.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:r.jsxs(Ye,{className:"w-full max-w-md",children:[r.jsxs(Ht,{className:"text-center",children:[r.jsxs("div",{className:"mx-auto mb-4",children:[n==="loading"&&r.jsx(sn,{className:"h-12 w-12 animate-spin text-primary"}),n==="success"&&r.jsx(za,{className:"h-12 w-12 text-green-500"}),n==="error"&&r.jsx(Lc,{className:"h-12 w-12 text-destructive"})]}),r.jsxs(Yt,{children:[n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(An,{children:i})]}),r.jsx(Je,{className:"flex justify-center",children:r.jsx(te,{onClick:()=>e("/admin/integrations"),children:n==="success"?"View Integrations":"Back to Integrations"})})]})})}function YHt(){const t=es(),e=Xr(),{isAdmin:n}=Fr(),[s,i]=P.useState(!1),[o,c]=P.useState(null),[a,f]=P.useState(null),{data:m,isLoading:y}=rr({queryKey:["my-social-accounts"],queryFn:async()=>{const{data:{user:F},error:q}=await ee.auth.getUser();if(q)throw q;if(!F)return[];const{data:W,error:K}=await ee.from("social_accounts").select("*").eq("user_id",F.id).order("created_at",{ascending:!1});if(K)throw K;return W}}),v=cr({mutationFn:async F=>{const{data:{user:q},error:W}=await ee.auth.getUser();if(W)throw W;if(!q)throw new Error("Not authenticated");const{error:K}=await ee.from("social_accounts").delete().eq("id",F).eq("user_id",q.id);if(K)throw K},onSuccess:()=>{e.invalidateQueries({queryKey:["my-social-accounts"]}),e.invalidateQueries({queryKey:["social-accounts-for-post"]}),Ge.success("Account disconnected successfully")},onError:()=>{Ge.error("Failed to disconnect account")}}),w=async()=>{i(!0);try{const{data:F,error:q}=await ee.functions.invoke("meta-oauth",{body:{action:"get_auth_url",callbackPath:"/social-connections/callback"}});if(q)throw q;if(F!=null&&F.authUrl)window.location.href=F.authUrl;else throw new Error("Failed to get authorization URL")}catch(F){console.error("Meta OAuth error:",F),Ge.error("Failed to start connection. Please try again."),i(!1)}},k=async()=>{i(!0);try{const{data:F,error:q}=await ee.functions.invoke("linkedin-oauth",{body:{action:"get_auth_url",callbackPath:"/social-connections/linkedin-callback"}});if(q)throw q;if(F!=null&&F.authUrl)window.location.href=F.authUrl;else throw new Error("Failed to get LinkedIn authorization URL")}catch(F){console.error("LinkedIn OAuth error:",F),Ge.error("Failed to start LinkedIn connection. Please try again."),i(!1)}},C=async()=>{i(!0);try{const{data:F,error:q}=await ee.functions.invoke("google-business-oauth",{body:{action:"get_auth_url"}});if(q)throw q;if(F!=null&&F.authUrl)window.location.href=F.authUrl;else throw new Error("Failed to get Google authorization URL")}catch(F){console.error("Google OAuth error:",F),Ge.error("Failed to start Google connection. Please try again."),i(!1)}},S=(m==null?void 0:m.filter(F=>F.platform==="facebook"))||[],T=(m==null?void 0:m.filter(F=>F.platform==="instagram"))||[],I=(m==null?void 0:m.filter(F=>F.platform==="linkedin"))||[],A=(m==null?void 0:m.filter(F=>F.platform==="google_business"))||[],D=((m==null?void 0:m.length)||0)>0,$=async(F,q)=>{c(F),f(null);try{const{data:W,error:K}=await ee.functions.invoke("meta-api-test",{body:{testType:"all",accountId:F}});if(K)throw K;f(W.results||[]),Ge.success(W.summary||"API tests completed")}catch(W){console.error("Meta API test error:",W),Ge.error("Failed to run API tests")}finally{c(null)}};return r.jsx(Or,{title:"Social Connections",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"relative overflow-hidden rounded-2xl bg-gradient-to-br from-pink-500 via-purple-500 to-blue-500 p-6 md:p-8 text-white",children:[r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmYiIGZpbGwtb3BhY2l0eT0iMC4xIj48cGF0aCBkPSJNMzYgMzRjMC0yIDItNCAyLTRzMiAyIDIgNC0yIDQtMiA0LTItMi0yLTR6Ii8+PC9nPjwvZz48L3N2Zz4=')] opacity-30"}),r.jsxs("div",{className:"relative",children:[r.jsx("div",{className:"flex items-center gap-2 mb-3",children:r.jsxs(Rt,{variant:"secondary",className:"bg-white/20 text-white border-0 backdrop-blur-sm",children:[r.jsx(Mi,{className:"h-3 w-3 mr-1"}),"Post directly from Social Swag"]})}),r.jsx("h1",{className:"text-2xl md:text-3xl font-bold mb-2",children:"Connect Your Social Accounts"}),r.jsx("p",{className:"text-white/90 max-w-xl",children:"Link your Facebook Pages and Instagram Business accounts to post content directly from Social Swag with one click."})]})]}),r.jsxs(te,{variant:"ghost",onClick:()=>t("/social-swag-2"),className:"gap-2",children:[r.jsx(Va,{className:"h-4 w-4"}),"Back to Social Swag"]}),!n&&r.jsx(Ye,{className:"border-amber-200 bg-amber-50 dark:bg-amber-950/20 dark:border-amber-800",children:r.jsxs(Je,{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx("div",{className:"rounded-full bg-amber-100 dark:bg-amber-900/30 p-4 mb-4",children:r.jsx(Xi,{className:"h-10 w-10 text-amber-600 dark:text-amber-400"})}),r.jsx(Rt,{variant:"secondary",className:"mb-3 bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-400",children:"Coming Soon"}),r.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Social Connections Coming Soon!"}),r.jsx("p",{className:"text-muted-foreground max-w-md",children:"We're putting the finishing touches on this feature. Soon you'll be able to connect your social accounts and post directly from Social Swag with one click."})]})}),n&&r.jsxs(r.Fragment,{children:[D&&r.jsx(Ye,{className:"border-green-200 bg-green-50 dark:bg-green-950/20 dark:border-green-900",children:r.jsxs(Je,{className:"flex items-center gap-4 p-4",children:[r.jsx("div",{className:"rounded-full bg-green-500 p-2",children:r.jsx(za,{className:"h-5 w-5 text-white"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-green-800 dark:text-green-200",children:"You're all set!"}),r.jsx("p",{className:"text-sm text-green-600 dark:text-green-400",children:"You can now post directly to your connected accounts from Social Swag."})]})]})}),r.jsxs("div",{className:"grid gap-6 md:grid-cols-2 lg:grid-cols-3",children:[r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-blue-500/10 p-3",children:r.jsx(Md,{className:"h-6 w-6 text-blue-600"})}),r.jsxs("div",{children:[r.jsx(Yt,{className:"text-lg",children:"Facebook"}),r.jsx(An,{children:"Connect your Facebook Pages"})]})]})}),r.jsxs(Je,{className:"space-y-4",children:[y?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Dl,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):S.length>0?r.jsx("div",{className:"space-y-3",children:S.map(F=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(Li,{className:"h-10 w-10",children:[r.jsx(Io,{src:F.profile_picture_url||""}),r.jsx(Oi,{children:r.jsx(Md,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:F.page_name||F.platform_username||"Facebook Page"}),r.jsx(Rt,{variant:F.is_active?"default":"secondary",className:"text-xs",children:F.is_active?"Connected":"Inactive"})]})]}),r.jsxs(ih,{children:[r.jsx(C0,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Xn,{className:"h-4 w-4"})})}),r.jsxs(yu,{children:[r.jsxs(xu,{children:[r.jsx(_u,{children:"Disconnect Facebook?"}),r.jsx(bu,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(vu,{children:[r.jsx(wu,{children:"Cancel"}),r.jsx(Hd,{onClick:()=>v.mutate(F.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},F.id))}):r.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No Facebook pages connected yet"}),r.jsxs(te,{onClick:w,disabled:s,className:"w-full gap-2",variant:S.length>0?"outline":"default",children:[s?r.jsx(Dl,{className:"h-4 w-4 animate-spin"}):r.jsx(Sn,{className:"h-4 w-4"}),S.length>0?"Connect Another Page":"Connect Facebook Page"]})]})]}),r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-gradient-to-br from-purple-500/10 via-pink-500/10 to-orange-500/10 p-3",children:r.jsx(Wd,{className:"h-6 w-6 text-pink-600"})}),r.jsxs("div",{children:[r.jsx(Yt,{className:"text-lg",children:"Instagram"}),r.jsx(An,{children:"Connect Instagram Business accounts"})]})]})}),r.jsxs(Je,{className:"space-y-4",children:[y?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Dl,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):T.length>0?r.jsx("div",{className:"space-y-3",children:T.map(F=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(Li,{className:"h-10 w-10",children:[r.jsx(Io,{src:F.profile_picture_url||""}),r.jsx(Oi,{children:r.jsx(Wd,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium",children:["@",F.platform_username||"Instagram Account"]}),r.jsx(Rt,{variant:F.is_active?"default":"secondary",className:"text-xs",children:F.is_active?"Connected":"Inactive"})]})]}),r.jsxs(ih,{children:[r.jsx(C0,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Xn,{className:"h-4 w-4"})})}),r.jsxs(yu,{children:[r.jsxs(xu,{children:[r.jsx(_u,{children:"Disconnect Instagram?"}),r.jsx(bu,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(vu,{children:[r.jsx(wu,{children:"Cancel"}),r.jsx(Hd,{onClick:()=>v.mutate(F.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},F.id))}):r.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No Instagram accounts connected yet"}),r.jsxs(te,{onClick:w,disabled:s,className:"w-full gap-2",variant:T.length>0?"outline":"default",children:[s?r.jsx(Dl,{className:"h-4 w-4 animate-spin"}):r.jsx(Sn,{className:"h-4 w-4"}),T.length>0?"Connect Another Account":"Connect Instagram"]}),r.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Instagram Business accounts must be connected to a Facebook Page"})]})]}),r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-blue-600/10 p-3",children:r.jsx(tm,{className:"h-6 w-6 text-blue-700"})}),r.jsxs("div",{children:[r.jsx(Yt,{className:"text-lg",children:"LinkedIn"}),r.jsx(An,{children:"Connect your LinkedIn profile"})]})]})}),r.jsxs(Je,{className:"space-y-4",children:[y?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Dl,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):I.length>0?r.jsx("div",{className:"space-y-3",children:I.map(F=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(Li,{className:"h-10 w-10",children:[r.jsx(Io,{src:F.profile_picture_url||""}),r.jsx(Oi,{children:r.jsx(tm,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:F.platform_username||"LinkedIn Account"}),r.jsx(Rt,{variant:F.is_active?"default":"secondary",className:"text-xs",children:F.is_active?"Connected":"Inactive"})]})]}),r.jsxs(ih,{children:[r.jsx(C0,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Xn,{className:"h-4 w-4"})})}),r.jsxs(yu,{children:[r.jsxs(xu,{children:[r.jsx(_u,{children:"Disconnect LinkedIn?"}),r.jsx(bu,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(vu,{children:[r.jsx(wu,{children:"Cancel"}),r.jsx(Hd,{onClick:()=>v.mutate(F.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},F.id))}):r.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No LinkedIn account connected yet"}),r.jsxs(te,{onClick:k,disabled:s,className:"w-full gap-2",variant:I.length>0?"outline":"default",children:[s?r.jsx(Dl,{className:"h-4 w-4 animate-spin"}):r.jsx(Sn,{className:"h-4 w-4"}),I.length>0?"Reconnect LinkedIn":"Connect LinkedIn"]}),r.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Share content directly to your LinkedIn profile"})]})]}),r.jsxs(Ye,{className:`relative overflow-hidden ${n?"":"opacity-75"}`,children:[!n&&r.jsx("div",{className:"absolute top-3 right-3 z-10",children:r.jsx(Rt,{variant:"secondary",className:"bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-400",children:"Coming Soon"})}),n&&r.jsx("div",{className:"absolute top-3 right-3 z-10",children:r.jsx(Rt,{variant:"secondary",className:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400",children:"Admin Testing"})}),r.jsx(Ht,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-red-500/10 p-3",children:r.jsx(yl,{className:"h-6 w-6 text-red-600"})}),r.jsxs("div",{children:[r.jsx(Yt,{className:"text-lg",children:"Google Business"}),r.jsx(An,{children:"Connect your Google Business Profile"})]})]})}),r.jsxs(Je,{className:"space-y-4",children:[y?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Dl,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):A.length>0?r.jsx("div",{className:"space-y-3",children:A.map(F=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(Li,{className:"h-10 w-10",children:[r.jsx(Io,{src:F.profile_picture_url||""}),r.jsx(Oi,{children:r.jsx(yl,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:F.page_name||F.platform_username||"Google Business"}),r.jsx(Rt,{variant:F.is_active?"default":"secondary",className:"text-xs",children:F.is_active?"Connected":"Inactive"})]})]}),r.jsxs(ih,{children:[r.jsx(C0,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Xn,{className:"h-4 w-4"})})}),r.jsxs(yu,{children:[r.jsxs(xu,{children:[r.jsx(_u,{children:"Disconnect Google Business?"}),r.jsx(bu,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(vu,{children:[r.jsx(wu,{children:"Cancel"}),r.jsx(Hd,{onClick:()=>v.mutate(F.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},F.id))}):r.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:n?"No Google Business account connected yet":"Google Business Profile integration is coming soon!"}),r.jsxs(te,{onClick:n?C:void 0,disabled:!n||s,className:"w-full gap-2",variant:A.length>0?"outline":"default",children:[s?r.jsx(Dl,{className:"h-4 w-4 animate-spin"}):r.jsx(Sn,{className:"h-4 w-4"}),A.length>0?"Reconnect Google Business":"Connect Google Business"]}),r.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Post updates directly to your Google Business Profile"})]})]})]}),n&&(S.length>0||T.length>0)&&r.jsxs(Ye,{className:"border-amber-200 bg-amber-50 dark:bg-amber-950/20 dark:border-amber-900",children:[r.jsx(Ht,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-amber-500/10 p-3",children:r.jsx(qw,{className:"h-6 w-6 text-amber-600"})}),r.jsxs("div",{children:[r.jsx(Yt,{className:"text-lg",children:"Meta API Testing (Admin Only)"}),r.jsx(An,{children:"Run API tests to trigger all required permissions for Meta App Review"})]})]})}),r.jsxs(Je,{className:"space-y-4",children:[r.jsxs("p",{className:"text-sm text-muted-foreground",children:['Click "Run Tests" on an account to trigger API calls for: ',r.jsx("strong",{children:"public_profile"}),", ",r.jsx("strong",{children:"pages_show_list"}),", ",r.jsx("strong",{children:"pages_read_engagement"}),", ",r.jsx("strong",{children:"instagram_basic"}),", ",r.jsx("strong",{children:"pages_manage_posts"}),", and ",r.jsx("strong",{children:"instagram_content_publish"}),"."]}),r.jsxs("div",{className:"space-y-3",children:[S.map(F=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border bg-background p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Md,{className:"h-5 w-5 text-blue-600"}),r.jsx("span",{className:"font-medium",children:F.page_name||"Facebook Page"})]}),r.jsx(te,{size:"sm",variant:"outline",onClick:()=>$(F.id),disabled:o===F.id,children:o===F.id?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),"Testing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(qw,{className:"h-4 w-4 mr-2"}),"Run Tests"]})})]},`test-fb-${F.id}`)),T.map(F=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border bg-background p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Wd,{className:"h-5 w-5 text-pink-600"}),r.jsxs("span",{className:"font-medium",children:["@",F.platform_username||"Instagram"]})]}),r.jsx(te,{size:"sm",variant:"outline",onClick:()=>$(F.id),disabled:o===F.id,children:o===F.id?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),"Testing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(qw,{className:"h-4 w-4 mr-2"}),"Run Tests"]})})]},`test-ig-${F.id}`))]}),a&&a.length>0&&r.jsxs("div",{className:"mt-4 rounded-lg border bg-background p-4",children:[r.jsx("h4",{className:"font-medium mb-3",children:"Test Results"}),r.jsx("div",{className:"space-y-2",children:a.map((F,q)=>r.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[F.status==="success"?r.jsx(io,{className:"h-4 w-4 text-green-600 mt-0.5 shrink-0"}):F.status==="pending"?r.jsx(sn,{className:"h-4 w-4 text-amber-600 mt-0.5 shrink-0"}):r.jsx(Lc,{className:"h-4 w-4 text-red-600 mt-0.5 shrink-0"}),r.jsxs("div",{children:[r.jsx("span",{className:"font-mono text-xs bg-muted px-1 rounded",children:F.test}),r.jsx("span",{className:"ml-2 text-muted-foreground",children:F.details})]})]},q))})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Note: Facebook posts are auto-deleted. Instagram posts will remain and should be manually deleted. Allow up to 24 hours for Meta to register the API calls."})]})]}),r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsx(Yt,{className:"text-lg",children:"How it works"})}),r.jsx(Je,{children:r.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground text-sm font-medium",children:"1"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Connect your accounts"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Link your Facebook, Instagram, or LinkedIn account"})]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground text-sm font-medium",children:"2"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Browse Social Swag"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Find the perfect image and caption for your post"})]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground text-sm font-medium",children:"3"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Post with one click"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:'Click "Create Post" to share directly to your accounts'})]})]})]})})]})]})]})})}function XHt(){const[t]=Ed(),e=es(),[n,s]=P.useState("loading"),[i,o]=P.useState("Processing your connection...");return P.useEffect(()=>{(async()=>{var v;const a=t.get("code"),f=t.get("error"),m=t.get("error_description"),y=t.get("state");if(f){s("error"),o(m||"Authorization was denied"),Ge.error("Connection failed: "+(m||f));return}if(!a){s("error"),o("No authorization code received"),Ge.error("No authorization code received");return}try{const{data:w,error:k}=await ee.functions.invoke("meta-oauth",{body:{action:"exchange_code",code:a,state:y,callbackPath:"/social-connections/callback"}});if(k)throw k;if(w!=null&&w.success)s("success"),o(`Successfully connected ${((v=w.accounts)==null?void 0:v.length)||0} account(s)!`),Ge.success("Social accounts connected successfully!");else throw new Error((w==null?void 0:w.error)||"Unknown error")}catch(w){console.error("OAuth callback error:",w),s("error"),o(w instanceof Error?w.message:"Failed to connect accounts"),Ge.error("Failed to connect: "+(w instanceof Error?w.message:"Unknown error"))}})()},[t]),r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:r.jsxs(Ye,{className:"w-full max-w-md",children:[r.jsxs(Ht,{className:"text-center",children:[n==="loading"&&r.jsx(sn,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),n==="success"&&r.jsx(za,{className:"h-12 w-12 mx-auto text-green-500"}),n==="error"&&r.jsx(Lc,{className:"h-12 w-12 mx-auto text-destructive"}),r.jsxs(Yt,{className:"mt-4",children:[n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(An,{children:i})]}),r.jsx(Je,{className:"flex justify-center",children:n!=="loading"&&r.jsx(te,{onClick:()=>e("/social-connections"),children:n==="success"?"View Connected Accounts":"Try Again"})})]})})}function QHt(){const[t]=Ed(),e=es(),[n,s]=P.useState("loading"),[i,o]=P.useState("Connecting your Google Business Profile...");return P.useEffect(()=>{(async()=>{const a=t.get("code"),f=t.get("error"),m=t.get("error_description"),y=t.get("state");if(f){s("error"),o(m||"Authorization was denied"),Ge.error("Connection failed: "+(m||f));return}if(!a){s("error"),o("No authorization code received"),Ge.error("No authorization code received");return}try{const{data:v,error:w}=await ee.functions.invoke("google-business-oauth",{body:{action:"exchange_code",code:a,state:y}});if(w)throw w;if(v!=null&&v.success)s("success"),o(v.message||"Successfully connected Google Business Profile!"),Ge.success("Google Business Profile connected!");else throw new Error((v==null?void 0:v.error)||"Unknown error")}catch(v){console.error("Google OAuth callback error:",v),s("error"),o(v instanceof Error?v.message:"Failed to connect Google Business Profile"),Ge.error("Failed to connect: "+(v instanceof Error?v.message:"Unknown error"))}})()},[t]),r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:r.jsxs(Ye,{className:"w-full max-w-md",children:[r.jsxs(Ht,{className:"text-center",children:[n==="loading"&&r.jsx(sn,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),n==="success"&&r.jsx(za,{className:"h-12 w-12 mx-auto text-green-500"}),n==="error"&&r.jsx(Lc,{className:"h-12 w-12 mx-auto text-destructive"}),r.jsxs(Yt,{className:"mt-4",children:[n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(An,{children:i})]}),r.jsx(Je,{className:"flex justify-center",children:n!=="loading"&&r.jsx(te,{onClick:()=>e("/social-connections"),children:n==="success"?"View Connected Accounts":"Try Again"})})]})})}function JHt(){const[t]=Ed(),e=es(),[n,s]=P.useState("loading"),[i,o]=P.useState("Connecting your LinkedIn account...");return P.useEffect(()=>{(async()=>{var v;const a=t.get("code"),f=t.get("state"),m=t.get("error"),y=t.get("error_description");if(m){console.error("LinkedIn OAuth error:",m,y),s("error"),o(y||"Failed to connect LinkedIn account"),Ge.error(y||"Failed to connect LinkedIn");return}if(!a){s("error"),o("No authorization code received"),Ge.error("No authorization code received");return}try{const{data:w,error:k}=await ee.functions.invoke("linkedin-oauth",{body:{action:"exchange_code",code:a,state:f,callbackPath:"/social-connections/linkedin-callback"}});if(k)throw k;if(w!=null&&w.success)s("success"),o(`Successfully connected ${((v=w.accounts)==null?void 0:v.length)||1} LinkedIn account`),Ge.success("LinkedIn connected successfully!");else throw new Error((w==null?void 0:w.error)||"Failed to connect LinkedIn account")}catch(w){console.error("LinkedIn callback error:",w),s("error"),o(w instanceof Error?w.message:"Failed to connect LinkedIn account"),Ge.error("Failed to connect LinkedIn")}})()},[t]),r.jsx("div",{className:"min-h-screen flex items-center justify-center p-4 bg-background",children:r.jsxs(Ye,{className:"w-full max-w-md",children:[r.jsxs(Ht,{className:"text-center",children:[r.jsxs("div",{className:"mx-auto mb-4 rounded-full bg-blue-600/10 p-4 w-fit",children:[n==="loading"&&r.jsx(sn,{className:"h-8 w-8 animate-spin text-blue-600"}),n==="success"&&r.jsx(za,{className:"h-8 w-8 text-green-600"}),n==="error"&&r.jsx(Lc,{className:"h-8 w-8 text-red-600"})]}),r.jsxs(Yt,{className:"flex items-center justify-center gap-2",children:[r.jsx(tm,{className:"h-5 w-5 text-blue-600"}),n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(An,{children:i})]}),r.jsx(Je,{className:"flex justify-center",children:r.jsx(te,{onClick:()=>e("/social-connections"),disabled:n==="loading",children:n==="success"?"Continue":"Back to Connections"})})]})})}function eWt(){const t=es(),[e,n]=P.useState(null),{data:s,isLoading:i}=g$e(e||void 0,!0),{data:o,isLoading:c}=y0e(!0),{cartItems:a}=dse(),f=a.reduce((y,v)=>y+v.quantity,0),m=y=>{t(`/marketplace/${y.id}`)};return i||c?r.jsx(Or,{title:"Marketplace",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"flex gap-2 overflow-x-auto pb-2",children:[1,2,3].map(y=>r.jsx(Gr,{className:"h-10 w-24 flex-shrink-0"},y))}),r.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:[1,2,3,4].map(y=>r.jsx(Gr,{className:"h-72 w-full"},y))})]})}):r.jsx(Or,{title:"Marketplace",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-5xl font-bold text-foreground",children:"Marketplace"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Shop exclusive products for LevelUp members"})]}),r.jsxs(te,{variant:"outline",onClick:()=>t("/marketplace/cart"),className:"relative",children:[r.jsx(sh,{className:"h-4 w-4 mr-2"}),"Cart",f>0&&r.jsx(Rt,{className:"absolute -top-2 -right-2 h-5 w-5 flex items-center justify-center p-0 text-xs",children:f})]})]}),o&&o.length>0&&r.jsxs("div",{className:"flex gap-2 overflow-x-auto pb-2",children:[r.jsx(te,{variant:e===null?"default":"outline",size:"sm",onClick:()=>n(null),children:"All"}),o.map(y=>r.jsx(te,{variant:e===y.id?"default":"outline",size:"sm",onClick:()=>n(y.id),children:y.name},y.id))]}),s&&s.length>0?r.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:s.map(y=>{var v;return r.jsxs(Ye,{className:"overflow-hidden cursor-pointer hover:shadow-lg transition-shadow",onClick:()=>m(y),children:[r.jsxs("div",{className:"aspect-square bg-muted relative",children:[y.images&&y.images.length>0?r.jsx("img",{src:((v=y.images.find(w=>w.is_primary))==null?void 0:v.image_url)||y.images[0].image_url,alt:y.name,className:"w-full h-full object-cover"}):r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx(Tl,{className:"h-12 w-12 text-muted-foreground"})}),y.category&&r.jsx(Rt,{className:"absolute top-2 left-2",variant:"secondary",children:y.category.name})]}),r.jsxs(Je,{className:"p-4",children:[r.jsx("h3",{className:"font-semibold mb-1 line-clamp-1",children:y.name}),y.description&&r.jsx("p",{className:"text-sm text-muted-foreground mb-2 line-clamp-2",children:y.description}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"font-bold text-lg",children:["$",Number(y.base_price).toFixed(2)]}),y.variants&&y.variants.length>0&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:[y.variants.length," options"]})]})]})]},y.id)})}):r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Tl,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"No products available yet."})]})]})})}const v$e=P.forwardRef(({...t},e)=>r.jsx("nav",{ref:e,"aria-label":"breadcrumb",...t}));v$e.displayName="Breadcrumb";const _$e=P.forwardRef(({className:t,...e},n)=>r.jsx("ol",{ref:n,className:zt("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",t),...e}));_$e.displayName="BreadcrumbList";const dee=P.forwardRef(({className:t,...e},n)=>r.jsx("li",{ref:n,className:zt("inline-flex items-center gap-1.5",t),...e}));dee.displayName="BreadcrumbItem";const Cpe=P.forwardRef(({asChild:t,className:e,...n},s)=>{const i=t?Sme:"a";return r.jsx(i,{ref:s,className:zt("transition-colors hover:text-foreground",e),...n})});Cpe.displayName="BreadcrumbLink";const b$e=P.forwardRef(({className:t,...e},n)=>r.jsx("span",{ref:n,role:"link","aria-disabled":"true","aria-current":"page",className:zt("font-normal text-foreground",t),...e}));b$e.displayName="BreadcrumbPage";const Mpe=({children:t,className:e,...n})=>r.jsx("li",{role:"presentation","aria-hidden":"true",className:zt("[&>svg]:size-3.5",e),...n,children:t??r.jsx(Ha,{})});Mpe.displayName="BreadcrumbSeparator";function tWt(){var Ne,se;const{productId:t}=dd(),e=es(),{data:n,isLoading:s}=cHt(t||""),{addToCart:i,cartItems:o}=dse(),[c,a]=P.useState(null),[f,m]=P.useState(1),[y,v]=P.useState(0),[w,k]=P.useState(null),[C,S]=P.useState(!1),[T,I]=P.useState(!1),A=(Ne=n==null?void 0:n.variants)==null?void 0:Ne.find(xe=>xe.id===c),D=((se=n==null?void 0:n.variants)==null?void 0:se.filter(xe=>xe.is_active))||[],$=Number((n==null?void 0:n.base_price)||0),F=A?Number(A.price_adjustment):0,q=$+F,W=Number((n==null?void 0:n.shipping_fee)||0),K=o.reduce((xe,ie)=>xe+ie.quantity,0),Z=async xe=>{if(!xe.target.files||xe.target.files.length===0)return;S(!0);const ie=xe.target.files[0],me=ie.name.split(".").pop(),fe=`artwork/${Date.now()}-${Math.random().toString(36).substring(7)}.${me}`;try{const{error:ve}=await ee.storage.from("marketplace").upload(fe,ie);if(ve)throw ve;const{data:{publicUrl:Ie}}=ee.storage.from("marketplace").getPublicUrl(fe);k(Ie),Ge.success("Artwork uploaded successfully")}catch(ve){Ge.error("Failed to upload artwork: "+ve.message)}finally{S(!1)}},re=()=>{if(n){if(D.length>0&&!c){Ge.error("Please select an option");return}i(n,A||void 0,f,w||void 0),I(!0),Ge.success("Added to cart!"),setTimeout(()=>I(!1),2e3)}},he=()=>{n!=null&&n.images&&v(xe=>(xe+1)%n.images.length)},ue=()=>{n!=null&&n.images&&v(xe=>(xe-1+n.images.length)%n.images.length)};return s?r.jsx(Or,{title:"Product",children:r.jsxs("div",{className:"grid gap-8 lg:grid-cols-2",children:[r.jsx(Gr,{className:"aspect-square w-full"}),r.jsxs("div",{className:"space-y-4",children:[r.jsx(Gr,{className:"h-8 w-3/4"}),r.jsx(Gr,{className:"h-6 w-1/4"}),r.jsx(Gr,{className:"h-24 w-full"}),r.jsx(Gr,{className:"h-12 w-full"})]})]})}):n?r.jsxs(Or,{title:n.name,children:[r.jsx(v$e,{className:"mb-6",children:r.jsxs(_$e,{children:[r.jsx(dee,{children:r.jsx(Cpe,{asChild:!0,children:r.jsx(ao,{to:"/marketplace",children:"Marketplace"})})}),n.category&&r.jsxs(r.Fragment,{children:[r.jsx(Mpe,{}),r.jsx(dee,{children:r.jsx(Cpe,{asChild:!0,children:r.jsx(ao,{to:`/marketplace?category=${n.category.id}`,children:n.category.name})})})]}),r.jsx(Mpe,{}),r.jsx(dee,{children:r.jsx(b$e,{children:n.name})})]})}),r.jsxs("div",{className:"grid gap-8 lg:grid-cols-2",children:[r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"relative aspect-square bg-muted rounded-lg overflow-hidden flex items-center justify-center",children:n.images&&n.images.length>0?r.jsxs(r.Fragment,{children:[r.jsx("img",{src:n.images[y].image_url,alt:n.name,className:"max-w-full max-h-full object-contain"}),n.images.length>1&&r.jsxs(r.Fragment,{children:[r.jsx(te,{variant:"ghost",size:"icon",className:"absolute left-2 top-1/2 -translate-y-1/2 bg-background/80 hover:bg-background",onClick:ue,children:r.jsx(sd,{className:"h-6 w-6"})}),r.jsx(te,{variant:"ghost",size:"icon",className:"absolute right-2 top-1/2 -translate-y-1/2 bg-background/80 hover:bg-background",onClick:he,children:r.jsx(Ha,{className:"h-6 w-6"})})]})]}):r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx(Tl,{className:"h-24 w-24 text-muted-foreground"})})}),n.images&&n.images.length>1&&r.jsx("div",{className:"flex gap-2 overflow-x-auto pb-2",children:n.images.map((xe,ie)=>r.jsx("button",{onClick:()=>v(ie),className:`w-16 h-16 flex-shrink-0 rounded-md overflow-hidden border-2 ${ie===y?"border-primary":"border-transparent"}`,children:r.jsx("img",{src:xe.image_url,alt:"",className:"w-full h-full object-cover"})},xe.id))}),n.video&&r.jsx(Ye,{children:r.jsxs(Je,{className:"p-4",children:[r.jsx("h4",{className:"font-medium mb-2",children:"Product Video"}),r.jsx("div",{className:"aspect-video",children:r.jsx("iframe",{src:n.video.video_url,className:"w-full h-full rounded-lg",allowFullScreen:!0})})]})})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[n.category&&r.jsx(Rt,{variant:"secondary",className:"mb-2",children:n.category.name}),r.jsx("h1",{className:"text-3xl font-bold mb-2",children:n.name}),r.jsxs("div",{className:"flex items-baseline gap-2",children:[r.jsxs("span",{className:"text-3xl font-bold",children:["$",q.toFixed(2)]}),W>0&&r.jsxs("span",{className:"text-muted-foreground",children:["+ $",W.toFixed(2)," shipping"]})]})]}),n.description&&r.jsx("div",{className:"prose prose-sm max-w-none",children:r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:n.description})}),D.length>0&&r.jsxs("div",{className:"space-y-3",children:[r.jsx(Qe,{children:"Select Option"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:D.map(xe=>r.jsxs(te,{variant:c===xe.id?"default":"outline",onClick:()=>a(xe.id),children:[xe.name,Number(xe.price_adjustment)!==0&&r.jsxs("span",{className:"ml-1 opacity-70",children:["(",Number(xe.price_adjustment)>0?"+":"","$",Number(xe.price_adjustment).toFixed(2),")"]})]},xe.id))})]}),n.allow_artwork_upload&&r.jsxs("div",{className:"space-y-3",children:[r.jsx(Qe,{children:"Upload Your Artwork (Optional)"}),w?r.jsxs("div",{className:"relative inline-block",children:[r.jsx("img",{src:w,alt:"Your artwork",className:"h-24 w-auto rounded-lg border"}),r.jsx(te,{variant:"ghost",size:"sm",className:"absolute -top-2 -right-2",onClick:()=>k(null),children:"×"})]}):r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-6",children:[r.jsx("input",{type:"file",accept:"image/*,.pdf,.ai,.eps",onChange:Z,className:"hidden",id:"artwork-upload",disabled:C}),r.jsxs("label",{htmlFor:"artwork-upload",className:"flex flex-col items-center cursor-pointer",children:[r.jsx(Ao,{className:"h-8 w-8 text-muted-foreground mb-2"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:C?"Uploading...":"Click to upload artwork"}),r.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"Supported: JPG, PNG, PDF, AI, EPS"})]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Qe,{children:"Quantity"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(te,{variant:"outline",size:"icon",onClick:()=>m(xe=>Math.max(1,xe-1)),children:"-"}),r.jsx(yt,{type:"number",value:f,onChange:xe=>m(Math.max(1,parseInt(xe.target.value)||1)),className:"w-20 text-center",min:"1"}),r.jsx(te,{variant:"outline",size:"icon",onClick:()=>m(xe=>xe+1),children:"+"})]})]}),r.jsxs("div",{className:"flex gap-4",children:[r.jsx(te,{size:"lg",className:"flex-1",onClick:re,disabled:T,children:T?r.jsxs(r.Fragment,{children:[r.jsx(Ba,{className:"h-5 w-5 mr-2"}),"Added!"]}):r.jsxs(r.Fragment,{children:[r.jsx(sh,{className:"h-5 w-5 mr-2"}),"Add to Cart"]})}),r.jsxs(te,{variant:"outline",size:"lg",onClick:()=>e("/marketplace/cart"),className:"relative",children:[r.jsx(sh,{className:"h-5 w-5"}),K>0&&r.jsx(Rt,{className:"absolute -top-2 -right-2 h-5 w-5 flex items-center justify-center p-0 text-xs",children:K})]})]}),n.requires_proof_approval&&r.jsx("p",{className:"text-sm text-muted-foreground bg-muted p-3 rounded-lg",children:"📋 This product requires proof approval before production. You'll receive a proof to review after your order is placed."})]})]})]}):r.jsx(Or,{title:"Product Not Found",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Tl,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Product not found"}),r.jsx(te,{onClick:()=>e("/marketplace"),children:"Back to Marketplace"})]})})}function rWt(){const t=es(),{cartItems:e,removeFromCart:n,updateQuantity:s,getItemPrice:i,getSubtotal:o,getShippingTotal:c,getTotal:a,clearCart:f}=dse(),[m,y]=P.useState(!1),[v,w]=P.useState(""),k=async()=>{if(e.length===0){Ge.error("Your cart is empty");return}y(!0);try{const{data:C,error:S}=await ee.functions.invoke("marketplace-checkout",{body:{items:e.map(T=>{var I;return{product_id:T.product.id,variant_id:((I=T.variant)==null?void 0:I.id)||null,quantity:T.quantity,artwork_url:T.artworkUrl||null}}),notes:v.trim()||null}});if(S)throw S;if(C!=null&&C.url)f(),window.open(C.url,"_blank");else throw new Error("No checkout URL received")}catch(C){Ge.error("Checkout failed: "+C.message)}finally{y(!1)}};return e.length===0?r.jsx(Or,{title:"Shopping Cart",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx(ug,{className:"h-16 w-16 mx-auto text-muted-foreground mb-4"}),r.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Your cart is empty"}),r.jsx("p",{className:"text-muted-foreground mb-6",children:"Add some products to get started!"}),r.jsx(te,{onClick:()=>t("/marketplace"),children:"Browse Marketplace"})]})}):r.jsx(Or,{title:"Shopping Cart",children:r.jsxs("div",{className:"grid gap-8 lg:grid-cols-3",children:[r.jsxs("div",{className:"lg:col-span-2 space-y-4",children:[e.map(C=>{var S,T;return r.jsx(Ye,{children:r.jsx(Je,{className:"p-4",children:r.jsxs("div",{className:"flex gap-4",children:[r.jsx("div",{className:"w-24 h-24 flex-shrink-0 bg-muted rounded-lg overflow-hidden",children:C.product.images&&C.product.images.length>0?r.jsx("img",{src:((S=C.product.images.find(I=>I.is_primary))==null?void 0:S.image_url)||C.product.images[0].image_url,alt:C.product.name,className:"w-full h-full object-cover"}):r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx(ug,{className:"h-8 w-8 text-muted-foreground"})})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-semibold line-clamp-1",children:C.product.name}),C.variant&&r.jsx("p",{className:"text-sm text-muted-foreground",children:C.variant.name}),r.jsxs("p",{className:"font-medium mt-1",children:["$",i(C).toFixed(2),Number(C.product.shipping_fee)>0&&r.jsxs("span",{className:"text-sm text-muted-foreground ml-2",children:["+ $",Number(C.product.shipping_fee).toFixed(2)," shipping"]})]}),C.artworkUrl&&r.jsx("div",{className:"mt-2",children:r.jsx("span",{className:"text-xs text-muted-foreground",children:"Artwork uploaded ✓"})})]}),r.jsxs("div",{className:"flex flex-col items-end gap-2",children:[r.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>{var I;return n(C.product.id,(I=C.variant)==null?void 0:I.id)},children:r.jsx(Xn,{className:"h-4 w-4 text-destructive"})}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(te,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>{var I;return s(C.product.id,(I=C.variant)==null?void 0:I.id,C.quantity-1)},disabled:C.quantity<=1,children:r.jsx(Y0,{className:"h-3 w-3"})}),r.jsx(yt,{type:"number",value:C.quantity,onChange:I=>{var A;return s(C.product.id,(A=C.variant)==null?void 0:A.id,parseInt(I.target.value)||1)},className:"w-14 h-8 text-center text-sm",min:"1"}),r.jsx(te,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>{var I;return s(C.product.id,(I=C.variant)==null?void 0:I.id,C.quantity+1)},children:r.jsx(Sn,{className:"h-3 w-3"})})]})]})]})})},`${C.product.id}-${((T=C.variant)==null?void 0:T.id)||"base"}`)}),r.jsx(te,{variant:"ghost",className:"text-destructive",onClick:f,children:"Clear Cart"})]}),r.jsx("div",{children:r.jsxs(Ye,{className:"sticky top-4",children:[r.jsx(Ht,{children:r.jsx(Yt,{children:"Order Summary"})}),r.jsxs(Je,{className:"space-y-4",children:[r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsxs("span",{children:["Subtotal (",e.reduce((C,S)=>C+S.quantity,0)," items)"]}),r.jsxs("span",{children:["$",o().toFixed(2)]})]}),r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{children:"Shipping"}),r.jsxs("span",{children:["$",c().toFixed(2)]})]}),r.jsx(Vd,{}),r.jsxs("div",{className:"flex justify-between font-bold text-lg",children:[r.jsx("span",{children:"Total"}),r.jsxs("span",{children:["$",a().toFixed(2)]})]}),r.jsx(Vd,{}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Qe,{htmlFor:"orderNotes",children:"Order Notes (Optional)"}),r.jsx(ps,{id:"orderNotes",placeholder:"Add any special instructions, design notes, or comments for your order...",value:v,onChange:C=>w(C.target.value),rows:3,className:"resize-none"})]}),r.jsx(te,{className:"w-full",size:"lg",onClick:k,disabled:m,children:m?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"h-5 w-5 mr-2 animate-spin"}),"Processing..."]}):r.jsxs(r.Fragment,{children:["Checkout",r.jsx(Ho,{className:"h-5 w-5 ml-2"})]})}),r.jsx("p",{className:"text-xs text-center text-muted-foreground",children:"Secure checkout powered by Stripe"})]})]})})]})})}function nWt(){const t=es(),{data:e,isLoading:n}=_Ht();return n?r.jsx(Or,{title:"My Orders",children:r.jsx("div",{className:"space-y-4",children:[1,2,3].map(s=>r.jsx(Gr,{className:"h-32 w-full"},s))})}):!e||e.length===0?r.jsx(Or,{title:"My Orders",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Tl,{className:"h-16 w-16 mx-auto text-muted-foreground mb-4"}),r.jsx("h2",{className:"text-xl font-semibold mb-2",children:"No orders yet"}),r.jsx("p",{className:"text-muted-foreground mb-6",children:"Start shopping to see your orders here!"}),r.jsx(te,{onClick:()=>t("/marketplace"),children:"Browse Marketplace"})]})}):r.jsx(Or,{title:"My Orders",children:r.jsx("div",{className:"space-y-4",children:e.map(s=>{var i,o,c;return r.jsx(Ye,{className:"cursor-pointer hover:shadow-md transition-shadow",onClick:()=>t(`/marketplace/orders/${s.id}`),children:r.jsxs(Je,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("div",{children:[r.jsx("span",{className:"font-semibold",children:s.order_number}),r.jsx("span",{className:"text-muted-foreground text-sm ml-2",children:un(new Date(s.created_at),"MMM d, yyyy")})]}),r.jsx(Rt,{className:g0e[s.status],children:p4[s.status]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs("div",{className:"flex -space-x-2",children:[(i=s.items)==null?void 0:i.slice(0,3).map((a,f)=>r.jsxs("div",{className:"w-10 h-10 bg-muted rounded border-2 border-background flex items-center justify-center text-xs font-medium",style:{zIndex:3-f},children:[a.quantity,"×"]},a.id)),s.items&&s.items.length>3&&r.jsxs("div",{className:"w-10 h-10 bg-muted rounded border-2 border-background flex items-center justify-center text-xs font-medium",children:["+",s.items.length-3]})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm",children:((o=s.items)==null?void 0:o.length)===1?s.items[0].product_name:`${(c=s.items)==null?void 0:c.length} items`}),r.jsxs("p",{className:"font-semibold",children:["$",Number(s.total).toFixed(2)]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[s.tracking_url&&r.jsxs(te,{variant:"outline",size:"sm",onClick:a=>{a.stopPropagation(),window.open(s.tracking_url,"_blank")},children:[r.jsx(Fs,{className:"h-4 w-4 mr-1"}),"Track"]}),r.jsx(Ha,{className:"h-5 w-5 text-muted-foreground"})]})]})]})},s.id)})})})}const X3e=["order_submitted","awaiting_proof_approval","proof_approved","processing","in_production","shipped","completed"];function sWt({currentStatus:t,statusHistory:e}){const n=X3e.indexOf(t);return r.jsx("div",{className:"space-y-3",children:X3e.map((s,i)=>{const o=e==null?void 0:e.find(m=>m.status===s),c=in;return r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:`mt-0.5 flex-shrink-0 w-6 h-6 rounded-full flex items-center justify-center ${c?"bg-green-500 text-white":a?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"}`,children:c?r.jsx(io,{className:"h-4 w-4"}):a?r.jsx(Xi,{className:"h-4 w-4"}):r.jsx("span",{className:"text-xs",children:i+1})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:`font-medium ${f?"text-muted-foreground":""}`,children:p4[s]}),o&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:[un(new Date(o.created_at),"MMM d, yyyy h:mm a"),o.notes&&` — ${o.notes}`]})]})]},s)})})}function iWt(){var I;const{orderId:t}=dd(),e=es(),{data:n,isLoading:s,refetch:i}=bHt(t||""),o=kHt(),c=NHt(),[a,f]=P.useState(!1),[m,y]=P.useState(null),[v,w]=P.useState(""),[k,C]=P.useState(null),S=async A=>{C(A);try{await o.mutateAsync({orderId:t,itemId:A}),Ge.success("Proof approved!"),i()}catch{Ge.error("Failed to approve proof")}finally{C(null)}},T=async()=>{if(m){C(m);try{await c.mutateAsync({orderId:t,itemId:m,reason:v}),Ge.success("Revision requested"),f(!1),w(""),y(null),i()}catch{Ge.error("Failed to request revision")}finally{C(null)}}};return s?r.jsx(Or,{title:"Order Details",children:r.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[r.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[r.jsx(Gr,{className:"h-64 w-full"}),r.jsx(Gr,{className:"h-48 w-full"})]}),r.jsx(Gr,{className:"h-96 w-full"})]})}):n?r.jsxs(Or,{title:`Order ${n.order_number}`,children:[r.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[r.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[r.jsxs(Ye,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsx(Yt,{children:"Order Status"}),r.jsx(Rt,{className:g0e[n.status],children:p4[n.status]})]}),r.jsx(Je,{children:r.jsx(sWt,{currentStatus:n.status,statusHistory:n.status_history})})]}),r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsx(Yt,{children:"Items"})}),r.jsx(Je,{className:"space-y-4",children:(I=n.items)==null?void 0:I.map(A=>r.jsxs("div",{className:"border rounded-lg p-4",children:[r.jsxs("div",{className:"flex justify-between items-start mb-3",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"font-semibold",children:A.product_name}),A.variant_name&&r.jsx("p",{className:"text-sm text-muted-foreground",children:A.variant_name}),r.jsxs("p",{className:"text-sm",children:["Qty: ",A.quantity," × $",Number(A.unit_price).toFixed(2)]})]}),r.jsxs("p",{className:"font-semibold",children:["$",(Number(A.unit_price)*A.quantity).toFixed(2)]})]}),A.artwork_url&&r.jsxs("div",{className:"mb-3",children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Your Artwork:"}),r.jsxs("a",{href:A.artwork_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-primary hover:underline",children:[r.jsx(V0,{className:"h-4 w-4"}),"View Artwork",r.jsx(Fs,{className:"h-3 w-3"})]})]}),A.proof_url&&r.jsxs("div",{className:"bg-muted rounded-lg p-3",children:[r.jsx("p",{className:"text-sm font-medium mb-2",children:"Proof Ready for Review"}),r.jsxs("a",{href:A.proof_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-primary hover:underline mb-3",children:[r.jsx(V0,{className:"h-4 w-4"}),"View Proof",r.jsx(Fs,{className:"h-3 w-3"})]}),A.proof_status==="pending"&&r.jsxs("div",{className:"flex gap-2 mt-3",children:[r.jsxs(te,{size:"sm",onClick:()=>S(A.id),disabled:k===A.id,children:[k===A.id?r.jsx(sn,{className:"h-4 w-4 mr-1 animate-spin"}):r.jsx(Zd,{className:"h-4 w-4 mr-1"}),"Approve"]}),r.jsxs(te,{size:"sm",variant:"outline",onClick:()=>{y(A.id),f(!0)},disabled:k===A.id,children:[r.jsx(ST,{className:"h-4 w-4 mr-1"}),"Request Changes"]})]}),A.proof_status==="approved"&&r.jsxs(Rt,{className:"bg-green-100 text-green-800",children:[r.jsx(io,{className:"h-3 w-3 mr-1"}),"Proof Approved"]}),A.proof_status==="rejected"&&A.proof_notes&&r.jsxs("div",{className:"mt-2",children:[r.jsx(Rt,{variant:"destructive",className:"mb-2",children:"Revision Requested"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:A.proof_notes})]})]})]},A.id))})]}),n.shipping_name&&r.jsxs(Ye,{children:[r.jsx(Ht,{children:r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(MT,{className:"h-5 w-5"}),"Shipping"]})}),r.jsxs(Je,{children:[r.jsx("p",{className:"font-medium",children:n.shipping_name}),r.jsxs("p",{className:"text-muted-foreground",children:[n.shipping_address,r.jsx("br",{}),n.shipping_city,", ",n.shipping_state," ",n.shipping_zip]}),n.tracking_number&&r.jsxs("div",{className:"mt-4 p-3 bg-muted rounded-lg",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Tracking Number:"}),r.jsx("p",{className:"font-mono font-medium",children:n.tracking_number}),n.tracking_url&&r.jsxs(te,{variant:"link",className:"p-0 h-auto mt-1",onClick:()=>window.open(n.tracking_url,"_blank"),children:["Track Package",r.jsx(Fs,{className:"h-3 w-3 ml-1"})]})]})]})]})]}),r.jsx("div",{children:r.jsxs(Ye,{className:"sticky top-4",children:[r.jsx(Ht,{children:r.jsx(Yt,{children:"Order Summary"})}),r.jsxs(Je,{className:"space-y-4",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["Placed on ",un(new Date(n.created_at),"MMMM d, yyyy")]}),r.jsx(Vd,{}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{children:"Subtotal"}),r.jsxs("span",{children:["$",Number(n.subtotal).toFixed(2)]})]}),r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{children:"Shipping"}),r.jsxs("span",{children:["$",Number(n.shipping_total).toFixed(2)]})]})]}),r.jsx(Vd,{}),r.jsxs("div",{className:"flex justify-between font-bold text-lg",children:[r.jsx("span",{children:"Total"}),r.jsxs("span",{children:["$",Number(n.total).toFixed(2)]})]}),n.notes&&r.jsxs(r.Fragment,{children:[r.jsx(Vd,{}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium mb-1",children:"Order Notes"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:n.notes})]})]})]})]})})]}),r.jsx($r,{open:a,onOpenChange:f,children:r.jsxs(zr,{children:[r.jsxs(Zr,{children:[r.jsx(Kr,{children:"Request Changes"}),r.jsx(ls,{children:"Please describe what changes you'd like made to the proof."})]}),r.jsx(ps,{placeholder:"Describe the changes needed...",value:v,onChange:A=>w(A.target.value),rows:4}),r.jsxs(ni,{children:[r.jsx(te,{variant:"outline",onClick:()=>f(!1),children:"Cancel"}),r.jsxs(te,{onClick:T,disabled:!v.trim()||k!==null,children:[k?r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}):null,"Submit Request"]})]})]})})]}):r.jsx(Or,{title:"Order Not Found",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Tl,{className:"h-16 w-16 mx-auto text-muted-foreground mb-4"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Order not found"}),r.jsx(te,{onClick:()=>e("/marketplace/orders"),children:"View All Orders"})]})})}function aWt(){const t=es(),[e]=Ed();return e.get("session_id"),P.useEffect(()=>{localStorage.removeItem("marketplace-cart")},[]),r.jsx(Or,{title:"Order Confirmed",children:r.jsx("div",{className:"max-w-lg mx-auto text-center py-8",children:r.jsx(Ye,{children:r.jsxs(Je,{className:"pt-8 pb-6",children:[r.jsx("div",{className:"w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-6",children:r.jsx(io,{className:"h-8 w-8 text-green-600"})}),r.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Thank You for Your Order!"}),r.jsx("p",{className:"text-muted-foreground mb-6",children:"Your order has been confirmed and is being processed. You'll receive an email confirmation shortly."}),r.jsxs("div",{className:"bg-muted rounded-lg p-4 mb-6 text-left",children:[r.jsxs("h3",{className:"font-medium mb-2 flex items-center gap-2",children:[r.jsx(Tl,{className:"h-4 w-4"}),"What happens next?"]}),r.jsxs("ul",{className:"text-sm text-muted-foreground space-y-2",children:[r.jsx("li",{children:"• We'll review your order and prepare it for production"}),r.jsx("li",{children:"• If your order requires a proof, you'll receive it for approval"}),r.jsx("li",{children:"• Once approved, we'll begin production and ship when ready"}),r.jsx("li",{children:"• You'll receive tracking info when your order ships"})]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(te,{className:"flex-1",onClick:()=>t("/marketplace/orders"),children:["View My Orders",r.jsx(Ho,{className:"h-4 w-4 ml-2"})]}),r.jsx(te,{variant:"outline",className:"flex-1",onClick:()=>t("/marketplace"),children:"Continue Shopping"})]})]})})})})}function oWt(){const{user:t}=Fr(),[e,n]=P.useState("store"),[s,i]=P.useState(null),[o,c]=P.useState(null),[a,f]=P.useState(!1),[m,y]=P.useState(5),[v,w]=P.useState(""),[k,C]=P.useState(!1),[S,T]=P.useState(!1),[I,A]=P.useState(""),[D,$]=P.useState(null),[F,q]=P.useState(!1),{hasSubmittedReview:W,submitReview:K,markPostedToGoogle:Z}=EOe(),{data:re}=x$e(),{data:he,isLoading:ue}=y$e(),{data:Ne,isLoading:se}=IHt(s),{data:xe,isLoading:ie}=PHt(t==null?void 0:t.id),{data:me=0}=OHt(t==null?void 0:t.id),fe=DHt(),ve=new Set((xe==null?void 0:xe.map(Ue=>Ue.item_id))||[]),Ie=async()=>{if(o)try{await fe.mutateAsync(o.id),Ge.success(`Successfully purchased "${o.name}"!`),c(null)}catch(Ue){Ge.error(Ue.message||"Failed to purchase item")}},Se=async()=>{if(!v.trim()){Ge.error("Please write a review");return}C(!0);const Ue=await K(m,v);C(!1),Ue.success?(Ge.success("Thank you for your review! You earned 25 points!"),A(v),T(!0),w(""),y(5)):Ge.error(Ue.error||"Failed to submit review")},oe=()=>{navigator.clipboard.writeText(I),Ge.success("Review copied to clipboard!")},ae=()=>{Z(),window.open("https://g.page/r/CT8bqTBTm7nJEBM/review","_blank")},je=()=>{T(!1),f(!1),A("")};return ue||se||ie?r.jsx(Or,{title:"Reward Store",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Gr,{className:"h-24 w-full"}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[1,2,3,4,5,6].map(Ue=>r.jsx(Gr,{className:"h-64"},Ue))})]})}):r.jsxs(Or,{title:"Reward Store",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-5xl font-bold text-foreground",children:"Reward Store"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Redeem your points for exclusive rewards"})]}),r.jsx(Ye,{className:"bg-gradient-to-r from-primary/10 to-primary/5 border-primary/20",children:r.jsx(Je,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"h-12 w-12 rounded-full bg-primary/20 flex items-center justify-center",children:r.jsx(Ca,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Your Spendable Points"}),r.jsx("p",{className:"text-3xl font-bold text-primary",children:me.toLocaleString()})]})]}),r.jsxs("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(qa,{className:"h-4 w-4"}),r.jsx("span",{children:"Earn points by attending events"})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Df,{className:"h-4 w-4 text-orange-500"}),r.jsx("span",{children:"Streak bonuses add extra points!"})]})]})]})})}),r.jsx(RT,{open:F,onOpenChange:q,children:r.jsxs(Ye,{className:"border-primary/20",children:[r.jsx(FT,{asChild:!0,children:r.jsx(Ht,{className:"cursor-pointer hover:bg-muted/50 transition-colors",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center",children:r.jsx(qa,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Yt,{className:"text-base",children:"How to Earn Points"}),r.jsx(An,{children:"See all the ways you can earn spendable points"})]})]}),F?r.jsx(U0,{className:"h-5 w-5 text-muted-foreground"}):r.jsx(uh,{className:"h-5 w-5 text-muted-foreground"})]})})}),r.jsx(zT,{children:r.jsx(Je,{className:"pt-0",children:r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:[re==null?void 0:re.filter(Ue=>Ue.is_active).map(Ue=>{const Re=$e=>{switch($e){case"event_attendance":return r.jsx(li,{className:"h-5 w-5"});case"leave_review":return r.jsx(Ca,{className:"h-5 w-5"});case"add_listing":return r.jsx(Hi,{className:"h-5 w-5"});case"first_contact":return r.jsx(hs,{className:"h-5 w-5"});case"first_video":return r.jsx(Gi,{className:"h-5 w-5"});case"first_community_post":return r.jsx(Wl,{className:"h-5 w-5"});default:return r.jsx(Qa,{className:"h-5 w-5"})}};return r.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/50 border",children:[r.jsx("div",{className:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center text-primary shrink-0",children:Re(Ue.action_key)}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium text-sm",children:Ue.action_name}),Ue.description&&r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:Ue.description})]}),r.jsxs(Rt,{variant:"secondary",className:"font-bold shrink-0",children:["+",Ue.points]})]},Ue.id)}),r.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-orange-500/10 border border-orange-500/20",children:[r.jsx("div",{className:"h-10 w-10 rounded-full bg-orange-500/20 flex items-center justify-center text-orange-500 shrink-0",children:r.jsx(Df,{className:"h-5 w-5"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium text-sm",children:"Streak Bonuses"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Attend consecutive weeks for bonus points!"})]}),r.jsx(Rt,{variant:"outline",className:"font-bold shrink-0 border-orange-500/50 text-orange-600",children:"+Bonus"})]})]})})})]})}),!W&&r.jsx(Ye,{className:"bg-gradient-to-r from-yellow-500/10 to-orange-500/10 border-yellow-500/20",children:r.jsx(Je,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"h-12 w-12 rounded-full bg-yellow-500/20 flex items-center justify-center",children:r.jsx(Wl,{className:"h-6 w-6 text-yellow-600"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Earn 25 Free Points!"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Leave a quick review and earn 25 spendable points"})]})]}),r.jsxs(te,{onClick:()=>f(!0),className:"bg-yellow-600 hover:bg-yellow-700",children:[r.jsx(Ca,{className:"h-4 w-4 mr-2"}),"Leave Review"]})]})})}),r.jsxs(La,{value:e,onValueChange:n,children:[r.jsxs(Ma,{children:[r.jsxs(yn,{value:"store",className:"flex items-center gap-2",children:[r.jsx(ug,{className:"h-4 w-4"}),"Store"]}),r.jsxs(yn,{value:"my-rewards",className:"flex items-center gap-2",children:[r.jsx(Tl,{className:"h-4 w-4"}),"My Rewards",xe&&xe.length>0&&r.jsx(Rt,{variant:"secondary",className:"ml-1",children:xe.length})]})]}),r.jsxs($n,{value:"store",className:"mt-6",children:[he&&he.length>0&&r.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[r.jsx(te,{variant:s===null?"default":"outline",size:"sm",onClick:()=>i(null),children:"All"}),he.map(Ue=>r.jsxs(te,{variant:s===Ue.id?"default":"outline",size:"sm",onClick:()=>i(Ue.id),children:[Ue.icon&&`${Ue.icon} `,Ue.name]},Ue.id))]}),!Ne||Ne.length===0?r.jsx(Ye,{children:r.jsx(Je,{className:"py-12",children:r.jsxs("div",{className:"text-center text-muted-foreground",children:[r.jsx(Qa,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{className:"font-medium",children:"No items available"}),r.jsx("p",{className:"text-sm",children:"Check back later for new rewards!"})]})})}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Ne.map(Ue=>{const Re=ve.has(Ue.id),$e=Ue.max_quantity!==null&&Ue.current_quantity===0,Pe=me>=Ue.points_cost;return r.jsxs(Ye,{className:`overflow-hidden transition-all cursor-pointer hover:shadow-lg ${Re?"ring-2 ring-green-500/50 bg-green-500/5":""}`,onClick:()=>$(Ue),children:[Ue.preview_image_url?r.jsxs("div",{className:"aspect-video relative overflow-hidden bg-muted",children:[r.jsx("img",{src:Ue.preview_image_url,alt:Ue.name,className:"w-full h-full object-cover"}),Re&&r.jsx("div",{className:"absolute top-2 right-2",children:r.jsxs(Rt,{className:"bg-green-500 text-white",children:[r.jsx(io,{className:"h-3 w-3 mr-1"}),"Owned"]})}),$e&&!Re&&r.jsx("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:r.jsx(Rt,{variant:"destructive",children:"Sold Out"})})]}):r.jsxs("div",{className:"aspect-video bg-muted flex items-center justify-center relative",children:[r.jsx(Qa,{className:"h-12 w-12 text-muted-foreground/50"}),Re&&r.jsx("div",{className:"absolute top-2 right-2",children:r.jsxs(Rt,{className:"bg-green-500 text-white",children:[r.jsx(io,{className:"h-3 w-3 mr-1"}),"Owned"]})})]}),r.jsxs(Ht,{className:"pb-2",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsx(Yt,{className:"text-lg",children:Ue.name}),r.jsxs(Rt,{variant:"secondary",className:"font-bold shrink-0",children:[r.jsx(Ca,{className:"h-3 w-3 mr-1"}),Ue.points_cost]})]}),Ue.category&&r.jsxs(Rt,{variant:"outline",className:"w-fit",children:[Ue.category.icon&&`${Ue.category.icon} `,Ue.category.name]})]}),r.jsxs(Je,{children:[r.jsx(An,{className:"mb-4 line-clamp-2",children:Ue.description||"No description available"}),Ue.max_quantity!==null&&!Re&&r.jsxs("p",{className:"text-xs text-muted-foreground mb-3",children:[Ue.current_quantity," of ",Ue.max_quantity," remaining"]}),Re?r.jsx(te,{className:"w-full",onClick:Ae=>{Ae.stopPropagation(),Ue.file_url&&rde(Ue.file_url,Ue.name)},disabled:!Ue.file_url,children:Ue.item_type==="file"?r.jsxs(r.Fragment,{children:[r.jsx(Mo,{className:"h-4 w-4 mr-2"}),"Download"]}):r.jsxs(r.Fragment,{children:[r.jsx(Fs,{className:"h-4 w-4 mr-2"}),"Access"]})}):r.jsx(te,{className:"w-full",onClick:Ae=>{Ae.stopPropagation(),c(Ue)},disabled:$e||!Pe,children:$e?"Sold Out":Pe?r.jsxs(r.Fragment,{children:[r.jsx(ug,{className:"h-4 w-4 mr-2"}),"Purchase"]}):`Need ${Ue.points_cost-me} more pts`})]})]},Ue.id)})})]}),r.jsx($n,{value:"my-rewards",className:"mt-6",children:!xe||xe.length===0?r.jsx(Ye,{children:r.jsx(Je,{className:"py-12",children:r.jsxs("div",{className:"text-center text-muted-foreground",children:[r.jsx(Tl,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{className:"font-medium",children:"No rewards yet"}),r.jsx("p",{className:"text-sm",children:"Purchase items from the store to see them here!"})]})})}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:xe.map(Ue=>{var Re,$e,Pe,Ae,nt;return r.jsxs(Ye,{className:"overflow-hidden",children:[(Re=Ue.item)!=null&&Re.preview_image_url?r.jsx("div",{className:"aspect-video relative overflow-hidden bg-muted",children:r.jsx("img",{src:Ue.item.preview_image_url,alt:(($e=Ue.item)==null?void 0:$e.name)||"Reward",className:"w-full h-full object-cover"})}):r.jsx("div",{className:"aspect-video bg-muted flex items-center justify-center",children:r.jsx(Qa,{className:"h-12 w-12 text-muted-foreground/50"})}),r.jsxs(Ht,{className:"pb-2",children:[r.jsx(Yt,{className:"text-lg",children:((Pe=Ue.item)==null?void 0:Pe.name)||"Unknown Item"}),r.jsxs(An,{className:"text-xs",children:["Purchased for ",Ue.points_spent," points • ",new Date(Ue.purchased_at).toLocaleDateString()]})]}),r.jsx(Je,{children:r.jsx(te,{className:"w-full",onClick:()=>{var Te,Xe;(Te=Ue.item)!=null&&Te.file_url&&rde(Ue.item.file_url,(Xe=Ue.item)==null?void 0:Xe.name)},disabled:!((Ae=Ue.item)!=null&&Ae.file_url),children:((nt=Ue.item)==null?void 0:nt.item_type)==="file"?r.jsxs(r.Fragment,{children:[r.jsx(Mo,{className:"h-4 w-4 mr-2"}),"Download"]}):r.jsxs(r.Fragment,{children:[r.jsx(Fs,{className:"h-4 w-4 mr-2"}),"Access"]})})})]},Ue.id)})})})]})]}),r.jsx(ih,{open:!!o,onOpenChange:()=>c(null),children:r.jsxs(yu,{children:[r.jsxs(xu,{children:[r.jsx(_u,{children:"Confirm Purchase"}),r.jsxs(bu,{children:['Are you sure you want to purchase "',o==null?void 0:o.name,'" for ',o==null?void 0:o.points_cost," points?",r.jsx("br",{}),r.jsx("br",{}),"You currently have ",r.jsxs("strong",{children:[me," points"]}),". After this purchase, you'll have"," ",r.jsxs("strong",{children:[me-((o==null?void 0:o.points_cost)||0)," points"]})," remaining."]})]}),r.jsxs(vu,{children:[r.jsx(wu,{children:"Cancel"}),r.jsx(Hd,{onClick:Ie,disabled:fe.isPending,children:fe.isPending?"Purchasing...":"Confirm Purchase"})]})]})}),r.jsx($r,{open:a,onOpenChange:Ue=>{!Ue&&S?je():f(Ue)},children:r.jsx(zr,{children:S?r.jsxs(r.Fragment,{children:[r.jsxs(Zr,{children:[r.jsxs(Kr,{className:"flex items-center gap-2",children:[r.jsx(io,{className:"h-5 w-5 text-green-500"}),"Thank You for Your Review!"]}),r.jsx(ls,{children:"Would you also share your review on Google? It helps other agents discover LevelUp!"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"bg-muted p-4 rounded-lg",children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Your review:"}),r.jsxs("p",{className:"text-sm italic",children:['"',I,'"']})]}),r.jsxs(te,{variant:"outline",className:"w-full",onClick:oe,children:[r.jsx(Ul,{className:"h-4 w-4 mr-2"}),"Copy Review to Clipboard"]})]}),r.jsxs(ni,{className:"flex-col sm:flex-row gap-2",children:[r.jsx(te,{variant:"outline",onClick:je,children:"Maybe Later"}),r.jsxs(te,{onClick:ae,className:"bg-blue-600 hover:bg-blue-700",children:[r.jsx(Fs,{className:"h-4 w-4 mr-2"}),"Leave Google Review"]})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs(Zr,{children:[r.jsx(Kr,{children:"Leave a Review"}),r.jsx(ls,{children:"Share your experience with LevelUp and earn 25 spendable points!"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Your Rating"}),r.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(Ue=>r.jsx("button",{type:"button",onClick:()=>y(Ue),className:"focus:outline-none",children:r.jsx(Ca,{className:`h-8 w-8 transition-colors ${m>=Ue?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-400"}`})},Ue))})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Your Review"}),r.jsx(ps,{placeholder:"What do you love about LevelUp? How has it helped your business?",value:v,onChange:Ue=>w(Ue.target.value),rows:4})]})]}),r.jsxs(ni,{children:[r.jsx(te,{variant:"outline",onClick:()=>f(!1),children:"Cancel"}),r.jsx(te,{onClick:Se,disabled:k,className:"bg-yellow-600 hover:bg-yellow-700",children:k?"Submitting...":"Submit & Earn 25 Points"})]})]})})}),r.jsx($r,{open:!!D,onOpenChange:()=>$(null),children:r.jsxs(zr,{className:"max-w-lg",children:[r.jsxs(Zr,{children:[r.jsxs(Kr,{className:"flex items-center gap-2",children:[D==null?void 0:D.name,r.jsxs(Rt,{variant:"secondary",className:"font-bold",children:[r.jsx(Ca,{className:"h-3 w-3 mr-1"}),D==null?void 0:D.points_cost]})]}),(D==null?void 0:D.category)&&r.jsxs(Rt,{variant:"outline",className:"w-fit",children:[D.category.icon&&`${D.category.icon} `,D.category.name]})]}),(D==null?void 0:D.preview_image_url)&&r.jsx("div",{className:"aspect-video relative overflow-hidden bg-muted rounded-lg",children:r.jsx("img",{src:D.preview_image_url,alt:D.name,className:"w-full h-full object-cover"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("p",{className:"text-muted-foreground",children:(D==null?void 0:D.description)||"No description available"}),(D==null?void 0:D.max_quantity)!==null&&!ve.has((D==null?void 0:D.id)||"")&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[D==null?void 0:D.current_quantity," of ",D==null?void 0:D.max_quantity," remaining"]})]}),r.jsx(ni,{children:D&&ve.has(D.id)?r.jsx(te,{className:"w-full",onClick:()=>{D.file_url&&rde(D.file_url,D.name)},disabled:!D.file_url,children:D.item_type==="file"?r.jsxs(r.Fragment,{children:[r.jsx(Mo,{className:"h-4 w-4 mr-2"}),"Download"]}):r.jsxs(r.Fragment,{children:[r.jsx(Fs,{className:"h-4 w-4 mr-2"}),"Access"]})}):D&&r.jsx(te,{className:"w-full",onClick:()=>{$(null),c(D)},disabled:D.max_quantity!==null&&D.current_quantity===0||me{let t=0;const e=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(t+=1,`u${e()}${t}`)})();function u1(t){const e=[];for(let n=0,s=t.length;nCh||t.height>Ch)&&(t.width>Ch&&t.height>Ch?t.width>t.height?(t.height*=Ch/t.width,t.width=Ch):(t.width*=Ch/t.height,t.height=Ch):t.width>Ch?(t.height*=Ch/t.width,t.width=Ch):(t.width*=Ch/t.height,t.height=Ch))}function sne(t){return new Promise((e,n)=>{const s=new Image;s.onload=()=>{s.decode().then(()=>{requestAnimationFrame(()=>e(s))})},s.onerror=n,s.crossOrigin="anonymous",s.decoding="async",s.src=t})}async function pWt(t){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(t)).then(encodeURIComponent).then(e=>`data:image/svg+xml;charset=utf-8,${e}`)}async function mWt(t,e,n){const s="http://www.w3.org/2000/svg",i=document.createElementNS(s,"svg"),o=document.createElementNS(s,"foreignObject");return i.setAttribute("width",`${e}`),i.setAttribute("height",`${n}`),i.setAttribute("viewBox",`0 0 ${e} ${n}`),o.setAttribute("width","100%"),o.setAttribute("height","100%"),o.setAttribute("x","0"),o.setAttribute("y","0"),o.setAttribute("externalResourcesRequired","true"),i.appendChild(o),o.appendChild(t),pWt(i)}const ph=(t,e)=>{if(t instanceof e)return!0;const n=Object.getPrototypeOf(t);return n===null?!1:n.constructor.name===e.name||ph(n,e)};function gWt(t){const e=t.getPropertyValue("content");return`${t.cssText} content: '${e.replace(/'|"/g,"")}';`}function yWt(t,e){return w$e(e).map(n=>{const s=t.getPropertyValue(n),i=t.getPropertyPriority(n);return`${n}: ${s}${i?" !important":""};`}).join(" ")}function xWt(t,e,n,s){const i=`.${t}:${e}`,o=n.cssText?gWt(n):yWt(n,s);return document.createTextNode(`${i}{${o}}`)}function Q3e(t,e,n,s){const i=window.getComputedStyle(t,n),o=i.getPropertyValue("content");if(o===""||o==="none")return;const c=cWt();try{e.className=`${e.className} ${c}`}catch{return}const a=document.createElement("style");a.appendChild(xWt(c,n,i,s)),e.appendChild(a)}function vWt(t,e,n){Q3e(t,e,":before",n),Q3e(t,e,":after",n)}const J3e="application/font-woff",eMe="image/jpeg",_Wt={woff:J3e,woff2:J3e,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:eMe,jpeg:eMe,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function bWt(t){const e=/\.([^./]*?)$/g.exec(t);return e?e[1]:""}function x0e(t){const e=bWt(t).toLowerCase();return _Wt[e]||""}function wWt(t){return t.split(/,/)[1]}function Tpe(t){return t.search(/^(data:)/)!==-1}function jWt(t,e){return`data:${e};base64,${t}`}async function k$e(t,e,n){const s=await fetch(t,e);if(s.status===404)throw new Error(`Resource "${s.url}" not found`);const i=await s.blob();return new Promise((o,c)=>{const a=new FileReader;a.onerror=c,a.onloadend=()=>{try{o(n({res:s,result:a.result}))}catch(f){c(f)}},a.readAsDataURL(i)})}const nde={};function kWt(t,e,n){let s=t.replace(/\?.*/,"");return n&&(s=t),/ttf|otf|eot|woff2?/i.test(s)&&(s=s.replace(/.*\//,"")),e?`[${e}]${s}`:s}async function v0e(t,e,n){const s=kWt(t,e,n.includeQueryParams);if(nde[s]!=null)return nde[s];n.cacheBust&&(t+=(/\?/.test(t)?"&":"?")+new Date().getTime());let i;try{const o=await k$e(t,n.fetchRequestInit,({res:c,result:a})=>(e||(e=c.headers.get("Content-Type")||""),wWt(a)));i=jWt(o,e)}catch(o){i=n.imagePlaceholder||"";let c=`Failed to fetch resource: ${t}`;o&&(c=typeof o=="string"?o:o.message),c&&console.warn(c)}return nde[s]=i,i}async function NWt(t){const e=t.toDataURL();return e==="data:,"?t.cloneNode(!1):sne(e)}async function SWt(t,e){if(t.currentSrc){const o=document.createElement("canvas"),c=o.getContext("2d");o.width=t.clientWidth,o.height=t.clientHeight,c==null||c.drawImage(t,0,0,o.width,o.height);const a=o.toDataURL();return sne(a)}const n=t.poster,s=x0e(n),i=await v0e(n,s,e);return sne(i)}async function CWt(t,e){var n;try{if(!((n=t==null?void 0:t.contentDocument)===null||n===void 0)&&n.body)return await Pie(t.contentDocument.body,e,!0)}catch{}return t.cloneNode(!1)}async function MWt(t,e){return ph(t,HTMLCanvasElement)?NWt(t):ph(t,HTMLVideoElement)?SWt(t,e):ph(t,HTMLIFrameElement)?CWt(t,e):t.cloneNode(N$e(t))}const TWt=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SLOT",N$e=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SVG";async function AWt(t,e,n){var s,i;if(N$e(e))return e;let o=[];return TWt(t)&&t.assignedNodes?o=u1(t.assignedNodes()):ph(t,HTMLIFrameElement)&&(!((s=t.contentDocument)===null||s===void 0)&&s.body)?o=u1(t.contentDocument.body.childNodes):o=u1(((i=t.shadowRoot)!==null&&i!==void 0?i:t).childNodes),o.length===0||ph(t,HTMLVideoElement)||await o.reduce((c,a)=>c.then(()=>Pie(a,n)).then(f=>{f&&e.appendChild(f)}),Promise.resolve()),e}function EWt(t,e,n){const s=e.style;if(!s)return;const i=window.getComputedStyle(t);i.cssText?(s.cssText=i.cssText,s.transformOrigin=i.transformOrigin):w$e(n).forEach(o=>{let c=i.getPropertyValue(o);o==="font-size"&&c.endsWith("px")&&(c=`${Math.floor(parseFloat(c.substring(0,c.length-2)))-.1}px`),ph(t,HTMLIFrameElement)&&o==="display"&&c==="inline"&&(c="block"),o==="d"&&e.getAttribute("d")&&(c=`path(${e.getAttribute("d")})`),s.setProperty(o,c,i.getPropertyPriority(o))})}function IWt(t,e){ph(t,HTMLTextAreaElement)&&(e.innerHTML=t.value),ph(t,HTMLInputElement)&&e.setAttribute("value",t.value)}function PWt(t,e){if(ph(t,HTMLSelectElement)){const n=e,s=Array.from(n.children).find(i=>t.value===i.getAttribute("value"));s&&s.setAttribute("selected","")}}function LWt(t,e,n){return ph(e,Element)&&(EWt(t,e,n),vWt(t,e,n),IWt(t,e),PWt(t,e)),e}async function OWt(t,e){const n=t.querySelectorAll?t.querySelectorAll("use"):[];if(n.length===0)return t;const s={};for(let o=0;oMWt(s,e)).then(s=>AWt(t,s,e)).then(s=>LWt(t,s,e)).then(s=>OWt(s,e))}const S$e=/url\((['"]?)([^'"]+?)\1\)/g,DWt=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,RWt=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function FWt(t){const e=t.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`,"g")}function zWt(t){const e=[];return t.replace(S$e,(n,s,i)=>(e.push(i),n)),e.filter(n=>!Tpe(n))}async function BWt(t,e,n,s,i){try{const o=n?lWt(e,n):e,c=x0e(e);let a;return i||(a=await v0e(o,c,s)),t.replace(FWt(e),`$1${a}$3`)}catch{}return t}function $Wt(t,{preferredFontFormat:e}){return e?t.replace(RWt,n=>{for(;;){const[s,,i]=DWt.exec(n)||[];if(!i)return"";if(i===e)return`src: ${s};`}}):t}function C$e(t){return t.search(S$e)!==-1}async function M$e(t,e,n){if(!C$e(t))return t;const s=$Wt(t,n);return zWt(s).reduce((o,c)=>o.then(a=>BWt(a,c,e,n)),Promise.resolve(s))}async function KN(t,e,n){var s;const i=(s=e.style)===null||s===void 0?void 0:s.getPropertyValue(t);if(i){const o=await M$e(i,null,n);return e.style.setProperty(t,o,e.style.getPropertyPriority(t)),!0}return!1}async function UWt(t,e){await KN("background",t,e)||await KN("background-image",t,e),await KN("mask",t,e)||await KN("-webkit-mask",t,e)||await KN("mask-image",t,e)||await KN("-webkit-mask-image",t,e)}async function qWt(t,e){const n=ph(t,HTMLImageElement);if(!(n&&!Tpe(t.src))&&!(ph(t,SVGImageElement)&&!Tpe(t.href.baseVal)))return;const s=n?t.src:t.href.baseVal,i=await v0e(s,x0e(s),e);await new Promise((o,c)=>{t.onload=o,t.onerror=e.onImageErrorHandler?(...f)=>{try{o(e.onImageErrorHandler(...f))}catch(m){c(m)}}:c;const a=t;a.decode&&(a.decode=o),a.loading==="lazy"&&(a.loading="eager"),n?(t.srcset="",t.src=i):t.href.baseVal=i})}async function VWt(t,e){const s=u1(t.childNodes).map(i=>T$e(i,e));await Promise.all(s).then(()=>t)}async function T$e(t,e){ph(t,Element)&&(await UWt(t,e),await qWt(t,e),await VWt(t,e))}function HWt(t,e){const{style:n}=t;e.backgroundColor&&(n.backgroundColor=e.backgroundColor),e.width&&(n.width=`${e.width}px`),e.height&&(n.height=`${e.height}px`);const s=e.style;return s!=null&&Object.keys(s).forEach(i=>{n[i]=s[i]}),t}const tMe={};async function rMe(t){let e=tMe[t];if(e!=null)return e;const s=await(await fetch(t)).text();return e={url:t,cssText:s},tMe[t]=e,e}async function nMe(t,e){let n=t.cssText;const s=/url\(["']?([^"')]+)["']?\)/g,o=(n.match(/url\([^)]+\)/g)||[]).map(async c=>{let a=c.replace(s,"$1");return a.startsWith("https://")||(a=new URL(a,t.url).href),k$e(a,e.fetchRequestInit,({result:f})=>(n=n.replace(c,`url(${f})`),[c,f]))});return Promise.all(o).then(()=>n)}function sMe(t){if(t==null)return[];const e=[],n=/(\/\*[\s\S]*?\*\/)/gi;let s=t.replace(n,"");const i=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const f=i.exec(s);if(f===null)break;e.push(f[0])}s=s.replace(i,"");const o=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,c="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",a=new RegExp(c,"gi");for(;;){let f=o.exec(s);if(f===null){if(f=a.exec(s),f===null)break;o.lastIndex=a.lastIndex}else a.lastIndex=o.lastIndex;e.push(f[0])}return e}async function WWt(t,e){const n=[],s=[];return t.forEach(i=>{if("cssRules"in i)try{u1(i.cssRules||[]).forEach((o,c)=>{if(o.type===CSSRule.IMPORT_RULE){let a=c+1;const f=o.href,m=rMe(f).then(y=>nMe(y,e)).then(y=>sMe(y).forEach(v=>{try{i.insertRule(v,v.startsWith("@import")?a+=1:i.cssRules.length)}catch(w){console.error("Error inserting rule from remote css",{rule:v,error:w})}})).catch(y=>{console.error("Error loading remote css",y.toString())});s.push(m)}})}catch(o){const c=t.find(a=>a.href==null)||document.styleSheets[0];i.href!=null&&s.push(rMe(i.href).then(a=>nMe(a,e)).then(a=>sMe(a).forEach(f=>{c.insertRule(f,c.cssRules.length)})).catch(a=>{console.error("Error loading remote stylesheet",a)})),console.error("Error inlining remote css file",o)}}),Promise.all(s).then(()=>(t.forEach(i=>{if("cssRules"in i)try{u1(i.cssRules||[]).forEach(o=>{n.push(o)})}catch(o){console.error(`Error while reading CSS rules from ${i.href}`,o)}}),n))}function GWt(t){return t.filter(e=>e.type===CSSRule.FONT_FACE_RULE).filter(e=>C$e(e.style.getPropertyValue("src")))}async function KWt(t,e){if(t.ownerDocument==null)throw new Error("Provided element is not within a Document");const n=u1(t.ownerDocument.styleSheets),s=await WWt(n,e);return GWt(s)}function A$e(t){return t.trim().replace(/["']/g,"")}function ZWt(t){const e=new Set;function n(s){(s.style.fontFamily||getComputedStyle(s).fontFamily).split(",").forEach(o=>{e.add(A$e(o))}),Array.from(s.children).forEach(o=>{o instanceof HTMLElement&&n(o)})}return n(t),e}async function YWt(t,e){const n=await KWt(t,e),s=ZWt(t);return(await Promise.all(n.filter(o=>s.has(A$e(o.style.fontFamily))).map(o=>{const c=o.parentStyleSheet?o.parentStyleSheet.href:null;return M$e(o.cssText,c,e)}))).join(` `)}async function XWt(t,e){const n=e.fontEmbedCSS!=null?e.fontEmbedCSS:e.skipFonts?null:await YWt(t,e);if(n){const s=document.createElement("style"),i=document.createTextNode(n);s.appendChild(i),t.firstChild?t.insertBefore(s,t.firstChild):t.appendChild(s)}}async function QWt(t,e={}){const{width:n,height:s}=j$e(t,e),i=await Pie(t,e,!0);return await XWt(i,e),await T$e(i,e),HWt(i,e),await mWt(i,n,s)}async function JWt(t,e={}){const{width:n,height:s}=j$e(t,e),i=await QWt(t,e),o=await sne(i),c=document.createElement("canvas"),a=c.getContext("2d"),f=e.pixelRatio||hWt(),m=e.canvasWidth||n,y=e.canvasHeight||s;return c.width=m*f,c.height=y*f,e.skipAutoScale||fWt(c),c.style.width=`${m}`,c.style.height=`${y}`,e.backgroundColor&&(a.fillStyle=e.backgroundColor,a.fillRect(0,0,c.width,c.height)),a.drawImage(o,0,0,c.width,c.height),c}async function eGt(t,e={}){return(await JWt(t,e)).toDataURL()}function tGt(){return rr({queryKey:["listing-swag-categories"],queryFn:async()=>{const{data:t,error:e}=await ee.from("listing_swag_categories").select("*").eq("is_active",!0).order("sort_order");if(e)throw e;return t}})}function rGt(){return rr({queryKey:["listing-swag-styles"],queryFn:async()=>{const{data:t,error:e}=await ee.from("listing_swag_styles").select("*").eq("is_active",!0).order("sort_order");if(e)throw e;return t}})}function nGt(){const{user:t}=Fr(),e=Xr();return cr({mutationFn:async n=>{if(!t)throw new Error("Not authenticated");const{error:s}=await ee.from("listing_swag_generations").insert({user_id:t.id,category_id:n.categoryId,style_id:n.styleId,listing_id:n.listingId||null,property_address:n.propertyAddress,property_city:n.propertyCity,property_state:n.propertyState,property_price:n.propertyPrice,bedrooms:n.bedrooms,bathrooms:n.bathrooms,square_feet:n.squareFeet,photo_url:n.photoUrl,formats_downloaded:n.formatsDownloaded});if(s)throw s},onSuccess:()=>{e.invalidateQueries({queryKey:["listing-swag-generations"]})}})}const sGt={portrait:{width:1080,height:1350},square:{width:1080,height:1080},story:{width:1080,height:1920}};function iMe(t){const e=t.substring(1),n=parseInt(e,16),s=n>>16&255,i=n>>8&255,o=n>>0&255;return .299*s+.587*i+.114*o>150}function aMe({data:t,format:e}){var w,k;const n=sGt[e],s=.4,i=t.primaryColor||"#1e3a5f",o=t.secondaryColor||"#ffffff",c=iMe(i)?"#0f172a":"#ffffff",a=iMe(o)?"#0f172a":"#ffffff",f=i+"33",m=C=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(C),y=e==="story",v=e==="square";return r.jsxs("div",{"data-template":!0,className:"relative overflow-hidden flex flex-col",style:{width:n.width*s,height:n.height*s,fontFamily:"'Inter', sans-serif",backgroundColor:i},children:[r.jsxs("div",{className:"relative",style:{height:y?"38%":v?"35%":"36%"},children:[t.photoUrl?r.jsx("img",{src:t.photoUrl,alt:"Property",className:"w-full h-full object-cover",crossOrigin:"anonymous"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",style:{backgroundColor:"#e5e7eb"},children:r.jsx("span",{style:{color:"#9ca3af",fontSize:28*s},children:"Add Property Photo"})}),r.jsx("div",{className:"absolute",style:{top:20*s,left:20*s,backgroundColor:i,padding:`${18*s}px ${36*s}px`,borderRadius:6*s},children:r.jsx("span",{style:{color:c,fontSize:28*s,fontWeight:800,textTransform:"uppercase",letterSpacing:"0.1em"},children:t.categoryName})}),r.jsxs("div",{className:"absolute",style:{bottom:20*s,right:20*s,backgroundColor:o,padding:`${20*s}px ${32*s}px`,borderRadius:6*s,boxShadow:"0 4px 20px rgba(0,0,0,0.15)"},children:[r.jsx("div",{style:{fontSize:16*s,color:"#64748b",fontWeight:600,marginBottom:4*s},children:"Listed at"}),r.jsx("div",{style:{fontSize:44*s,fontWeight:900,color:i},children:m(t.propertyPrice)})]})]}),r.jsxs("div",{className:"flex items-center",style:{backgroundColor:i,padding:`${28*s}px ${36*s}px`,gap:16*s},children:[r.jsx(yl,{style:{width:36*s,height:36*s,color:c,opacity:.8,flexShrink:0}}),r.jsxs("div",{children:[r.jsx("div",{style:{fontSize:36*s,fontWeight:800,color:c,marginBottom:4*s},children:t.propertyAddress}),r.jsxs("div",{style:{fontSize:24*s,color:c,opacity:.8,fontWeight:600},children:[t.propertyCity,", ",t.propertyState]})]})]}),r.jsx("div",{className:"flex",style:{backgroundColor:o},children:[{icon:Of,value:t.bedrooms,label:"Bedrooms"},{icon:Lf,value:t.bathrooms,label:"Bathrooms"},{icon:Z0,value:((w=t.squareFeet)==null?void 0:w.toLocaleString())||"—",label:"Sq Ft"}].map((C,S)=>r.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center",style:{padding:`${28*s}px`,borderRight:S<2?`2px solid ${f}`:"none",backgroundColor:S===1?f:o},children:[r.jsx(C.icon,{style:{width:36*s,height:36*s,color:i,marginBottom:10*s}}),r.jsx("div",{style:{fontSize:42*s,fontWeight:900,color:i},children:C.value}),r.jsx("div",{style:{fontSize:18*s,color:"#64748b",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em"},children:C.label})]},S))}),r.jsxs("div",{className:"flex items-center",style:{padding:`${48*s}px`,backgroundColor:o,gap:36*s,flex:1},children:[t.agentPhoto?r.jsx("img",{src:t.agentPhoto,alt:t.agentName,className:"object-cover",style:{width:220*s,height:220*s,borderRadius:"50%",border:`8px solid ${i}`,flexShrink:0},crossOrigin:"anonymous"}):r.jsx("div",{className:"flex items-center justify-center",style:{width:220*s,height:220*s,borderRadius:"50%",backgroundColor:i,color:c,fontSize:88*s,fontWeight:700,flexShrink:0},children:((k=t.agentName)==null?void 0:k.charAt(0))||"A"}),r.jsxs("div",{className:"flex-1 flex flex-col justify-center",children:[r.jsx("div",{style:{fontSize:56*s,fontWeight:900,color:i,marginBottom:8*s,lineHeight:1.1},children:t.agentName}),r.jsx("div",{style:{fontSize:28*s,color:"#64748b",marginBottom:24*s,fontWeight:600},children:"Real Estate Professional"}),r.jsxs("div",{className:"flex flex-col",style:{gap:16*s},children:[r.jsxs("div",{className:"flex items-center",style:{gap:16*s},children:[r.jsx("div",{style:{width:52*s,height:52*s,borderRadius:"50%",backgroundColor:i,display:"flex",alignItems:"center",justifyContent:"center"},children:r.jsx(Wa,{style:{width:28*s,height:28*s,color:c}})}),r.jsx("span",{style:{fontSize:36*s,color:a,fontWeight:800},children:t.agentPhone})]}),r.jsxs("div",{className:"flex items-center",style:{gap:16*s},children:[r.jsx("div",{style:{width:52*s,height:52*s,borderRadius:"50%",backgroundColor:i,display:"flex",alignItems:"center",justifyContent:"center"},children:r.jsx(di,{style:{width:28*s,height:28*s,color:c}})}),r.jsx("span",{style:{fontSize:30*s,color:"#475569",fontWeight:600},children:t.agentEmail})]})]})]})]})]})}const iGt={portrait:{width:1080,height:1350},square:{width:1080,height:1080},story:{width:1080,height:1920}};function oMe(t){const e=t.substring(1),n=parseInt(e,16),s=n>>16&255,i=n>>8&255,o=n>>0&255;return .299*s+.587*i+.114*o>150}function aGt({data:t,format:e}){var w,k;const n=iGt[e],s=.4,i=t.primaryColor||"#0f766e",o=t.secondaryColor||"#ffffff",c=oMe(i)?"#0f172a":"#ffffff",a=oMe(o)?"#0f172a":"#ffffff",f=i+"22",m=C=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(C),y=e==="story",v=e==="square";return r.jsxs("div",{"data-template":!0,className:"relative overflow-hidden flex flex-col",style:{width:n.width*s,height:n.height*s,fontFamily:"'Inter', sans-serif",backgroundColor:i},children:[r.jsxs("div",{className:"flex items-center justify-between",style:{backgroundColor:o,padding:`${28*s}px ${36*s}px`},children:[r.jsxs("div",{children:[r.jsx("div",{style:{fontSize:18*s,color:i,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.1em",marginBottom:4*s},children:"Just"}),r.jsx("div",{style:{fontSize:48*s,fontWeight:900,color:i,textTransform:"uppercase"},children:t.categoryName})]}),r.jsxs("div",{className:"text-right",children:[r.jsx("div",{style:{fontSize:16*s,color:"#64748b",marginBottom:4*s},children:"Price"}),r.jsx("div",{style:{fontSize:48*s,fontWeight:900,color:i},children:m(t.propertyPrice)})]})]}),r.jsx("div",{className:"relative",style:{height:y?"32%":"28%",margin:`0 ${24*s}px`,borderRadius:16*s,overflow:"hidden",border:`6px solid ${o}`},children:t.photoUrl?r.jsx("img",{src:t.photoUrl,alt:"Property",className:"w-full h-full object-cover",crossOrigin:"anonymous"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",style:{backgroundColor:f},children:r.jsx("span",{style:{color:i,fontSize:24*s},children:"Add Property Photo"})})}),r.jsxs("div",{className:"flex items-center",style:{backgroundColor:o,margin:`${20*s}px ${24*s}px`,padding:`${24*s}px ${32*s}px`,borderRadius:16*s,gap:18*s},children:[r.jsx("div",{className:"flex items-center justify-center",style:{width:64*s,height:64*s,backgroundColor:i,borderRadius:"50%",flexShrink:0},children:r.jsx(yl,{style:{width:32*s,height:32*s,color:c}})}),r.jsxs("div",{children:[r.jsx("div",{style:{fontSize:32*s,fontWeight:800,color:a},children:t.propertyAddress}),r.jsxs("div",{style:{fontSize:22*s,color:"#64748b",fontWeight:600},children:[t.propertyCity,", ",t.propertyState]})]})]}),r.jsx("div",{className:"flex justify-center",style:{gap:20*s,padding:`0 ${24*s}px`},children:[{icon:Of,value:t.bedrooms,label:"Beds"},{icon:Lf,value:t.bathrooms,label:"Baths"},{icon:Z0,value:((w=t.squareFeet)==null?void 0:w.toLocaleString())||"—",label:"Sq Ft"}].map((C,S)=>r.jsxs("div",{className:"flex-1 flex flex-col items-center",style:{backgroundColor:o,padding:`${24*s}px`,borderRadius:16*s},children:[r.jsx(C.icon,{style:{width:36*s,height:36*s,color:i,marginBottom:10*s}}),r.jsx("div",{style:{fontSize:40*s,fontWeight:900,color:a},children:C.value}),r.jsx("div",{style:{fontSize:16*s,color:"#64748b",fontWeight:600,textTransform:"uppercase"},children:C.label})]},S))}),r.jsxs("div",{className:"flex items-center",style:{backgroundColor:o,margin:`${20*s}px ${24*s}px`,marginBottom:24*s,padding:`${40*s}px`,borderRadius:20*s,gap:36*s,flex:1},children:[t.agentPhoto?r.jsx("img",{src:t.agentPhoto,alt:t.agentName,className:"object-cover",style:{width:200*s,height:200*s,borderRadius:"50%",border:`8px solid ${i}`,flexShrink:0},crossOrigin:"anonymous"}):r.jsx("div",{className:"flex items-center justify-center",style:{width:200*s,height:200*s,borderRadius:"50%",backgroundColor:i,color:c,fontSize:80*s,fontWeight:700,flexShrink:0},children:((k=t.agentName)==null?void 0:k.charAt(0))||"A"}),r.jsxs("div",{className:"flex-1 flex flex-col justify-center",children:[r.jsx("div",{style:{fontSize:52*s,fontWeight:900,color:a,marginBottom:8*s,lineHeight:1.1},children:t.agentName}),r.jsx("div",{style:{fontSize:24*s,color:i,fontWeight:700,marginBottom:20*s},children:"Licensed Real Estate Agent"}),r.jsxs("div",{className:"flex flex-col",style:{gap:14*s},children:[r.jsxs("div",{className:"flex items-center",style:{gap:14*s},children:[r.jsx("div",{style:{width:48*s,height:48*s,borderRadius:"50%",backgroundColor:i,display:"flex",alignItems:"center",justifyContent:"center"},children:r.jsx(Wa,{style:{width:26*s,height:26*s,color:c}})}),r.jsx("span",{style:{fontSize:34*s,color:a,fontWeight:800},children:t.agentPhone})]}),r.jsxs("div",{className:"flex items-center",style:{gap:14*s},children:[r.jsx("div",{style:{width:48*s,height:48*s,borderRadius:"50%",backgroundColor:i,display:"flex",alignItems:"center",justifyContent:"center"},children:r.jsx(di,{style:{width:26*s,height:26*s,color:c}})}),r.jsx("span",{style:{fontSize:28*s,color:"#475569",fontWeight:600},children:t.agentEmail})]})]})]})]})]})}const oGt={portrait:{width:1080,height:1350},square:{width:1080,height:1080},story:{width:1080,height:1920}};function lMe(t){const e=t.substring(1),n=parseInt(e,16),s=n>>16&255,i=n>>8&255,o=n>>0&255;return .299*s+.587*i+.114*o>150}function lGt({data:t,format:e}){var v,w;const n=oGt[e],s=.4,i=t.primaryColor||"#2c3e50",o=t.secondaryColor||"#c9a962",c=lMe(i)?"#0f172a":"#ffffff",a=lMe(o)?"#0f172a":"#ffffff",f=k=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(k),m=e==="story",y=e==="square";return r.jsxs("div",{"data-template":!0,className:"relative overflow-hidden flex flex-col",style:{width:n.width*s,height:n.height*s,fontFamily:"'Georgia', serif",backgroundColor:i},children:[r.jsxs("div",{className:"text-center",style:{backgroundColor:i,padding:`${32*s}px`,borderBottom:`6px solid ${o}`},children:[r.jsx("div",{style:{fontSize:20*s,color:o,textTransform:"uppercase",letterSpacing:"0.3em",marginBottom:8*s},children:"Just"}),r.jsx("div",{style:{fontSize:56*s,fontWeight:400,color:c,textTransform:"uppercase",letterSpacing:"0.15em"},children:t.categoryName})]}),r.jsxs("div",{className:"relative",style:{height:m?"30%":"26%",margin:`${24*s}px`,border:`4px solid ${o}`,borderRadius:6*s,overflow:"hidden"},children:[t.photoUrl?r.jsx("img",{src:t.photoUrl,alt:"Property",className:"w-full h-full object-cover",crossOrigin:"anonymous"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",style:{backgroundColor:"#e8e4de"},children:r.jsx("span",{style:{color:"#9ca3af",fontSize:24*s},children:"Add Property Photo"})}),r.jsxs("div",{className:"absolute",style:{bottom:20*s,right:20*s,backgroundColor:i,padding:`${18*s}px ${32*s}px`,borderRadius:6*s,border:`3px solid ${o}`},children:[r.jsx("div",{style:{fontSize:14*s,color:o,textTransform:"uppercase",letterSpacing:"0.1em"},children:"Offered at"}),r.jsx("div",{style:{fontSize:42*s,fontWeight:400,color:c},children:f(t.propertyPrice)})]})]}),r.jsxs("div",{className:"text-center",style:{padding:`${20*s}px ${36*s}px`,backgroundColor:"#faf8f5"},children:[r.jsx("div",{style:{fontSize:36*s,fontWeight:400,color:i,marginBottom:8*s},children:t.propertyAddress}),r.jsxs("div",{style:{fontSize:24*s,color:o,letterSpacing:"0.1em",fontWeight:600},children:[t.propertyCity,", ",t.propertyState]})]}),r.jsx("div",{className:"flex justify-center",style:{gap:48*s,padding:`${28*s}px`,backgroundColor:"#faf8f5",borderTop:"2px solid #e8e4de",borderBottom:"2px solid #e8e4de"},children:[{icon:Of,value:t.bedrooms,label:"Bedrooms"},{icon:Lf,value:t.bathrooms,label:"Bathrooms"},{icon:Z0,value:((v=t.squareFeet)==null?void 0:v.toLocaleString())||"—",label:"Sq Ft"}].map((k,C)=>r.jsxs("div",{className:"flex flex-col items-center",children:[r.jsx(k.icon,{style:{width:32*s,height:32*s,color:o,marginBottom:10*s}}),r.jsx("div",{style:{fontSize:40*s,fontWeight:400,color:i},children:k.value}),r.jsx("div",{style:{fontSize:16*s,color:"#7c8798",textTransform:"uppercase",letterSpacing:"0.08em"},children:k.label})]},C))}),r.jsxs("div",{className:"flex items-center justify-center",style:{backgroundColor:i,padding:`${48*s}px`,gap:40*s,borderTop:`6px solid ${o}`,flex:1},children:[t.agentPhoto?r.jsx("img",{src:t.agentPhoto,alt:t.agentName,className:"object-cover",style:{width:200*s,height:200*s,borderRadius:"50%",border:`6px solid ${o}`,flexShrink:0},crossOrigin:"anonymous"}):r.jsx("div",{className:"flex items-center justify-center",style:{width:200*s,height:200*s,borderRadius:"50%",backgroundColor:o,color:a,fontSize:80*s,fontWeight:400,fontStyle:"italic",flexShrink:0},children:((w=t.agentName)==null?void 0:w.charAt(0))||"A"}),r.jsxs("div",{className:"text-center flex flex-col justify-center",children:[r.jsx("div",{style:{fontSize:52*s,fontWeight:400,color:c,fontStyle:"italic",marginBottom:10*s,lineHeight:1.1},children:t.agentName}),r.jsx("div",{style:{fontSize:22*s,color:o,textTransform:"uppercase",letterSpacing:"0.2em",marginBottom:24*s},children:"Real Estate Advisor"}),r.jsxs("div",{className:"flex flex-col items-center",style:{gap:16*s},children:[r.jsxs("div",{className:"flex items-center",style:{gap:14*s},children:[r.jsx("div",{style:{width:48*s,height:48*s,borderRadius:"50%",backgroundColor:o,display:"flex",alignItems:"center",justifyContent:"center"},children:r.jsx(Wa,{style:{width:26*s,height:26*s,color:a}})}),r.jsx("span",{style:{fontSize:32*s,color:c,fontWeight:600},children:t.agentPhone})]}),r.jsxs("div",{className:"flex items-center",style:{gap:14*s},children:[r.jsx("div",{style:{width:48*s,height:48*s,borderRadius:"50%",backgroundColor:o,display:"flex",alignItems:"center",justifyContent:"center"},children:r.jsx(di,{style:{width:26*s,height:26*s,color:a}})}),r.jsx("span",{style:{fontSize:26*s,color:"#94a3b8"},children:t.agentEmail})]})]})]})]})]})}const cGt={portrait:{width:1080,height:1350},square:{width:1080,height:1080},story:{width:1080,height:1920}};function dGt(t){const e=t.substring(1),n=parseInt(e,16),s=n>>16&255,i=n>>8&255,o=n>>0&255;return .299*s+.587*i+.114*o>150}function uGt({data:t,format:e}){var v,w;const n=cGt[e],s=.4,i=t.primaryColor||"#dc2626",o=t.secondaryColor||"#ffffff",c=dGt(i)?"#0f172a":"#ffffff",a=i+"22",f=k=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(k),m=e==="story",y=e==="square";return r.jsxs("div",{"data-template":!0,className:"relative overflow-hidden flex flex-col",style:{width:n.width*s,height:n.height*s,fontFamily:"'Inter', sans-serif",backgroundColor:"#0f172a"},children:[r.jsxs("div",{className:"flex items-center justify-between",style:{backgroundColor:i,padding:`${32*s}px ${40*s}px`},children:[r.jsx("div",{style:{fontSize:48*s,fontWeight:900,color:c,textTransform:"uppercase",letterSpacing:"0.05em"},children:t.categoryName}),r.jsxs("div",{className:"text-right",children:[r.jsx("div",{style:{fontSize:16*s,color:c,opacity:.8,marginBottom:4*s},children:"Asking"}),r.jsx("div",{style:{fontSize:44*s,fontWeight:900,color:c},children:f(t.propertyPrice)})]})]}),r.jsxs("div",{className:"relative",style:{height:m?"30%":y?"28%":"26%"},children:[t.photoUrl?r.jsx("img",{src:t.photoUrl,alt:"Property",className:"w-full h-full object-cover",crossOrigin:"anonymous"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",style:{backgroundColor:a},children:r.jsx("span",{style:{color:i,fontSize:24*s},children:"Add Property Photo"})}),r.jsxs("div",{className:"absolute",style:{bottom:0,left:0,right:0,backgroundColor:"rgba(0,0,0,0.9)",padding:`${24*s}px ${32*s}px`},children:[r.jsx("div",{style:{fontSize:32*s,fontWeight:800,color:"#ffffff"},children:t.propertyAddress}),r.jsxs("div",{style:{fontSize:22*s,color:i,fontWeight:600},children:[t.propertyCity,", ",t.propertyState]})]})]}),r.jsx("div",{className:"flex",style:{borderBottom:`6px solid ${i}`},children:[{icon:Of,value:t.bedrooms,label:"Beds"},{icon:Lf,value:t.bathrooms,label:"Baths"},{icon:Z0,value:((v=t.squareFeet)==null?void 0:v.toLocaleString())||"—",label:"Sq Ft"}].map((k,C)=>r.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center",style:{padding:`${28*s}px`,backgroundColor:C===1?a:o,borderRight:C<2?`2px solid ${a}`:"none"},children:[r.jsx(k.icon,{style:{width:36*s,height:36*s,color:i,marginBottom:10*s}}),r.jsx("div",{style:{fontSize:42*s,fontWeight:900,color:"#0f172a"},children:k.value}),r.jsx("div",{style:{fontSize:16*s,color:"#64748b",fontWeight:600,textTransform:"uppercase"},children:k.label})]},C))}),r.jsxs("div",{className:"flex items-center",style:{backgroundColor:"#0f172a",padding:`${48*s}px`,gap:40*s,flex:1},children:[r.jsx("div",{style:{width:220*s,height:220*s,borderRadius:"50%",border:`8px solid ${i}`,padding:6*s,backgroundColor:"#1e293b",flexShrink:0},children:t.agentPhoto?r.jsx("img",{src:t.agentPhoto,alt:t.agentName,className:"w-full h-full object-cover",style:{borderRadius:"50%"},crossOrigin:"anonymous"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",style:{borderRadius:"50%",backgroundColor:i,color:c,fontSize:88*s,fontWeight:700},children:((w=t.agentName)==null?void 0:w.charAt(0))||"A"})}),r.jsxs("div",{className:"flex-1 flex flex-col justify-center",children:[r.jsx("div",{style:{fontSize:56*s,fontWeight:900,color:"#ffffff",marginBottom:10*s,lineHeight:1.1},children:t.agentName}),r.jsx("div",{style:{fontSize:28*s,color:i,fontWeight:700,marginBottom:24*s},children:"Your Real Estate Expert"}),r.jsxs("div",{className:"flex flex-col",style:{gap:18*s},children:[r.jsxs("div",{className:"flex items-center",style:{gap:16*s},children:[r.jsx("div",{style:{width:56*s,height:56*s,borderRadius:"50%",backgroundColor:i,display:"flex",alignItems:"center",justifyContent:"center"},children:r.jsx(Wa,{style:{width:30*s,height:30*s,color:c}})}),r.jsx("span",{style:{fontSize:38*s,color:"#ffffff",fontWeight:800},children:t.agentPhone})]}),r.jsxs("div",{className:"flex items-center",style:{gap:16*s},children:[r.jsx("div",{style:{width:56*s,height:56*s,borderRadius:"50%",backgroundColor:i,display:"flex",alignItems:"center",justifyContent:"center"},children:r.jsx(di,{style:{width:30*s,height:30*s,color:c}})}),r.jsx("span",{style:{fontSize:30*s,color:"#94a3b8",fontWeight:600},children:t.agentEmail})]})]})]})]})]})}function hGt({templateKey:t,data:e,format:n}){switch(t){case"modern-minimal":return r.jsx(aMe,{data:e,format:n});case"bold-impact":return r.jsx(aGt,{data:e,format:n});case"classic-elegant":return r.jsx(lGt,{data:e,format:n});case"vibrant-energy":return r.jsx(uGt,{data:e,format:n});default:return r.jsx(aMe,{data:e,format:n})}}const fGt={Home:r.jsx(Hi,{className:"h-6 w-6"}),DoorOpen:r.jsx(oT,{className:"h-6 w-6"}),TrendingDown:r.jsx(Kw,{className:"h-6 w-6"}),CheckCircle:r.jsx(za,{className:"h-6 w-6"}),FileText:r.jsx(Ai,{className:"h-6 w-6"})},I5={portrait:{label:"Portrait",icon:r.jsx(Wo,{className:"h-5 w-5"}),dimensions:"1080×1350",ratio:"4:5"},square:{label:"Square",icon:r.jsx(im,{className:"h-5 w-5"}),dimensions:"1080×1080",ratio:"1:1"},story:{label:"Story",icon:r.jsx(Q0,{className:"h-5 w-5"}),dimensions:"1080×1920",ratio:"9:16"}};function pGt(){const{user:t}=Fr(),{data:e,isLoading:n}=tGt(),{data:s,isLoading:i}=rGt(),{data:o}=aye(),{avatarUrl:c}=mge(t==null?void 0:t.id),a=nGt(),[f,m]=P.useState(null);P.useEffect(()=>{(async()=>{if(!t)return;const{data:je}=await ee.from("profiles").select("name, phone").eq("id",t.id).single();je&&m(je)})()},[t]);const[y,v]=P.useState("category"),[w,k]=P.useState(null),[C,S]=P.useState(null),[T,I]=P.useState("portrait"),[A,D]=P.useState(!1),[$,F]=P.useState(""),[q,W]=P.useState("#1e3a5f"),[K,Z]=P.useState("#ffffff"),[re,he]=P.useState({propertyAddress:"",propertyCity:"",propertyState:"",propertyPrice:"",bedrooms:"",bathrooms:"",squareFeet:"",openHouseDate:"",openHouseTime:"",originalPrice:""}),ue=P.useRef(null),Ne=ae=>{var Me;const je=(Me=ae.target.files)==null?void 0:Me[0];if(je){const Ue=new FileReader;Ue.onloadend=()=>{F(Ue.result)},Ue.readAsDataURL(je)}},se=ae=>{var Me,Ue,Re,$e,Pe,Ae;const je=o==null?void 0:o.find(nt=>nt.id===ae);je&&(he({propertyAddress:je.property_address||"",propertyCity:je.city||"",propertyState:je.state||"",propertyPrice:((Me=je.price)==null?void 0:Me.toString())||"",bedrooms:((Ue=je.bedrooms)==null?void 0:Ue.toString())||"",bathrooms:((Re=je.bathrooms)==null?void 0:Re.toString())||"",squareFeet:(($e=je.square_footage)==null?void 0:$e.toString())||"",openHouseDate:"",openHouseTime:"",originalPrice:""}),(Ae=(Pe=je.photos)==null?void 0:Pe[0])!=null&&Ae.photo_url&&F(je.photos[0].photo_url))},xe=()=>({categoryId:(w==null?void 0:w.id)||"",categoryName:(w==null?void 0:w.name)||"",styleId:(C==null?void 0:C.id)||"",templateKey:(C==null?void 0:C.template_key)||"modern-minimal",primaryColor:q,secondaryColor:K,accentColor:q,fontFamily:(C==null?void 0:C.font_family)||"Inter",propertyAddress:re.propertyAddress,propertyCity:re.propertyCity,propertyState:re.propertyState,propertyPrice:parseFloat(re.propertyPrice)||0,bedrooms:parseInt(re.bedrooms)||0,bathrooms:parseFloat(re.bathrooms)||0,squareFeet:parseInt(re.squareFeet)||0,photoUrl:$,agentName:(f==null?void 0:f.name)||"Agent Name",agentPhone:(f==null?void 0:f.phone)||"",agentEmail:(t==null?void 0:t.email)||"",agentPhoto:c||"",brokerageName:"",openHouseDate:re.openHouseDate,openHouseTime:re.openHouseTime,originalPrice:re.originalPrice?parseFloat(re.originalPrice):void 0}),ie=async ae=>{if(ue.current){D(!0);try{const je=ue.current.querySelector("[data-template]");if(!je)throw new Error("Template not found");const Me={portrait:{width:1080,height:1350},square:{width:1080,height:1080},story:{width:1080,height:1920}},Ue=.3,Re=Me[ae],$e=await eGt(je,{width:Re.width*Ue,height:Re.height*Ue,pixelRatio:1/Ue,cacheBust:!0}),Pe=document.createElement("a");Pe.download=`listing-${w==null?void 0:w.slug}-${ae}-${Date.now()}.png`,Pe.href=$e,Pe.click(),w&&C&&a.mutate({categoryId:w.id,styleId:C.id,propertyAddress:re.propertyAddress,propertyCity:re.propertyCity,propertyState:re.propertyState,propertyPrice:parseFloat(re.propertyPrice)||void 0,bedrooms:parseInt(re.bedrooms)||void 0,bathrooms:parseFloat(re.bathrooms)||void 0,squareFeet:parseInt(re.squareFeet)||void 0,photoUrl:$,formatsDownloaded:[ae]}),Ge.success(`Downloaded ${I5[ae].label} format!`)}catch(je){console.error("Download error:",je),Ge.error("Failed to download image")}finally{D(!1)}}},me=async()=>{const ae=["portrait","square","story"];for(const je of ae)I(je),await new Promise(Me=>setTimeout(Me,500)),await ie(je)},fe=()=>{switch(y){case"category":return!!w;case"style":return!!C;case"details":return re.propertyAddress&&re.propertyPrice&&$;default:return!0}},ve=()=>{const ae=["category","style","details","preview"],je=ae.indexOf(y);je{const ae=["category","style","details","preview"],je=ae.indexOf(y);je>0&&v(ae[je-1])},Se=()=>r.jsx("div",{className:"flex items-center justify-center gap-2 mb-8",children:["category","style","details","preview"].map((ae,je)=>r.jsxs(lt.Fragment,{children:[r.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center text-sm font-medium transition-colors ${y===ae?"bg-primary text-primary-foreground":oe.indexOf(y)>je?"bg-primary/20 text-primary":"bg-muted text-muted-foreground"}`,children:je+1}),je<3&&r.jsx("div",{className:`w-12 h-0.5 ${oe.indexOf(y)>je?"bg-primary":"bg-muted"}`})]},ae))}),oe=["category","style","details","preview"];return n||i?r.jsxs("div",{className:"space-y-6",children:[r.jsx(Gr,{className:"h-8 w-64 mx-auto"}),r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:[1,2,3,4,5].map(ae=>r.jsx(Gr,{className:"h-32"},ae))})]}):r.jsxs("div",{className:"max-w-4xl mx-auto",children:[Se(),y==="category"&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("h2",{className:"text-2xl font-bold mb-2",children:"What type of announcement?"}),r.jsx("p",{className:"text-muted-foreground",children:"Choose the category that matches your listing status"})]}),r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:e==null?void 0:e.map(ae=>r.jsx(Ye,{className:`cursor-pointer transition-all hover:shadow-md ${(w==null?void 0:w.id)===ae.id?"ring-2 ring-primary border-primary":""}`,onClick:()=>k(ae),children:r.jsxs(Je,{className:"p-6 text-center",children:[r.jsx("div",{className:"w-12 h-12 mx-auto mb-3 rounded-full bg-primary/10 flex items-center justify-center text-primary",children:fGt[ae.icon||"Home"]}),r.jsx("h3",{className:"font-semibold",children:ae.name})]})},ae.id))})]}),y==="style"&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("h2",{className:"text-2xl font-bold mb-2",children:"Choose your layout & colors"}),r.jsx("p",{className:"text-muted-foreground",children:"Select a layout style and customize your brand colors"})]}),r.jsx(Ye,{children:r.jsxs(Je,{className:"p-6",children:[r.jsx("h3",{className:"font-semibold mb-4",children:"Your Brand Colors"}),r.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[r.jsxs("div",{children:[r.jsx(Qe,{className:"mb-2 block",children:"Primary Color"}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("input",{type:"color",value:q,onChange:ae=>W(ae.target.value),className:"w-12 h-12 rounded-lg border-2 border-border cursor-pointer",style:{padding:0}}),r.jsx(yt,{value:q,onChange:ae=>W(ae.target.value),className:"flex-1 font-mono uppercase",maxLength:7})]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Used for headers, badges, and accents"})]}),r.jsxs("div",{children:[r.jsx(Qe,{className:"mb-2 block",children:"Secondary Color"}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("input",{type:"color",value:K,onChange:ae=>Z(ae.target.value),className:"w-12 h-12 rounded-lg border-2 border-border cursor-pointer",style:{padding:0}}),r.jsx(yt,{value:K,onChange:ae=>Z(ae.target.value),className:"flex-1 font-mono uppercase",maxLength:7})]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Used for backgrounds and contrast"})]})]}),r.jsxs("div",{className:"mt-4 p-4 rounded-lg border flex items-center gap-4",children:[r.jsx("div",{className:"w-16 h-16 rounded-lg flex items-center justify-center text-sm font-bold",style:{backgroundColor:q,color:K},children:"Preview"}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"This is how your primary and secondary colors will look together"})]})]})}),r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-4 text-center",children:"Choose Layout Style"}),r.jsx("div",{className:"grid grid-cols-2 gap-4",children:s==null?void 0:s.map(ae=>r.jsxs(Ye,{className:`cursor-pointer transition-all hover:shadow-md overflow-hidden ${(C==null?void 0:C.id)===ae.id?"ring-2 ring-primary border-primary":""}`,onClick:()=>S(ae),children:[r.jsx("div",{className:"h-32 flex items-center justify-center text-white font-bold",style:{background:`linear-gradient(135deg, ${q} 0%, ${q}cc 100%)`},children:r.jsx("span",{className:"text-lg",children:ae.name})}),r.jsxs(Je,{className:"p-4",children:[r.jsx("h3",{className:"font-semibold mb-1",children:ae.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:ae.description})]})]},ae.id))})]})]}),y==="details"&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("h2",{className:"text-2xl font-bold mb-2",children:"Add listing details"}),r.jsx("p",{className:"text-muted-foreground",children:"Enter the property information and upload a photo"})]}),o&&o.length>0&&r.jsx(Ye,{children:r.jsxs(Je,{className:"p-4",children:[r.jsx(Qe,{className:"mb-2 block",children:"Quick fill from your listings"}),r.jsxs("select",{className:"w-full p-2 border rounded-md",onChange:ae=>se(ae.target.value),defaultValue:"",children:[r.jsx("option",{value:"",children:"Select a listing..."}),o.map(ae=>r.jsxs("option",{value:ae.id,children:[ae.property_address,", ",ae.city]},ae.id))]})]})}),r.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[r.jsx(Ye,{children:r.jsxs(Je,{className:"p-4",children:[r.jsx(Qe,{className:"mb-2 block",children:"Property Photo *"}),r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-4 text-center cursor-pointer hover:border-primary transition-colors",onClick:()=>{var ae;return(ae=document.getElementById("photo-upload"))==null?void 0:ae.click()},children:[$?r.jsx("img",{src:$,alt:"Preview",className:"w-full h-48 object-cover rounded"}):r.jsxs("div",{className:"py-8",children:[r.jsx(Ao,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Click to upload photo"})]}),r.jsx("input",{id:"photo-upload",type:"file",accept:"image/*",className:"hidden",onChange:Ne})]})]})}),r.jsx(Ye,{children:r.jsxs(Je,{className:"p-4 space-y-4",children:[r.jsxs("div",{children:[r.jsx(Qe,{children:"Street Address *"}),r.jsx(yt,{value:re.propertyAddress,onChange:ae=>he({...re,propertyAddress:ae.target.value}),placeholder:"123 Main Street"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsxs("div",{children:[r.jsx(Qe,{children:"City"}),r.jsx(yt,{value:re.propertyCity,onChange:ae=>he({...re,propertyCity:ae.target.value}),placeholder:"Austin"})]}),r.jsxs("div",{children:[r.jsx(Qe,{children:"State"}),r.jsx(yt,{value:re.propertyState,onChange:ae=>he({...re,propertyState:ae.target.value}),placeholder:"TX"})]})]}),r.jsxs("div",{children:[r.jsx(Qe,{children:"Price *"}),r.jsx(yt,{type:"number",value:re.propertyPrice,onChange:ae=>he({...re,propertyPrice:ae.target.value}),placeholder:"450000"})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[r.jsxs("div",{children:[r.jsx(Qe,{children:"Beds"}),r.jsx(yt,{type:"number",value:re.bedrooms,onChange:ae=>he({...re,bedrooms:ae.target.value}),placeholder:"3"})]}),r.jsxs("div",{children:[r.jsx(Qe,{children:"Baths"}),r.jsx(yt,{type:"number",step:"0.5",value:re.bathrooms,onChange:ae=>he({...re,bathrooms:ae.target.value}),placeholder:"2"})]}),r.jsxs("div",{children:[r.jsx(Qe,{children:"Sq Ft"}),r.jsx(yt,{type:"number",value:re.squareFeet,onChange:ae=>he({...re,squareFeet:ae.target.value}),placeholder:"2000"})]})]}),(w==null?void 0:w.slug)==="open-house"&&r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsxs("div",{children:[r.jsx(Qe,{children:"Open House Date"}),r.jsx(yt,{type:"date",value:re.openHouseDate,onChange:ae=>he({...re,openHouseDate:ae.target.value})})]}),r.jsxs("div",{children:[r.jsx(Qe,{children:"Time"}),r.jsx(yt,{value:re.openHouseTime,onChange:ae=>he({...re,openHouseTime:ae.target.value}),placeholder:"2-4 PM"})]})]}),(w==null?void 0:w.slug)==="price-drop"&&r.jsxs("div",{children:[r.jsx(Qe,{children:"Original Price"}),r.jsx(yt,{type:"number",value:re.originalPrice,onChange:ae=>he({...re,originalPrice:ae.target.value}),placeholder:"500000"})]})]})})]})]}),y==="preview"&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("h2",{className:"text-2xl font-bold mb-2",children:"Preview & Download"}),r.jsx("p",{className:"text-muted-foreground",children:"Choose your format and download your listing graphic"})]}),r.jsx(La,{value:T,onValueChange:ae=>I(ae),className:"w-full",children:r.jsx(Ma,{className:"grid w-full grid-cols-4",children:Object.entries(I5).map(([ae,je])=>r.jsxs(yn,{value:ae,className:"gap-2",children:[je.icon,r.jsx("span",{className:"hidden sm:inline",children:je.label})]},ae))})}),r.jsxs("div",{className:"flex justify-center gap-2 mb-4",children:[r.jsx(Rt,{variant:"secondary",children:I5[T].dimensions}),r.jsx(Rt,{variant:"outline",children:I5[T].ratio})]}),r.jsx("div",{className:"flex justify-center",ref:ue,children:r.jsx("div",{"data-template":!0,className:"shadow-2xl rounded-lg overflow-hidden",children:r.jsx(hGt,{templateKey:(C==null?void 0:C.template_key)||"modern-minimal",data:xe(),format:T})})}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[r.jsxs(te,{size:"lg",onClick:()=>ie(T),disabled:A,children:[A?r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(Mo,{className:"h-4 w-4 mr-2"}),"Download ",I5[T].label]}),r.jsxs(te,{size:"lg",variant:"outline",onClick:me,disabled:A,children:[r.jsx(Mo,{className:"h-4 w-4 mr-2"}),"Download All Formats"]})]})]}),r.jsxs("div",{className:"flex justify-between mt-8 pt-6 border-t",children:[r.jsxs(te,{variant:"outline",onClick:Ie,disabled:y==="category",children:[r.jsx(Va,{className:"h-4 w-4 mr-2"}),"Back"]}),y!=="preview"&&r.jsxs(te,{onClick:ve,disabled:!fe(),children:["Continue",r.jsx(Ho,{className:"h-4 w-4 ml-2"})]})]})]})}function mGt(){const{isAdmin:t}=Fr();return t?r.jsxs(Or,{children:[r.jsxs(Mg,{children:[r.jsx("title",{children:"Listing Swag | LevelUp"}),r.jsx("meta",{name:"description",content:"Create stunning listing graphics for your properties"})]}),r.jsxs("div",{className:"space-y-8",children:[r.jsxs("div",{className:"relative overflow-hidden rounded-2xl bg-gradient-to-br from-primary via-primary/90 to-primary/80 p-8 text-white",children:[r.jsx("div",{className:"absolute inset-0 bg-[url('/placeholder.svg')] opacity-5"}),r.jsxs("div",{className:"relative z-10",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx(Mi,{className:"h-6 w-6"}),r.jsx("span",{className:"text-sm font-medium uppercase tracking-wider opacity-90",children:"Marketing Tools"})]}),r.jsx("h1",{className:"text-3xl md:text-4xl font-bold mb-3",children:"Listing Swag"}),r.jsx("p",{className:"text-lg opacity-90 max-w-2xl mb-6",children:"Create beautiful, professional listing graphics in seconds. Choose from stunning templates and download in multiple formats."}),r.jsxs("div",{className:"flex flex-wrap gap-4",children:[r.jsxs("div",{className:"flex items-center gap-2 bg-white/10 rounded-lg px-4 py-2",children:[r.jsx(Gd,{className:"h-5 w-5"}),r.jsx("span",{className:"text-sm",children:"4 Unique Styles"})]}),r.jsxs("div",{className:"flex items-center gap-2 bg-white/10 rounded-lg px-4 py-2",children:[r.jsx(Wo,{className:"h-5 w-5"}),r.jsx("span",{className:"text-sm",children:"4 Export Formats"})]}),r.jsxs("div",{className:"flex items-center gap-2 bg-white/10 rounded-lg px-4 py-2",children:[r.jsx(Mo,{className:"h-5 w-5"}),r.jsx("span",{className:"text-sm",children:"Instant Download"})]})]})]})]}),r.jsx(pGt,{})]})]}):r.jsx(ZJ,{to:"/dashboard",replace:!0})}const gGt=()=>{const t=Cg();return P.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",t.pathname)},[t.pathname]),r.jsx("div",{className:"flex min-h-screen items-center justify-center bg-gray-100",children:r.jsxs("div",{className:"text-center",children:[r.jsx("h1",{className:"mb-4 text-4xl font-bold",children:"404"}),r.jsx("p",{className:"mb-4 text-xl text-gray-600",children:"Oops! Page not found"}),r.jsx("a",{href:"/",className:"text-blue-500 underline hover:text-blue-700",children:"Return to Home"})]})})},yGt=new JXe,xGt=()=>{const t=window.location.hostname;return t==="listings.relevelup.com"||t.startsWith("listings.")},vGt=()=>r.jsx(sQe,{client:yGt,children:r.jsx(wEe,{children:r.jsxs(KE,{children:[r.jsx(_Ze,{}),r.jsx(QZe,{}),r.jsx(yJe,{children:r.jsx(krt,{children:r.jsxs(Nrt,{children:[r.jsx(Srt,{}),r.jsx(Pnt,{}),xGt()?r.jsx(vst,{}):r.jsxs(cJe,{children:[r.jsx(ln,{path:"/",element:r.jsx(Ist,{})}),r.jsx(ln,{path:"/privacy-policy",element:r.jsx(Pst,{})}),r.jsx(ln,{path:"/terms-of-service",element:r.jsx(Lst,{})}),r.jsx(ln,{path:"/data-deletion",element:r.jsx(Ost,{})}),r.jsx(ln,{path:"/public/listings",element:r.jsx($Pe,{})}),r.jsx(ln,{path:"/public/listing/:slugOrId",element:r.jsx(Fut,{})}),r.jsx(ln,{path:"/auth",element:r.jsx(uit,{})}),r.jsx(ln,{path:"/subscription-success",element:r.jsx(hit,{})}),r.jsx(ln,{path:"/subscription",element:r.jsx(Nn,{children:r.jsx(uut,{})})}),r.jsx(ln,{path:"/share/video",element:r.jsx(Lut,{}),children:r.jsx(ln,{path:":shareToken",element:r.jsx(Put,{})})}),r.jsx(ln,{path:"/og/video/:token",element:r.jsx(Out,{})}),r.jsx(ln,{path:"/setup-brokerage",element:r.jsx(Nn,{children:r.jsx(hut,{})})}),r.jsx(ln,{path:"/claim-account",element:r.jsx(Qje,{})}),r.jsx(ln,{path:"/claim",element:r.jsx(Qje,{})}),r.jsx(ln,{path:"/join",element:r.jsx(fut,{})}),r.jsx(ln,{path:"/trial",element:r.jsx(kut,{})}),r.jsx(ln,{path:"/trial/success",element:r.jsx(Nut,{})}),r.jsx(ln,{path:"/dashboard",element:r.jsx(Nn,{children:r.jsx($ht,{})})}),r.jsx(ln,{path:"/profile",element:r.jsx(Nn,{children:r.jsx(wft,{})})}),r.jsx(ln,{path:"/apps",element:r.jsx(Nn,{children:r.jsx(Oft,{})})}),r.jsx(ln,{path:"/admin",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(Pgt,{})})}),r.jsx(ln,{path:"/admin/apps",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(Dgt,{})})}),r.jsx(ln,{path:"/admin/members",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(zgt,{})})}),r.jsx(ln,{path:"/admin/invite-codes",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(Bgt,{})})}),r.jsx(ln,{path:"/admin/events",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(L2t,{})})}),r.jsx(ln,{path:"/events",element:r.jsx(Nn,{children:r.jsx(Ift,{})})}),r.jsx(ln,{path:"/events/:eventId",element:r.jsx(Nn,{children:r.jsx(Lft,{})})}),r.jsx(ln,{path:"/templates",element:r.jsx(Nn,{children:r.jsx(Dft,{})})}),r.jsx(ln,{path:"/templates/:templateId",element:r.jsx(Nn,{children:r.jsx(Bft,{})})}),r.jsx(ln,{path:"/admin/templates",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(O2t,{})})}),r.jsx(ln,{path:"/academy",element:r.jsx(Nn,{children:r.jsx($ft,{})})}),r.jsx(ln,{path:"/academy/:videoId",element:r.jsx(Nn,{children:r.jsx(qft,{})})}),r.jsx(ln,{path:"/admin/academy",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(R2t,{})})}),r.jsx(ln,{path:"/toolbox",element:r.jsx(Nn,{children:r.jsx(Vft,{})})}),r.jsx(ln,{path:"/toolbox/:kitId",element:r.jsx(Nn,{children:r.jsx(Hft,{})})}),r.jsx(ln,{path:"/admin/toolbox",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(F2t,{})})}),r.jsx(ln,{path:"/social-swag",element:r.jsx(Nn,{children:r.jsx(Wft,{})})}),r.jsx(ln,{path:"/social-swag-2",element:r.jsx(Nn,{children:r.jsx(ngt,{})})}),r.jsx(ln,{path:"/social-swag/:swagId",element:r.jsx(Nn,{children:r.jsx(sgt,{})})}),r.jsx(ln,{path:"/social-connections",element:r.jsx(Nn,{children:r.jsx(YHt,{})})}),r.jsx(ln,{path:"/social-connections/callback",element:r.jsx(Nn,{children:r.jsx(XHt,{})})}),r.jsx(ln,{path:"/social-connections/linkedin-callback",element:r.jsx(Nn,{children:r.jsx(JHt,{})})}),r.jsx(ln,{path:"/social-connections/google-callback",element:r.jsx(Nn,{children:r.jsx(QHt,{})})}),r.jsx(ln,{path:"/admin/social-swag",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(z2t,{})})}),r.jsx(ln,{path:"/admin/social-swag-2",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(B2t,{})})}),r.jsx(ln,{path:"/community",element:r.jsx(Nn,{children:r.jsx(jgt,{})})}),r.jsx(ln,{path:"/support",element:r.jsx(Nn,{children:r.jsx(kgt,{})})}),r.jsx(ln,{path:"/admin/community",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx($2t,{})})}),r.jsx(ln,{path:"/admin/support-tickets",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(Z2t,{})})}),r.jsx(ln,{path:"/admin/email-templates",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(Q2t,{})})}),r.jsx(ln,{path:"/admin/analytics",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(W2t,{})})}),r.jsx(ln,{path:"/admin/brokerage-resources",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(G2t,{})})}),r.jsx(ln,{path:"/admin/dashboard-management",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(K2t,{})})}),r.jsx(ln,{path:"/brokerage/dashboard",element:r.jsx(Nn,{requireBrokerageManager:!0,children:r.jsx(cbt,{})})}),r.jsx(ln,{path:"/my-brokerage",element:r.jsx(Nn,{children:r.jsx(mbt,{})})}),r.jsx(ln,{path:"/brokerage-resources",element:r.jsx(Nn,{requireBrokerageManager:!0,children:r.jsx(Agt,{})})}),r.jsx(ln,{path:"/brokerage-resources/:resourceId",element:r.jsx(Nn,{requireBrokerageManager:!0,children:r.jsx(Egt,{})})}),r.jsx(ln,{path:"/newsletters",element:r.jsx(Nn,{children:r.jsx(gbt,{})})}),r.jsx(ln,{path:"/newsletters/:id",element:r.jsx(Nn,{children:r.jsx(ybt,{})})}),r.jsx(ln,{path:"/wishlist",element:r.jsx(Nn,{children:r.jsx(vbt,{})})}),r.jsx(ln,{path:"/wishlist/:itemId",element:r.jsx(Nn,{children:r.jsx(_bt,{})})}),r.jsx(ln,{path:"/admin/wishlist",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(bbt,{})})}),r.jsx(ln,{path:"/admin/levelup-brief",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(wbt,{})})}),r.jsx(ln,{path:"/admin/newsletters",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(xbt,{})})}),r.jsx(ln,{path:"/admin/additional-services",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(jbt,{})})}),r.jsx(ln,{path:"/admin/discounts",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(kbt,{})})}),r.jsx(ln,{path:"/admin/subscriptions",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(Nbt,{})})}),r.jsx(ln,{path:"/admin/referrals",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(Sbt,{})})}),r.jsx(ln,{path:"/admin/onboarding-checklist",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(Mbt,{})})}),r.jsx(ln,{path:"/admin/marketplace",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(AHt,{})})}),r.jsx(ln,{path:"/admin/agent-points",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(iHt,{})})}),r.jsx(ln,{path:"/admin/reward-store",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(HHt,{})})}),r.jsx(ln,{path:"/admin/integrations",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(WHt,{})})}),r.jsx(ln,{path:"/admin/integrations/callback",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(ZHt,{})})}),r.jsx(ln,{path:"/reward-store",element:r.jsx(Nn,{children:r.jsx(oWt,{})})}),r.jsx(ln,{path:"/additional-services",element:r.jsx(Nn,{children:r.jsx(zbt,{})})}),r.jsx(ln,{path:"/additional-services/:serviceId",element:r.jsx(Nn,{children:r.jsx(Bbt,{})})}),r.jsx(ln,{path:"/ai-toolkit",element:r.jsx(Nn,{children:r.jsx($bt,{})})}),r.jsx(ln,{path:"/listing-swag",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(mGt,{})})}),r.jsx(ln,{path:"/innercircle",element:r.jsx(Nn,{children:r.jsx(Vbt,{})})}),r.jsx(ln,{path:"/innercircle/contacts",element:r.jsx(Nn,{children:r.jsx(nwt,{})})}),r.jsx(ln,{path:"/innercircle/contacts/:contactId",element:r.jsx(Nn,{children:r.jsx(xwt,{})})}),r.jsx(ln,{path:"/innercircle/plans",element:r.jsx(Nn,{children:r.jsx(vwt,{})})}),r.jsx(ln,{path:"/innercircle/popbys",element:r.jsx(Nn,{children:r.jsx(wwt,{})})}),r.jsx(ln,{path:"/innercircle/popbys/map",element:r.jsx(Nn,{children:r.jsx(kwt,{})})}),r.jsx(ln,{path:"/admin/notification-settings",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(KHt,{})})}),r.jsx(ln,{path:"/admin/agent-os",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(Abt,{})})}),r.jsx(ln,{path:"/innercircle/listings",element:r.jsx(Nn,{children:r.jsx(oVt,{})})}),r.jsx(ln,{path:"/innercircle/listings/new",element:r.jsx(Nn,{children:r.jsx(Z3e,{})})}),r.jsx(ln,{path:"/innercircle/listings/:listingId",element:r.jsx(Nn,{children:r.jsx(wVt,{})})}),r.jsx(ln,{path:"/innercircle/listings/:listingId/edit",element:r.jsx(Nn,{children:r.jsx(Z3e,{})})}),r.jsx(ln,{path:"/admin/listing-exchange",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(JVt,{})})}),r.jsx(ln,{path:"/innercircle/pipeline",element:r.jsx(Nn,{children:r.jsx(KVt,{})})}),r.jsx(ln,{path:"/innercircle/scorecard",element:r.jsx(Nn,{children:r.jsx(Jqt,{})})}),r.jsx(ln,{path:"/admin/scorecard",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(YVt,{})})}),r.jsx(ln,{path:"/admin/scorecard/:userId",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(QVt,{})})}),r.jsx(ln,{path:"/admin/membership-reviews",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(eHt,{})})}),r.jsx(ln,{path:"/admin/weekly-digest",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(nHt,{})})}),r.jsx(ln,{path:"/innercircle/video/record",element:r.jsx(Nn,{children:r.jsx(AVt,{})})}),r.jsx(ln,{path:"/innercircle/video-library",element:r.jsx(Nn,{children:r.jsx(LVt,{})})}),r.jsx(ln,{path:"/marketplace",element:r.jsx(Nn,{children:r.jsx(eWt,{})})}),r.jsx(ln,{path:"/marketplace/:productId",element:r.jsx(Nn,{children:r.jsx(tWt,{})})}),r.jsx(ln,{path:"/marketplace/cart",element:r.jsx(Nn,{children:r.jsx(rWt,{})})}),r.jsx(ln,{path:"/marketplace/orders",element:r.jsx(Nn,{children:r.jsx(nWt,{})})}),r.jsx(ln,{path:"/marketplace/orders/:orderId",element:r.jsx(Nn,{children:r.jsx(iWt,{})})}),r.jsx(ln,{path:"/marketplace/success",element:r.jsx(Nn,{children:r.jsx(aWt,{})})}),r.jsx(ln,{path:"*",element:r.jsx(gGt,{})})]})]})})})]})})});ITe(document.getElementById("root")).render(r.jsx(vGt,{}));